Changeset 32553
- Timestamp:
- Mar 31, 2021, 8:34:20 AM (4 years ago)
- Location:
- extensions/ConcoursPhoto
- Files:
-
- 3 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ConcoursPhoto/CHANGELOG
r32546 r32553 8 8 Version 11.0.x 9 9 ------------- 10 11.0.3 - Add result link on category page (param) 10 11.0.3 - Add result link on category page (param) + corrections + show author/addedby on podium + result page 11 11 11.0.2 - Correct language files and help.tpl file 12 12 11.0.1 - Minor corrections -
extensions/ConcoursPhoto/admin/manage.php
r32546 r32553 32 32 $defaultconcours = new Concours(0); 33 33 34 $status = (isset($_GET[' status']) ? $_GET['status'] : '');35 $sortby = (isset($_GET[' sortby']) ? $_GET['sortby'] : 'id');36 $sortorder = (isset($_GET[' sortorder']) ? $_GET['sortorder'] : 'desc');34 $status = (isset($_GET['concours_status']) ? $_GET['concours_status'] : ''); 35 $sortby = (isset($_GET['concours_sort_by']) ? $_GET['concours_sort_by'] : 'id'); 36 $sortorder = (isset($_GET['concours_sort_order']) ? $_GET['concours_sort_order'] : 'desc'); 37 37 $start = (isset($_GET['start']) ? $_GET['start'] : 0); 38 38 $no_concours = l10n('active_concours_1') ; … … 103 103 break; 104 104 } 105 105 $sortby = $_POST['concours_sort_by']; 106 $sortorder = $_POST['concours_sort_order']; 106 107 $template->assign('concours_filter', array( 107 108 'status' => $_POST['concours_status'], … … 222 223 $start = 0; 223 224 224 $management_url_std = get_root_url().'admin.php?page=plugin-'.CONCOURS_DIR.'-manage' ;225 $management_url_std = get_root_url().'admin.php?page=plugin-'.CONCOURS_DIR.'-manage'.'&concours_status='.$status.'&concours_sort_order='.$sortorder.'&concours_sort_by='.$sortby; 225 226 //Create the navigation bar (for more than 1 page) 226 $management_url = get_root_url().'admin.php?page=plugin-'.CONCOURS_DIR.'-manage'.'& status='.$status.'&sortorder='.$sortorder.'&sortby='.$sortby;227 $management_url = get_root_url().'admin.php?page=plugin-'.CONCOURS_DIR.'-manage'.'&concours_status='.$status.'&concours_sort_order='.$sortorder.'&concours_sort_by='.$sortby; 227 228 $concours_navbar = array(); 228 229 $concours_navbar = create_navigation_bar($management_url, $end, $start, $defaultconcours->my_config['nb_concours_page']); … … 273 274 'U_FILE' => $filename ? CONCOURS_ADMIN_PATH . 'file.php?file=' . $filename : (has_result($concours['id']) ? PHPWG_ROOT_PATH . 'admin.php?page=plugin-' . CONCOURS_DIR . '-add_concours&concours=' . $concours['id'].'&action=file' : ''), 274 275 'NB_VOTE' => count($defaultconcours->get_user_list($concours['id']))+count($defaultconcours->get_guest_list($concours['id'])), 276 'NBIMG' => $defaultconcours->nb_img_by_concours($concours['id']), 275 277 'SHOWPODIUM' => ($concours['Podium_onCat'] ? '1' : '0'), 276 278 'U_PODIUM' => PHPWG_ROOT_PATH . 'admin.php?page=plugin-' . CONCOURS_DIR . '-manage&concours=' . $concours['id'].'&action=podium&mode='.($concours['Podium_onCat'] ? '0' : '1') , -
extensions/ConcoursPhoto/admin/template/manage.tpl
r32547 r32553 140 140 {else}{$concours_list1.NAME} 141 141 {/if} 142 <br>[ <i>{'concours_nbscore'|@translate}: {$concours_list1.NB_VOTE}</i>]</td>142 <br>[{'concours_nbphotos'|@translate}: <b>{$concours_list1.NBIMG}</b> / <i>{'concours_nbscore'|@translate}: <b>{$concours_list1.NB_VOTE}</b></i>]</td> 143 143 <td>{$concours_list1.DESC}</td> 144 144 <td>{$concours_list1.CREATE_DATE}</td> -
extensions/ConcoursPhoto/concours_vote.php
r32457 r32553 11 11 $ap_id = explode('concours_vote/' , $_SERVER['REQUEST_URI']); 12 12 $id_concours = $ap_id[1]; 13 14 15 $sortby = (isset($_GET['concours_sort_order']) ? $_GET['concours_sort_order'] : 'score'); 16 17 if (isset($_POST['concours_SORT_submit']) OR isset($_POST['concours_submit'])) 18 { 19 $sortby = $_POST['concours_sort_order']; 20 // echo 'sortby='.$sortby; 21 $template->assign('sort_order',$sortby); 22 } 23 24 $template->assign('sort_order',$sortby); 25 26 $img_array = array(); 13 27 14 28 $user['ipguest'] = null; … … 236 250 237 251 $user_global_note = $concours->get_img_globalnote_user($row['id'], $concours->concours_infos['id'], $user['id'], $user['ipguest']); 238 239 240 252 253 array_push($img_array, array( 254 'img_id' => $row['id'], 255 'name' => $row['name'], 256 'file' => $row['file'], 257 'author' => $row['author'], 258 'thumb' => DerivativeImage::url(IMG_XSMALL, $row), 259 260 'url' => $url, 261 'score' => $array_note_user[$row['id']] , 262 'max_note' => $concours_maxnote, 263 'note' => ($user_global_note >= 0 ? $user_global_note : 0), 264 'concours_comment' => $concours->get_img_comment_user($row['id'], $concours->concours_infos['id'], $user['id'], $user['ipguest']), 265 'change_note' => ($user_global_note == -1 OR $concours->my_config['concours_change_score']) ? true : false, 266 267 )); 268 269 270 /* 241 271 $template->append( 'concours_note', array( 242 272 'img_id' => $row['id'], … … 254 284 255 285 )); 256 286 */ 257 287 } 258 288 259 289 } 260 290 291 /* 292 foreach ($img_array as $i=>$img) 293 { 294 echo "<br>;i=".$i; 295 foreach ($img as $j=>$value) 296 echo "<br>j=".$j." ->".$value.' ;'; 297 298 } 299 */ 300 // Order photo by score 301 if ($sortby == 'score') 302 { 303 foreach (array_sort($img_array, 'note', SORT_DESC) as $i=>$img) 304 $template->append( 'concours_note', $img); 305 } 306 else 307 { 308 foreach ($img_array as $i=>$img) 309 $template->append( 'concours_note', $img); 310 } 311 312 // $template->append( 'concours_note', array_sort($img_array, 'note', SORT_DESC)); 261 313 262 314 $template->assign( 'TEXT_OVERLAY', $concours->my_config['text_overlay']); … … 287 339 $template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED')); 288 340 } 341 342 343 344 function array_sort($array, $on, $order=SORT_ASC) 345 { 346 $new_array = array(); 347 $sortable_array = array(); 348 349 if (count($array) > 0) { 350 foreach ($array as $k => $v) { 351 if (is_array($v)) { 352 foreach ($v as $k2 => $v2) { 353 if ($k2 == $on) { 354 $sortable_array[$k] = $v2; 355 } 356 } 357 } else { 358 $sortable_array[$k] = $v; 359 } 360 } 361 362 switch ($order) { 363 case SORT_ASC: 364 asort($sortable_array); 365 break; 366 case SORT_DESC: 367 arsort($sortable_array); 368 break; 369 } 370 371 foreach ($sortable_array as $k => $v) { 372 $new_array[$k] = $array[$k]; 373 } 374 } 375 376 return $new_array; 377 } 378 289 379 ?> -
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), -
extensions/ConcoursPhoto/language/en_GB/plugin.lang.php
r32546 r32553 220 220 $lang['concours_nopodium'] = 'Podium not displayed on category'; 221 221 222 $lang['concours_addedby'] = 'Photo added by '; 223 $lang['concours_nbphotos'] = 'photo(s)'; 224 $lang['concours_displaybyscore'] = 'by score'; 222 225 223 226 ?> -
extensions/ConcoursPhoto/language/en_UK/plugin.lang.php
r32546 r32553 220 220 $lang['concours_nopodium'] = 'Podium not displayed on category'; 221 221 222 $lang['concours_addedby'] = 'Photo added by '; 223 $lang['concours_nbphotos'] = 'photo(s)'; 224 $lang['concours_displaybyscore'] = 'by score'; 222 225 223 226 ?> -
extensions/ConcoursPhoto/language/fr_FR/plugin.lang.php
r32546 r32553 219 219 $lang['concours_nopodium'] = 'Podium masqué sur la catégorie'; 220 220 221 221 $lang['concours_addedby'] = 'Photo ajoutée par '; 222 $lang['concours_nbphotos'] = 'photo(s)'; 223 $lang['concours_displaybyscore'] = 'par note'; 222 224 ?> -
extensions/ConcoursPhoto/publish.php
r32457 r32553 1 1 <?php 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 4 include_once CONCOURS_PATH.'/stuffs_module/functions.inc.php'; 3 5 4 6 global $template; … … 36 38 'END_DATE' => $concours->concours_infos['end_date'], 37 39 'METHOD' => l10n("concours_method".$concours->concours_infos['method']), 38 'METHODNB' => $concours->concours_infos['method'] 40 'METHODNB' => $concours->concours_infos['method'], 41 'DAYS' => NbJours($concours->concours_infos['begin_date'], $concours->concours_infos['end_date']), 42 'NB_VOTANT' => count($concours->get_user_list($concours->concours_infos['id']))+count($concours->get_guest_list($concours->concours_infos['id'])), 43 'NBIMG' => $concours->nb_img_by_concours($concours->concours_infos['id']) 44 39 45 )); 40 46 … … 45 51 $concours->concours_infos['method'] = 1; 46 52 47 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img.author, 53 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img.author, img.added_by, 48 54 ic.category_id, cat.name AS catname, conc.note, conc.moyenne, conc.moderation1, conc.moderation2, conc.nbvotant' 49 55 .' FROM ' . IMAGES_TABLE.' AS img' … … 131 137 'name' => $row['name'], 132 138 'file' => $row['file'], 133 'author' => $row['author'], 139 'author' => (strlen($row['author']) === 0 ? get_username($row['added_by']): $row['author']), 140 'addedby' => get_username($row['added_by']), 134 141 'rang' => $rang, 135 142 // 'thumb' => DerivativeImage::thumb_url($row), … … 173 180 $template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED')); 174 181 182 175 183 ?> -
extensions/ConcoursPhoto/stuffs_module/concours_stuffs.tpl
r32546 r32553 1 <ul class="thumbnail Categories">1 <ul class="thumbnail"> 2 2 {foreach from=$block.contests item=contest} 3 <li class="{$block. SIZE_CLASS} {if !$contest.VISIBLE}novisible{/if}">4 <div class="p ersonal_block">3 <li class="{$block.CLASS} {$block.SIZE_CLASS} {if !$contest.VISIBLE}novisible{/if}"> 4 <div class="podium_block"> 5 5 <div class="illustration"> 6 6 <a href="{$contest.URL}"> … … 16 16 <div class="CR_text"> 17 17 <p class="Nb_images">{$contest.BEGIN_DATE} - {$contest.END_DATE}</p> 18 <span class="CR_finished">[{$contest.DAYS} {'jours'|@translate} - <i>{$contest.NB_VOTANT} {'concours_nbscore'|@translate}]</i></span>18 <span class="CR_finished">[{$contest.DAYS} {'jours'|@translate} - {$contest.NBIMG} {'concours_nbphotos'|@translate} - <i>{$contest.NB_VOTANT} {'concours_nbscore'|@translate}]</i></span> 19 19 20 20 <p> -
extensions/ConcoursPhoto/stuffs_module/main.inc.php
r32457 r32553 6 6 include_once CONCOURS_INC_PATH.'Concours.class.php'; 7 7 include_once CONCOURS_PATH.'/stuffs_module/functions.inc.php'; 8 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 8 9 9 10 if ($datas['contest_id'] != 0) … … 25 26 'DAYS' => NbJours($concours->concours_infos['begin_date'], $concours->concours_infos['end_date']), 26 27 'VISIBLE' => true, 27 'NB_VOTANT' => count($concours->get_user_list($concours->concours_infos['id']))+count($concours->get_guest_list($concours->concours_infos['id'])) 28 'NB_VOTANT' => count($concours->get_user_list($concours->concours_infos['id']))+count($concours->get_guest_list($concours->concours_infos['id'])), 29 'NBIMG' => $concours->nb_img_by_concours($concours->concours_infos['id']) 28 30 ); 29 31 … … 37 39 $query = 'SELECT ' 38 40 .' RESULT.id_concours, CONC.name, CONC.descr, CONC.begin_date, CONC.end_date, CONC.method, 39 RESULT.img_id as id, IMG.name, IMG.author, IMG.file, IMG.path, 41 RESULT.img_id as id, IMG.name, IMG.author, IMG.file, IMG.path, IMG.added_by, 40 42 ic.category_id, cat.name AS catname, 41 43 RESULT.date, RESULT.note, RESULT.moyenne, RESULT.moderation1, RESULT.moderation2, RESULT.nbvotant, RESULT.datas' … … 95 97 $block['contests'][$result['id_concours']]['RESULTS'][$rank] = array( 96 98 'RANK' => $rank, 97 'AUTHOR' => $result['author'],99 'AUTHOR' => (strlen($result['author']) === 0 ? get_username($result['added_by']): $result['author']), 98 100 'TN_SRC' => DerivativeImage::thumb_url($result), 99 101 'XSMALL_SRC' => DerivativeImage::url(IMG_XSMALL, $result), -
extensions/ConcoursPhoto/template/concours.tpl
r32457 r32553 190 190 <td colspan="2">{'concours_comment'|@translate} </td> 191 191 <td colspan="3"> 192 <textarea cols="50" rows="4" name="concours_comment" id="concours_comment" {if !$CONCOURS_CHANGE_SCORE}disabled="disabled"{/if}>{$CONCOURS_COMMENT} 192 <textarea cols="50" rows="4" name="concours_comment" id="concours_comment" {if !$CONCOURS_CHANGE_SCORE}disabled="disabled"{/if}>{$CONCOURS_COMMENT}</textarea> 193 193 </td> 194 194 </tr> -
extensions/ConcoursPhoto/template/concours_description-cat.tpl
r32457 r32553 1 2 TESTTESTTEST3 1 4 2 -
extensions/ConcoursPhoto/template/concours_vote.tpl
r32457 r32553 39 39 40 40 </script> 41 {/literal} 41 {/literal} 42 43 44 45 42 46 43 47 <div class="concours"> … … 113 117 <form method="post" action="{$CONCOURS_F_ACTIONS}" class="concours"> 114 118 {/if} 119 120 121 122 115 123 <fieldset> 116 124 <legend>{'concours_infos'|@translate}</legend> 117 125 <table align="left"> 126 <tr> 118 127 <td > 119 128 {'concours_name'|@translate} : <b>{$CONCOURS.NAME}</b> 120 129 <br>{'concours_descr'|@translate} : <b>{$CONCOURS.DESCR}</b> 121 130 <br>{'concours_activ_from'|@translate} <b>{$CONCOURS.BEGIN_DATE}</b> {'concours_activ_to'|@translate} <b>{$CONCOURS.END_DATE}</b> 131 </td> 132 </tr> 133 <tr> 134 <td> 135 <form method="post" id="concours_SORT"> 136 <label> 137 {'Sort order'|@translate} 138 <select name="concours_sort_order"> 139 <option value="" label="{'default'|@translate}" {if $sort_order==''}selected="selected"{/if}>{'default'|@translate}</option> 140 <option value="score" label="{'concours_displaybyscore'|@translate}" {if $sort_order=='score'}selected="selected"{/if}>{'concours_displaybyscore'|@translate}</option> 141 </select> 142 </label> 143 <label> 144 145 <input type="submit" name="concours_SORT_submit" value="{'Submit'|@translate}" /> 146 </label> 147 </form> 122 148 </td> 123 149 </tr> … … 198 224 <td colspan="4">{'concours_comment_short'|@translate} : 199 225 200 <textarea cols="75" rows="1" name="{$concours_note1.img_id}_concours_comment" id="concours_comment" {if !$concours_note1.change_note}disabled="disabled"{/if}>{$concours_note1.concours_comment} 226 <textarea cols="75" rows="1" name="{$concours_note1.img_id}_concours_comment" id="concours_comment" {if !$concours_note1.change_note}disabled="disabled"{/if}>{$concours_note1.concours_comment}</textarea> 201 227 202 228 -
extensions/ConcoursPhoto/template/result.tpl
r32457 r32553 4 4 <table align="left"> 5 5 <td > 6 {'concours_name'|@translate} : <b>{$CONCOURS.NAME}</b> 6 {'concours_name'|@translate} : <b>{$CONCOURS.NAME}</b> [{$CONCOURS.DAYS} {'jours'|@translate} - {$CONCOURS.NBIMG} {'concours_nbphotos'|@translate} - <i>{$CONCOURS.NB_VOTANT} {'concours_nbscore'|@translate}]</i> 7 7 <br>{'concours_descr'|@translate} : <b>{$CONCOURS.DESCR}</b> 8 8 <br>{'concours_activ_from'|@translate} <b>{$CONCOURS.BEGIN_DATE}</b> {'concours_activ_to'|@translate} <b>{$CONCOURS.END_DATE}</b> 9 9 <br>{'concours_method'|@translate} : <b>{$CONCOURS.METHOD}</b> 10 <br> 11 10 12 </td> 11 13 </tr> … … 30 32 <img class="thumbnail" src="{$concours_note1.thumb}" alt="{$concours_note1.name}" title="{$concours_note1.name}"/> 31 33 </a> 34 <div align="left"> 32 35 <br><u>{'concours_name'|@translate}</u> : {$concours_note1.name} 33 36 <br><u>{'concours_author'|@translate}</u> : {$concours_note1.author} 37 </div> 34 38 </td> 35 39 <td> -
extensions/ConcoursPhoto/template/style.css
r32546 r32553 1 #podium_block { 2 margin: 0; 3 padding: 0; 4 list-style: none; 5 width: 100%; 6 } 7 1 8 .CR_finished { 2 9 font-weight:normal;
Note: See TracChangeset
for help on using the changeset viewer.