Changeset 32553 for extensions/ConcoursPhoto/include
- Timestamp:
- Mar 31, 2021, 8:34:20 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ConcoursPhoto/include/Concours.class.php
r32552 r32553 5 5 */ 6 6 7 8 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 9 7 10 global $user, $conf; 8 11 … … 620 623 } 621 624 622 625 626 627 // TESTTEST 628 // function to return the number of images for a concours 629 function nb_img_by_concours($concours_id = NULL) 630 { 631 632 633 // nb of users who vote for each image (for a selected concours 634 $query = 'SELECT count(img.id) AS NBIMG ' 635 .' FROM ' . IMAGES_TABLE.' AS img' 636 .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' 637 .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' 638 .' INNER JOIN '.CONCOURS_TABLE.' AS conc ON conc.category = cat.id' 639 .' WHERE conc.id = '.($concours_id !== null ? $concours_id : $this->concours_id ) 640 .';'; 641 642 $result = pwg_query($query); 643 if ($row = pwg_db_fetch_array($result)) 644 { 645 return $row['NBIMG']; 646 } 647 648 return 0; 649 } 623 650 624 651 … … 1247 1274 // for the image, check (depending the config) if user = author or addedby or none 1248 1275 if ($this->check_img_user($page['current_item'])) 1276 { 1249 1277 return; 1278 } 1250 1279 1251 1280 // Check if user is guest and if guest is allowed … … 2410 2439 $query = 'SELECT ' 2411 2440 .' RESULT.id_concours, CONC.name, CONC.descr, CONC.begin_date, CONC.end_date, CONC.method, 2412 RESULT.img_id as id, IMG.name, IMG.author, IMG.file, IMG.path, 2441 RESULT.img_id as id, IMG.name, IMG.author, IMG.file, IMG.path, IMG.added_by, 2413 2442 ic.category_id, cat.name AS catname, 2414 2443 RESULT.date, RESULT.note, RESULT.moyenne, RESULT.moderation1, RESULT.moderation2, RESULT.nbvotant, RESULT.datas' … … 2468 2497 $block['contests'][$result['id_concours']]['RESULTS'][$rank] = array( 2469 2498 'RANK' => $rank, 2470 'AUTHOR' => $result['author'], 2499 // 'AUTHOR' => $result['author'], 2500 'AUTHOR' => (strlen($result['author']) === 0 ? get_username($result['added_by']): $result['author']), 2471 2501 'TN_SRC' => DerivativeImage::thumb_url($result), 2472 2502 'XSMALL_SRC' => DerivativeImage::url(IMG_XSMALL, $result),
Note: See TracChangeset
for help on using the changeset viewer.