diff --git a/admin/theme/template/rating_photos.html.twig b/admin/theme/template/rating_photos.html.twig index 131ca9b19..422dd2839 100644 --- a/admin/theme/template/rating_photos.html.twig +++ b/admin/theme/template/rating_photos.html.twig @@ -2,20 +2,25 @@ {% extends "__layout.html.twig" %} {% block breadcrumb_items %} - - + + {% endblock %} {% block content %}
-

{{'Show/Hide form filter'|trans}}

+

+ {{'Show/Hide form filter'|trans}} +

{{'Filter'|trans}}

@@ -24,7 +29,7 @@
@@ -60,23 +65,32 @@ {% for image in images %} - {{image.FILE}} - {{image.NB_RATES}}/{{image.NB_RATES_TOTAL}} - {{image.SCORE_RATE}} - {{image.AVG_RATE}} - {{image.SUM_RATE}} + + {{image.FILE}} + + + {{image.NB_RATES}}/{{image.NB_RATES_TOTAL}} + + + {{image.SCORE_RATE}} + + + {{image.AVG_RATE}} + + + {{image.SUM_RATE}} + {% for rate in image.rates %} - + {% endfor %} diff --git a/src/Controller/Admin/AdminRatingController.php b/src/Controller/Admin/AdminRatingController.php index a977b6e67..16671b6d0 100644 --- a/src/Controller/Admin/AdminRatingController.php +++ b/src/Controller/Admin/AdminRatingController.php @@ -39,9 +39,16 @@ protected function setTabsheet(string $section = 'photos'): array return ['tabsheet' => $tabsheet]; } - public function photos(Request $request, Conf $conf, ImageStandardParams $image_std_params, TranslatorInterface $translator, UserMapper $userMapper, - UserRepository $userRepository, RateRepository $rateRepository, int $start = 0) - { + public function photos( + Request $request, + Conf $conf, + ImageStandardParams $image_std_params, + TranslatorInterface $translator, + UserMapper $userMapper, + UserRepository $userRepository, + RateRepository $rateRepository, + int $start = 0 + ) { $tpl_params = []; $this->translator = $translator; @@ -111,7 +118,7 @@ public function photos(Request $request, Conf $conf, ImageStandardParams $image_ $tpl_params['images'] = []; foreach ($rateRepository->getRatePerImage($guest_id, $operator_user_filter, $available_order_by[$order_by_index][1], $elements_per_page, $start) as $image) { - $tpl_params['images'][] = $image; + // $tpl_params['images'][] = $image; $thumbnail_src = (new DerivativeImage(new SrcImage($image, $conf['picture_ext']), $image_std_params->getByType(ImageStandardParams::IMG_THUMB), $image_std_params))->getUrl(); $image_url = $this->generateUrl('admin_photo', ['image_id' => $image['id']]); @@ -144,6 +151,7 @@ public function photos(Request $request, Conf $conf, ImageStandardParams $image_ $tpl_image['rates'][] = [ 'USER' => $user_rate, + 'user_id' => $rate->getUser()->getId(), 'md5sum' => md5($rate->getUser()->getId() . $rate->getImage()->getId() . $rate->getAnonymousId()), 'element_id' => $rate->getImage()->getId(), 'anonymous_id' => $rate->getAnonymousId(), @@ -151,7 +159,7 @@ public function photos(Request $request, Conf $conf, ImageStandardParams $image_ 'date' => $rate->getDate() ]; } - $tpl_params['images'][] = $tpl_image; + $tpl_params['images'][] = array_merge($tpl_image, $image); } $tpl_params['navbar'] = Utils::createNavigationBar($this->get('router'), 'admin_rating', $navbar_params, $nb_images, $start, $elements_per_page); @@ -173,9 +181,16 @@ public function photos(Request $request, Conf $conf, ImageStandardParams $image_ return $this->render('rating_photos.html.twig', $tpl_params); } - public function users(Request $request, Conf $conf, UserMapper $userMapper, ImageStandardParams $image_std_params, - TranslatorInterface $translator, UserRepository $userRepository, ImageMapper $imageMapper, RateRepository $rateRepository) - { + public function users( + Request $request, + Conf $conf, + UserMapper $userMapper, + ImageStandardParams $image_std_params, + TranslatorInterface $translator, + UserRepository $userRepository, + ImageMapper $imageMapper, + RateRepository $rateRepository + ) { $tpl_params = []; $this->translator = $translator; diff --git a/src/Repository/RateRepository.php b/src/Repository/RateRepository.php index ece1591d6..dc73c1f53 100644 --- a/src/Repository/RateRepository.php +++ b/src/Repository/RateRepository.php @@ -39,12 +39,12 @@ public function calculateRateSummary(int $image_id) return $qb->getQuery()->getOneOrNullResult(AbstractQuery::HYDRATE_SCALAR); } - public function countImagesRatedForUser(int $user_id, string $operator = '') : int + public function countImagesRatedForUser(int $user_id, string $operator = null) : int { $qb = $this->createQueryBuilder('r'); $qb->select('COUNT(DISTINCT(r.image))'); - if ($operator != '') { + if (!is_null($operator)) { $qb->where('r.user ' . $operator . ' :user_id'); $qb->setParameter('user_id', $user_id); } diff --git a/src/Repository/UpgradeRepository.php b/src/Repository/UpgradeRepository.php index 7cb307895..36a41ba8e 100644 --- a/src/Repository/UpgradeRepository.php +++ b/src/Repository/UpgradeRepository.php @@ -22,7 +22,7 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, Upgrade::class); } - public function addUpgrade(Upgrade $upgrade): int + public function addUpgrade(Upgrade $upgrade): string { $this->_em->persist($upgrade); $this->_em->flush();
{{rate.rate}}{{rate.USER}} + {{rate.USER}} + {{rate.date|date}} - +