Changeset 4368 for extensions
- Timestamp:
- Nov 26, 2009, 12:57:43 AM (15 years ago)
- Location:
- extensions/ConcoursPhoto
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ConcoursPhoto/CHANGELOG
r4310 r4368 2 2 - 3 3 4 ______________ _4 ______________ 5 5 6 6 Version 1.0.x 7 7 ------------- 8 1.1.0 - Add datas "moyenne" and "nbvotant" in database concours_result. Export theses datas in csv. 9 - add method of rank calculation in a concours (in database). 10 - generate the result (export) with the method (moyenne or sum) 8 11 1.0.0 --> First public release 9 12 _______________ -
extensions/ConcoursPhoto/admin/add_concours.php
r4141 r4368 30 30 load_language('plugin.lang', CONCOURS_PATH); 31 31 32 $method_list = array(l10n('concours_method1'), l10n ('concours_method2') ); 32 33 33 34 … … 73 74 if (isset($_POST['submit'])) 74 75 { 76 77 $concours->concours_infos['method'] = $_POST['concours_method']; 78 75 79 if ($action == "modify_crit") 76 80 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin%2Fadmin.php'); 77 81 78 82 if ($action == "edit") 83 { 84 if ($concours->is_closed($concours_id) AND ! $concours->is_result_present($concours_id)) 85 $concours->update_concoursfield("method", $concours_id); 86 79 87 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin%2Fadmin.php'); 88 } 80 89 81 90 // Step 1 : action = modify … … 108 117 $concours->concours_infos['category'] = $_POST['cat_selection']; 109 118 119 120 110 121 switch($action) 111 122 { … … 340 351 $template->assign(array('month_list' => $month_list)); 341 352 353 // Add method list to 354 $i=1; 355 foreach ( $method_list as $order ) //on parcours le tableau 356 { 357 $template->append('concours_method', 358 array( 'ID' => $i, 359 'NAME' => $order, 360 'SELECTED' => (isset($concours->concours_infos['method']) && $concours->concours_infos['method'] == $i ? 'selected' : ''))); 361 $i++; 362 } 363 364 if ($concours->is_closed($concours_id) AND !$concours->is_result_present($concours_id)) 365 $template->append('result_not_generated', true); 366 342 367 343 368 // Groups selection -
extensions/ConcoursPhoto/admin/admin.php
r3905 r4368 35 35 $my_base_url.'&tab=params'); 36 36 37 $tabsheet->add('audit', 38 l10n('concours_audit'), 39 $my_base_url.'&tab=audit'); 40 37 41 $tabsheet->select($page['tab']); 38 42 $tabsheet->assign(); -
extensions/ConcoursPhoto/admin/functions.inc.php
r3905 r4368 97 97 FROM ' . CONCOURS_TABLE .' 98 98 WHERE time_to_sec(TIMEDIFF(begin_date, now())) > 0 99 ORDER BY id 99 100 ;'; 100 101 … … 118 119 WHERE time_to_sec(TIMEDIFF(begin_date, now())) < 0 119 120 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 121 ORDER BY id 120 122 ;'; 121 123 … … 137 139 SELECT * 138 140 FROM ' . CONCOURS_TABLE .' 139 WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 ' 141 WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 142 ORDER BY id 143 144 ' 140 145 // .'AND id != 0' 141 146 .';'; -
extensions/ConcoursPhoto/admin/manage.php
r3905 r4368 42 42 43 43 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=modify', 44 'U_AUDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Faudit.php&concours=' . $concours['id'], 44 45 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=del': '', 45 46 )); … … 61 62 62 63 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=edit', 64 'U_AUDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Faudit.php&concours=' . $concours['id'], 63 65 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=del' : '', 64 66 'U_RESULT' => (!is_adviser() and !has_result($concours['id']) )? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=result' : '', -
extensions/ConcoursPhoto/admin/template/add_concours.tpl
r4141 r4368 51 51 <b>{$END_DAY_SELECTED} / {$END_MONTH_SELECTED} / {$END_YEAR} - {$END_HOUR} : {$END_MIN}</b> 52 52 </td> 53 </tr> 54 <tr> 55 <td><b>{'concours_method'|@translate} </b></td> 56 <td colspan = "3"> 57 <select name="concours_method" {if !isset($result_not_generated)}disabled="disabled"{/if}> 58 {foreach from=$concours_method item=concours_method} 59 <option value="{$concours_method.ID}" {$concours_method.SELECTED}>{$concours_method.NAME}</option> 60 {/foreach} 61 </select> 62 </td> 63 53 64 </tr> 54 65 … … 62 73 </select> 63 74 </td> 64 75 </tr> 65 76 {else} 66 77 <tr> … … 142 153 </tr> 143 154 155 <tr> 156 <td><b>{'concours_method'|@translate} </b></td> 157 <td colspan = "3"> 158 <select name="concours_method"> 159 {foreach from=$concours_method item=concours_method} 160 <option value="{$concours_method.ID}" {$concours_method.SELECTED}>{$concours_method.NAME}</option> 161 {/foreach} 162 </select> 163 </td> 164 165 </tr> 144 166 <tr><td colspan="4"><br></td></tr> 145 167 … … 153 175 </select> 154 176 </td> 155 177 </tr> 156 178 {/if} 157 179 </table> -
extensions/ConcoursPhoto/admin/template/manage.tpl
r3905 r4368 13 13 <table border="1"> 14 14 <tr> 15 <th><b>{'concours_id '|@translate}</b></th>15 <th><b>{'concours_id2'|@translate}</b></th> 16 16 <th><b>{'concours_name'|@translate}</b></th> 17 17 <th><b>{'concours_create_date'|@translate}</b></th> … … 41 41 <table border="1"> 42 42 <tr> 43 <th><b>{'concours_id '|@translate}</b></th>43 <th><b>{'concours_id2'|@translate}</b></th> 44 44 <th><b>{'concours_name'|@translate}</b></th> 45 45 <th><b>{'concours_create_date'|@translate}</b></th> … … 52 52 <tr> 53 53 <td>{$active_concours.ID}</td> 54 <td> {$active_concours.NAME}</td>54 <td><a href="{$prepared_concours.U_AUDIT}" title="{'concours_audit1'|@translate}">{$active_concours.NAME}</a></td> 55 55 <td>{$active_concours.CREATE_DATE}</td> 56 56 <td>{$active_concours.DESC}</td> … … 69 69 <table border="1"> 70 70 <tr> 71 <th><b>{'concours_id '|@translate}</b></th>71 <th><b>{'concours_id2'|@translate}</b></th> 72 72 <th><b>{'concours_name'|@translate}</b></th> 73 73 <th><b>{'concours_create_date'|@translate}</b></th> … … 80 80 <tr> 81 81 <td>{$closed_concours.ID}</td> 82 <td> {$closed_concours.NAME}</td>82 <td><a href="{$closed_concours.U_AUDIT}" title="{'concours_audit1'|@translate}">{$closed_concours.NAME}</a></td> 83 83 <td>{$closed_concours.CREATE_DATE}</td> 84 84 <td>{$closed_concours.DESC}</td> -
extensions/ConcoursPhoto/include/Concours.class.php
r4260 r4368 163 163 `end_date`, 164 164 `category`, 165 `groups`) 165 `groups`, 166 `method` 167 ) 166 168 VALUES (".($concours_id !== NULL ? $concours_id : $this->concours_id).", now(), 167 169 \"".$this->concours_infos['name']."\", \"".$this->concours_infos['descr']."\", 168 170 \"".$this->concours_infos['begin_date']."\", \"".$this->concours_infos['end_date']."\", 169 ".$this->concours_infos['category'].", ".$this->concours_infos['groups'].");"; 171 ".$this->concours_infos['category'].", ".$this->concours_infos['groups'].", 172 ".$this->concours_infos['method']." 173 );"; 170 174 if (pwg_query($query) != null) 171 175 return true; … … 191 195 end_date = \"".$this->concours_infos['end_date']."\", 192 196 category = ".$this->concours_infos['category'].", 193 groups = ".$this->concours_infos['groups']." 197 groups = ".$this->concours_infos['groups'].", 198 method = ".$this->concours_infos['method']." 199 194 200 WHERE id = ".($concours_id !== NULL ? $concours_id : $this->concours_id)." 195 201 ;"; … … 205 211 } 206 212 213 // update field on database for a concours_id 214 function update_concoursfield($field_id, $concours_id = null) 215 { 216 if ($concours_id!== null or $this->concours_id !== null) 217 { 218 219 $query = "UPDATE " . CONCOURS_TABLE . " 220 SET 221 " . $field_id." = ". $this->concours_infos[$field_id] . " 222 223 WHERE id = ".($concours_id !== NULL ? $concours_id : $this->concours_id)." 224 ;"; 225 pwg_query($query); 226 if (pwg_query($query) != null) 227 return true; 228 else 229 return false; 230 } 231 else 232 return false; 233 234 } 235 207 236 // delete concours from db (and all sub informations such as details, vote and result 208 237 function delete_concours($concours_id = null) … … 583 612 } 584 613 614 // function to return the number of votes for a concours by images 615 function nb_votes_by_img($concours_id = NULL) 616 { 617 618 // nb of users who vote for each image (for a selected concours 619 $query = 'SELECT img_id, COUNT(DISTINCT user_id) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 620 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ) 621 .' GROUP BY img_id ' 622 .';'; 623 624 $result = pwg_query($query); 625 $nbvotes = array(); 626 while ($row = mysql_fetch_assoc($result)) 627 { 628 $nbvotes[$row['img_id']] = $row['NBVOTE']; 629 } 630 return $nbvotes; 631 } 632 585 633 586 634 // After concours is completed (closed date is passed), generate the result and store it to DB … … 594 642 if ($this->is_closed($concours_id) AND ! $this->is_result_present($concours_id)) 595 643 { 644 645 // array with the number of vote by image for the concours. Needed for the moyenne 646 $nbvotes = $this->nb_votes_by_img($concours_id); 647 596 648 $user_id = array(); 597 649 // vars not initialized … … 646 698 // update database and store result into RESULT table 647 699 // note = global note 700 $IMGmoyenne = 0; 648 701 foreach ($global_note as $id => $val) 702 // id contains the image id 649 703 { 650 $query = 'INSERT INTO ' . CONCOURS_RESULT_TABLE .'(`id_concours`, `img_id`, `date` , `note` ) 704 if ($this->debug) echo $nbvotes[$id]; 705 $IMGmoyenne = (isset($nbvotes[$id]) && $nbvotes[$id] != 0 ? $val/$nbvotes[$id] : 0); 706 707 $query = 'INSERT INTO ' . CONCOURS_RESULT_TABLE .'(`id_concours`, `img_id`, `date` , `note`, `moyenne`, `nbvotant` ) 651 708 VALUES ('.($concours_id !== null ? $concours_id : $this->concours_id ) 652 709 .', '.$id 653 710 .', now() ' 654 711 .', '.$val 712 .', '.$IMGmoyenne 713 .', '.(isset($nbvotes[$id]) ? $nbvotes[$id] : 0) 655 714 .');'; 656 715 $result = pwg_query($query); … … 1221 1280 function generate_csv($concours_id = NULL) 1222 1281 { 1223 $file = "rang, id_concours, img_id, img_name, img_file, date, note, datas\r\n"; 1224 1282 $file = "rang, id_concours,method, img_id, img_name, img_file, date, note, moyenne, nbvotant, datas\r\n"; 1283 1284 if (!(isset($this->concours_info['method']))) 1285 $this->concours_info['method'] = 1; 1286 1225 1287 // recover all img_id from the category 1226 $query = 'SELECT id_concours, img_id, IMG.name, IMG.file, date, note, datas'1288 $query = 'SELECT id_concours,method, img_id, IMG.name, IMG.file, date, note, moyenne, nbvotant, datas' 1227 1289 .' FROM ' .CONCOURS_RESULT_TABLE 1290 .' INNER JOIN ' . CONCOURS.' AS CONC on CONC.id = id_concours' 1228 1291 .' INNER JOIN ' . IMAGES_TABLE.' AS IMG on IMG.id = img_id' 1229 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ) 1230 .' ORDER BY note DESC' 1231 .';'; 1292 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ); 1293 1294 if ($this->concours_info['method'] == 1) // total 1295 $query .= ' ORDER BY note DESC'; 1296 elseif ($this->concours_info['method'] == 2) // moyenne 1297 $query .= ' ORDER BY moyenne DESC'; 1298 1299 $query .=';'; 1232 1300 1233 1301 $result = pwg_query($query); … … 1236 1304 while ($row = mysql_fetch_assoc($result)) 1237 1305 { 1238 $file .= $rang.', '1306 $file .= ($row['nbvotant'] != 0 ? $rang : 'N/A').', ' 1239 1307 .$row['id_concours'].', ' 1308 .$row['method'].', ' 1240 1309 .$row['img_id'].', ' 1241 1310 .$row['name'].', ' … … 1243 1312 .$row['date'].', ' 1244 1313 .$row['note'].', ' 1314 .$row['moyenne'].', ' 1315 .$row['nbvotant'].', ' 1245 1316 .($row['datas'] != null ? $row['datas'] : '') 1246 1317 ."\r\n"; … … 1306 1377 1307 1378 // All informations in csv format 1308 $file = "rang, id_concours, nom_concours, date_debut, date_fin, date_export, img_id, img_name, img_file, img_author, note, nbvotant, datas,"1379 $file = "rang, id_concours, method, nom_concours, date_debut, date_fin, date_export, img_id, img_name, img_file, img_author, note, moyenne, nbvotant, datas," 1309 1380 .$users_criteria 1310 1381 ."\r\n"; 1311 1382 1312 1383 // nb of users who vote for each image 1313 $query = 'SELECT img_id, COUNT(DISTINCT user_id) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 1384 1385 // NOT NEEDED, INFO STORE IN DATABASE 'RESULT' 1386 $nbvotes = $this->nb_votes_by_img($concours_id); 1387 1388 1389 /* $query = 'SELECT img_id, COUNT(DISTINCT user_id) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 1314 1390 .' GROUP BY img_id ' 1315 1391 .';'; … … 1322 1398 $nbvotes[$row['img_id']] = $row['NBVOTE']; 1323 1399 } 1400 */ 1324 1401 /* 1325 1402 foreach ($nbvotes as $id=>$val) … … 1329 1406 */ 1330 1407 // recover all img_id from the category 1331 $query = 'SELECT id_concours, img_id, IMG.name, IMG.file, IMG.author, date, note, datas, comment' 1408 if (!(isset($this->concours_info['method']))) 1409 $this->concours_info['method'] = 1; 1410 $query = 'SELECT id_concours, method, img_id, IMG.name, IMG.file, IMG.author, date, note, moyenne, nbvotant, datas, comment' 1332 1411 .' FROM ' .CONCOURS_RESULT_TABLE 1412 .' INNER JOIN ' . CONCOURS_TABLE.' AS CONC on CONC.id = id_concours' 1333 1413 .' INNER JOIN ' . IMAGES_TABLE.' AS IMG on IMG.id = img_id' 1334 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ) 1335 .' ORDER BY note DESC' 1336 .';'; 1337 1414 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ); 1415 1416 if ($this->concours_info['method'] == 1) // total 1417 $query .= ' ORDER BY note DESC'; 1418 elseif ($this->concours_info['method'] == 2) // moyenne 1419 $query .= ' ORDER BY moyenne DESC'; 1420 1421 $query .=';'; 1422 1423 if ($this->debug) echo $query; 1338 1424 $result = pwg_query($query); 1339 // echo $query;1340 1425 // For each images 1341 1426 $rang = 1; 1342 1427 while ($row = mysql_fetch_assoc($result)) 1343 1428 { 1344 $file .= $rang.', '1429 $file .= ($row['nbvotant'] != 0 ? $rang : 'N/A').', ' 1345 1430 .$row['id_concours'].', ' 1431 .$row['method'].', ' 1346 1432 .str_replace(",", "",$this->concours_infos['name']).', ' 1347 1433 .$this->concours_infos['begin_date'].', ' … … 1354 1440 .$row['author'].', ' 1355 1441 .$row['note'].', ' 1356 .(isset($nbvotes[$row['img_id']]) ? $nbvotes[$row['img_id']] : 0).', ' 1442 .$row['moyenne'].', ' 1443 .$row['nbvotant'].', ' 1444 // .(isset($nbvotes[$row['img_id']]) ? $nbvotes[$row['img_id']] : 0).', ' 1357 1445 .($row['datas'] != null ? $row['datas'] : '') 1358 1446 ; … … 1398 1486 $rang ++; 1399 1487 } 1400 //echo $file;1488 if ($this->debug) echo $file; 1401 1489 return $file; 1402 1490 … … 1433 1521 ;"; 1434 1522 pwg_query($query); 1435 //echo $query;1523 if ($this->debug) echo $query; 1436 1524 1437 1525 return $filename; … … 1446 1534 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ) 1447 1535 .';'; 1448 $row = mysql_fetch_assoc(pwg_query($query)); 1449 if ($row) 1450 return $row['file_name']; 1451 else 1452 return false; 1453 1536 if ($this->debug) echo $query; 1537 $result = pwg_query($query); 1538 if ($result) 1539 { 1540 $row = mysql_fetch_assoc($result); 1541 if ($row) 1542 return $row['file_name']; 1543 else 1544 return false; 1545 } 1454 1546 } 1455 1547 … … 1602 1694 { 1603 1695 1604 global $page ;1696 global $page, $user; 1605 1697 $this->get_user_groups(); 1606 1698 … … 1638 1730 { 1639 1731 1640 foreach($tpl_var as $cle=>$valeur) { 1641 { 1642 $tpl_var[$cle]['NAME'] = $tpl_var[$cle]['NAME'].'<br> '.l10n('thumbnail_global_note').' : '.$this->get_img_globalnote_user($tpl_var[$cle]['ID'], $concours['id']); 1643 } 1732 foreach($tpl_var as $cle=>$valeur) 1733 { 1734 // show only if the author is not the active user 1735 if ($tpl_var[$cle]['FILE_AUTHOR'] != $user['username']) 1736 { 1737 $tpl_var[$cle]['NAME'] = $tpl_var[$cle]['NAME'].'<br> '.l10n('thumbnail_global_note').' : '.$this->get_img_globalnote_user($tpl_var[$cle]['ID'], $concours['id']); 1738 } 1644 1739 } 1645 1740 } -
extensions/ConcoursPhoto/language/fr_FR/plugin.lang.php
r4260 r4368 13 13 $lang['concours_add'] = 'Ajouter un concours'; 14 14 $lang['concours_id'] = 'Identifiant'; 15 $lang['concours_id2'] = 'Id.'; 15 16 $lang['concours_name'] = 'Nom'; 16 17 $lang['concours_descr'] = 'Description'; … … 73 74 $lang['concours_thumb_note'] = 'Ajouter la note globale sous les miniatures'; 74 75 $lang['concours_global_user_note'] = 'Total enregistré'; 76 77 78 $lang['concours_activ_from'] = 'Concours actif de '; 79 $lang['concours_activ_to'] = ' à '; 80 $lang['concours_method'] = 'Méthode de calcul du classement'; 81 $lang['concours_method1'] = 'Somme des notes'; 82 $lang['concours_method2'] = 'Moyenne des notes'; 83 84 $lang['concours_note'] = 'Note globale'; 85 $lang['concours_moyenne'] = 'Moyenne'; 86 $lang['concours_nbvotant'] = 'Nombre de votant'; 87 $lang['concours_usernote'] = 'Votre note'; 88 $lang['concours_infos'] = 'Information sur le concours'; 89 $lang['concours_audit'] = 'Audit'; 90 $lang['concours_audit1'] = 'Auditer le concours'; 91 $lang['concours_author'] = 'Auteur'; 92 75 93 ?> -
extensions/ConcoursPhoto/main.inc.php
r4310 r4368 2 2 /* 3 3 * Plugin Name: ConcoursPhoto 4 * Version: 1. 0.04 * Version: 1.1.0 5 5 * Description: Concours de photo paramétrable 6 6 * Plugin URI: http://piwigo.org/ext/extension_view.php?eid=323 -
extensions/ConcoursPhoto/maintain.inc.php
r3905 r4368 26 26 `category` smallint(5) default NULL, 27 27 `groups` varchar(255) default NULL, 28 `method` smallint(5) default 1 NOT NULL, 28 29 29 30 PRIMARY KEY (`id`) … … 70 71 `datas` longtext default NULL, 71 72 `file_name` longtext default NULL, 73 `moyenne` float default 0, 74 `nbvotant` smallint(5) default 0, 75 72 76 PRIMARY KEY (`img_id`), 73 77 FOREIGN KEY (`id_concours`) REFERENCES ' . $prefixeTable . 'concours(id) … … 184 188 global $prefixeTable; 185 189 190 // Check if upgrade is needed 191 $query = 'SHOW FULL COLUMNS FROM ' . $prefixeTable . 'concours_result;'; 192 $result = array_from_query($query, 'Field'); 193 if (count($result) < 7) // only 6 datas on previous database 194 { 195 upgrade_concours_from_100(); 196 } 197 186 198 } 187 199 … … 204 216 } 205 217 218 // Add new parameter in database in version 2.0.0: 219 // - moy : moyenne of global note with all participant 220 // - nbvotant : nb of vote for an image 221 // - method = type of rank calculation (1-> total; 2-> moyenne) 222 function upgrade_concours_from_100() 223 { 224 global $prefixeTable; 225 // Add new parameters 226 $query = 'ALTER TABLE ' . $prefixeTable . 'concours_result 227 ADD `moyenne` float default 0 AFTER `note`, 228 ADD `nbvotant` smallint(5) default 0 AFTER `moyenne` 229 ;'; 230 231 pwg_query($query); 232 233 // TODO : Recalcul the moyenne and the nb of participation if the table still exist for the selected concours 234 235 $query = 'ALTER TABLE ' . $prefixeTable . 'concours 236 ADD `method` smallint(5) default 1 NOT NULL 237 ;'; 238 239 pwg_query($query); 240 241 } 206 242 207 243 ?> -
extensions/ConcoursPhoto/publish.php
r3905 r4368 13 13 $concours = new Concours($id_concours); 14 14 15 $template->assign( 'CONCOURS', array( 16 'ID' => $concours->concours_infos['id'], 17 'NAME' => $concours->concours_infos['name'], 18 'DESCR' => $concours->concours_infos['descr'], 19 'BEGIN_DATE' => $concours->concours_infos['begin_date'], 20 'END_DATE' => $concours->concours_infos['end_date'], 21 'METHOD' => l10n("concours_method".$concours->concours_infos['method']) 22 )); 23 24 15 25 $category = $concours->concours_infos['category']; 16 26 17 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img.tn_ext, 18 ic.category_id, cat.name AS catname, conc.note '27 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img.tn_ext,img.author, 28 ic.category_id, cat.name AS catname, conc.note, conc.moyenne, conc.nbvotant' 19 29 .' FROM ' . IMAGES_TABLE.' AS img' 20 30 .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' … … 60 70 'name' => $row['name'], 61 71 'file' => $row['file'], 72 'author' => $row['author'], 62 73 'rang' => $rang, 63 74 'thumb' => get_thumbnail_url($row), 64 75 'url' => $url, 65 'note' => ($row['note'] == 0 ? 'N/A' :$row['note']) 76 'note' => ($row['note'] == 0 ? 'N/A' :$row['note']), 77 'moyenne' => ($row['moyenne'] == 0 ? 'N/A' :$row['moyenne']), 78 'nbvotant' => $row['nbvotant'], 79 'usernote' => $concours->get_img_globalnote_user($row['id']) 80 66 81 )); 67 82 $rang ++; -
extensions/ConcoursPhoto/template/result.tpl
r3905 r4368 1 1 <div class="concours"> 2 <fieldset> 3 <legend>{'concours_infos'|@translate}</legend> 4 <table align="left"> 5 <td > 6 {'concours_name'|@translate} : <b>{$CONCOURS.NAME}</b> 7 <br>{'concours_descr'|@translate} : <b>{$CONCOURS.DESCR}</b> 8 <br>{'concours_activ_from'|@translate} <b>{$CONCOURS.BEGIN_DATE}</b> {'concours_activ_to'|@translate} <b>{$CONCOURS.END_DATE}</b> 9 <br>{'concours_method'|@translate} : <b>{$CONCOURS.METHOD}</b> 10 </td> 11 </tr> 12 </table> 13 </fieldset> 2 14 <fieldset> 3 15 <legend>{'concours_result_page'|@translate}</legend> … … 6 18 {foreach from=$concours_note item=concours_note} 7 19 <tr> 8 <td><b><i> ({$concours_note.rang}{if $concours_note.rang == 1}{'concours_1st'|@translate} 20 <td><b><i> {if $concours_note.nbvotant != 0} 21 ({$concours_note.rang}{if $concours_note.rang == 1}{'concours_1st'|@translate} 9 22 {elseif $concours_note.rang == 2}{'concours_2nd'|@translate} 10 23 {elseif $concours_note.rang == 3}{'concours_3rd'|@translate} 11 24 {else}{'concours_4th'|@translate}{/if} 12 ) </i></b></td> 25 ) 26 {else}(N/A){/if} </i></b></td> 13 27 <td><b>Photo {$concours_note.img_id} </b></td> 14 28 <td> … … 16 30 <img class="thumbnail" src="{$concours_note.thumb}" alt="{$concours_note.name}" title="{$concours_note.name}"/> 17 31 </a> 32 <br><u>{'concours_author'|@translate}</u> : {$concours_note.author}</center> 18 33 </td> 19 <td><i>Note : {$concours_note.note} </i></td> 34 <td> 35 <fieldset> 36 <i>{'concours_note'|@translate} : <b>{$concours_note.note}</b> </i> 37 <br><i>{'concours_moyenne'|@translate} : <b>{$concours_note.moyenne}</b> </i> 38 <br><i>{'concours_nbvotant'|@translate} : {$concours_note.nbvotant} </i> 39 <br> 40 <br>{'concours_usernote'|@translate} : <b>{$concours_note.usernote}</b> 41 </fieldset> 42 </td> 20 43 {if $concours_note.rang > 3} 21 44 <td> </td> … … 24 47 {/if} 25 48 </tr> 49 <tr><td colspan="2"></td> 50 <td ><hr></td> 51 <td colspan="2"></td> 52 </tr> 53 26 54 {/foreach} 27 55
Note: See TracChangeset
for help on using the changeset viewer.