Changeset 32457
- Timestamp:
- Feb 12, 2021, 7:00:27 PM (3 years ago)
- Location:
- extensions/ConcoursPhoto
- Files:
-
- 44 added
- 6 deleted
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ConcoursPhoto/CHANGELOG
r9370 r32457 1 1 TODO for next versions : 2 - Clean and optimize code/requests + display (use CSS...) 3 - Add another "star notation" (https://codepen.io/tobiasdev/pen/XgegoO) 4 - Add compatibility with Smartpocket theme 2 5 6 ______________ 7 8 Version 11.0.x 9 ------------- 10 11.0.1 - Minor corrections 11 - Change rule for author check (custom choice between "author"/"added by"/both/none) 12 - param to disable meta display on photo when concours is prepared or active 13 - Add language (LV+SK) 14 - clean code (suppress Debug) 15 11.0.0 - Version for Piwigo 11.x 16 17 ______________ 18 19 Version 2.9.x 20 ------------- 21 2.9.1 - Add RU translation (thanks to Alexander) 22 - Add "stars style" to vote instead of "text style" (with param to choose) 23 - Adjust admin page 24 - Add new page to vote for all images (with parameter to activate) 25 - Clean code 26 - Allow method change when concours was closed if result not already present 27 - Allow admin to access to contest (param) 28 - Add overlay message when user already have vote (and param "do not allow user to change score" is active) 29 30 2.9.0g - Add parameters into admin page for the deadline information 31 - Add timer when the contest is prepared but not started 32 - Add parameter to allow possibility to mask photos before the contest start 33 34 2.9.0f - Add deadline information (with css/js) 35 36 2.9.0e - Corrections (pb guest) 37 - add RU language 38 39 2.9.0d - Correct config file for PWG Stuffs 40 41 2.9.0c - Add missing language (FR/EN) 42 - Correct/complete the help page 43 - Correct error when reinit score (concours.class.php) 44 - Correct bad link for criteria in admin page 45 - Correct bad test when user have not already vote and option "disable second vote" actived 46 - Adjust "Author=user" control to display note and concours 47 48 2.9.0b - Add PWG Stuffs module (thnaks to "contest" plugin from Mistic) 49 - Correct maintain.inc.php (old sql function not allowed in php7) 50 51 2.9.0 - Correction display debug info "user id = " on image page even id debug=false 52 - Compatible with Piwigo 2.9 53 - Correct concours type not saved in second page (detailled criterias) 54 - Add method "moderation1" & "moderation2" for the result of concours (update DB needed) 55 - some little corrections (guest vote, templates...) 3 56 ______________ 4 57 -
extensions/ConcoursPhoto/admin/add_concours.php
r8965 r32457 12 12 // List informations about concours id and modify it to store to piwifo_concours table 13 13 // Go to Step 2 (if needed by client choice ==> 2 buttons) with action=modify_crit 14 // Ste 2 : action=modify_crit & concours_id=XX14 // Step 2 : action=modify_crit & concours_id=XX 15 15 // List informations about criterias and modify them 16 16 // Warning : different cases are possible : … … 30 30 load_language('plugin.lang', CONCOURS_PATH); 31 31 32 $method_list = array(l10n('concours_method1'), l10n ('concours_method2') );32 $method_list = array(l10n('concours_method1'), l10n ('concours_method2'), l10n ('concours_method3'), l10n ('concours_method4') ); 33 33 34 34 … … 39 39 $action = $_GET['action']; 40 40 41 42 43 41 /* 42 echo "action : ".$action."\n"; 43 sleep(5); 44 */ 45 44 46 // Month initialization for date selection... 45 47 $month_list = $lang['month']; … … 63 65 $query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id 64 66 FROM ' . CONCOURS_TABLE . ' ;'; 65 list($next_element_id) = mysql_fetch_array(pwg_query($query));67 list($next_element_id) = pwg_db_fetch_array(pwg_query($query)); 66 68 $concours_id = $next_element_id; 67 69 } … … 75 77 { 76 78 case "1" : 77 array_push($page['errors'], sprintf( l10n('concours_end_date_change_to'),$concours->concours_infos['end_date'] ));79 array_push($page['errors'], l10n('concours_end_date_change_to' ,$concours->concours_infos['end_date'] )); 78 80 break; 79 81 … … 91 93 { 92 94 95 // Update method if changed 96 if (!isset($concours->concours_infos['method']) OR (isset($_POST['concours_method']) AND $concours->concours_infos['method'] != $_POST['concours_method'])) 97 { 98 $concours->concours_infos['method'] = $_POST['concours_method']; 99 $concours->update_concoursfield("method", $concours_id); 100 } 93 101 94 102 if ($action == "modify_crit") 95 103 { 96 104 $concours->infos = 0; 97 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin%2Fadmin.php&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: ''));98 // redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin%2Fadmin.php');105 // redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin%2Fadmin.php&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: '')); 106 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: '')); 99 107 } 100 108 101 109 if ($action == "edit") 102 110 { 103 if ($concours->is_closed($concours_id) AND ! $concours->is_result_present($concours_id)) 104 $concours->update_concoursfield("method", $concours_id); 105 106 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin%2Fadmin.php'); 111 112 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php'); 107 113 } 108 114 109 $concours->concours_infos['method'] = $_POST['concours_method'];110 115 111 116 // Step 1 : action = modify … … 128 133 $concours->concours_infos['descr'] = $_POST['concours_descr']; 129 134 130 // $concours->concours_infos['begin_date'] = $_POST['concours_begin_date'];131 // $concours->concours_infos['end_date'] = AjoutJours($concours->concours_infos['begin_date'],$_POST['concours_end_date'] );132 135 133 136 $concours->concours_infos['begin_date'] = sprintf("%04d-%02d-%02d %02d:%02d:%02d",$_POST['start_year'], $_POST['start_month'], $_POST['start_day'], $_POST['start_hour'], $_POST['start_min'], 0); … … 148 151 $tBeginDate = explodeDateArray($concours->concours_infos['begin_date']); 149 152 $tEndDate = explodeDateArray($concours->concours_infos['end_date']); 150 // echo "Hour=".intval($tBeginDate[3])." / ".intval($tEndDate[3]);151 // echo "Min=".intval($tBeginDate[4])." / ".intval($tEndDate[4]);152 153 if ( (intval(@$tEndDate[3]) < intval(@$tBeginDate[3])) // End hour is lower than begin hour 153 154 OR ( (intval(@$tBeginDate[3]) == intval(@$tEndDate[3])) // End hour is equal to begin hour … … 168 169 $concours->concours_infos['groups'] = (!empty($_POST['groups']) ? '"' . implode(',', $_POST['groups']) . '"' : 'NULL'); 169 170 $concours->concours_infos['guest'] = isset($_POST['guest']); 171 $concours->concours_infos['admin'] = isset($_POST['admin']); 172 170 173 $concours->concours_infos['category'] = $_POST['cat_selection']; 171 174 … … 175 178 { 176 179 case "edit" : 177 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php');180 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php'); 178 181 break; 179 182 case "new" : … … 181 184 $concours->save_concours(); 182 185 $concours->get_default_criterias(); 183 if ($concours->debug) sleep(5);184 186 // Redirect to admin 185 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: ''));187 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: '')); 186 188 187 189 break; 188 190 case "modify" : 189 191 $concours->update_concours(); 190 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: ''));192 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: '')); 191 193 192 194 break; 193 195 case "modify_crit" : 194 // echo "ICI";sleep(5);195 196 $concours->infos = 0; 196 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: ''));197 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&concours=' . $concours_id.(isset($concours->infos) ? '&infos=' .$concours->infos: '')); 197 198 break; 198 199 } … … 207 208 // Download the file 208 209 case "file" : 209 // TODOgenerate csv file210 // generate csv file 210 211 $file = $concours->generate_csv(); 211 212 // Get the existing filename or the new one if doesnt exist 212 213 $filename = $concours->save_file($file); 213 214 214 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php');215 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php'); 215 216 break; 216 217 … … 227 228 $filename = $concours->save_file($file); 228 229 229 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php');230 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php'); 230 231 break; 231 232 … … 233 234 // Suppress concours and all parameters 234 235 $concours->delete_concours(); 235 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php');236 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php'); 236 237 break; 237 238 … … 241 242 $template->assign( 'CONCOURS', array( 242 243 'ID' => $concours_id, 243 // 'BEGIN_DATE' => date("Y-m-d H:m:s"),244 // 'END_DATE' => 15245 244 )); 246 245 … … 270 269 case "modify" : 271 270 272 /* $info_concours['groups']273 `create_date` datetime NOT NULL,274 `name` text NOT NULL,275 `descr` varchar(255) default NULL,276 `begin_date` datetime NOT NULL,277 `end_date` datetime NOT NULL,278 `category` smallint(5) default NULL,279 `groups` varchar(255) default NULL,280 */281 271 // Format group list 282 272 $concours->concours_infos['groups'] = explode(',', $concours->concours_infos['groups']); … … 285 275 $tBeginDate = explodeDateArray($concours->concours_infos['begin_date']); 286 276 $tEndDate = explodeDateArray($concours->concours_infos['end_date']); 277 278 279 287 280 288 281 $template->assign( 'CONCOURS', array( … … 291 284 'DESCR' => $concours->concours_infos['descr'], 292 285 'GUEST' => ($concours->concours_infos['guest'] ? 'checked="checked"' : ''), 293 // 'BEGIN_DATE' => $concours->concours_infos['begin_date'], 294 // 'END_DATE' => NbJours($concours->concours_infos['begin_date'], $concours->concours_infos['end_date']) 286 'ADMIN' => ($concours->concours_infos['admin'] ? 'checked="checked"' : ''), 295 287 )); 296 288 $template->assign( … … 298 290 299 291 'START_DAY_SELECTED' => @$tBeginDate[2], 300 'START_MONTH_SELECTED' => @$tBeginDate[1],292 'START_MONTH_SELECTED' => intval($tBeginDate[1]), 301 293 'START_YEAR' => @$tBeginDate[0], 302 294 'START_HOUR' => @$tBeginDate[3], … … 304 296 305 297 'END_DAY_SELECTED' => @$tEndDate[2], 306 'END_MONTH_SELECTED' => @$tEndDate[1],298 'END_MONTH_SELECTED' => intval($tEndDate[1]), 307 299 'END_YEAR' => @$tEndDate[0], 308 300 'END_HOUR' => @$tEndDate[3], … … 324 316 'DESCR' => $concours->concours_infos['descr'], 325 317 'GUEST' => ($concours->concours_infos['guest'] ? 'checked="checked"' : ''), 326 // 'BEGIN_DATE' => $concours->concours_infos['begin_date'], 327 // 'END_DATE' => NbJours($concours->concours_infos['begin_date'], $concours->concours_infos['end_date']) 318 'ADMIN' => ($concours->concours_infos['admin'] ? 'checked="checked"' : ''), 328 319 )); 329 320 $template->assign( … … 361 352 'pond' => $criteria['ponderation'], // ponderation 362 353 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&id_concours=' . $concours->concours_id.'&action=modify&id='.$criteria['id'], 363 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&id_concours=' . $concours->concours_id.'&action=delete&id='.$criteria['id'] : '',354 'U_DELETE' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&id_concours=' . $concours->concours_id.'&action=delete&id='.$criteria['id'], 364 355 'U_ADD' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&id_concours=' . $concours->concours_id.'&action=add&upcriteria='.$criteria['criteria_id'], 365 356 )); … … 389 380 'pond' => $subcriteria['ponderation'], // ponderation 390 381 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&id_concours=' . $concours->concours_id.'&action=modify&id='.$subcriteria['id'], 391 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&id_concours=' . $concours->concours_id.'&action=delete&id='.$subcriteria['id'] : '', 392 )); 393 382 'U_DELETE' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&id_concours=' . $concours->concours_id.'&action=delete&id='.$subcriteria['id'] , 383 )); 394 384 } 395 385 } … … 441 431 if (!empty($result)) 442 432 { 443 while ($row = mysql_fetch_assoc($result))433 while ($row = pwg_db_fetch_array($result)) 444 434 array_push($categories, $row); 445 435 } -
extensions/ConcoursPhoto/admin/audit.php
r9370 r32457 11 11 global $template; 12 12 13 $user_vote = array(); 13 14 14 15 if (isset($_POST['user_list'])) … … 26 27 $concours = new Concours($concours_id); 27 28 29 // get user that already vote for the concours 30 $user_vote = $concours->get_user_list(); 31 28 32 // Get group authorized to participate 29 33 $users = array(); // contain {id;username} or each 30 34 $groups = $concours->concours_infos['groups']; 31 $query = 'SELECT distinct(user_id), username FROM ' . USER_GROUP_TABLE 32 .' INNER JOIN ' . USERS_TABLE .' ON id = user_id' 35 36 $query = 'SELECT distinct(id) AS user_id, username FROM '. USERS_TABLE .' USER ' 37 .($groups != NULL ?' INNER JOIN ' . USER_GROUP_TABLE .' ON id = user_id' : '') 33 38 .($groups != NULL ? ' WHERE group_id IN ('.$groups.')' : '') 34 // = '.$groups: '')39 .($user_vote != NULL ? ($groups != NULL ? 'AND ' : 'WHERE ').'id IN ('.implode(',', $user_vote).')' : '') 35 40 .' ORDER BY username ASC' 36 41 .';'; 37 // echo $query."\n"; 42 38 43 $result = pwg_query($query); 39 while ($row = mysql_fetch_assoc($result))40 { 41 44 while ($row = pwg_db_fetch_array($result)) 45 { 46 array_push($users, $row); 42 47 } 43 48 49 44 50 // Add user list 45 51 $template->append('user_list', … … 76 82 'BEGIN_DATE' => $concours->concours_infos['begin_date'], 77 83 'END_DATE' => $concours->concours_infos['end_date'], 78 'METHOD' => l10n("concours_method".$concours->concours_infos['method']) 84 'METHOD' => l10n("concours_method".$concours->concours_infos['method']), 85 'METHODNB' => $concours->concours_infos['method'] 79 86 )); 80 87 … … 99 106 // For each user 100 107 $user_list = array(); 101 while ($row2 = mysql_fetch_assoc($result)) 102 // Dont take the guest informations because 103 // if ($row2['user_id'] != $conf['guest_id']) 108 while ($row2 = pwg_db_fetch_array($result)) 104 109 array_push($user_list, $row2); 105 110 … … 142 147 $category = $concours->concours_infos['category']; 143 148 144 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img. tn_ext, img.author ,149 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img.author , 145 150 ic.category_id, cat.name AS catname' //, conc.note' 146 151 .' FROM ' . IMAGES_TABLE.' AS img' 147 152 .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' 148 153 .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id' 149 // .' INNER JOIN '.CONCOURS_RESULT_TABLE.' AS conc ON conc.img_id = img.id'150 154 .' WHERE ic.category_id = '.$concours->concours_infos['category'] 151 // .' ORDER by note DESC152 155 .';'; 153 156 154 157 $result = pwg_query($query); 155 // echo $query;156 158 $concours_img = array(); 157 159 158 160 // Recover all pictures and informations (global note 159 while ($row = mysql_fetch_assoc($result))161 while ($row = pwg_db_fetch_array($result)) 160 162 { 161 163 // link on picture.php page … … 191 193 $user_note = array(); 192 194 $globalnote = 0; 193 // echo "USER=".$user_id."\n";194 195 if (!is_numeric($user_id) OR $user_id != 0) // for user 195 196 { 196 // echo "USERNON0=".$user_id."\n";197 197 $pos = strpos($user_id, 'G'); 198 198 199 if ($pos === false) 199 200 { 200 201 $globalnote = $concours->get_img_globalnote_user($row['id'], $concours_id, $user_id); 202 if ($globalnote < 0) $globalnote = 0; 201 203 $user_note = $concours->get_img_note_user($row['id'], $concours_id, $user_id); 202 204 } 203 205 else 204 206 { 205 // echo "G...".substr($user_id, $pos+1)." = ".substr($user_id, $pos+1)."\n";206 // echo "IPGUEST=".$ipguest[substr($user_id, $pos+1)]."\n";207 207 $globalnote = $concours->get_img_globalnote_user($row['id'], $concours_id, $conf['guest_id'], $ipguest[substr($user_id, $pos+1)]); 208 if ($globalnote < 0) $globalnote = 0; 208 209 $user_note = $concours->get_img_note_user($row['id'], $concours_id, $conf['guest_id'], $ipguest[substr($user_id, $pos+1)]); 209 210 } 210 211 } 211 212 elseif (is_numeric($user_id) AND $user_id == 0) // for user // global 212 { 213 // echo "USER00=".$user_id."\n"; 214 213 { 215 214 foreach ($user_list as $i => $userid) 216 $globalnote += $concours->get_img_globalnote_user($row['id'], null, $userid['user_id']); 217 215 { 216 $usernote = $concours->get_img_globalnote_user($row['id'], null, $userid['user_id']); 217 $globalnote += ($usernote >= 0 ? $usernote : 0) ; 218 } 218 219 foreach ($ipguest as $i => $ipguestt) 219 220 { 220 $globalnote += $concours->get_img_globalnote_user($row['id'], null, $conf['guest_id'], $ipguestt); 221 } 221 $usernote = $concours->get_img_globalnote_user($row['id'], null, $conf['guest_id'], $ipguestt); 222 $globalnote += ($usernote >= 0 ? $usernote : 0) ; 223 224 } 222 225 } 223 226 227 228 229 // replace get_thumbnail_url (>piwigo 2.5) 230 // DerivativeImage::thumb_url($row); 224 231 225 232 $concours_img[$row['id']] = array( … … 229 236 'file' => $row['file'], 230 237 'rang' => 0, 231 'thumb' => get_thumbnail_url($row),238 'thumb' => DerivativeImage::thumb_url($row), 232 239 'url' => $url, 233 'note' => $globalnote,234 'moyenne' => (isset($nbvotes[$row['id']]) && $nbvotes[$row['id']] !=0 ? $globalnote/(int)$nbvotes[$row['id']] : 0),240 'note' => ($globalnote < 0 ? "N/A" : $globalnote) , 241 'moyenne' => (isset($nbvotes[$row['id']]) && $nbvotes[$row['id']] >=0 ? round ($globalnote/(int)$nbvotes[$row['id']], 2) : "N/A"), 235 242 'nbvotant' => isset($nbvotes[$row['id']]) ? $nbvotes[$row['id']] : 0 236 243 ); 237 244 238 245 } 239 /* 240 foreach ($concours_img as $key => $value) 241 { 242 echo 243 'img_id => '.$concours_img[$key]['img_id'] 244 .'author => '.$concours_img[$key]['author'] 245 .'name => '.$concours_img[$key]['name'] 246 .'file => '.$concours_img[$key]['file'] 247 .'rang => '.$concours_img[$key]['rang'] 248 .'thumb => '.$concours_img[$key]['thumb'] 249 .'url => '.$concours_img[$key]['url'] 250 .'note => '.$concours_img[$key]['note']; 251 } 252 */ 253 254 // Ordre image by "note" or "moyenne" 246 247 // Order image by "note" or "moyenne" 255 248 if ($concours->concours_infos['method'] == 1) // sum method 256 249 $concours_img = array_sort($concours_img, 'note', false); 257 elseif ($concours->concours_infos['method'] == 2) // moy method250 elseif ($concours->concours_infos['method'] > 1) // moy method (even for moderation, moderation are only calculated on final) 258 251 $concours_img = array_sort($concours_img, 'moyenne', false); 259 252 … … 261 254 $previousNote = $previousMoy = 0; 262 255 263 foreach ($concours_img as $key => $value)256 if ($concours_img != null) 264 257 { 265 266 // Check the exaequos 267 if ($concours->my_config['check_exaequo']) 268 { 269 if ( ($concours->concours_infos['method'] == 1 // total 270 AND ($concours_img[$key]['note'] == $previousNote)) 271 OR ($concours->concours_infos['method'] == 2 // moyenne 272 AND ($concours_img[$key]['moyenne'] == $previousMoy))) 273 { 274 $rang --; 275 276 } 277 } 278 // echo "RANG=".$rang."\n"; 279 $concours_img[$key]['rang'] = $rang; 280 281 $template->append( 'concours_note', array( 282 'img_id' => $concours_img[$key]['img_id'], 283 'author' => $concours_img[$key]['author'], 284 'name' => $concours_img[$key]['name'], 285 'file' => $concours_img[$key]['file'], 286 'rang' => $concours_img[$key]['rang'], 287 'thumb' => $concours_img[$key]['thumb'], 288 'url' => $concours_img[$key]['url'], 289 'note' => $concours_img[$key]['note'], 290 'moyenne' => $concours_img[$key]['moyenne'], 291 'nbvotant' => $concours_img[$key]['nbvotant'] 292 293 )); 294 $rang++; 295 296 $previousNote = $concours_img[$key]['note']; 297 $previousMoy = $concours_img[$key]['moyenne']; 258 foreach ($concours_img as $key => $value) 259 { 260 261 // Check the exaequos 262 if ($concours->my_config['check_exaequo']) 263 { 264 if ( ($concours->concours_infos['method'] == 1 // total 265 AND ($concours_img[$key]['note'] == $previousNote)) 266 OR ($concours->concours_infos['method'] > 1 // moyenne (and moderation) 267 AND ($concours_img[$key]['moyenne'] == $previousMoy))) 268 { 269 $rang --; 270 271 } 272 } 273 $concours_img[$key]['rang'] = $rang; 274 275 $template->append( 'concours_note', array( 276 'img_id' => $concours_img[$key]['img_id'], 277 'author' => $concours_img[$key]['author'], 278 'name' => $concours_img[$key]['name'], 279 'file' => $concours_img[$key]['file'], 280 'rang' => $concours_img[$key]['rang'], 281 'thumb' => $concours_img[$key]['thumb'], 282 'url' => $concours_img[$key]['url'], 283 'note' => ($concours_img[$key]['note'] < 0 ? "N/A" : $concours_img[$key]['note']), 284 'moyenne' => ($concours_img[$key]['moyenne'] < 0 ? "N/A" : round($concours_img[$key]['moyenne'], 2)), 285 'nbvotant' => $concours_img[$key]['nbvotant'] 286 287 )); 288 $rang++; 289 290 $previousNote = ($concours_img[$key]['note'] < 0 ? $previousNote : $concours_img[$key]['note']); 291 $previousMoy = ($concours_img[$key]['moyenne'] < 0 ? $previousMoy : $concours_img[$key]['moyenne']); 292 } 298 293 } 299 300 294 } 301 295 … … 315 309 function array_sort($array, $key, $asc=true) 316 310 { 317 foreach ($array as $i => $o)311 if ($array != null) 318 312 { 319 $sort_values[$i] = $array[$i][$key]; 320 313 foreach ($array as $i => $o) 314 { 315 $sort_values[$i] = $array[$i][$key]; 316 317 } 318 if ($asc) 319 asort ($sort_values); 320 else 321 arsort ($sort_values); 322 reset ($sort_values); 323 324 325 while (list ($arr_key, $arr_val) = each ($sort_values)) 326 { 327 $sorted_arr[] = $array[$arr_key]; 328 } 329 330 unset($array); 331 return $sorted_arr; 321 332 } 322 if ($asc) 323 asort ($sort_values); 324 else 325 arsort ($sort_values); 326 reset ($sort_values); 327 328 329 while (list ($arr_key, $arr_val) = each ($sort_values)) 330 { 331 $sorted_arr[] = $array[$arr_key]; 332 } 333 334 unset($array); 335 return $sorted_arr; 333 return null; 336 334 } 337 335 -
extensions/ConcoursPhoto/admin/config.php
r8946 r32457 54 54 'pond' => $criteria['ponderation'], // ponderation 55 55 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&concours_id=' . $defaultconcours->concours_id.'&action=modify&id='.$criteria['id'], 56 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&concours_id=' . $defaultconcours->concours_id.'&action=delete&id='.$criteria['id'] : '',56 'U_DELETE' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&concours_id=' . $defaultconcours->concours_id.'&action=delete&id='.$criteria['id'] , 57 57 'U_ADD' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&concours_id=' . $defaultconcours->concours_id.'&action=add&upcriteria='.$criteria['criteria_id'], 58 58 )); … … 82 82 'pond' => $subcriteria['ponderation'], // ponderation 83 83 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&concours_id=' . $defaultconcours->concours_id.'&action=modify&id='.$subcriteria['id'], 84 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&concours_id=' . $defaultconcours->concours_id.'&action=delete&id='.$subcriteria['id'] : '',84 'U_DELETE' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fcriteria.php&concours_id=' . $defaultconcours->concours_id.'&action=delete&id='.$subcriteria['id'] , 85 85 )); 86 86 -
extensions/ConcoursPhoto/admin/criteria.php
r8946 r32457 42 42 43 43 if ($id_concours == 0) 44 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php&tab=config');44 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&tab=config'); 45 45 else 46 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $id_concours);46 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $id_concours); 47 47 } 48 48 … … 60 60 61 61 if ($id_concours == 0) 62 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php&tab=config');62 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&tab=config'); 63 63 else 64 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin %2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $id_concours);64 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin§ion=' . CONCOURS_DIR . '%2Fadmin.php&tab=add_concours&action=modify_crit&concours=' . $id_concours); 65 65 66 66 } … … 93 93 $query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id 94 94 FROM ' . CONCOURS_DETAIL_TABLE . ' ;'; 95 list($next_element_id) = mysql_fetch_array(pwg_query($query));95 list($next_element_id) = pwg_db_fetch_array(pwg_query($query)); 96 96 $query = 'SELECT IF(MAX(criteria_id)+1 IS NULL, 1, MAX(criteria_id)+1) AS next_criteria_id 97 97 FROM ' . CONCOURS_DETAIL_TABLE . ' 98 98 WHERE id_concours = '.$concours->concours_id . ' ;'; 99 list($next_criteria_id) = mysql_fetch_array(pwg_query($query));99 list($next_criteria_id) = pwg_db_fetch_array(pwg_query($query)); 100 100 101 101 $template->assign( array( -
extensions/ConcoursPhoto/admin/functions.inc.php
r8946 r32457 47 47 $result = pwg_query($query); 48 48 if ($result) 49 return mysql_fetch_assoc($result);49 return pwg_db_fetch_assoc($result); 50 50 else 51 51 return false; … … 64 64 $result = pwg_query($query); 65 65 // For each images 66 if (mysql_fetch_assoc($result)) 66 if (pwg_db_fetch_assoc($result)) 67 67 68 return true; 68 69 else … … 80 81 $result = pwg_query($query); 81 82 // For each images 82 if ($row = mysql_fetch_assoc($result))83 if ($row = pwg_db_fetch_assoc($result)) 83 84 return $row['file_name']; 84 85 else 85 86 return false; 86 87 88 } 89 90 function get_nb_concours($type = null) 91 { 92 switch ($type) 93 { 94 case 'prepared': 95 return get_nb_prepared_concours(); 96 break; 97 case 'active': 98 return get_nb_active_concours(); 99 break; 100 case 'closed': 101 return get_nb_closed_concours(); 102 break; 103 case 'closed-noresult': 104 { 105 $query = ' 106 SELECT count(distinct id) as nb_concours 107 FROM ' . CONCOURS_TABLE 108 .' WHERE id>0' // Do not take Concours 0 (default) 109 .' AND id NOT IN (SELECT id_concours FROM ' .CONCOURS_RESULT_TABLE.')' 110 .';'; 111 112 $result = pwg_query($query); 113 if ($result) 114 { 115 $row = pwg_db_fetch_array($result); 116 return $row['nb_concours']; 117 } 118 else 119 return 0; 120 break; 121 } 122 default: 123 { 124 $query = ' 125 SELECT count(distinct id) as nb_concours 126 FROM ' . CONCOURS_TABLE 127 .' WHERE id>0' // Do not take Concours 0 (default) 128 .';'; 129 130 $result = pwg_query($query); 131 if ($result) 132 { 133 $row = pwg_db_fetch_array($result); 134 return $row['nb_concours']; 135 } 136 else 137 return 0; 138 break; 139 } 140 } 141 142 } 143 144 function get_nb_active_concours() 145 { 146 $query = ' 147 SELECT count(distinct id) as nb_concours 148 FROM ' . CONCOURS_TABLE. 149 ' WHERE time_to_sec(TIMEDIFF(begin_date, now())) < 0 150 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0' 151 .' AND id>0' // Do not take Concours 0 (default) 152 .';'; 153 154 $result = pwg_query($query); 155 if ($result) 156 { 157 $row = pwg_db_fetch_array($result); 158 return $row['nb_concours']; 159 } 160 else 161 return 0; 162 } 163 164 165 function get_nb_prepared_concours() 166 { 167 $query = ' 168 SELECT count(distinct id) as nb_concours 169 FROM ' . CONCOURS_TABLE .' 170 WHERE time_to_sec(TIMEDIFF(begin_date, now())) > 0' 171 .' AND id>0' // Do not take Concours 0 (default) 172 .';'; 173 174 $result = pwg_query($query); 175 if ($result) 176 { 177 $row = pwg_db_fetch_array($result); 178 return $row['nb_concours']; 179 } 180 else 181 return 0; 182 } 183 184 function get_nb_closed_concours() 185 { 186 $query = ' 187 SELECT count(distinct id) as nb_concours 188 FROM ' . CONCOURS_TABLE .' 189 WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 ' 190 .' AND id>0' // Do not take Concours 0 (default) 191 .';'; 192 193 $result = pwg_query($query); 194 if ($result) 195 { 196 $row = pwg_db_fetch_array($result); 197 return $row['nb_concours']; 198 } 199 else 200 return 0; 87 201 } 88 202 … … 96 210 SELECT * 97 211 FROM ' . CONCOURS_TABLE .' 98 WHERE time_to_sec(TIMEDIFF(begin_date, now())) > 0 99 ORDER BY id 212 WHERE time_to_sec(TIMEDIFF(begin_date, now())) > 0' 213 .' AND id>0' // Do not take Concours 0 (default) 214 .' ORDER BY id 100 215 ;'; 101 216 102 217 $result = pwg_query($query); 103 //echo $query; 104 while ($row = mysql_fetch_assoc($result)) 218 while ($row = pwg_db_fetch_assoc($result)) 219 105 220 { 106 221 array_push($concours_list, $row); … … 118 233 FROM ' . CONCOURS_TABLE .' 119 234 WHERE time_to_sec(TIMEDIFF(begin_date, now())) < 0 120 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 121 ORDER BY id 235 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0' 236 .' AND id>0' // Do not take Concours 0 (default) 237 .' ORDER BY id 122 238 ;'; 123 239 124 240 $result = pwg_query($query); 125 //echo $query; 126 while ($row = mysql_fetch_assoc($result)) 241 while ($row = pwg_db_fetch_assoc($result)) 242 127 243 { 128 244 array_push($concours_list, $row); … … 139 255 SELECT * 140 256 FROM ' . CONCOURS_TABLE .' 141 WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 142 ORDER BY id 143 144 ' 145 // .'AND id != 0' 257 WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 ' 258 .' AND id>0' // Do not take Concours 0 (default) 259 .'ORDER BY id' 146 260 .';'; 147 261 148 262 $result = pwg_query($query); 149 //echo $query; 150 while ($row = mysql_fetch_assoc($result)) 263 while ($row = pwg_db_fetch_assoc($result)) 151 264 { 152 265 array_push($concours_list, $row); … … 206 319 207 320 $groups = array(); 208 while ($row = mysql_fetch_assoc($result))321 while ($row = pwg_db_fetch_assoc($result)) 209 322 { 210 323 array_push($groups, $row); -
extensions/ConcoursPhoto/admin/help.php
r9370 r32457 9 9 10 10 $template->assign(array('SCRIPT' => 11 '<script type="text/javascript" src="'.CONCOURS_ADMIN_PATH.'template/Scripts.js"></script>')); 11 '<script type="text/javascript" src="'.CONCOURS_ADMIN_PATH.'template/Scripts.js"></script> 12 <link rel="stylesheet" type="text/css" href="'.CONCOURS_ADMIN_PATH.'template/concours.css")' 13 14 )); 12 15 13 16 -
extensions/ConcoursPhoto/admin/manage.php
r8946 r32457 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 5 global $template; 6 7 // Show concours list in 3 cases : 8 // 1-> prepared concours (not actived) 9 // 2-> active concours 10 // 3-> closed concours 11 12 $prepared_concours = get_inactive_concours(); 13 $active_concours = get_active_concours(); 14 $closed_concours = get_closed_concours(); 15 16 // 1 prepared concours 17 foreach ($prepared_concours as $concours) 5 global $template, $page; 6 7 8 if (isset($_POST['add_concours_submit'])) 9 redirect(PHPWG_ROOT_PATH.'admin.php?page=plugin-'.CONCOURS_DIR.'-add_concours&action=new'); 10 11 // Show default criterias (concours id=0) 12 $defaultconcours = new Concours(0); 13 14 $status = (isset($_GET['status']) ? $_GET['status'] : ''); 15 $sortby = (isset($_GET['sortby']) ? $_GET['sortby'] : 'id'); 16 $sortorder = (isset($_GET['sortorder']) ? $_GET['sortorder'] : 'desc'); 17 $start = (isset($_GET['start']) ? $_GET['start'] : 0); 18 $no_concours = l10n('active_concours_1') ; 19 $query = 'SELECT DISTINCT(id), name, descr, create_date, begin_date, end_date, method, category FROM '.CONCOURS_TABLE; 20 21 if (isset($_POST['concours_form_filter_submit'])) { 22 $start = 0; 23 switch ($_POST['concours_status']) { 24 case 'prepared': 25 $query .= ' WHERE time_to_sec(TIMEDIFF(begin_date, now())) > 0 AND id!=0'; 26 $status = 'prepared'; 27 $no_concours = l10n('prepared_concours_1') ; 28 break; 29 case 'active': 30 $query .= ' WHERE time_to_sec(TIMEDIFF(begin_date, now())) < 0 AND id!=0 31 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0'; 32 $status = 'active'; 33 $no_concours = l10n('active_concours_1') ; 34 break; 35 case 'closed': 36 $query .= ' WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 AND id!=0'; 37 $status = 'closed'; 38 $no_concours = l10n('closed_concours_1') ; 39 break; 40 case'closed-noresult': 41 $query .= ' WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 AND id!=0'; 42 $query .= ' AND id NOT IN (SELECT id_concours FROM ' .CONCOURS_RESULT_TABLE.') '; 43 $status = 'closed-noresult'; 44 $no_concours = l10n('closed_noresult_concours_1'); 45 break; 46 default: 47 $query .= ' WHERE id!=0'; 48 $status = null; 49 $no_concours = ''; 50 break; 51 } 52 53 switch ($_POST['concours_sort_by']) { 54 case 'id': 55 $query .= ' ORDER BY id'; 56 break; 57 case 'name': 58 $query .= ' ORDER BY name'; 59 break; 60 case 'create_date': 61 $query .= ' ORDER BY create_date'; 62 break; 63 case 'begin_date': 64 $query .= ' ORDER BY begin_date'; 65 break; 66 case 'end_date': 67 $query .= ' ORDER BY end_date'; 68 break; 69 default: 70 $query .= ' ORDER BY create_date'; 71 break; 72 } 73 74 switch ($_POST['concours_sort_order']) { 75 case 'asc': 76 $query .= ' ASC'; 77 break; 78 case 'desc': 79 $query .= ' DESC'; 80 break; 81 default: 82 $query .= ' DESC'; 83 break; 84 } 85 86 $template->assign('concours_filter', array( 87 'status' => $_POST['concours_status'], 88 'sort_by' => $_POST['concours_sort_by'], 89 'sort_order' => $_POST['concours_sort_order'], 90 ) 91 ); 92 93 if (intval($_POST['concours_nb_concours_page']) == 0) 94 $defaultconcours->my_config['nb_concours_page'] = 1; 95 else 96 $defaultconcours->my_config['nb_concours_page'] = intval($_POST['concours_nb_concours_page']); 97 $defaultconcours->set_config(); 98 99 100 } 101 else 18 102 { 19 $template->append('prepared_concours', array( 20 'ID' => $concours['id'], 21 'CREATE_DATE' => $concours['create_date'], 22 'NAME' => $concours['name'], 23 'DESC' => $concours['descr'], 24 'BEGIN_DATE' => $concours['begin_date'], 25 'END_DATE' => $concours['end_date'], 26 27 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=modify', 28 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=del' : '', 29 )); 30 31 } 32 // 2 active concours 33 foreach ($active_concours as $concours) 34 { 35 $template->append('active_concours', array( 36 'ID' => $concours['id'], 37 'CREATE_DATE' => $concours['create_date'], 38 'NAME' => $concours['name'], 39 'DESC' => $concours['descr'], 40 'BEGIN_DATE' => $concours['begin_date'], 41 'END_DATE' => $concours['end_date'], 42 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'], 45 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=del': '', 46 )); 47 48 } 49 // 3 closed concours 50 foreach ($closed_concours as $concours) 51 { 52 if ($concours['id'] != 0) // Default are not display 103 switch ($status) { 104 case 'prepared': 105 $query .= ' WHERE time_to_sec(TIMEDIFF(begin_date, now())) > 0 AND id!=0'; 106 $status = 'prepared'; 107 $no_concours = l10n('prepared_concours_1') ; 108 break; 109 case 'active': 110 $query .= ' WHERE time_to_sec(TIMEDIFF(begin_date, now())) < 0 AND id!=0 111 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0'; 112 $status = 'active'; 113 $no_concours = l10n('active_concours_1') ; 114 break; 115 case 'closed': 116 $query .= ' WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 AND id!=0'; 117 $status = 'closed'; 118 $no_concours = l10n('closed_concours_1') ; 119 break; 120 case 'closed-noresult': 121 $query .= ' WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 AND id!=0'; 122 $query .= ' AND id NOT IN (SELECT id_concours FROM ' .CONCOURS_RESULT_TABLE.') '; 123 $status = 'closed-noresult'; 124 $no_concours = l10n('closed_noresult_concours_1'); 125 break; 126 default: 127 $query .= ' WHERE id!=0'; 128 $status = null; 129 $no_concours = ''; 130 break; 131 } 132 133 switch ($sortby) { 134 case 'id': 135 $query .= ' ORDER BY id'; 136 break; 137 case 'name': 138 $query .= ' ORDER BY name'; 139 break; 140 case 'create_date': 141 $query .= ' ORDER BY create_date'; 142 break; 143 case 'begin_date': 144 $query .= ' ORDER BY begin_date'; 145 break; 146 case 'end_date': 147 $query .= ' ORDER BY end_date'; 148 break; 149 default: 150 $query .= ' ORDER BY create_date'; 151 break; 152 } 153 154 switch ($sortorder) { 155 case 'asc': 156 $query .= ' ASC'; 157 break; 158 case 'desc': 159 $query .= ' DESC'; 160 break; 161 default: 162 $query .= ' DESC'; 163 break; 164 } 165 166 $template->assign('concours_filter', array( 167 'status' => $status, 168 'sort_by' => $sortby, 169 'sort_order' => $sortorder, 170 ) 171 ); 172 173 } 174 175 176 177 178 179 if (isset($_POST['delete_selected_submit'])) { 180 if (isset($_POST['concours_to_delete_sure']) && $_POST['concours_to_delete_sure'] == '1') { 181 if (isset($_POST['concours_to_delete'])) { 182 foreach ($_POST['concours_to_delete'] as $concours_id) { 183 $defaultconcours->delete_concours($concours_id); 184 } 185 array_push($page['infos'], l10n('concours_deleted')); 186 } 187 if (isset($_POST['concours_delete_closed']) && $_POST['concours_delete_closed'] == '1') { 188 $defaultconcours->delete_allclosed_concours(); 189 array_push($page['infos'], l10n('concours_invalid_deleted')); 190 } 191 } else { 192 array_push($page['errors'], l10n('You need to confirm deletion')); 193 } 194 } 195 196 ////////// 197 $end = get_nb_concours($status); 198 $start = (isset($_GET['start']) ? intval($_GET['start']) : 0); 199 if ($start > $end) 200 $start = 0; 201 if ($start != 0 AND $end <= $defaultconcours->my_config['nb_concours_page']) 202 $start = 0; 203 204 $management_url_std = get_root_url().'admin.php?page=plugin-'.CONCOURS_DIR.'-manage'; 205 //Create the navigation bar (for more than 1 page) 206 $management_url = get_root_url().'admin.php?page=plugin-'.CONCOURS_DIR.'-manage'.'&status='.$status.'&sortorder='.$sortorder.'&sortby='.$sortby; 207 $concours_navbar = array(); 208 $concours_navbar = create_navigation_bar($management_url, $end, $start, $defaultconcours->my_config['nb_concours_page']); 209 210 //DB Query 211 212 if (strpos($query, 'WHERE') === FALSE) { 213 $query .= ' WHERE time_to_sec(TIMEDIFF(begin_date, now())) < 0 AND id!=0 214 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0'; 215 } 216 217 if (strpos($query, 'ORDER BY') === FALSE) { 218 $query .= ' ORDER BY create_date'; 219 } 220 221 222 $query .= ' LIMIT '.$start.','.$defaultconcours->my_config['nb_concours_page'].';'; 223 $result = pwg_query($query); 224 while($concours = pwg_db_fetch_assoc($result)) { 225 226 if ($concours['id']!=0) 53 227 { 228 229 230 $concours_status = 0; 231 // 0 Prepared / 1 Active / 2 Closed 232 $concours_status = (strtotime($concours['begin_date'])-time() > 0 ? 0 : (strtotime($concours['end_date']) - time() > 0 ? 1 : 2 )); 54 233 $filename = has_file($concours['id']); 55 $template->append('closed_concours', array( 56 'ID' => $concours['id'], 57 'CREATE_DATE' => $concours['create_date'], 58 'NAME' => $concours['name'], 59 'DESC' => $concours['descr'], 60 'BEGIN_DATE' => $concours['begin_date'], 61 'END_DATE' => $concours['end_date'], 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'], 65 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=del' : '', 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' : '', 67 'U_FILE' => !is_adviser() 68 ? ($filename ? CONCOURS_ADMIN_PATH . 'file.php?file=' . $filename 69 : (has_result($concours['id']) ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=file' : '')) 70 : '', 71 )); 234 235 if ( ($status == 'closed-noresult' AND !has_result($concours['id'])) // option "closed without result' => display only closed without result 236 OR ($status != 'closed-noresult' ) // OR option "closed" OR "active" OR "prepared" 237 ) 238 { 239 $template->append('concours_list', array( 240 'ID' => $concours['id'], 241 'STATUS1' => $concours_status, 242 'STATUS' => ($concours_status == 0 ? 'prepared' : ($concours_status == 1 ? 'actived' : 'closed')) , 243 'CREATE_DATE' => $concours['create_date'], 244 'NAME' => $concours['name'], 245 'DESC' => $concours['descr'], 246 'BEGIN_DATE' => $concours['begin_date'], 247 'END_DATE' => $concours['end_date'], 248 249 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action='.($concours_status != 2 ? 'modify' : 'edit'), 250 'U_AUDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Faudit.php&concours=' . $concours['id'], 251 'U_DELETE' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=del' , 252 'U_RESULT' => !has_result($concours['id'])? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=result' : '', 253 'U_FILE' => $filename ? CONCOURS_ADMIN_PATH . 'file.php?file=' . $filename : (has_result($concours['id']) ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $concours['id'].'&action=file' : ''), 254 'NB_VOTE' => count($defaultconcours->get_user_list($concours['id']))+count($defaultconcours->get_guest_list($concours['id'])) 255 256 257 )); 258 } 72 259 } 73 260 } 74 261 75 262 $template->assign('IMG_URL', CONCOURS_IMG_PATH); 76 77 263 $template->assign('MANAGE_URL', $management_url_std); 264 265 $template->assign('no_concours', sprintf(l10n('concours_no_concours'), $no_concours)); 266 267 $nb_concours_valid_total = sprintf(l10n('concours_nb_concours_total'), get_nb_concours(), get_nb_prepared_concours(), get_nb_active_concours(), get_nb_closed_concours()); 268 269 270 $template->assign('nb_concours_total', $nb_concours_valid_total); 271 $template->assign('concours_nb_concours_page', $defaultconcours->my_config['nb_concours_page']); 272 $template->assign('navbar', $concours_navbar); 78 273 79 274 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/manage.tpl'); 80 275 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 81 276 277 278 82 279 ?> -
extensions/ConcoursPhoto/admin/params.php
r8946 r32457 7 7 8 8 // General parameters for the concours 9 $concours = new Concours();9 $concours1 = new Concours(); 10 10 11 11 if (isset($_POST['submit'])) { 12 $concours ->my_config['active_menubar'] = isset($_POST['active_menubar']);13 $concours ->my_config['nbconcours_menubar'] = $_POST['nbconcours_menubar'];12 $concours1->my_config['active_menubar'] = isset($_POST['active_menubar']); 13 $concours1->my_config['nbconcours_menubar'] = $_POST['nbconcours_menubar']; 14 14 15 $concours->my_config['mask_author'] = isset($_POST['mask_author']); 16 $concours->my_config['thumb_note'] = isset($_POST['thumb_note']); 15 $concours1->my_config['mask_author'] = isset($_POST['mask_author']); 16 $concours1->my_config['mask_meta'] = isset($_POST['mask_meta']); 17 $concours1->my_config['thumb_note'] = isset($_POST['thumb_note']); 17 18 18 $concours ->my_config['check_exaequo'] = isset($_POST['check_exaequo']);19 $concours1->my_config['check_exaequo'] = isset($_POST['check_exaequo']); 19 20 20 $concours->my_config['author_vote_available'] = isset($_POST['author_vote_available']); 21 $concours->my_config['concours_change_score'] = isset($_POST['concours_change_score']); 21 $concours1->my_config['author_vote_available'] = $_POST['AUTHOR_MODE']; 22 22 23 $concours->save_config(); 23 $concours1->my_config['concours_change_score'] = isset($_POST['concours_change_score']); 24 $concours1->my_config['concours_deadline'] = $_POST['concours_deadline']; 25 $concours1->my_config['mask_thumbnail'] = isset($_POST['mask_thumbnail']); 26 $concours1->my_config['active_global_score_page'] = isset($_POST['active_global_score_page']); 27 $concours1->my_config['score_mode'] = $_POST['score_mode']; 28 $concours1->my_config['text_overlay'] = $_POST['text_overlay']; 29 30 $concours1->save_config(); 31 24 32 array_push($page['infos'], l10n('concours_saveOK')); 25 33 } 26 34 35 for($jj=0; $jj < 4; $jj++) 36 { 37 $template->append('AUTHOR_MODE',array('ID' => $jj,'NAME' => l10n('concours_author_vote'.$jj),'SELECTED' => ($concours1->my_config['author_vote_available'] == $jj ? 'selected' : ''))); 38 } 39 40 41 27 42 for($jj=0; $jj < 10; $jj++) 28 43 { 29 $template->append('NBCONCOURS',array('ID' => $jj,'NAME' => $jj,'SELECTED' => ($concours->my_config['nbconcours_menubar'] == $jj ? 'selected' : ''))); 30 $i++; 44 $template->append('NBCONCOURS',array('ID' => $jj,'NAME' => $jj,'SELECTED' => ($concours1->my_config['nbconcours_menubar'] == $jj ? 'selected' : ''))); 31 45 } 32 46 47 for($jj=0; $jj < 3; $jj++) 48 { 49 $template->append('DEADLINE',array('ID' => $jj,'NAME' => l10n('concours_deadline_param'.$jj),'SELECTED' => ($concours1->my_config['concours_deadline'] == $jj ? 'selected' : ''))); 50 } 51 for($jj=0; $jj < 2; $jj++) 52 { 53 $template->append('SCORE_MODE',array('ID' => $jj,'NAME' => l10n('concours_score_mode'.$jj),'SELECTED' => ($concours1->my_config['score_mode'] == $jj ? 'selected' : ''))); 54 } 55 56 33 57 $template->assign(array( 34 'SHOW_MENUBAR' => ($concours->my_config['active_menubar'] ? 'checked="checked"' : ''), 35 'MASK_AUTHOR' => ($concours->my_config['mask_author'] ? 'checked="checked"' : ''), 36 'THUMB_NOTE' => ($concours->my_config['thumb_note'] ? 'checked="checked"' : ''), 37 'CHECK_EXAEQUO' => ($concours->my_config['check_exaequo'] ? 'checked="checked"' : ''), 38 'AUTHOR_VOTE_AVAILABLE' => ($concours->my_config['author_vote_available'] ? 'checked="checked"' : ''), 39 'CHANGE_SCORE' => ($concours->my_config['concours_change_score'] ? 'checked="checked"' : ''), 58 'SHOW_MENUBAR' => ($concours1->my_config['active_menubar'] ? 'checked="checked"' : ''), 59 'MASK_AUTHOR' => ($concours1->my_config['mask_author'] ? 'checked="checked"' : ''), 60 'THUMB_NOTE' => ($concours1->my_config['thumb_note'] ? 'checked="checked"' : ''), 61 'CHECK_EXAEQUO' => ($concours1->my_config['check_exaequo'] ? 'checked="checked"' : ''), 62 'CHANGE_SCORE' => ($concours1->my_config['concours_change_score'] ? 'checked="checked"' : ''), 63 'MASK_THUMB' => ($concours1->my_config['mask_thumbnail'] ? 'checked="checked"' : ''), 64 'GLOBAL_SCORE' => ($concours1->my_config['active_global_score_page'] ? 'checked="checked"' : ''), 65 'TEXT_OVERLAY' => $concours1->my_config['text_overlay'], 66 'MASK_META' => ($concours1->my_config['mask_meta'] ? 'checked="checked"' : ''), 40 67 41 68 )); -
extensions/ConcoursPhoto/admin/template/add_concours.tpl
r9364 r32457 56 56 <td colspan = "3"> 57 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>58 {foreach $concours_method as $concours_method1} 59 <option value="{$concours_method1.ID}" {$concours_method1.SELECTED}>{$concours_method1.NAME}</option> 60 60 {/foreach} 61 61 </select> … … 68 68 <b>{'concours_category_select'|@translate}</b> 69 69 <select name="cat_selection" disabled="disabled"> 70 {foreach from=$category_selection item=category_selection}71 <option value="{$category_selection .ID}" {$category_selection.SELECTED}>{$category_selection.NAME}</option>70 {foreach $category_selection as $category_selection1} 71 <option value="{$category_selection1.ID}" {$category_selection1.SELECTED}>{$category_selection1.NAME}</option> 72 72 {/foreach} 73 73 </select> … … 102 102 </TD> 103 103 </TR> 104 <TR> 105 <TD colspan="4"> 106 <input type="checkbox" name="admin" {$CONCOURS.ADMIN}/> {'concours_allow_admin'|@translate} 107 <br/> 108 </TD> 109 </TR> 104 110 105 111 <tr><td colspan="4"><br></td></tr> … … 180 186 <td colspan = "3"> 181 187 <select name="concours_method"> 182 {foreach from=$concours_method item=concours_method}183 <option value="{$concours_method .ID}" {$concours_method.SELECTED}>{$concours_method.NAME}</option>188 {foreach $concours_method as $concours_method1} 189 <option value="{$concours_method1.ID}" {$concours_method1.SELECTED}>{$concours_method1.NAME}</option> 184 190 {/foreach} 185 191 </select> … … 193 199 <b>{'concours_category_select'|@translate}</b> 194 200 <select name="cat_selection"> 195 {foreach from=$category_selection item=category_selection}196 <option value="{$category_selection .ID}" {$category_selection.SELECTED}>{$category_selection.NAME}</option>201 {foreach $category_selection as $category_selection1} 202 <option value="{$category_selection1.ID}" {$category_selection1.SELECTED}>{$category_selection1.NAME}</option> 197 203 {/foreach} 198 204 </select> … … 203 209 </fieldset> 204 210 {if (isset($action) && ($action == 'modify_crit' || $action == 'edit'))} 205 <fieldset> 206 <legend>{'concours_criterias'|@translate}</legend> 207 <table border="1"> 208 <tr> 209 <td><b>{'concours_id'|@translate}</b></td> 210 <td><b>{'concours_name'|@translate}</b></td> 211 <td width="50%"><b>{'concours_descr'|@translate}</b></td> 212 <td><b>{'concours_min_value'|@translate}</b></td> 213 <td><b>{'concours_max_value'|@translate}</b></td> 214 <td><b>{'concours_coef'|@translate}</b></td> 215 {if $action != 'edit'} 216 <td width="10%"><b>{'concours_actions'|@translate}</b></td> 217 {/if} 218 </tr> 219 {foreach from=$concours_criteria item=concours_criteria} 220 <tr> 221 <td>{$concours_criteria.id}</td> 222 <td> 223 {if $concours_criteria.level == 1} 224 <b>{$concours_criteria.name}</b> 225 {else} 226 <i>{$concours_criteria.name}</i> 211 <fieldset> 212 <legend>{'concours_criterias'|@translate}</legend> 213 </fieldset> 214 215 {if count($concours_criteria)} 216 <table class="table2" width="97%"> 217 <thead> 218 <tr class="throw"> 219 <td width="5%">{'concours_id'|@translate}</td> 220 <td width="15%">{'concours_name'|@translate}</td> 221 <td width="50%">{'concours_descr'|@translate}</td> 222 <td width="5%">{'concours_min_value'|@translate}</td> 223 <td width="5%">{'concours_max_value'|@translate}</td> 224 <td width="5%">{'concours_coef'|@translate}</td> 225 {if $action != 'edit'} 226 <td width="10%">{'concours_actions'|@translate}</td> 227 {/if} 228 </tr> 229 </thread> 230 <tbody> 231 {foreach $concours_criteria as $concours_criteria1} 232 {if $smarty.foreach.foreach_concours_criteria.iteration is even} 233 <tr class="row1"> 234 {else} 235 <tr class="row2"> 227 236 {/if} 228 </td> 229 <td>{$concours_criteria.lib}</td> 230 {if !$concours_criteria.nosub} 231 <td colspan="3"> </td> 232 {else} 233 <td>{$concours_criteria.min}</td> 234 <td>{$concours_criteria.max}</td> 235 <td>{$concours_criteria.pond}</td> 236 {/if} 237 {if $action != 'edit'} 238 <td> 239 {if isset($concours_criteria.U_EDIT)} 240 <a href="{$concours_criteria.U_EDIT}" title="{'criteria_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'criteria_edit'|@translate}"/></a> 241 242 {/if} 243 {if isset($concours_criteria.U_DELETE)} 244 <a href="{$concours_criteria.U_DELETE}" title="{'criteria_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'criteria_delete'|@translate}" /></a> 245 {/if} 246 {if $concours_criteria.level == 1} 247 <a href="{$concours_criteria.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" class="button" alt="{'subcriteria_add'|@translate}" /></a> 248 {/if} 249 </td> 250 {/if} 251 </tr> 252 {/foreach} 253 </table> 237 <td>{$concours_criteria1.id}</td> 238 <td> 239 {if $concours_criteria1.level == 1} 240 <b>{$concours_criteria1.name}</b> 241 {else} 242 <i>{$concours_criteria1.name}</i> 243 {/if} 244 </td> 245 <td>{$concours_criteria1.lib}</td> 246 {if !$concours_criteria1.nosub} 247 <td colspan="3"> </td> 248 {else} 249 <td>{$concours_criteria1.min}</td> 250 <td>{$concours_criteria1.max}</td> 251 <td>{$concours_criteria1.pond}</td> 252 {/if} 253 {if $action != 'edit'} 254 <td> 255 {if isset($concours_criteria1.U_EDIT)} 256 <a href="{$concours_criteria1.U_EDIT}" title="{'criteria_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'criteria_edit'|@translate}"/></a> 257 258 {/if} 259 {if isset($concours_criteria1.U_DELETE)} 260 <a href="{$concours_criteria1.U_DELETE}" title="{'criteria_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'criteria_delete'|@translate}" /></a> 261 {/if} 262 {if $concours_criteria1.level == 1} 263 <a href="{$concours_criteria1.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" width="30" class="button" alt="{'subcriteria_add'|@translate}" /></a> 264 {/if} 265 </td> 266 {/if} 267 </tr> 268 {/foreach} 269 </table> 270 {else} 271 <fieldset> 272 <div class="concours_no_criteria"> 273 {'concours_no_criteria'|@translate} 274 </div> 275 </fieldset> 276 277 {/if} 254 278 {if $action != 'edit'} 255 <p><input type="submit" name="add" value="{'concours_add_criteria'|@translate}" />279 <p><input type="submit" name="add" value="{'concours_add_criteria'|@translate}" /> 256 280 {/if} 257 281 258 259 </fieldset> 260 {/if} 282 {/if} 261 283 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p> 262 284 </form> -
extensions/ConcoursPhoto/admin/template/audit.tpl
r9364 r32457 5 5 <fieldset> 6 6 <legend>{'concours_audit_page'|@translate}</legend> 7 <fieldset> 8 <legend>{'concours_infos'|@translate}</legend> 9 <table align="left"> 10 <td align = "left"> 11 {'concours_name'|@translate} : <b>{$CONCOURS.NAME}</b> 12 <br>{'concours_descr'|@translate} : <b>{$CONCOURS.DESCR}</b> 13 <br>{'concours_activ_from'|@translate} <b>{$CONCOURS.BEGIN_DATE}</b> {'concours_activ_to'|@translate} <b>{$CONCOURS.END_DATE}</b> 14 <br>{'concours_method'|@translate} : <b>{$CONCOURS.METHOD}</b> 15 </td> 16 </tr> 17 </table> 18 </fieldset> 19 <form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 20 {'concours_username_selection'|@translate} : </b> 21 <select name="user_list"> 22 {foreach from=$user_list item=user_list} 23 <option value="{$user_list.ID}" {$user_list.SELECTED}>{$user_list.NAME}</option> 24 {/foreach} 25 </select> 26 <input type="submit" name="Submit" value="{'Submit'|@translate}" /> 27 </form> 28 <table align="left"> 29 <tr><td colspan="4"><br></td></tr> 30 {foreach from=$concours_note item=concours_note} 31 <tr> 32 <td><b><i> {if $concours_note.nbvotant != 0} 33 ({$concours_note.rang}{if $concours_note.rang == 1}{'concours_1st'|@translate} 34 {elseif $concours_note.rang == 2}{'concours_2nd'|@translate} 35 {elseif $concours_note.rang == 3}{'concours_3rd'|@translate} 36 {else}{'concours_4th'|@translate}{/if} 37 ) 38 {else}(N/A){/if} </i></b></td> 39 <td> 40 <b>Photo Id : {$concours_note.img_id} </b> 41 </td> 42 <td> 43 <a href="{$concours_note.url}"> 44 <img class="thumbnail" src="{$concours_note.thumb}" alt="{$concours_note.name}" title="{$concours_note.name}"/> 45 </a> 46 <br><u>{'concours_name'|@translate}</u> : {$concours_note.name} 47 <br><u>{'concours_author'|@translate}</u> : {$concours_note.author} 7 <fieldset> 8 <legend>{'concours_infos'|@translate}</legend> 9 <table align="left"> 10 <td align = "left"> 11 {'concours_name'|@translate} : <b>{$CONCOURS.NAME}</b> 12 <br>{'concours_descr'|@translate} : <b>{$CONCOURS.DESCR}</b> 13 <br>{'concours_activ_from'|@translate} <b>{$CONCOURS.BEGIN_DATE}</b> {'concours_activ_to'|@translate} <b>{$CONCOURS.END_DATE}</b> 14 <br>{'concours_method'|@translate} : <b>{$CONCOURS.METHOD}</b> 48 15 </td> 49 <td align="left">50 <fieldset>51 <i>{'concours_note'|@translate} : <b>{$concours_note.note}</b> </i>52 <br><i>{'concours_moyenne'|@translate} : <b>{$concours_note.moyenne}</b> </i>53 <br><i>{'concours_nbvotant'|@translate} : {$concours_note.nbvotant} </i>54 </fieldset>55 </td>56 16 </tr> 57 <tr><td colspan="2"></td> 58 <td><hr></td> 59 <td></td> 60 </tr> 61 {/foreach} 17 </table> 18 </fieldset> 19 <fieldset> 20 <form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 21 {'concours_username_selection'|@translate} : </b> 22 <select name="user_list"> 23 {foreach $user_list as $user_list1} 24 <option value="{$user_list1.ID}" {$user_list1.SELECTED}>{$user_list1.NAME}</option> 25 {/foreach} 26 </select> 27 <input type="submit" name="Submit" value="{'Submit'|@translate}" /> 28 </form> 29 <table align="left"> 30 <tr><td colspan="4"><br></td></tr> 31 {foreach $concours_note as $concours_note1} 32 <tr> 33 <td><b><i> {if $concours_note1.nbvotant != 0} 34 ({$concours_note1.rang}{if $concours_note1.rang == 1}{'concours_1st'|@translate} 35 {elseif $concours_note1.rang == 2}{'concours_2nd'|@translate} 36 {elseif $concours_note1.rang == 3}{'concours_3rd'|@translate} 37 {else}{'concours_4th'|@translate}{/if} 38 ) 39 {else}(N/A){/if} </i></b></td> 40 <td> 41 <b>Photo Id : {$concours_note1.img_id} </b> 42 </td> 43 <td> 44 <a href="{$concours_note1.url}"> 45 <img class="thumbnail" src="{$concours_note1.thumb}" alt="{$concours_note1.name}" title="{$concours_note1.name}"/> 46 </a> 47 <br><u>{'concours_name'|@translate}</u> : {$concours_note1.name} 48 <br><u>{'concours_author'|@translate}</u> : {$concours_note1.author} 49 </td> 50 <td align="left"> 51 <fieldset> 52 <i>{'concours_note'|@translate} : <b>{$concours_note1.note}</b> </i> 53 <br><i>{'concours_moyenne'|@translate} : <b>{$concours_note1.moyenne}</b> </i> 54 {if ($CONCOURS.METHODNB > 2)} 55 <br>{'concours_warn_moderation'|@translate} 56 {/if} 57 <br><i>{'concours_nbvotant'|@translate} : {$concours_note1.nbvotant} </i> 58 </fieldset> 59 </td> 60 </tr> 61 <tr><td colspan="2"></td> 62 <td><hr></td> 63 <td></td> 64 </tr> 65 {/foreach} 62 66 63 </table> 67 </table> 68 </fieldset> 64 69 </fieldset> 65 70 -
extensions/ConcoursPhoto/admin/template/config.tpl
r9364 r32457 5 5 {'concours_admin_title'|@translate} 6 6 </p> 7 <form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 8 <fieldset> 7 <fieldset> 9 8 <legend>{'default_criteria'|@translate}</legend> 9 </fieldset> 10 10 11 <table border="1"> 12 <tr> 13 <td><b>{'concours_id'|@translate}</b></td> 14 <td><b>{'concours_name'|@translate}</b></td> 15 <td width="50%"><b>{'concours_descr'|@translate}</b></td> 16 <td><b>{'concours_min_value'|@translate}</b></td> 17 <td><b>{'concours_max_value'|@translate}</b></td> 18 <td><b>{'concours_coef'|@translate}</b></td> 19 <td width="10%"><b>{'concours_actions'|@translate}</b></td> 20 </tr> 21 {foreach from=$concours_criteria item=concours_criteria} 22 <tr> 23 <td>{$concours_criteria.id}</td> 24 <td> 25 {if $concours_criteria.level == 1} 26 <b>{$concours_criteria.name}</b> 27 {else} 28 <i>{$concours_criteria.name}</i> 29 {/if} 30 </td> 31 <td>{$concours_criteria.lib}</td> 32 {if !$concours_criteria.nosub} 33 <td colspan="3"> </td> 34 {else} 35 <td>{$concours_criteria.min}</td> 36 <td>{$concours_criteria.max}</td> 37 <td>{$concours_criteria.pond}</td> 38 {/if} 39 <td> 40 {if isset($concours_criteria.U_EDIT)} 41 <a href="{$concours_criteria.U_EDIT}" title="{'criteria_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'criteria_edit'|@translate}"/></a> 42 43 {/if} 44 {if isset($concours_criteria.U_DELETE)} 45 <a href="{$concours_criteria.U_DELETE}" title="{'criteria_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'criteria_delete'|@translate}" /></a> 46 {/if} 47 {if $concours_criteria.level == 1} 48 <a href="{$concours_criteria.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" class="button" alt="{'subcriteria_add'|@translate}" /></a> 49 {/if} 50 </td> 51 </tr> 52 {/foreach} 53 </table> 54 <p><input type="submit" name="add" value="{'concours_add_criteria'|@translate}" /> 55 56 </fieldset> 57 </form> 11 {if count($concours_criteria)} 12 <table class="table2" width="97%"> 13 <thead> 14 <tr class="throw"> 15 <td width="5%">{'concours_id'|@translate}</td> 16 <td width="15%">{'concours_name'|@translate}</td> 17 <td width="50%">{'concours_descr'|@translate}</td> 18 <td width="5%">{'concours_min_value'|@translate}</td> 19 <td width="5%">{'concours_max_value'|@translate}</td> 20 <td width="5%">{'concours_coef'|@translate}</td> 21 <td width="10%">{'concours_actions'|@translate}</td> 22 </tr> 23 </thead> 24 <tbody> 25 {foreach $concours_criteria as $concours_criteria1} 26 {if $smarty.foreach.foreach_concours_criteria.iteration is even} 27 <tr class="row1"> 28 {else} 29 <tr class="row2"> 30 {/if} 31 <td>{$concours_criteria1.id}</td> 32 <td> 33 {if $concours_criteria1.level == 1} 34 <b>{$concours_criteria1.name}</b> 35 {else} 36 <i>{$concours_criteria1.name}</i> 37 {/if} 38 </td> 39 <td>{$concours_criteria1.lib}</td> 40 {if !$concours_criteria1.nosub} 41 <td colspan="3"> </td> 42 {else} 43 <td>{$concours_criteria1.min}</td> 44 <td>{$concours_criteria1.max}</td> 45 <td>{$concours_criteria1.pond}</td> 46 {/if} 47 <td> 48 {if isset($concours_criteria1.U_EDIT)} 49 <a href="{$concours_criteria1.U_EDIT}" title="{'criteria_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'criteria_edit'|@translate}"/></a> 50 51 {/if} 52 {if isset($concours_criteria1.U_DELETE)} 53 <a href="{$concours_criteria1.U_DELETE}" title="{'criteria_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'criteria_delete'|@translate}" /></a> 54 {/if} 55 {if $concours_criteria1.level == 1} 56 <a href="{$concours_criteria1.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" width="30" class="button" alt="{'subcriteria_add'|@translate}" /></a> 57 {/if} 58 </td> 59 </tr> 60 {/foreach} 61 </tbody> 62 </table> 63 {else} 64 <fieldset> 65 <div class="concours_no_criteria"> 66 {'concours_no_criteria'|@translate} 67 </div> 68 </fieldset> 69 {/if} 70 <fieldset> 71 <form method="post" id="add"> 72 <p><input type="submit" name="add" value="{'concours_add_criteria'|@translate}" /> 73 </fieldset> 74 75 </form> -
extensions/ConcoursPhoto/admin/template/help.tpl
r9370 r32457 1 {known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.js" } 2 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.js" } 3 {known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.js"} 4 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js" } 1 {combine_script id='jquery' path='themes/default/js/jquery.min.js'} 2 {combine_script id='jquery.cluetip' require='jquery' path='themes/default/js/plugins/jquery.cluetip.js'} 5 3 6 4 {html_head} … … 8 6 {/html_head} 9 7 8 9 10 11 12 10 13 <div class="instructions"> 11 14 <h2>{$CONCOURS_VERSION}</h2> 12 15 <fieldset style=" position:relative ; top:15px"> 13 16 <legend>{'concours_admin_help'|translate}</legend> 14 <div id="instructionFonction" class="instructionBlock" >15 16 <div17 id="fonction_header"18 class="instructionBlockHeaderCollapsed"19 onclick="blockToggleDisplay('fonction_header', 'Fonction')"20 ><span>21 {'ConcoursPhoto_Fonctionality'|translate}22 </span></div>23 <div24 id="Fonction"25 class="instructionBlockContent"26 style="display:none"27 >28 <p>{'CC_Function'|translate}.</p>29 <ol>30 <li>{'CC_hlp_1_1'|translate}</li>31 <li>{'CC_hlp_1_2'|translate}</li>32 <li>{'CC_hlp_1_3'|translate}</li>33 <li>{'CC_hlp_1_4'|translate}</li>34 <li>{'CC_hlp_1_5'|translate}</li>35 <li>{'CC_hlp_1_6'|translate}</li>36 </ol>37 <p></p>38 </div> <!-- Fonction -->39 </div> <!-- Fonctions -->40 41 <div id="instructionOPTION" class="instructionBlock">42 <div43 id="USAGE_header"44 class="instructionBlockHeaderCollapsed"45 onclick="blockToggleDisplay('USAGE_header', 'USAGE_content')"46 ><span>47 {'CC_Usage'|translate}48 </span></div>49 <div50 id="USAGE_content"51 class="instructionBlockContent"52 style="display:none"53 >54 55 56 57 <ol>58 <li ><span class="throw"> {'CC_Create_step1'|translate}</span></li>59 <ul>60 <li>{'CC_hlp_C1_1'|translate}</li>61 <li>{'CC_hlp_C1_2'|translate}</li>62 <li>{'CC_hlp_C1_3'|translate}</li>63 <li>{'CC_hlp_C1_4'|translate}</li>64 </ul>65 <li ><span class="throw">{'CC_Create_step2'|translate}</span></li>66 67 <ul>68 <li>{'CC_hlp_C2_1'|translate}</li>69 <li>{'CC_hlp_C2_2'|translate}</li>70 <li>{'CC_hlp_C2_3'|translate}</li>71 <li>{'CC_hlp_C2_4'|translate}</li>72 </ul>73 <li><span class="throw">{'CC_usage'|translate}</span> </li>74 <ul>75 <li>{'CC_hlp_C3_1'|translate}</li>76 <li>{'CC_hlp_C3_2'|translate}</li>77 <li>{'CC_hlp_C3_3'|translate}</li>78 <li>{'CC_hlp_C3_4'|translate}</li>79 </ul>80 </ul>81 <li><span class="throw">{'CC_result'|translate}</span> </li>82 <ul>83 <li>{'CC_hlp_C4_1'|translate}</li>84 <li>{'CC_hlp_C4_2'|translate}</li>85 <li>{'CC_hlp_C4_3'|translate}</li>86 <li>{'CC_hlp_C4_4'|translate}</li>87 </ul>88 </ol>89 17 90 18 91 19 92 20 93 </div> <!-- OPTION_content --> 94 </div> <!-- instructionOPTION --> 21 <div id="instructionConcours" class="instructionBlock" > 22 23 <div id="Concours_header" class="instructionBlockHeaderCollapsed" onclick="blockToggleDisplay('Concours_header', 'Fonction')"> 24 <span class="cluetip" title="{'ConcoursPhoto_Fonctionality'|translate}">{'ConcoursPhoto_Fonctionality'|translate}</span> 25 </div> 26 <div id="Fonction" class="instructionBlockContent" style="display:none"> 27 <fieldset> 28 {'ConcoursPhoto_Fonctionality_txt'|@translate} 29 </fieldset> 30 </div> <!-- Fonction --> 31 </div> <!-- instructionConcours --> 32 33 <div id="instructionOPTION" class="instructionBlock"> 34 <div id="USAGE_header" class="instructionBlockHeaderCollapsed" onclick="blockToggleDisplay('USAGE_header', 'USAGE_content')"> 35 <span class="cluetip" title="{'ConcoursPhoto_Options'|translate}">{'ConcoursPhoto_Options'|translate}</span> 36 </div> 37 <div id="USAGE_content" class="instructionBlockContent" style="display:none" > 38 <fieldset> 39 {'ConcoursPhoto_Options_txt'|@translate} 40 </fieldset> 41 42 </div> <!-- USAGE_header --> 43 </div> <!-- USAGE_content --> 95 44 96 45 </fieldset> -
extensions/ConcoursPhoto/admin/template/manage.tpl
r9364 r32457 5 5 {'concours_admin_title'|@translate} 6 6 </p> 7 <form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 8 <fieldset> 9 <legend>{'manage_concours'|@translate}</legend> 7 10 8 11 9 <fieldset> 12 <legend>{'prepared_concours'|@translate}</legend> 13 <table border="1"> 14 <tr> 15 <th><b>{'concours_id2'|@translate}</b></th> 16 <th><b>{'concours_name'|@translate}</b></th> 17 <th><b>{'concours_create_date'|@translate}</b></th> 18 <th width="50%"><b>{'concours_descr'|@translate}</b></th> 19 <th><b>{'concours_begin_date'|@translate}</b></th> 20 <th><b>{'concours_end_date'|@translate}</b></th> 21 <th width="10%"><b>{'concours_actions'|@translate}</b></th> 22 </tr> 23 {foreach from=$prepared_concours item=prepared_concours} 24 <tr> 25 <td>{$prepared_concours.ID}</td> 26 <td>{$prepared_concours.NAME}</td> 27 <td>{$prepared_concours.CREATE_DATE}</td> 28 <td>{$prepared_concours.DESC}</td> 29 <td>{$prepared_concours.BEGIN_DATE}</td> 30 <td>{$prepared_concours.END_DATE}</td> 31 <td><a href="{$prepared_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a> 32 <a href="{$prepared_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a> 33 </td> 34 </tr> 35 {/foreach} 36 </table> 37 </fieldset> 38 39 <fieldset> 40 <legend>{'active_concours'|@translate}</legend> 41 <table border="1"> 42 <tr> 43 <th><b>{'concours_id2'|@translate}</b></th> 44 <th><b>{'concours_name'|@translate}</b></th> 45 <th><b>{'concours_create_date'|@translate}</b></th> 46 <th width="50%"><b>{'concours_descr'|@translate}</b></th> 47 <th><b>{'concours_begin_date'|@translate}</b></th> 48 <th><b>{'concours_end_date'|@translate}</b></th> 49 <th width="10%"><b>{'concours_actions'|@translate}</b></th> 50 </tr> 51 {foreach from=$active_concours item=active_concours} 52 <tr> 53 <td>{$active_concours.ID}</td> 54 <td><a href="{$active_concours.U_AUDIT}" title="{'concours_audit1'|@translate}">{$active_concours.NAME}</a></td> 55 <td>{$active_concours.CREATE_DATE}</td> 56 <td>{$active_concours.DESC}</td> 57 <td>{$active_concours.BEGIN_DATE}</td> 58 <td>{$active_concours.END_DATE}</td> 59 <td><a href="{$active_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a> 60 <a href="{$active_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a> 61 </td> 62 </tr> 63 {/foreach} 64 </table> 10 <legend>{'manage_concours'|@translate}</legend> 11 <form method="post" id="add_concours_submit"> 12 <div class="concours_last_line"> 13 <span>{$nb_concours_total} </span></br></br> 14 <span><input type="submit" name="add_concours_submit" value="{'concours_add'|@translate}" /></span> 15 </div> 16 </form> 65 17 </fieldset> 66 18 67 19 <fieldset> 68 <legend>{'closed_concours'|@translate}</legend> 69 <table border="1"> 70 <tr> 71 <th><b>{'concours_id2'|@translate}</b></th> 72 <th><b>{'concours_name'|@translate}</b></th> 73 <th><b>{'concours_create_date'|@translate}</b></th> 74 <th width="50%"><b>{'concours_descr'|@translate}</b></th> 75 <th><b>{'concours_begin_date'|@translate}</b></th> 76 <th><b>{'concours_end_date'|@translate}</b></th> 77 <th><b>{'concours_actions'|@translate}</b></th> 78 </tr> 79 {foreach from=$closed_concours item=closed_concours} 80 <tr> 81 <td>{$closed_concours.ID}</td> 82 <td><a href="{$closed_concours.U_AUDIT}" title="{'concours_audit1'|@translate}">{$closed_concours.NAME}</a></td> 83 <td>{$closed_concours.CREATE_DATE}</td> 84 <td>{$closed_concours.DESC}</td> 85 <td>{$closed_concours.BEGIN_DATE}</td> 86 <td>{$closed_concours.END_DATE}</td> 87 <td><a href="{$closed_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a> 88 <a href="{$closed_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a> 89 {if $closed_concours.U_RESULT != ''} <a href="{$closed_concours.U_RESULT}" title="{'concours_result'|@translate}"><img src="{$IMG_URL}generate.png" class="button" alt="{'concours_result'|@translate}" /></a>{/if} 90 {if $closed_concours.U_FILE != ''} <a href="{$closed_concours.U_FILE}" title="{'concours_file'|@translate}"><img src="{$IMG_URL}file.png" class="button" alt="{'concours_file'|@translate}" /></a>{/if} 91 92 </td> 93 </tr> 94 {/foreach} 95 </table> 20 <legend>{'Filter'|@translate}</legend> 21 <form method="post" id="concours_form_filter" action="{$MANAGE_URL}"> 22 <span> 23 <label> 24 {'Status'|@translate} 25 <select name="concours_status"> 26 <option value="all" label="------------">------------</option> 27 <option value="active" label="{'active_concours'|@translate}" {if $concours_filter.status=='active'}selected="selected"{/if}>{'active_concours'|@translate}</option> 28 <option value="prepared" label="{'prepared_concours'|@translate}" {if $concours_filter.status=='prepared'}selected="selected"{/if}>{'prepared_concours'|@translate}</option> 29 <option value="closed" label="{'closed_concours'|@translate}" {if $concours_filter.status=='closed'}selected="selected"{/if}>{'closed_concours'|@translate}</option> 30 <option value="closed-noresult" label="{'closed-noresult_concours'|@translate}" {if $concours_filter.status=='closed-noresult'}selected="selected"{/if}>{'closed_concours'|@translate}</option> 31 </select> 32 </label> 33 </span> 34 <span> 35 <label> 36 {'Sort by'|@translate} 37 <select name="concours_sort_by"> 38 <option value="default" label="------------">------------</option> 39 <option value="id" label="{'concours_id2'|@translate}" {if $concours_filter.sort_by=='id'}selected="selected"{/if}>{'concours_id2'|@translate}</option> 40 <option value="name" label="{'concours_name'|@translate}" {if $concours_filter.sort_by=='name'}selected="selected"{/if}>{'concours_name'|@translate}</option> 41 <option value="create_date" label="{'concours_create_date'|@translate}" {if $concours_filter.sort_by=='create_date'}selected="selected"{/if}>{'concours_create_date'|@translate}</option> 42 <option value="begin_date" label="{'concours_begin_date'|@translate}" {if $concours_filter.sort_by=='begin_date'}selected="selected"{/if}>{'concours_begin_date'|@translate}</option> 43 <option value="end_date" label="{'concours_end_date'|@translate}" {if $concours_filter.sort_by=='end_date'}selected="selected"{/if}>{'concours_end_date'|@translate}</option> 44 </select> 45 </label> 46 </span> 47 <span> 48 <label> 49 {'Sort order'|@translate} 50 <select name="concours_sort_order"> 51 <option value="asc" label="{'ascending'|@translate}" {if $concours_filter.sort_order=='asc'}selected="selected"{/if}>{'ascending'|@translate}</option> 52 <option value="desc" label="{'descending'|@translate}" {if $concours_filter.sort_order=='desc'}selected="selected"{/if}>{'descending'|@translate}</option> 53 </select> 54 </label> 55 </span> 56 <span> 57 <label> 58 {'concours_nb_concours_page'|@translate} 59 <input type="text" maxlength="3" size="3" name="concours_nb_concours_page" id="concours_nb_concours_page" value="{$concours_nb_concours_page}" /> 60 </label> 61 </span> 62 <span> 63 <label> 64 65 <input type="submit" name="concours_form_filter_submit" value="{'Submit'|@translate}" /> 66 </label> 67 </span> 68 <span> 69 <div> 70 <img src="{$IMG_URL}prepared-0.png" width="20"/> {if $concours_filter.status=='prepared'}<b>{'prepared_concours'|@translate}</b> {else}{'prepared_concours'|@translate} {/if} 71 <img src="{$IMG_URL}actived-1.png" width="20"/> {if $concours_filter.status=='active'}<b>{'active_concours'|@translate} </b>{else}{'active_concours'|@translate} {/if} 72 <img src="{$IMG_URL}closed-2.png" width="20" /> {if $concours_filter.status=='closed' or $concours_filter.status=='closed-noresult'}<b>{'closed_concours'|@translate} </b>{else}{'closed_concours'|@translate} {/if} 73 </div> 74 </span> 75 </form> 96 76 </fieldset> 77 {if count($concours_list)} 78 <form method="post" id="concours_form_delete"> 79 <table class="table2" width="97%"> 80 <thead> 81 <tr class="throw"> 82 <td> </td> 83 <td>{'concours_status'|@translate}</td> 84 <td>{'concours_id2'|@translate}</td> 85 <td>{'concours_name'|@translate}</td> 86 <td>{'concours_descr'|@translate}</td> 87 <td>{'concours_create_date'|@translate}</td> 88 <td>{'concours_begin_date'|@translate}</td> 89 <td>{'concours_end_date'|@translate}</td> 90 <td>{'concours_actions'|@translate}</td> 91 </tr> 92 </thead> 93 <tbody> 94 {foreach from=$concours_list item=concours_list1 name=foreach_concours_list1} 95 {if $smarty.foreach.foreach_concours_list1.iteration is even} 96 <tr class="row1"> 97 {else} 98 <tr class="row2"> 99 {/if} 100 <td><input type="checkbox" name="concours_to_delete[]" value="{$concours_list1.ID}"></td> 101 <td align=center><img src="{$IMG_URL}prepared-{$concours_list1.STATUS1}.png" {if $concours_list1.STATUS1 == 0}width="35"{else}width="27"{/if} /> 102 <img src="{$IMG_URL}actived-{$concours_list1.STATUS1}.png" {if $concours_list1.STATUS1 == 1}width="35"{else}width="27"{/if}/> 103 <img src="{$IMG_URL}closed-{$concours_list1.STATUS1}.png" {if $concours_list1.STATUS1 == 2}width="35"{else}width="27"{/if} /></td> 104 <td>{$concours_list1.ID}</td> 105 <td>{if $concours_list1.STATUS1}<a href="{$concours_list1.U_AUDIT}" target="_blank" title="{'concours_audit1'|@translate}">{$concours_list1.NAME}</a> 106 {else}{$concours_list1.NAME} 107 {/if} 108 <br>[<i>{'concours_nbscore'|@translate}: {$concours_list1.NB_VOTE}</i>]</td> 109 <td>{$concours_list1.DESC}</td> 110 <td>{$concours_list1.CREATE_DATE}</td> 111 <td>{$concours_list1.BEGIN_DATE}</td> 112 <td>{$concours_list1.END_DATE}</td> 113 <td> 114 <a href="{$concours_list1.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a> 115 {if $concours_list1.STATUS1 == 2} 116 {if $concours_list1.U_RESULT != ''}<a href="{$concours_list1.U_RESULT}" title="{'concours_result'|@translate}"><img src="{$IMG_URL}generate.png" width="30" class="button" alt="{'concours_result'|@translate}" /></a>{/if} 117 {if $concours_list1.U_FILE != ''}<a href="{$concours_list1.U_FILE}" title="{'concours_file'|@translate}"><img src="{$IMG_URL}file.png" width="30" class="button" alt="{'concours_file'|@translate}" /></a>{/if} 118 {/if} 119 <a href="{$concours_list1.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a> 120 </td> 121 122 </tr> 123 {/foreach} 124 </tbody> 125 </table> 126 {if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if} 127 <fieldset> 128 <legend>{'concours_delete_selected'|@translate}</legend> 129 <div class="concours_line"> 130 <span><input type="checkbox" name="concours_delete_closed" id="concours_delete_closed" value="1"></span> 131 <span><label for="concours_delete_closed">{'concours_delete_all_closed'|@translate}</label></span> 132 </div> 133 <div class="concours_last_line"> 134 <span><input type="checkbox" name="concours_to_delete_sure" id="concours_to_delete_sure" value="1"></span> 135 <span><label for="concours_to_delete_sure">{'Are you sure?'|@translate}</label></span> 136 <span><input type="submit" name="delete_selected_submit" value="{'concours_delete'|@translate}" /></span> 137 </div> 138 </fieldset> 139 </form> 140 {else} 141 <fieldset> 142 <div class="concours_no_concours"> 143 <b>{$no_concours}</b> 144 </div> 145 </fieldset> 146 {/if} 147 148 97 149 98 </fieldset>99 </form> -
extensions/ConcoursPhoto/admin/template/params.tpl
r9364 r32457 1 {footer_script}{literal} 2 function detecter(){ 3 if(document.getElementById('concours_change_score').checked){ 4 document.getElementById('text_overlay_concours').style.display='none'; 5 } 6 else{ 7 document.getElementById('text_overlay_concours').style.display='inline'; 8 } 9 }{/literal}{/footer_script} 10 11 1 12 <div class="titrePage"> 2 13 <h2>{$CONCOURS_VERSION}</h2> … … 8 19 <fieldset> 9 20 <legend>{'concours_params'|@translate}</legend> 10 <TABLE border="0" CELLPADDING="2" ALIGN="LEFT"> 21 <div id="ConcoursParams"> 22 23 <TABLE border="0" ALIGN="LEFT"> 11 24 12 25 <TR> 13 <TD colspan=" 2">26 <TD colspan="3"> 14 27 <input type="checkbox" name="active_menubar" {$SHOW_MENUBAR}/> {'concours_show_menubar'|@translate} 15 28 <br/> … … 17 30 </TR> 18 31 <TR> 19 <TD colspan=" 2">32 <TD colspan="3"> 20 33 {'concours_nb_concours_menubar'|@translate} 21 34 <select id="nbconcours_menubar" name="nbconcours_menubar"> 22 {foreach from=$NBCONCOURS item=NBCONCOURS}23 <option value="{$NBCONCOURS .ID}" {$NBCONCOURS.SELECTED}>{$NBCONCOURS.NAME}</option>35 {foreach $NBCONCOURS as $NBCONCOURS1} 36 <option value="{$NBCONCOURS1.ID}" {$NBCONCOURS1.SELECTED}>{$NBCONCOURS1.NAME}</option> 24 37 {/foreach} 25 38 </select> … … 28 41 </TR> 29 42 <TR> 30 <TD colspan=" 2">43 <TD colspan="3"> 31 44 <input type="checkbox" name="mask_author" {$MASK_AUTHOR}/> {'concours_mask_author'|@translate} 32 45 <br/> … … 34 47 </TR> 35 48 <TR> 36 <TD colspan="2"> 49 <TD colspan="3"> 50 <input type="checkbox" name="mask_meta" {$MASK_META}/> {'concours_mask_meta'|@translate} 51 <br/> 52 </TD> 53 </TR> 54 <TR> 55 <TD colspan="3"> 37 56 <input type="checkbox" name="thumb_note" {$THUMB_NOTE}/> {'concours_thumb_note'|@translate} 38 57 <br/> … … 40 59 </TR> 41 60 <TR> 42 <TD colspan=" 2">61 <TD colspan="3"> 43 62 <input type="checkbox" name="check_exaequo" {$CHECK_EXAEQUO}/> {'concours_check_exaequo'|@translate} 44 63 <br/> 45 64 </TD> 46 65 <TR> 66 <TD colspan="3"> 67 {'concours_author_vote'|@translate} 68 <select id="AUTHOR_MODE" name="AUTHOR_MODE"> 69 {foreach $AUTHOR_MODE as $AUTHOR_MODE1} 70 <option value="{$AUTHOR_MODE1.ID}" {$AUTHOR_MODE1.SELECTED}>{$AUTHOR_MODE1.NAME}</option> 71 {/foreach} 72 </select> 73 74 </TD> 75 </TR> 76 77 <TR> 78 <TD colspan="3"> 79 {'concours_author_vote_detail'|@translate} 80 <br/> 81 </TD> 82 </TR> 83 84 <TR> 85 <TD> 86 <input type="checkbox" name="concours_change_score" id="concours_change_score" {$CHANGE_SCORE} onclick="detecter()" /> {'concours_change_score'|@translate} 87 <br/> 88 </TD> 47 89 <TD colspan="2"> 48 <input type="checkbox" name="author_vote_available" {$AUTHOR_VOTE_AVAILABLE}/> {'concours_author_vote'|@translate} 90 <div id="text_overlay_concours"> 91 ({'concours_overlay_text'|@translate}<textarea name="text_overlay" id ="text_overlay" rows="1" cols="10" style="width:90%;">{$TEXT_OVERLAY}</textarea>) 92 <br/> 93 </div> 94 </TD> 95 </TR> 96 <TR> 97 <TD colspan="3"> 98 {'concours_deadline_param'|@translate} 99 <select id="concours_deadline" name="concours_deadline"> 100 {foreach $DEADLINE as $DEADLINE1} 101 <option value="{$DEADLINE1.ID}" {$DEADLINE1.SELECTED}>{$DEADLINE1.NAME}</option> 102 {/foreach} 103 </select> 104 105 </TD> 106 </TR> 107 <TR> 108 <TD colspan="3"> 109 <input type="checkbox" name="mask_thumbnail" {$MASK_THUMB}/> {'mask_thumbnail'|@translate} 49 110 <br/> 50 111 </TD> 51 112 </TR> 52 113 <TR> 53 <TD colspan=" 2">54 <input type="checkbox" name=" concours_change_score" {$CHANGE_SCORE}/> {'concours_change_score'|@translate}114 <TD colspan="3"> 115 <input type="checkbox" name="active_global_score_page" {$GLOBAL_SCORE}/> {'concours_global_score_admin'|@translate} 55 116 <br/> 56 117 </TD> 57 118 </TR> 119 <TR> 120 <TD colspan="3"> 121 {'concours_score_mode'|@translate} 122 <select id="score_mode" name="score_mode"> 123 {foreach $SCORE_MODE as $SCORE_MODE1} 124 <option value="{$SCORE_MODE1.ID}" {$SCORE_MODE1.SELECTED}>{$SCORE_MODE1.NAME}</option> 125 {/foreach} 126 </select> 127 128 </TD> 129 </TR> 130 58 131 </table> 132 </div> 59 133 <br/> 60 134 </fieldset> … … 75 149 </tr> 76 150 {if count($FILE)} 77 {foreach from=$FILE item=FILE}151 {foreach $FILE as $FILE1} 78 152 <tr align="left"> 79 153 <td> 80 <a href="{$FILE .LINK}">{$FILE.NAME}</a>154 <a href="{$FILE1.LINK}">{$FILE1.NAME}</a> 81 155 </td> 82 156 <td> 83 Concours <b>{$FILE .CONC_NAME}</b> {if $FILE.CONC_ID != 0}({$FILE.CONC_ID}){/if} : <i>{$FILE.CONC_DESCR}</i>157 Concours <b>{$FILE1.CONC_NAME}</b> {if $FILE1.CONC_ID != 0}({$FILE1.CONC_ID}){/if} : <i>{$FILE1.CONC_DESCR}</i> 84 158 </td> 85 159 </tr> -
extensions/ConcoursPhoto/include/Concours.class.php
r9370 r32457 12 12 var $concours_infos = array(); 13 13 14 /* var $create_date = null;15 var $name = null;16 var $descr = null;17 var $begin_date = null;18 var $end_date = null;19 var $category = null;20 var $groups = null;21 */22 23 14 // General configuration parameters 24 15 var $my_config = array(); 25 /*26 active_menubar27 nbconcours_menubar28 */29 16 var $user_groups = array(); 30 17 var $debug = false; 31 32 // Class constructor with concours id. Return NULL if not existing or create it 33 function Concours($concours_id = null, $force_creation = NULL) 34 { 35 // $this->get_user_groups(); 18 19 20 /** 21 * Class constructor with concours id. 22 * Return NULL if not existing or create it 23 */ 24 function __construct($concours_id = null, $force_creation = NULL) 25 { 36 26 if ($concours_id !== null) 37 27 { … … 44 34 45 35 46 // Load general configuration from config_database 47 function load_config() 48 { 49 50 $query = ' 51 SELECT value 52 FROM '.CONFIG_TABLE.' 53 WHERE param = \'concoursphoto\' 54 ;'; 55 36 /** 37 * Load configuration from database 38 * Assign value to the variable $config 39 */ 40 function load_config() { 41 $query = 'SELECT value FROM '.CONFIG_TABLE.' WHERE param="concoursphoto";'; 56 42 $result = pwg_query($query); 57 43 58 if($result) 59 { 60 $row = mysql_fetch_row($result); 61 if(is_string($row[0])) 62 { 63 $this->my_config = unserialize(($row[0])); 64 } 44 if(isset($result)) { 45 $row = pwg_db_fetch_row($result); 46 if(is_string($row[0])) { 47 $this->my_config = unserialize(($row[0])); 48 } 65 49 } 66 $this->load_default_config(); 67 } 68 69 // Initialize default values of params 50 if ($this->debug) 51 foreach ($this->my_config as $key => $value) 52 { 53 echo "my_config[".$key."] = ".$value."\n"; 54 } 55 $this->load_default_config(); 56 } 57 58 59 /** 60 * Load default configuration, initialize default values of params 61 */ 70 62 private function load_default_config() 71 63 { … … 96 88 } 97 89 90 /** 91 * Save the current configuration (ie the value of $config) to the database 92 */ 93 function set_config() { 94 conf_update_param('concoursphoto', pwg_db_real_escape_string(serialize($this->my_config))); 95 } 96 98 97 99 98 // Retrieve user groups … … 101 100 { 102 101 global $user; 103 if ($this->debug)104 foreach ($user as $id=>$val)105 {106 if (is_array($val))107 foreach ($val as $id2=>$val2)108 echo "user[".$id."][".$id2."]=".$val2."\n";109 else110 echo "user[".$id."]=".$val."\n";111 }112 113 102 $query = 'SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id = ' . $user['id'] . ';'; 114 if ($this->debug) echo $query."\n"; 103 115 104 $result = pwg_query($query); 116 while ($row = mysql_fetch_assoc($result))105 while ($row = pwg_db_fetch_array($result)) 117 106 { 118 107 array_push($this->user_groups, $row['group_id']); 119 108 } 120 121 if ($this->debug)122 foreach ($this->user_groups as $gr)123 echo "Group=".$gr."\n";124 109 125 110 } … … 144 129 $result = pwg_query($query); 145 130 if ($result) 146 $this->concours_infos = mysql_fetch_assoc($result); 147 } 148 149 } 131 $this->concours_infos = pwg_db_fetch_array($result); 132 } 133 134 } 135 150 136 151 137 // save informations on database for a concours_id … … 165 151 `groups`, 166 152 `method`, 167 `guest` 153 `guest`, 154 `admin` 168 155 169 156 ) … … 172 159 \"".$this->concours_infos['begin_date']."\", \"".$this->concours_infos['end_date']."\", 173 160 ".$this->concours_infos['category'].", ".$this->concours_infos['groups'].", 174 ".$this->concours_infos['method'].", ".($this->concours_infos['guest'] ? "TRUE" : "FALSE")." 161 ".$this->concours_infos['method'].", ".($this->concours_infos['guest'] ? "TRUE" : "FALSE").", 162 ".($this->concours_infos['admin'] ? "TRUE" : "FALSE")." 175 163 );"; 176 164 if (pwg_query($query) != null) … … 199 187 groups = ".$this->concours_infos['groups'].", 200 188 method = ".$this->concours_infos['method'].", 201 guest = ".($this->concours_infos['guest'] ? "TRUE" : "FALSE")." 189 guest = ".($this->concours_infos['guest'] ? "TRUE" : "FALSE").", 190 admin = ".($this->concours_infos['admin'] ? "TRUE" : "FALSE")." 202 191 203 192 WHERE id = ".($concours_id !== NULL ? $concours_id : $this->concours_id)." … … 245 234 $query = ' 246 235 DELETE 247 FROM ' . CONCOURS_TABLE .' 248 WHERE id =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . ' 236 FROM ' . CONCOURS_RESULT_TABLE .' 237 WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . ' 238 '; 239 pwg_query($query); 240 $query = ' 241 DELETE 242 FROM ' . CONCOURS_DATA_TABLE .' 243 WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . ' 249 244 '; 250 245 pwg_query($query); … … 257 252 $query = ' 258 253 DELETE 259 FROM ' . CONCOURS_ DATA_TABLE .'260 WHERE id _concours=' . ($concours_id !== null ? $concours_id : $this->concours_id ) . '254 FROM ' . CONCOURS_TABLE .' 255 WHERE id =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . ' 261 256 '; 262 257 pwg_query($query); 263 $query = '264 DELETE265 FROM ' . CONCOURS_RESULT_TABLE .'266 WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . '267 ';268 pwg_query($query);269 258 } 270 259 else 271 260 return false; 272 261 262 } 263 264 265 // delete all closed concours from db 266 function delete_allclosed_concours() 267 { 268 $concours_list=array(); 269 $query = ' 270 SELECT id 271 FROM ' . CONCOURS_TABLE .' 272 WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 273 AND id>0;'; 274 275 $result = pwg_query($query); 276 while ($row = pwg_db_fetch_assoc($result)) 277 { 278 $this->delete_concours($row['id']); 279 } 273 280 } 274 281 … … 288 295 289 296 $result = pwg_query($query); 290 if ($this->debug) echo $query."\n";291 297 if ($result != NULL) 292 298 return true; … … 311 317 312 318 $result = pwg_query($query); 313 if ($this->debug) echo $query."\n";314 319 if ($result != NULL) 315 320 return true; … … 321 326 } 322 327 323 328 // Get high value of concours (max score for each criterias) 329 function get_MaxScore_concours($concours_id = null) 330 { 331 $max = 0; 332 $query = ' 333 SELECT criteria_id, max_value, ponderation, uppercriteria 334 FROM ' . CONCOURS_DETAIL_TABLE .' 335 WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . ' 336 ORDER BY criteria_id 337 '; 338 $result = pwg_query($query); 339 while ($row = pwg_db_fetch_array($result)) 340 { 341 if ($row['uppercriteria'] != NULL || !$this->is_criterias_contains_sub($row['criteria_id'])) // subcriteria or uppercriteria without sub 342 $max += $row['max_value']*$row['ponderation']; 343 } 344 return $max; 345 346 347 } 348 324 349 // Get criterias that are stored on db for default mode (concours_id = 0) 325 350 function get_default_criterias() … … 328 353 $query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id 329 354 FROM ' . CONCOURS_DETAIL_TABLE . ' ;'; 330 list($next_element_id) = mysql_fetch_array(pwg_query($query));355 list($next_element_id) = pwg_db_fetch_array(pwg_query($query)); 331 356 332 357 foreach ($criterias as $criteria) 333 358 { 334 if ($this->debug) echo "NEXT =".$next_element_id."\n"; 359 335 360 $query = 'INSERT INTO '.CONCOURS_DETAIL_TABLE.' 336 361 (id, id_concours, criteria_id, name, descr, min_value, max_value, ponderation, uppercriteria)' … … 343 368 344 369 $result = pwg_query($query); 345 if ($this->debug) echo $query; 370 346 371 $next_element_id = $next_element_id +1; 347 372 } … … 361 386 '; 362 387 $result = pwg_query($query); 363 if ($this->debug) echo $query."\n"; 364 while ($row = mysql_fetch_assoc($result)) 388 while ($row = pwg_db_fetch_array($result)) 365 389 { 366 390 array_push($criteria_list, $row); … … 386 410 '; 387 411 $result = pwg_query($query); 388 if ($this->debug) echo $query."\n"; 389 while ($row = mysql_fetch_assoc($result)) 390 { 391 if ($this->debug) echo "criteria_id=".$row['criteria_id']."\n"; 412 413 while ($row = pwg_db_fetch_array($result)) 392 414 array_push($criteria_list, $row); 393 }394 415 return $criteria_list; 395 416 } … … 410 431 '; 411 432 $result = pwg_query($query); 412 if ($this->debug) echo $query."\n"; 413 // mini 1 line 414 if(mysql_fetch_assoc($result)) 433 if(pwg_db_fetch_array($result)) 415 434 return true; 416 435 else … … 435 454 '; 436 455 $result = pwg_query($query); 437 if ($this->debug) echo $query."\n"; 438 while ($row = mysql_fetch_assoc($result)) 456 while ($row = pwg_db_fetch_array($result)) 439 457 { 440 458 array_push($criteria_list, $row); … … 460 478 '; 461 479 $result = pwg_query($query); 462 if ($this->debug) echo $query."\n"; 463 $criteria = mysql_fetch_assoc($result); 464 /* while ($row = mysql_fetch_assoc($result)) 465 { 466 array_push($criteria, $row); 467 } 468 */ 480 481 $criteria = pwg_db_fetch_array($result); 469 482 } 470 483 return $criteria; … … 483 496 '; 484 497 $result = pwg_query($query); 485 if ($this->debug) echo $query."\n"; 486 $criteria = mysql_fetch_assoc($result); 487 /* while ($row = mysql_fetch_assoc($result)) 488 { 489 array_push($criteria, $row); 490 } 491 */ 492 return $criteria; 498 499 $criteria = pwg_db_fetch_array($result); 500 return $criteria; 493 501 494 502 } … … 504 512 $query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id 505 513 FROM ' . CONCOURS_DETAIL_TABLE . ' ;'; 506 list($next_element_id) = mysql_fetch_array(pwg_query($query)); 514 list($next_element_id) = pwg_db_fetch_array(pwg_query($query)); 515 507 516 $query = 'SELECT IF(MAX(criteria_id)+1 IS NULL, 1, MAX(criteria_id)+1) AS next_criteria_id 508 517 FROM ' . CONCOURS_DETAIL_TABLE . ' 509 518 WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ) . ' ;'; 510 list($next_criteria_id) = mysql_fetch_array(pwg_query($query));519 list($next_criteria_id) = pwg_db_fetch_array(pwg_query($query)); 511 520 512 521 $query = ' … … 553 562 554 563 pwg_query($query); 555 556 if ($this->debug) echo $query."\n";557 558 564 } 559 565 } … … 573 579 '; 574 580 $result = pwg_query($query); 575 if ($this->debug) echo $query."\n";581 576 582 if($result) 577 583 return true; … … 594 600 '; 595 601 $result = pwg_query($query); 596 if ($this->debug) echo $query."\n";597 602 598 603 } … … 608 613 $result = pwg_query($query); 609 614 // For each images 610 if ( mysql_fetch_assoc($result))615 if (pwg_db_fetch_array($result)) 611 616 return true; 612 617 else … … 614 619 615 620 } 621 622 623 616 624 617 625 // function to return the number of votes for a concours by images … … 628 636 $result = pwg_query($query); 629 637 $nbvotes = array(); 630 while ($row = mysql_fetch_assoc($result))638 while ($row = pwg_db_fetch_array($result)) 631 639 { 632 640 $nbvotes[$row['img_id']] = $row['NBVOTE']; … … 634 642 635 643 // Add guest infos 636 $query = 'SELECT img_id, COUNT(DISTINCT user_id,ipguest) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE644 $query = 'SELECT img_id, COUNT(DISTINCT ipguest) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 637 645 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ) 638 646 .' AND ipguest IS NOT NULL' … … 641 649 642 650 $result = pwg_query($query); 643 if ($this->debug) echo "NBVOTE = ".$query."\n";644 while ($row = mysql_fetch_assoc($result)) 651 while ($row = pwg_db_fetch_array($result)) 652 645 653 if (!isset($nbvotes[$row['img_id']])) 646 654 $nbvotes[$row['img_id']] = $row['NBVOTE']; 647 655 else 648 656 $nbvotes[$row['img_id']] += $row['NBVOTE']; 649 657 650 658 return $nbvotes; 651 659 } 652 660 661 662 663 // Get All user that are vote for guest who have vote (IP Stores in db) in a concours 664 function get_user_list($concours_id = NULL) 665 { 666 global $conf; 667 $userid = array(); 668 if ($concours_id!== null or $this->concours_id !== null) 669 { 670 $query = ' 671 SELECT distinct(user_id) 672 FROM ' . CONCOURS_DATA_TABLE .' 673 WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . ' 674 AND ipguest IS NULL 675 AND user_id !='.$conf['guest_id'] 676 677 .' ORDER BY user_id 678 '; 679 $result = pwg_query($query); 680 while ($row = pwg_db_fetch_array($result)) 681 { 682 array_push($userid, $row['user_id']); 683 } 684 } 685 return $userid; 686 } 687 688 653 689 // Get All iaddr for guest who have vote (IP Stores in db) in a concours 654 690 function get_guest_list($concours_id = NULL) 655 691 { 692 global $conf; 656 693 $ipguest = array(); 657 694 if ($concours_id!== null or $this->concours_id !== null) … … 660 697 SELECT distinct(ipguest) 661 698 FROM ' . CONCOURS_DATA_TABLE .' 662 WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . ' 663 AND ipguest IS NOT NULL 699 WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) 700 .' AND user_id = '.$conf['guest_id'] 701 .' AND ipguest IS NOT NULL 664 702 ORDER BY ipguest 665 703 '; 666 704 $result = pwg_query($query); 667 if ($this->debug) echo $query."\n"; 668 while ($row = mysql_fetch_assoc($result)) 705 while ($row = pwg_db_fetch_array($result)) 669 706 { 670 707 array_push($ipguest, $row['ipguest']); … … 689 726 // var which contains id=img_id and val =global note 690 727 $global_note = array(); 728 // FOR MODERATION 729 // var which contains id=user_id and val =global note 730 $vote_by_user = array(); 731 $amplitiudeMINmax = 999; // MIN of all max score (for each users) 732 $amplitiudeMAXmin = -999; // MIN of all max score (for each users) 733 $REFaverage = 0; // reference average (average between amplitiudeMINmax and amplitiudeMAXmin) 734 $global_note_mod1 = array(); 735 $global_note_mod2 = array(); 736 691 737 if ($concours_id!== null or $this->concours_id !== null) 692 738 { … … 698 744 $nbvotes = $this->nb_votes_by_img($concours_id); 699 745 746 700 747 $user_id = array(); 701 748 // vars not initialized … … 703 750 $this->get_concours(); 704 751 $category = $this->concours_infos['category']; 705 706 if ($this->debug) 707 echo "CAT=".$category; 752 708 753 // Get all user_id from a concours 709 754 $query = 'SELECT DISTINCT user_id' … … 713 758 .';'; 714 759 $result = pwg_query($query); 715 if ($this->debug) 716 echo $query; 717 while ($row = mysql_fetch_assoc($result)) 760 761 while ($row = pwg_db_fetch_array($result)) 718 762 array_push($user_id, $row['user_id']); 719 763 720 764 // Add guest info is present 721 765 $ipguest = array(); 722 if ($concours_id!== null) 766 if ($concours_id!== null or $this->concours_id !== null) 767 { 768 if ($this->debug) 769 echo "Check IPGUEST"; 723 770 $ipguest = $this->get_guest_list(($concours_id !== null ? $concours_id : $this->concours_id )); 724 725 if ($this->debug) 726 { 727 foreach ($user_id as $userid) 728 echo "USER = ".$userid; 729 foreach ($ipguest as $userid) 730 echo "IPGUEST = ".$userid; 731 } 771 } 772 732 773 733 774 // recover all img_id from the category … … 736 777 .' WHERE category_id = '.$category.';'; 737 778 779 $nb_image_concours = 0; 738 780 $result = pwg_query($query); 739 781 // For each images 740 while ($row = mysql_fetch_assoc($result))782 while ($row = pwg_db_fetch_array($result)) 741 783 { 742 if ($this->debug) echo "IMG_ID=".$row['image_id']."\n"; 784 $nb_image_concours++; 785 743 786 foreach ($user_id as $i => $userid) 744 787 { 788 $img_note_user = $this->get_img_globalnote_user($row['image_id'], null, $userid); 789 745 790 if (!isset($global_note[$row['image_id']])) 746 791 $global_note[$row['image_id']] = 0; 747 $global_note[$row['image_id']] += $this->get_img_globalnote_user($row['image_id'], null, $userid); 792 // FOR MODERATION 793 // store the nb of vote for each user 794 if ($img_note_user >= 0) // user has made a vote 795 { 796 if (!isset($vote_by_user[$userid]['nbvote'])) 797 $vote_by_user[$userid]['nbvote'] = 0; 798 799 $vote_by_user[$userid]['nbvote'] ++; // update vote counter 800 801 $global_note[$row['image_id']] += $img_note_user ; 802 803 804 // FOR MODERATION 805 // store the total of note for the same user 806 if (!isset($vote_by_user[$userid]['totalvote'])) 807 $vote_by_user[$userid]['totalvote'] = 0; 808 $vote_by_user[$userid]['totalvote'] += $img_note_user; 809 // FOR MODERATION 810 // store min/max for each user 811 if (!isset($vote_by_user[$userid]['min'])) $vote_by_user[$userid]['min'] = 999; 812 if (!isset($vote_by_user[$userid]['max'])) $vote_by_user[$userid]['max'] = 0; 813 814 815 if ($vote_by_user[$userid]['min'] > $img_note_user) $vote_by_user[$userid]['min'] = $img_note_user; 816 if ($vote_by_user[$userid]['max'] < $img_note_user) $vote_by_user[$userid]['max'] = $img_note_user; 817 } 818 748 819 } 749 820 // Add guest scores if present 750 foreach ($ipguest as $i => $ ipguestt)821 foreach ($ipguest as $i => $userid) 751 822 { 823 824 $img_note_user = $this->get_img_globalnote_user($row['image_id'], null, null, $userid); // $userid contains the ip address for the guest! 752 825 if (!isset($global_note[$row['image_id']])) 753 826 $global_note[$row['image_id']] = 0; 754 $global_note[$row['image_id']] += $this->get_img_globalnote_user($row['image_id'], null, null, $ipguestt); 827 828 // FOR MODERATION 829 // store the nb of vote for each guest (with ipaddr) 830 if ($img_note_user >= 0) // user has made a vote 831 { 832 if (!isset($vote_by_user[$userid]['nbvote'])) 833 $vote_by_user[$userid]['nbvote'] = 0; 834 835 $vote_by_user[$userid]['nbvote'] ++; // update vote counter 836 837 $global_note[$row['image_id']] += $img_note_user ; 838 839 840 // FOR MODERATION 841 // store the total of note for the same user 842 if (!isset($vote_by_user[$userid]['totalvote'])) 843 $vote_by_user[$userid]['totalvote'] = 0; 844 $vote_by_user[$userid]['totalvote'] += $img_note_user; 845 // FOR MODERATION 846 // store min/max for each user 847 if (!isset($vote_by_user[$userid]['min'])) $vote_by_user[$userid]['min'] = 999; 848 if (!isset($vote_by_user[$userid]['max'])) $vote_by_user[$userid]['max'] = 0; 849 850 851 if ($vote_by_user[$userid]['min'] > $img_note_user) $vote_by_user[$userid]['min'] = $img_note_user; 852 if ($vote_by_user[$userid]['max'] < $img_note_user) $vote_by_user[$userid]['max'] = $img_note_user; 853 } 854 755 855 } 756 856 } 757 if ($this->debug) 857 858 // FOR MODERATION 859 // calcul the average by user and min/max global 860 foreach ($user_id as $i => $userid) 758 861 { 759 foreach ($global_note as $id => $val) 760 echo "Note img ( ".$id.") = ".$val."\n"; 862 $vote_by_user[$userid]['average'] = $vote_by_user[$userid]['totalvote']/$vote_by_user[$userid]['nbvote']; 863 $vote_by_user[$userid]['lowerAmp'] = $vote_by_user[$userid]['min']; 864 // calcul the max value of the concours (for the moderation) 865 $vote_by_user[$userid]['upperAmp'] = $this->get_MaxScore_concours() - $vote_by_user[$userid]['max']; 866 867 $vote_by_user[$userid]['minLevel'] = $vote_by_user[$userid]['average'] - $vote_by_user[$userid]['lowerAmp']; 868 $vote_by_user[$userid]['maxLevel'] = $vote_by_user[$userid]['average'] + $vote_by_user[$userid]['upperAmp']; 869 if ($amplitiudeMINmax > $vote_by_user[$userid]['maxLevel']) $amplitiudeMINmax = $vote_by_user[$userid]['maxLevel']; 870 if ($amplitiudeMAXmin < $vote_by_user[$userid]['minLevel']) $amplitiudeMAXmin = $vote_by_user[$userid]['minLevel']; 761 871 } 872 873 // calcul the average by guest and min/max global 874 foreach ($ipguest as $i => $userid) 875 { 876 $vote_by_user[$userid]['average'] = $vote_by_user[$userid]['totalvote']/$vote_by_user[$userid]['nbvote']; 877 $vote_by_user[$userid]['lowerAmp'] = $vote_by_user[$userid]['min']; 878 // calcul the max value of the concours (for the moderation) 879 $vote_by_user[$userid]['upperAmp'] = $this->get_MaxScore_concours() - $vote_by_user[$userid]['max']; 880 881 $vote_by_user[$userid]['minLevel'] = $vote_by_user[$userid]['average'] - $vote_by_user[$userid]['lowerAmp']; 882 $vote_by_user[$userid]['maxLevel'] = $vote_by_user[$userid]['average'] + $vote_by_user[$userid]['upperAmp']; 883 if ($amplitiudeMINmax > $vote_by_user[$userid]['maxLevel']) $amplitiudeMINmax = $vote_by_user[$userid]['maxLevel']; 884 if ($amplitiudeMAXmin < $vote_by_user[$userid]['minLevel']) $amplitiudeMAXmin = $vote_by_user[$userid]['minLevel']; 885 886 } 887 888 889 // FOR MODERATION 890 // calcul the reference average 891 $calcultemp = (int)($amplitiudeMINmax+$amplitiudeMAXmin)/2+0.5; 892 if ((int)(($amplitiudeMINmax+$amplitiudeMAXmin)/2+0.5) > $amplitiudeMAXmin) 893 { 894 if ((int)(($amplitiudeMINmax+$amplitiudeMAXmin)/2+0.5) < $amplitiudeMINmax) 895 $REFaverage = (int)(($amplitiudeMINmax+$amplitiudeMAXmin)/2+0.5); 896 else 897 $REFaverage = $amplitiudeMINmax; 898 } 899 else 900 $REFaverage = $amplitiudeMAXmin; 901 902 903 // FOR MODERATION 904 // calcul the moderation scopr for each users 905 foreach ($user_id as $i => $userid) 906 $vote_by_user[$userid]['moderation'] = $REFaverage - $vote_by_user[$userid]['average']; 907 908 // FOR MODERATION 909 // calcul the moderation scopr for each guest ($ipguest) 910 foreach ($ipguest as $i => $userid) 911 $vote_by_user[$userid]['moderation'] = $REFaverage - $vote_by_user[$userid]['average']; 912 913 // FOR MODERATION 914 // need to parse again image for new calcul with moderation 915 // moderation 1 => For each photo without note (user = author or user != author but no vote) add each user avaerage to the total of note and calcul the average 916 // moderation 2 => For each photo with note, adapt/change all the value with the moderation value : user note + moderation. 917 918 // parse again all img_id from the category 919 $query = 'SELECT DISTINCT(image_id)' 920 .' FROM ' .IMAGE_CATEGORY_TABLE 921 .' WHERE category_id = '.$category.';'; 922 923 $result = pwg_query($query); 924 // For each images 925 while ($row = pwg_db_fetch_array($result)) 926 { 927 // for each user 928 foreach ($user_id as $i => $userid) 929 { 930 if (!isset($global_note_mod1[$row['image_id']])) 931 $global_note_mod1[$row['image_id']] = 0; 932 $globalnote_user = $this->get_img_globalnote_user($row['image_id'], null, $userid, null, 1, $vote_by_user[$userid]['average']); 933 934 $global_note_mod1[$row['image_id']] += ($globalnote_user >= 0 ? $globalnote_user : 0) ; 935 936 if (!isset($global_note_mod2[$row['image_id']])) 937 $global_note_mod2[$row['image_id']] = 0; 938 $globalnote_user = $this->get_img_globalnote_user($row['image_id'], null, $userid, null, 2, $vote_by_user[$userid]['moderation']); 939 940 $global_note_mod2[$row['image_id']] += ($globalnote_user >= 0 ? $globalnote_user : 0) ; 941 } 942 943 // for each guest 944 foreach ($ipguest as $i => $userid) 945 { 946 if (!isset($global_note_mod1[$row['image_id']])) 947 $global_note_mod1[$row['image_id']] = 0; 948 $globalnote_user = $this->get_img_globalnote_user($row['image_id'], null, null, $userid, 1, $vote_by_user[$userid]['average']); // userid contains the ip addr for the guest 949 950 $global_note_mod1[$row['image_id']] += ($globalnote_user >= 0 ? $globalnote_user : 0) ; 951 952 if (!isset($global_note_mod2[$row['image_id']])) 953 $global_note_mod2[$row['image_id']] = 0; 954 $globalnote_user = $this->get_img_globalnote_user($row['image_id'], null, null, $userid, 2, $vote_by_user[$userid]['moderation']); 955 956 $global_note_mod2[$row['image_id']] += ($globalnote_user >= 0 ? $globalnote_user : 0) ; 957 } 958 959 960 } 961 762 962 763 963 // update database and store result into RESULT table 764 964 // note = global note 765 965 $IMGmoyenne = 0; 966 $IMGmoyenneModeration1 = 0; 967 $IMGmoyenneModeration2 = 0; 968 766 969 foreach ($global_note as $id => $val) 767 970 // id contains the image id 768 971 { 769 if ($this->debug) echo $nbvotes[$id];770 972 $IMGmoyenne = (isset($nbvotes[$id]) && $nbvotes[$id] != 0 ? $val/$nbvotes[$id] : 0); 973 // Moderation 974 975 $IMGmoyenneModeration1 = ($nb_image_concours != 0 ? $global_note_mod1[$id]/$this->nb_user_by_concours() : 0); // all photos have note 976 $IMGmoyenneModeration2 = (isset($nbvotes[$id]) && $nbvotes[$id] != 0 ? $global_note_mod2[$id]/$nbvotes[$id] : 0); // only voted photos are used 771 977 772 $query = 'INSERT INTO ' . CONCOURS_RESULT_TABLE .'(`id_concours`, `img_id`, `date` , `note`, `moyenne`, `nbvotant` ) 978 $query = 'INSERT INTO ' . CONCOURS_RESULT_TABLE .'(`id_concours`, `img_id`, `date` , `note`, `moyenne`, 979 `moderation1`, `moderation2`, 980 `nbvotant` ) 773 981 VALUES ('.($concours_id !== null ? $concours_id : $this->concours_id ) 774 982 .', '.$id … … 776 984 .', '.$val 777 985 .', '.$IMGmoyenne 986 .', '.$IMGmoyenneModeration1 987 .', '.$IMGmoyenneModeration2 778 988 .', '.(isset($nbvotes[$id]) ? $nbvotes[$id] : 0) 779 989 .');'; 780 $result = pwg_query($query); 781 990 $result = pwg_query($query); 782 991 783 992 } 784 785 786 787 788 993 } 789 994 else … … 794 999 } 795 1000 796 797 // Check if an image's author is the same as the actual user 1001 1002 // Get array with nb of vote for each user of a concours_id 1003 function nb_user_by_concours($concours_id = NULL) 1004 { 1005 $nbusertotal = 0; 1006 // user 1007 $query = 'SELECT count(distinct(user_id)) as nb_user FROM ' . CONCOURS_DATA_TABLE .' 1008 WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id).' 1009 AND ipguest IS NULL 1010 ;'; 1011 $result = pwg_query($query); 1012 if ($result) 1013 { 1014 $row = pwg_db_fetch_array($result); 1015 $nbusertotal += $row['nb_user']; 1016 } 1017 // guest 1018 $query = 'SELECT count(distinct(ipguest)) as nb_user FROM ' . CONCOURS_DATA_TABLE .' 1019 WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id).' 1020 AND ipguest IS NOT NULL 1021 ;'; 1022 $result = pwg_query($query); 1023 if ($result) 1024 { 1025 $row = pwg_db_fetch_array($result); 1026 $nbusertotal += $row['nb_user']; 1027 } 1028 return $nbusertotal; 1029 1030 } 1031 1032 1033 // Check if an image's author OR addebBy is the same as the actual user 1034 // depending the config param 798 1035 function check_img_user($img_id) 799 1036 { 800 1037 global $user; 1038 1039 801 1040 $query = ' 802 SELECT author 1041 SELECT author, added_by 803 1042 FROM ' . IMAGES_TABLE .' 804 1043 WHERE id =' . $img_id . ' … … 809 1048 if ($result) 810 1049 { 811 $row = mysql_fetch_assoc($result);1050 $row = pwg_db_fetch_array($result); 812 1051 $authorid = get_userid($row['author']); 813 if ($authorid and ($authorid == $user['id'])) 814 return true; 815 else 816 return false; 1052 $addedbyid = $row['added_by']; 1053 1054 switch ($this->my_config['author_vote_available']) 1055 { 1056 1057 case 0 : // no check (allow to vote for all photos) 1058 return false; 1059 1060 case 1 : // check between author and user 1061 if ($authorid) // Author name present as username 1062 { 1063 if ($authorid == $user['id']) 1064 return true; 1065 else 1066 return false; 1067 } 1068 else 1069 { 1070 // check if author name = user name 1071 $AuthorArray = strip_punctuation2($row['author']); 1072 $UserArray = strip_punctuation2($user['username']); 1073 // Patch if author is empty 1074 if (empty($AuthorArray)) 1075 return false; 1076 1077 if (count(array_intersect($AuthorArray, $UserArray)) == count ($AuthorArray)) // found 1078 return true; 1079 else 1080 return false; 1081 } 1082 1083 1084 case 2 : // check between author and user 1085 if (isset($addedbyid) AND $addedbyid == $user['id']) 1086 return true; 1087 else 1088 return false; 1089 case 3 : // check between author OR addedby and user 1090 // Check Author 1091 if ($authorid AND $authorid == $user['id']) // Author name present as username 1092 return true; 1093 else 1094 { 1095 // check if author name = user name 1096 $AuthorArray = strip_punctuation2($row['author']); 1097 $UserArray = strip_punctuation2($user['username']); 1098 if (empty($AuthorArray) AND (count(array_intersect($AuthorArray, $UserArray)) == count ($AuthorArray))) // found 1099 return true; 1100 } 1101 // check addebBy 1102 if (isset($addedbyid) AND $addedbyid == $user['id']) 1103 return true; 1104 1105 return false; 1106 1107 default : 1108 return false; 1109 1110 } 1111 817 1112 } 818 1113 return false; 819 820 1114 } 821 1115 … … 826 1120 // Step0 : if user = guest, check the concours param and store ip address to user name. 827 1121 // Step1 : concours is defined to this category AND concours is open AND user is authorized to access to this category (thru group) 828 // Step1 bis : dont show concours if img_author = user_id1122 // Step1 bis : dont show concours if check author or added_by id is the samie as used_id (depending the param) 829 1123 // Step 2 : Recover stored informations in db for this user 830 1124 // Step 3 : Complete tpl information … … 839 1133 840 1134 // STEP 0 841 if ($this->debug) echo "STEP0\n"; 842 843 $user['ipguest'] = null; 844 845 echo "user id=".$user['id']; 846 // Check if the user is a guest only 847 if (is_a_guest()) 848 { 849 if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) 850 $IP = $_SERVER['HTTP_X_FORWARDED_FOR']; 851 elseif(isset($_SERVER['HTTP_CLIENT_IP'])) 852 $IP = $_SERVER['HTTP_CLIENT_IP']; 853 else 854 $IP = $_SERVER['REMOTE_ADDR']; 855 856 // store ip 857 $user['ipguest'] = $IP; 858 if ($this->debug) 859 echo "user ip guest=".$user['ipguest']; 860 861 } 862 863 864 865 // DEBUG 866 if ($this->debug) 867 { 868 foreach ($user as $id=>$val) 869 { 870 if (is_array($val)) 871 foreach ($val as $id2=>$val2) 872 echo "user[".$id."][".$id2."]=".$val2."\n"; 873 else 874 echo "user[".$id."]=".$val."\n"; 875 } 876 } 877 878 // END DEBUG 1135 $user['ipguest'] = null; 1136 1137 // Check if the user is a guest only 1138 if (is_a_guest()) 1139 { 1140 if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) 1141 $IP = $_SERVER['HTTP_X_FORWARDED_FOR']; 1142 elseif(isset($_SERVER['HTTP_CLIENT_IP'])) 1143 $IP = $_SERVER['HTTP_CLIENT_IP']; 1144 else 1145 $IP = $_SERVER['REMOTE_ADDR']; 1146 1147 // store ip 1148 $user['ipguest'] = $IP; 1149 } 879 1150 880 1151 881 // DEBUG 882 if ($this->debug) 883 foreach ($page as $id=>$val) 884 { 885 if (is_array($val)) 886 foreach ($val as $id2=>$val2) 887 echo "page[".$id."][".$id2."]=".$val2."\n"; 888 else 889 echo "page[".$id."]=".$val."\n"; 890 } 891 // END DEBUG 892 893 // disable author name on image which are present in a concours. 894 // check the categories where the current image is present and disable the author name 1152 // disable author name on image which are present in a concours. 1153 // check the categories where the current image is present and disable the author name 895 1154 if (isset($this->my_config['mask_author']) && $this->my_config['mask_author'] == true) 896 1155 { … … 902 1161 WHERE image_id = '.$page['image_id'].' 903 1162 ;'; 904 // echo $query;905 1163 $result = pwg_query($query); 906 1164 $related_categories = array(); 907 while ($row = mysql_fetch_array($result))1165 while ($row = pwg_db_fetch_array($result)) 908 1166 { 909 1167 array_push($related_categories, $row['category_id']); … … 920 1178 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 921 1179 '; 922 // echo $query;923 1180 $result = pwg_query($query); 924 1181 // If one or more concours are found, the author name is masked 925 if ($result && mysql_fetch_assoc($result)) 926 { 927 $template->assign('INFO_AUTHOR',l10n('concours_img_author')); 928 } 929 } 930 } 931 932 // End disable author name 933 934 935 if (($page['section']) == 'categories' AND !empty($page['category'])) 936 { 937 if ($this->debug) echo "STEP1\n"; 938 //------------ 939 // Step 1 940 941 /* 942 if ($this->my_config['mask_author'] && $this->my_config['mask_author'] == true) 943 { 944 // Request for all concours prepared & actived 945 $query = ' 946 SELECT * 947 FROM ' . CONCOURS_TABLE .' 948 WHERE category =' . $page['category']['id'] . ' 949 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 950 '; 951 // echo $query; 952 $result = pwg_query($query); 953 if ($result && mysql_fetch_assoc($result)) 1182 if ($result && pwg_db_fetch_array($result)) 954 1183 $template->assign('INFO_AUTHOR',l10n('concours_img_author')); 955 1184 } 956 */ 1185 } 1186 1187 // End disable author name 1188 1189 1190 if (($page['section']) == 'categories' AND !empty($page['category'])) 1191 { 1192 // Step 1 957 1193 958 1194 $query = ' … … 965 1201 966 1202 $result = pwg_query($query); 967 if ($this->debug) echo $query."\n"; 968 while ($row = mysql_fetch_assoc($result))1203 1204 while ($row = pwg_db_fetch_array($result)) 969 1205 { 970 if (! empty($row['groups']))1206 if (!is_a_guest() AND !empty($row['groups'])) 971 1207 { 972 if ($this->debug) echo "GROUPS=".$row['groups']; 973 $authorized_groups = explode(',', $row['groups']); 974 if (array_intersect($this->user_groups, $authorized_groups) == array()) 975 { 976 if ($this->debug) echo "ERROR GROUPS"; 977 continue; 1208 1209 if (is_admin() AND $row['admin']) // allow admin 1210 $concours = $row; 1211 else 1212 { 1213 $authorized_groups = explode(',', $row['groups']); 1214 if (array_intersect($this->user_groups, $authorized_groups) == array()) 1215 continue; 1216 // If no group is parameter for that concours ==> available for all registered users 1217 $concours = $row; 978 1218 } 979 // If no group is parameter for that concours ==> available for all registered users980 $concours = $row;981 1219 } 982 else 1220 else 1221 983 1222 $concours = $row; 984 985 986 1223 } 987 988 if ($this->debug) echo "STEP1 bis\n";989 1224 //------------ 990 1225 // Step 1 bis 991 1226 // Actual user is the author of the picture ==>end 992 if ( !$this->my_config['author_vote_available']993 AND$this->check_img_user($page['current_item']))1227 // for the image, check (depending the config) if user = author or addedby or none 1228 if ($this->check_img_user($page['current_item'])) 994 1229 return; 995 996 997 if ($this->debug) echo "STEP2\n"; 1230 1231 // Check if user is guest and if guest is allowed 1232 if (is_a_guest() AND array_key_exists('guest', $concours) AND !$concours['guest']) 1233 return; 1234 // Check if user is admin and if admin is allowed 1235 if (is_admin() AND (!isset($concours['admin']) OR (isset($concours['admin']) AND !$concours['admin']))) 1236 return; 1237 998 1238 //------------ 999 1239 // Step 2 … … 1003 1243 if (isset($_POST['concours_submit'])) 1004 1244 { 1005 1245 1006 1246 // array_push($page['infos'] , l10n('concours_vote_saved')); 1007 1247 1008 1248 $user_note = ""; 1009 if ($this->debug) echo "SUBMIT"; 1010 // concat all the notes to save on db 1011 1249 1250 // concat all the notes to save on db 1012 1251 $firstcriterias = $this->get_firstlevel_criterias($concours['id']); 1013 1252 foreach ($firstcriterias as $criteria) 1014 1253 { 1015 1016 1254 // First without sub criterias 1017 1255 if (!$this->is_criterias_contains_sub($criteria['criteria_id'],$concours['id'] )) 1018 1256 { 1019 1257 // Check value 1020 $value = str_replace(",",".", $_POST[$criteria['criteria_id']]);1258 $value = str_replace(",",".",(isset($_POST[$criteria['criteria_id']]) ? $_POST[$criteria['criteria_id']] : floatval($criteria['min_value']))); 1021 1259 $value = str_replace(" ","",$value); 1022 1260 $value = floatval($value); … … 1034 1272 { 1035 1273 // Check value 1036 $value = str_replace(",",".", $_POST[$subcriteria['criteria_id']]);1274 $value = str_replace(",",".",(isset($_POST[$subcriteria['criteria_id']]) ? $_POST[$subcriteria['criteria_id']] : floatval($subcriteria['min_value'] ))); 1037 1275 $value = str_replace(" ","",$value); 1038 1276 $value = floatval($value); … … 1047 1285 } 1048 1286 1049 // $datas = "0=0";1050 1287 $this->store_img_note_user($page['current_item'], $user_note, $concours['id'], $user['ipguest']); 1051 if ($this->debug) echo "COMMENT=".$_POST['CONCOURS_COMMENT'];1052 1288 $this->store_img_comment_user($page['current_item'], $_POST['concours_comment'], $concours['id'], $user['ipguest']); 1053 1289 } … … 1056 1292 if (isset($_POST['concours_raz'])) 1057 1293 { 1058 if ($this->debug) echo "RAZ"; 1059 $ this->RAZ_img_note_user($page['current_item'], $concours['id'], $user['ipguest']);1294 $this->delete_img_note_user($page['current_item'], $concours['id'], $user['ipguest']); 1295 $user_notes = array(); 1060 1296 } 1061 1297 else … … 1068 1304 $comment = $this->get_img_comment_user($page['current_item'], $concours['id'], $user['id'], $user['ipguest']); 1069 1305 1070 if ($this->debug) echo "STEP3\n";1071 1306 //------------ 1072 1307 // Step 3 … … 1075 1310 foreach ($firstcriterias as $criteria) 1076 1311 { 1077 if ($this->debug) echo "criteriaID=".$criteria['criteria_id']."\n";1078 1312 // First without sub criterias 1079 1313 if (!$this->is_criterias_contains_sub($criteria['criteria_id'],$concours['id'] )) … … 1102 1336 foreach ($secondcriterias as $subcriteria) 1103 1337 { 1104 if ($this->debug) echo "subcriteriaID=".$criteria['criteria_id']."\n";1105 1338 $template->append( 'concours_criteria', array( 1106 1339 'nosub' => true, … … 1123 1356 // if a user has already vote for this photo, check if the score change is allowed 1124 1357 1125 if ($this->debug) echo "change=".($this->my_config['concours_change_score'] ? "OK" : "KO"); 1358 1126 1359 if ($user_notes == array() OR $this->my_config['concours_change_score']) // Allow user to change his vote after a validation 1127 1360 $template->assign( 'CONCOURS_CHANGE_SCORE', true); … … 1129 1362 $template->assign( 'CONCOURS_CHANGE_SCORE', false); 1130 1363 1131 1364 $noteuser = $this->get_img_globalnote_user($page['current_item'], $concours['id'], null, $user['ipguest']); 1132 1365 // Add concours informations on template 1133 1366 $template->assign( 'concours_infos', array( 1134 1367 'name' => $concours['name'], 1135 1368 'descr' => $concours['descr'], 1136 'note' => $this->get_img_globalnote_user($page['current_item'], $concours['id'], null, $user['ipguest']) 1369 'note' => ($noteuser >= 0 ? $noteuser : 0 ), 1370 'begin_date' => $concours['begin_date'], 1371 'end_date' => $concours['end_date'], 1372 'end_concours_min' => (strtotime($concours['end_date'])-time()) , 1373 'max_note' => $this->get_concours_maxnote($concours['id']), 1374 'deadline_type' => $this->my_config['concours_deadline'] 1137 1375 )); 1138 1376 1377 1378 $template->assign( 'SCORE_MODE', $this->my_config['score_mode']); 1379 $template->assign( 'TEXT_OVERLAY', $this->my_config['text_overlay']); 1139 1380 1140 1381 $template->set_filenames(array('concours' => CONCOURS_ROOT.'/template/concours.tpl')); 1141 // $template->concat('PLUGIN_PICTURE_AFTER', $template->parse('concours', true));1142 1382 $template->concat('COMMENT_IMG', $template->parse('concours', true)); 1143 1383 1144 //1145 1384 $template->assign('INFO_AUTHOR',l10n('concours_img_author')); 1146 1385 } … … 1148 1387 } 1149 1388 1389 1390 // RAZ notation from user to db 1391 // fill criterias notes to 0 in DB 1392 // return false if error 1393 function delete_img_note_user($img_id, $concours_id = NULL, $ipguest = null, $userid=null) 1394 { 1395 global $user; 1396 1397 if ($concours_id === null) 1398 if ($this->concours_id !== null) 1399 $concours_id = $this->concours_id; 1400 else 1401 return false; 1402 1403 $query = ' 1404 DELETE FROM ' . CONCOURS_DATA_TABLE .' 1405 WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ).' 1406 AND user_id = '.($userid == null ? $user['id'] : $userid).' 1407 AND img_id = '.$img_id. 1408 ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '') 1409 .';'; 1410 1411 return pwg_query($query); 1412 1413 } 1414 1415 1150 1416 // RAZ notation from user to db 1151 1417 // fill criterias notes to 0 in DB … … 1163 1429 foreach ($firstcriterias as $criteria) 1164 1430 { 1165 if ($this->debug) echo "ID=".$criteria['criteria_id']."\n";1166 1431 // First without sub criterias 1167 1432 if (!$this->is_criterias_contains_sub($criteria['criteria_id'],$concours_id )) 1168 {1169 1433 $user_note .= (strlen($user_note) != 0 ? ";" : "").$criteria['criteria_id']."=".$criteria['min_value']; 1170 }1171 1434 else 1172 1435 { 1173 1436 $secondcriterias = $this->get_subcriterias($criteria['criteria_id'], $concours_id ); 1174 1437 foreach ($secondcriterias as $subcriteria) 1175 {1176 if ($this->debug) echo "ID=".$criteria['criteria_id']."\n";1177 1438 $user_note .= (strlen($user_note) != 0 ? ";" : "").$subcriteria['criteria_id']."=".$subcriteria['min_value']; 1178 }1179 1439 } 1180 1440 } 1181 if ($this->debug) echo "RAZ=>".$user_note."\n";1182 1441 if (strlen($user_note) != 0) 1183 1442 { … … 1187 1446 else 1188 1447 return false; 1189 1190 1191 1448 } 1192 1449 … … 1199 1456 { 1200 1457 $query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id FROM ' . CONCOURS_DATA_TABLE . ' ;'; 1201 list($next_element_id) = mysql_fetch_array(pwg_query($query));1202 if ($this->debug) echo "Next_element=".$next_element_id."\n"; 1458 list($next_element_id) = pwg_db_fetch_array(pwg_query($query)); 1459 1203 1460 $query = ' 1204 1461 INSERT INTO ' . CONCOURS_DATA_TABLE .' … … 1229 1486 .';'; 1230 1487 } 1231 if ($this->debug) echo $query."\n"; 1232 pwg_query($query); 1488 pwg_query($query); 1233 1489 1234 1490 } … … 1240 1496 function get_img_note_user($img_id, $concours_id = NULL, $user_id = null, $ipguest = null) 1241 1497 { 1242 global $user ;1498 global $user, $conf; 1243 1499 $img_note = array(); 1244 1500 if ($concours_id!== null or $this->concours_id !== null) … … 1247 1503 SELECT datas 1248 1504 FROM ' . CONCOURS_DATA_TABLE .' 1249 WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) . '1250 AND user_id = '. ($user_id !== null ? $user_id : $user['id']).'1251 AND img_id = '. $img_id .1252 ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '') 1505 WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) 1506 . ($ipguest == null ? ' AND user_id = '. ($user_id !== null ? $user_id : $user['id']) 1507 : ' AND user_id = '.$conf['guest_id'] .' AND ipguest = "'.$ipguest.'"') 1508 .' AND img_id = '. $img_id 1253 1509 .';'; 1254 if ($this->debug) echo $query."\n";1255 $result = pwg_query($query);1256 1257 while ($row = mysql_fetch_assoc($result))1258 {1259 if ($this->debug) echo "row[data]=".$row['datas']."\n";1260 $datas = explode(";",$row['datas']);1261 foreach ($datas as $val)1262 {1263 if (strpos($val, '=') !== FALSE)1264 $img_note[substr($val, 0, strpos($val, '='))]=substr($val, strpos($val, '=')+1);1265 }1266 }1267 // DEBUG1268 if ($this->debug)1269 foreach ($img_note as $id=>$val)1270 {1271 if (is_array($val))1272 foreach ($val as $id2=>$val2)1273 echo "img_note[".$id."][".$id2."]=".$val2."\n";1274 else1275 echo "img_note[".$id."]=".$val."\n";1276 }1277 // END DEBUG1278 1279 return $img_note;1280 }1281 else1282 return array();1283 1284 1285 }1286 1287 1288 // get notation's user from db1289 // Return the global note for a picture id from a user1290 function get_img_globalnote_user($img_id, $concours_id = NULL, $user_id = null, $ipguest = null)1291 {1292 global $user;1293 $img_note = array();1294 $global_user_note = 0;1295 if ($concours_id!== null or $this->concours_id !== null)1296 {1297 $query = '1298 SELECT datas1299 FROM ' . CONCOURS_DATA_TABLE .'1300 WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) . '1301 AND user_id = '. ($user_id !== null ? $user_id : $user['id']).'1302 AND img_id = '. $img_id .1303 1510 ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '') 1304 1511 .';'; 1305 1512 $result = pwg_query($query); 1306 1513 1307 while ($row = mysql_fetch_assoc($result)) 1514 while ($row = pwg_db_fetch_array($result)) 1515 1308 1516 { 1309 1517 $datas = explode(";",$row['datas']); … … 1315 1523 } 1316 1524 1525 return $img_note; 1526 } 1527 else 1528 return array(); 1529 } 1530 1531 1532 1533 // Return the max note for a concours 1534 function get_concours_maxnote($concours_id = NULL) 1535 { 1536 1537 if ($concours_id!== null or $this->concours_id !== null) 1538 { 1539 $query = ' 1540 SELECT SUM(max_value) AS TOTAL 1541 FROM ' . CONCOURS_DETAIL_TABLE .' 1542 WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) 1543 .' AND uppercriteria IS NULL' 1544 .';'; 1545 1546 $result = pwg_query($query); 1547 if ($this->debug) echo "query=".$query."<br>\n"; 1548 1549 if ($row = pwg_db_fetch_array($result)) 1550 { 1551 return $row['TOTAL']; 1552 } 1553 else 1554 return -1; 1555 1556 } 1557 1558 1559 } 1560 1561 1562 1563 // get notation's user from db 1564 // Return the global note for a picture id from a user 1565 // if moderationMode = 1, the 'moderation' contains the GlobalAverage for all the concours 1566 // if moderationMode = 2, the 'moderation' contains the user moderation for all image that are voted by 1567 // return -1 if there is no vote for that user 1568 function get_img_globalnote_user($img_id, $concours_id = NULL, $user_id = null, $ipguest = null, $moderationMode = 0, $moderation = 0) 1569 { 1570 global $user, $conf; 1571 $img_note = array(); 1572 $global_user_note = -1; 1573 $note_found = false; 1574 if ($concours_id!== null or $this->concours_id !== null) 1575 { 1576 $query = ' 1577 SELECT datas 1578 FROM ' . CONCOURS_DATA_TABLE .' 1579 WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) 1580 . ($ipguest == null ? ' AND user_id = '. ($user_id !== null ? $user_id : $user['id']) 1581 : ' AND user_id = '.$conf['guest_id'] .' AND ipguest = "'.$ipguest.'"') 1582 .' AND img_id = '. $img_id 1583 .';'; 1584 $result = pwg_query($query); 1585 if ($this->debug) echo "query=".$query."<br>\n"; 1586 1587 while ($row = pwg_db_fetch_array($result)) 1588 { 1589 $global_user_note = 0; // init note if one vote is present 1590 $note_found = true; 1591 $datas = explode(";",$row['datas']); 1592 foreach ($datas as $val) 1593 { 1594 if (strpos($val, '=') !== FALSE) 1595 $img_note[substr($val, 0, strpos($val, '='))]=substr($val, strpos($val, '=')+1); 1596 } 1597 } 1598 1317 1599 $firstcriterias = $this->get_firstlevel_criterias($concours_id); 1318 1600 foreach ($firstcriterias as $criteria) 1319 1601 { 1320 if ($this->debug) echo "criteriaID=".$criteria['criteria_id']."\n";1321 1602 // First without sub criterias 1322 1603 if (!$this->is_criterias_contains_sub($criteria['criteria_id'],$concours_id )) … … 1327 1608 else 1328 1609 { 1329 1330 1610 $secondcriterias = $this->get_subcriterias($criteria['criteria_id'], $concours_id ); 1331 1611 foreach ($secondcriterias as $subcriteria) 1332 1612 { 1333 if ($this->debug) echo "subcriteriaID=".$subcriteria['criteria_id']."\n";1334 1613 if (isset($img_note[$subcriteria['criteria_id']])) 1335 1614 $global_user_note += (int)$subcriteria['ponderation'] * (float)$img_note[$subcriteria['criteria_id']]; 1336 1615 } 1337 1616 } 1338 1339 1617 } 1340 1618 1619 // MODERATION 1620 // moderation 1 => For each photo without note (user = author or user != author but no vote) add each user avaerage to the total of note and calcul the average 1621 // moderation 2 => For each photo with note, adapt/change all the value with the moderation value : user note + moderation. 1622 1623 if ($user_id !== null) // only for user 1624 { 1625 if ($moderationMode == 1 && !$note_found) 1626 { // Moderation1 1627 $global_user_note = $moderation; 1628 } 1629 elseif ($moderationMode == 2 && $note_found) 1630 { // Moderation2 1631 $global_user_note += $moderation; 1632 } 1633 1634 1635 } 1341 1636 return $global_user_note; 1342 1637 } … … 1354 1649 { 1355 1650 $query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id FROM ' . CONCOURS_DATA_TABLE . ' ;'; 1356 list($next_element_id) = mysql_fetch_array(pwg_query($query));1357 if ($this->debug) echo "Next_element=".$next_element_id."\n"; 1651 list($next_element_id) = pwg_db_fetch_array(pwg_query($query)); 1652 1358 1653 $query = ' 1359 1654 INSERT INTO ' . CONCOURS_DATA_TABLE .' … … 1381 1676 .';'; 1382 1677 } 1383 if ($this->debug) echo $query."\n";1384 1678 pwg_query($query); 1385 1386 1679 } 1387 1680 … … 1402 1695 ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '') 1403 1696 .';'; 1404 if ($this->debug) echo $query."\n"; 1697 1405 1698 $result = pwg_query($query); 1406 1699 1407 while ($row = mysql_fetch_assoc($result)) 1408 { 1409 if ($this->debug) echo "row[comment]=".$row['comment']."\n"; 1700 while ($row = pwg_db_fetch_array($result)) 1410 1701 $datas = $row['comment']; 1411 }1412 1702 } 1413 1703 return $datas; … … 1441 1731 // For each images 1442 1732 $rang = 1; 1443 while ($row = mysql_fetch_assoc($result))1733 while ($row = pwg_db_fetch_array($result)) 1444 1734 { 1445 1735 $file .= ($row['nbvotant'] != 0 ? $rang : 'N/A').', ' … … 1467 1757 { 1468 1758 global $conf; 1759 $MethodType = "0"; 1469 1760 if ($concours_id === null) 1470 1761 $concours_id = $this->concours_id; … … 1495 1786 $ident1++; 1496 1787 } 1497 if ($this->debug) echo "CRITERIA_LIST=".$criteria_list."\n";1498 1788 $user_list = array(); 1499 1789 $users_criteria = ""; … … 1511 1801 $result = pwg_query($query); 1512 1802 // For each user 1513 while ($row = mysql_fetch_assoc($result))1803 while ($row = pwg_db_fetch_array($result)) 1514 1804 { 1515 1805 array_push($user_list, $row); 1516 1806 $users_criteria .= (strlen($users_criteria) ? "," : "")."user, user_global_note, comment, ".$criteria_list; 1517 1518 1807 } 1519 1808 … … 1530 1819 } 1531 1820 1532 if ($this->debug) echo "users_criteria=".$users_criteria."\n";1533 1821 1534 1822 // All informations in csv format 1535 $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,"1823 $file = "rang, id_concours, method, nom_concours, date_debut, date_fin, date_export, img_id, img_name, img_file, img_author, note, moyenne, moderation1, moderation2, nbvotant, datas," 1536 1824 .$users_criteria 1537 1825 ."\r\n"; … … 1542 1830 $nbvotes = $this->nb_votes_by_img($concours_id); 1543 1831 1544 1545 1832 // recover all img_id from the category 1546 1833 if (!(isset($this->concours_infos['method']))) 1547 1834 $this->concours_infos['method'] = 1; 1548 $query = 'SELECT id_concours, method, img_id, IMG.name, IMG.file, IMG.author, date, note, moyenne, nbvotant, datas, comment'1835 $query = 'SELECT id_concours, method, img_id, IMG.name, IMG.file, IMG.author, date, note, moyenne, moderation1, moderation2, nbvotant, datas, comment' 1549 1836 .' FROM ' .CONCOURS_RESULT_TABLE 1550 1837 .' INNER JOIN ' . CONCOURS_TABLE.' AS CONC on CONC.id = id_concours' … … 1552 1839 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ); 1553 1840 1554 if ($this->concours_infos['method'] == 1) // total 1841 switch ($this->concours_infos['method']) 1842 { 1843 case 1 : // total 1555 1844 $query .= ' ORDER BY note DESC'; 1556 elseif ($this->concours_infos['method'] == 2) // moyenne 1845 $MethodType = "1-Sum"; 1846 break; 1847 case 2 : // moyenne 1557 1848 $query .= ' ORDER BY moyenne DESC'; 1558 1849 $MethodType = "2-Average"; 1850 break; 1851 case 3 : // moderation1 1852 $query .= ' ORDER BY moderation1 DESC'; 1853 $MethodType = "3-Average(Mod1)"; 1854 break; 1855 case 4 : // moderation2 1856 $query .= ' ORDER BY moderation2 DESC'; 1857 $MethodType = "4-Average(Mod2)"; 1858 break; 1859 } 1860 1559 1861 $query .=';'; 1560 1862 1561 if ($this->debug) echo $query;1562 1863 $result = pwg_query($query); 1563 1864 // For each images … … 1565 1866 $previousNote = $previousMoy = 0; 1566 1867 1567 while ($row = mysql_fetch_assoc($result))1868 while ($row = pwg_db_fetch_array($result)) 1568 1869 { 1569 1870 // Check and verify for exaequo … … 1575 1876 AND ($row['moyenne'] == $previousMoy))) 1576 1877 { 1577 $rang --; 1578 1878 $rang --; 1579 1879 } 1580 1880 } … … 1582 1882 $file .= ($row['nbvotant'] != 0 ? $rang : 'N/A').', ' 1583 1883 .$row['id_concours'].', ' 1584 .$ row['method'].', '1884 .$MethodType.', ' 1585 1885 .str_replace(",", "",$this->concours_infos['name']).', ' 1586 1886 .$this->concours_infos['begin_date'].', ' … … 1594 1894 .$row['note'].', ' 1595 1895 .$row['moyenne'].', ' 1896 .$row['moderation1'].', ' 1897 .$row['moderation2'].', ' 1596 1898 .$row['nbvotant'].', ' 1597 // .(isset($nbvotes[$row['img_id']]) ? $nbvotes[$row['img_id']] : 0).', '1598 1899 .($row['datas'] != null ? $row['datas'] : '') 1599 1900 ; … … 1605 1906 $user_note = $this->get_img_note_user($row['img_id'], $concours_id, $uuser['user_id']); 1606 1907 1607 $ file .= ', '.$uuser['username'].', '.$this->get_img_globalnote_user($row['img_id'], $concours_id, $uuser['user_id'])1608 // .', '.($row['comment'] != null ? str_replace(",", "",$row['comment']) : '')1908 $user_global_note = $this->get_img_globalnote_user($row['img_id'], $concours_id, $uuser['user_id']); 1909 $file .= ', '.$uuser['username'].', '.($user_global_note >= 0 ? $user_global_note : 0) 1609 1910 .', '.($comment != false ? str_replace(array(",","\r\n", "\n", "\r"), " ",$comment) : '') 1610 1911 .', ' … … 1642 1943 foreach ($ipguest as $ipguestt) 1643 1944 { 1644 // echo "IP=".$ipguestt."\n";1645 1945 $comment = $this->get_img_comment_user($row['img_id'], $concours_id, $conf['guest_id'], $ipguestt); 1646 1946 1647 1947 $user_note = $this->get_img_note_user($row['img_id'], $concours_id, $conf['guest_id'], $ipguestt); 1648 1649 $file .= ', Guest('.$ipguestt.'), '.$this->get_img_globalnote_user($row['img_id'], $concours_id, $conf['guest_id'], $ipguestt)1650 // .', '.($row['comment'] != null ? str_replace(",", "",$row['comment']) : '')1948 $user_global_note = $this->get_img_globalnote_user($row['img_id'], $concours_id, $conf['guest_id'], $ipguestt); 1949 1950 $file .= ', Guest('.$ipguestt.'), '.($user_global_note >= 0 ? $user_global_note : 0) 1651 1951 .', '.($comment != false ? str_replace(array(",","\r\n", "\n", "\r"), " ",$comment) : '') 1652 1952 .', ' … … 1687 1987 1688 1988 } 1689 if ($this->debug) echo $file;1690 1989 return utf8_decode($file); 1691 1990 1692 1991 1693 1992 } 1694 1695 1993 1696 1994 … … 1722 2020 ;"; 1723 2021 pwg_query($query); 1724 if ($this->debug) echo $query;1725 2022 1726 2023 return $filename; … … 1735 2032 .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ) 1736 2033 .';'; 1737 if ($this->debug) echo $query;1738 2034 $result = pwg_query($query); 1739 2035 if ($result) 1740 2036 { 1741 $row = mysql_fetch_assoc($result);2037 $row = pwg_db_fetch_array($result); 1742 2038 if ($row) 1743 2039 return $row['file_name']; … … 1762 2058 fpassthru($file); 1763 2059 } 1764 1765 }1766 1767 // Activation page administration 2060 } 2061 2062 // DEPRECATED Piwigo 11 Activation page administration 2063 /* 1768 2064 function concours_admin_menu($menu) 1769 2065 { … … 1771 2067 array( 1772 2068 'NAME' => CONCOURS_NAME, 1773 'URL' => get_ admin_plugin_menu_link(CONCOURS_ADMIN_PATH.'admin.php')2069 'URL' => get_root_url().'admin.php?page=plugin-'.CONCOURS_DIR.'-manage' 1774 2070 ) 1775 2071 ); 1776 2072 return $menu; 1777 2073 } 2074 */ 1778 2075 1779 2076 // register Concours Menubar 1780 2077 public function register_blocks( $menu_ref_arr ) 1781 2078 { 1782 $menu = & $menu_ref_arr[0];1783 if ($menu->get_id() != 'menubar' OR $this->my_config['active_menubar'] == false)1784 return;1785 $menu->register_block( new RegisteredBlock( 'CONCOURS_menu', 'concours', 'ConcoursPhoto'));2079 $menu = & $menu_ref_arr[0]; 2080 if ($menu->get_id() != 'menubar' OR $this->my_config['active_menubar'] == false) 2081 return; 2082 $menu->register_block( new RegisteredBlock( 'CONCOURS_menu', 'concours', 'ConcoursPhoto')); 1786 2083 } 1787 2084 … … 1789 2086 public function blockmanager_apply( $menu_ref_arr ) 1790 2087 { 1791 2088 1792 2089 global $user, $template; 1793 2090 $menu = & $menu_ref_arr[0]; … … 1798 2095 if ( ($block = $menu->get_block( 'CONCOURS_menu' ) ) != null ) 1799 2096 { 1800 1801 $menu_list=array(); 1802 1803 if(is_admin())1804 { 2097 $menu_list=array(); 2098 2099 if(is_admin()) 2100 { 2101 1805 2102 array_push($menu_list, 1806 2103 array( 1807 ' nfo' => "",1808 ' text' => l10n('concours_admin_add'),1809 ' link' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&action=new',1810 ' edit' => ""2104 'NAME' => l10n('concours_admin_add'), 2105 'TITLE' => l10n('concours_admin_add'), 2106 'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&action=new', 2107 'REL' => "" 1811 2108 ) 1812 2109 ); 1813 } 2110 2111 } 1814 2112 1815 2113 // recover all img_id from the category 1816 $query = 'SELECT distinct(id_concours), groups, guest, CONC.name'2114 $query = 'SELECT distinct(id_concours), groups, guest, admin, CONC.name' 1817 2115 .' FROM ' .CONCOURS_RESULT_TABLE 1818 2116 .' INNER JOIN '.CONCOURS_TABLE. ' AS CONC ON CONC.id = id_concours' … … 1822 2120 $result = pwg_query($query); 1823 2121 $nb_concours = 1; 2122 1824 2123 // For each concours 1825 while ($row = mysql_fetch_assoc($result)) 2124 while ($row = pwg_db_fetch_assoc($result)) 2125 1826 2126 { 1827 2127 … … 1831 2131 $conc_to_show = false; // Default ==> dont show 1832 2132 1833 // Guest 1834 if (is_a_guest() AND $row['guest']) 2133 // Guest OR admin 2134 if ((is_a_guest() AND $row['guest']) 2135 OR (is_admin() AND $row['admin'])) 1835 2136 $conc_to_show = true; 1836 2137 // Group present 2138 2139 1837 2140 elseif (!empty($row['groups'])) 1838 2141 { … … 1848 2151 { 1849 2152 $nb_concours ++; 2153 1850 2154 array_push($menu_list, 1851 2155 array( 1852 ' nfo' => "",1853 ' text' => $row['name'],1854 ' link' => './index.php?/concours/'.$row['id_concours'],1855 ' edit' => (is_admin()? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $row['id_concours'].'&action=modify':"")2156 'NAME' => $row['name'], 2157 'TITLE' => $row['name'], 2158 'URL' => './index.php?/concours/'.$row['id_concours'], 2159 'EDIT' => (is_admin()? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . CONCOURS_DIR . '%2Fadmin%2Fadd_concours.php&concours=' . $row['id_concours'].'&action=modify':"") 1856 2160 ) 1857 2161 ); … … 1861 2165 if (count($menu_list)) 1862 2166 { 1863 1864 $block->set_title(l10n('concoursphoto'));1865 2167 $block->template = CONCOURS_ROOT.'/template/concours_menu.tpl'; 1866 2168 $block->data = $menu_list; … … 1869 2171 } 1870 2172 1871 1872 2173 function section_init_concours() 1873 2174 { … … 1875 2176 if ($tokens[0] == 'concours') 1876 2177 $page['section'] = 'concours'; 2178 elseif ($tokens[0] == 'concours_vote') 2179 $page['section'] = 'concours_vote'; 1877 2180 } 1878 2181 … … 1880 2183 { 1881 2184 global $page; 1882 1883 1884 2185 if (isset($page['section']) and $page['section'] == 'concours') 1885 2186 { … … 1888 2189 } 1889 2190 2191 function index_vote_concours() 2192 { 2193 global $page; 2194 if (isset($page['section']) and $page['section'] == 'concours_vote') 2195 { 2196 include(CONCOURS_PATH . 'concours_vote.php'); 2197 } 2198 } 2199 1890 2200 1891 2201 // Show the global note under the thumbnail 1892 function thumbnail_note($tpl_var )2202 function thumbnail_note($tpl_var, $pictures) 1893 2203 { 1894 1895 global $page, $user; 2204 global $page, $user, $template; 1896 2205 $this->get_user_groups(); 1897 2206 … … 1909 2218 $user['ipguest'] = $IP; 1910 2219 } 1911 1912 if ($this->my_config['thumb_note'] && $this->my_config['thumb_note'] == true) 1913 { 1914 $concours = array(); 1915 if (($page['section']) == 'categories' AND !empty($page['category'])) 1916 { 1917 $query = ' 1918 SELECT * 1919 FROM ' . CONCOURS_TABLE .' 1920 WHERE category =' . $page['category']['id'] . ' 1921 AND time_to_sec(TIMEDIFF(begin_date,now())) < 0 1922 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 1923 '; 1924 1925 $result = pwg_query($query); 1926 if ($this->debug) echo $query."\n"; 1927 while ($row = mysql_fetch_assoc($result)) 1928 { 1929 1930 if (!empty($row['groups'])) 1931 { 1932 if ($this->debug) echo "GROUPS=".$row['groups']; 1933 $authorized_groups = explode(',', $row['groups']); 1934 if (array_intersect($this->user_groups, $authorized_groups) == array()) 1935 { 1936 if ($this->debug) echo "ERROR GROUPS"; 1937 continue; 1938 } 1939 $concours = $row; 1940 } 1941 1942 // If no group is parameter for that concours ==> available for all registered users 1943 else 1944 $concours = $row; 1945 1946 } 1947 if (count($concours)) 1948 { 1949 // Check if user is guest and if guest is allowed 1950 if ((is_a_guest() AND $concours['guest']) 1951 OR !is_a_guest()) 1952 { 1953 foreach($tpl_var as $cle=>$valeur) 1954 { 1955 // show only if the author is not the active user 1956 if ($tpl_var[$cle]['FILE_AUTHOR'] != $user['username'] 1957 OR $this->my_config['author_vote_available'] // Allow author to vote (and also show his score) 1958 ) 1959 { 1960 $tpl_var[$cle]['NAME'] = $tpl_var[$cle]['NAME'].'<br> '.l10n('thumbnail_global_note').' : '.$this->get_img_globalnote_user($tpl_var[$cle]['ID'], $concours['id'], $user['id'], $user['ipguest']); 1961 } 1962 } 1963 } 1964 } 1965 } 1966 } 2220 2221 if (($page['section']) == 'categories' AND !empty($page['category'])) 2222 { 2223 2224 $concours = array(); 2225 2226 $query = ' 2227 SELECT * 2228 FROM ' . CONCOURS_TABLE .' 2229 WHERE category =' . $page['category']['id'] 2230 // comment to load prepared contests and opened contests . ' AND time_to_sec(TIMEDIFF(begin_date,now())) < 0' 2231 . ' AND time_to_sec(TIMEDIFF(now(), end_date)) < 0'; 2232 2233 $result = pwg_query($query); 2234 // DEBUG 2235 if ($this->debug) echo $query."\n"; 2236 // END DEBUG 2237 while ($row = pwg_db_fetch_array($result)) 2238 { 2239 if ((strtotime($row['begin_date'])-time() > 0) AND $this->my_config['mask_thumbnail']) 2240 { 2241 // disable picture if contest is prepared for all users 2242 $i=0; 2243 while ($i<count($tpl_var)) 2244 { 2245 array_splice($tpl_var, $i, 1); 2246 array_splice($pictures, $i, 1); 2247 } 2248 $concours = $row; 2249 2250 } 2251 elseif (is_admin() AND $row['admin']) 2252 $concours = $row; 2253 elseif (!is_a_guest() AND !empty($row['groups'])) 2254 { 2255 $authorized_groups = explode(',', $row['groups']); 2256 if (array_intersect($this->user_groups, $authorized_groups) == array()) 2257 continue; 2258 $concours = $row; 2259 } 2260 2261 // If no group is parameter for that concours ==> available for all registered users 2262 else 2263 $concours = $row; 2264 } 2265 2266 2267 if (count($concours)) 2268 { 2269 // Add timeline for all users. 2270 if (strtotime($concours['begin_date'])-time() > 0) 2271 { 2272 $template->assign('begin_concours_min', (strtotime($concours['begin_date'])-time())); 2273 $template->assign('deadline_type',$this->my_config['concours_deadline']); 2274 $template->assign('begin_concours', $concours['begin_date']); 2275 } 2276 else 2277 { 2278 // Check if user is guest and if guest is allowed 2279 if ((is_a_guest() AND $concours['guest']) 2280 OR (is_admin() AND $concours['admin']) 2281 OR !is_a_guest()) 2282 { 2283 2284 // check if contest is concours not already open (date begin > now) 2285 2286 2287 2288 foreach($tpl_var as $cle=>$valeur) 2289 { 2290 // show only if the author is not the active user 2291 2292 $AuthorArray = strip_punctuation2($tpl_var[$cle]['author']); 2293 $AddedByID = ($tpl_var[$cle]['added_by']); 2294 $UserArray = strip_punctuation2($user['username']); 2295 2296 if ($this->my_config['author_vote_available'] == 0 // Allow to vote for all photos (and also show his score) 2297 OR ($this->my_config['author_vote_available'] == 1 // check between author and user 2298 AND (empty($AuthorArray) OR count(array_intersect($AuthorArray, $UserArray)) != count ($AuthorArray)) // Author is the same as user name 2299 ) 2300 OR ($this->my_config['author_vote_available'] == 2 // check between author and user 2301 AND (!isset($AddedByID) OR ($user['id'] != $AddedByID)) // Addedby is the same as user name 2302 ) 2303 OR ($this->my_config['author_vote_available'] == 3 // check between author OR addedby and user 2304 AND (!isset($AddedByID) OR ($user['id'] != $AddedByID)) // Addedby is the same as user name 2305 AND (empty($AuthorArray) OR count(array_intersect($AuthorArray, $UserArray)) != count ($AuthorArray)) // Author is the same as user name 2306 ) 2307 ) 2308 2309 { 2310 if ($this->my_config['thumb_note']) // display thumbnail note only if option is activated 2311 { 2312 $user_global_note = $this->get_img_globalnote_user($tpl_var[$cle]['id'], $concours['id'], $user['id'], $user['ipguest']); 2313 $tpl_var[$cle]['NAME'] = $tpl_var[$cle]['NAME'].'('.l10n('thumbnail_global_note').': '.($user_global_note >= 0 ? $user_global_note : 0).')'; 2314 } 2315 } 2316 } 2317 2318 // Add deadline on description page 2319 $template->assign('end_concours', $concours['end_date']); 2320 $template->assign('end_concours_min', (strtotime($concours['end_date'])-time())); 2321 $template->assign('deadline_type',$this->my_config['concours_deadline']); 2322 if (isset($this->my_config['active_global_score_page']) AND $this->my_config['active_global_score_page']) // only if option is activated 2323 $template->assign('global_vote_link', PHPWG_ROOT_PATH . 'index.php?/concours_vote/'.$concours['id']); 2324 } 2325 2326 } 2327 $template->assign('IMG_URL', CONCOURS_IMG_PATH); 2328 2329 $template->set_filenames(array('concours_description' => CONCOURS_ROOT.'/template/concours_description.tpl')); 2330 $template->concat('CONTENT_DESCRIPTION', $template->parse('concours_description', true)); 2331 2332 } 2333 } 2334 1967 2335 return $tpl_var; 1968 2336 } 1969 2337 2338 function concours_stuffs_module($modules) 2339 { 2340 array_push($modules, array( 2341 'path' => CONCOURS_PATH.'stuffs_module/', 2342 'name' => l10n('concours_stuffs_name'), 2343 'description' => l10n('concours_stuffs_description'), 2344 ) 2345 ); 2346 return $modules; 2347 } 2348 2349 2350 2351 function add_contest_desc($tpl_var) 2352 { 2353 global $page, $user, $template; 2354 // TO DO : Add contest information on subcategory 2355 /* 2356 echo "ICI<br>"; 2357 echo "tpl_VAR".(is_array($tpl_var) ? "OK" : $tpl_var)."<br>"; 2358 foreach ($tpl_var as $id=>$val) 2359 { 2360 2361 if (is_array($val)) 2362 foreach ($val as $id2=>$val2) 2363 if (is_array($val2)) 2364 foreach ($val2 as $id3=>$val3) 2365 if (is_array($val3)) 2366 foreach ($val3 as $id4=>$val4) 2367 echo "tpl_var[".$id."][".$id2."][".$id3."][".$id4."]=".$val4."<br>\n"; 2368 else 2369 echo "tpl_var[".$id."][".$id2."][".$id3."]=".$val3."<br>\n"; 2370 else 2371 echo "tpl_var[".$id."][".$id2."]=".$val2."<br>\n"; 2372 else 2373 echo "tpl_var[".$id."]=".$val."<br>\n"; 2374 } 2375 $i=0; 2376 while ($i<count($tpl_var)) 2377 { 2378 $tpl_var[$i]['NAME'] = "TEST TEST"; 2379 $i++; 2380 2381 } 2382 2383 $template->set_filenames(array('concours_description' => CONCOURS_ROOT.'/template/concours_description-cat.tpl')); 2384 $template->concat('DESCRIPTION', $template->parse('concours_description', true)); 2385 2386 return $tpl_var; 2387 */ 2388 } 2389 2390 2391 2392 2393 // Check if a concours is present (prepared or actived) for the category and user group 2394 function concours_present_cat($category = NULL) 2395 { 2396 global $page; 2397 $concours_present = false; 2398 if (!isset($category)) // param not present 2399 { 2400 if (($page['section']) == 'categories' AND !empty($page['category'])) 2401 $category = $page['category']['id'] ; 2402 } 2403 2404 if (isset($category)) 2405 { 2406 $query = ' 2407 SELECT * 2408 FROM ' . CONCOURS_TABLE .' 2409 WHERE category =' . $category . ' 2410 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 2411 '; 2412 2413 $result = pwg_query($query); 2414 while ($row = pwg_db_fetch_array($result)) 2415 return true; 2416 } 2417 return false; 2418 } 2419 2420 2421 // Disable Metatdata to picture for a prepared or active concours 2422 function disable_meta_to_picture() 2423 { 2424 if (isset($this->my_config['mask_meta']) && $this->my_config['mask_meta'] == true) 2425 { 2426 if ($this->concours_present_cat()) 2427 pwg_set_session_var('show_metadata', 0 ); 2428 } 2429 } 2430 1970 2431 1971 2432 } 1972 2433 2434 function strip_punctuation($string) { 2435 $string = strtolower($string); // lower case 2436 $string = preg_replace("/\p{P}+/", "", $string); // remove punctuation 2437 $string = preg_replace("/\p{Nd}+/", "", $string); // remove numeric 2438 $string = preg_replace("/[\p{Z}\t\r\n\v\f]+/", "", $string); // remove spaces 2439 $string = str_replace(" +", "", $string); // remove space 2440 //echo "stripPunct=".$string."!\n"; 2441 return $string; 2442 } 2443 2444 // return array 2445 function strip_punctuation2($string) { 2446 $string = strtolower($string); // lower case 2447 $string = preg_replace("/\p{P}+/", " ", $string); // remove punctuation by space 2448 $string = preg_replace("/\p{Nd}+/", "", $string); // remove numeric 2449 $string = preg_replace("/[\p{Z}\t\r\n\v\f]+/", " ", $string); // remove spaces by spaces (only 1) 2450 // $string = str_replace(" +", "", $string); // remove space 2451 $stringArray = $returnValue = preg_split('/\\W/', $string, -1, PREG_SPLIT_NO_EMPTY); 2452 2453 return $stringArray; 2454 } 2455 2456 2457 1973 2458 ?> -
extensions/ConcoursPhoto/include/default_values.inc.php
r8946 r32457 7 7 $concours_default_values['active_menubar'] = true; // Activate menubar view 8 8 $concours_default_values['nbconcours_menubar'] = 3; // Nb of last published concours show on concours menubar 9 $concours_default_values['mask_author'] = true; // Mask author for prepared concours 9 $concours_default_values['mask_author'] = true; // Mask author for prepared concours or active concours 10 $concours_default_values['mask_meta'] = false; // Mask meta for prepared concours or active concours 10 11 $concours_default_values['thumb_note'] = true; // Display global note (for user) under thumbnail 11 12 $concours_default_values['check_exaequo'] = false; // Check exaequo and display the same rank 12 $concours_default_values['author_vote_available'] = false; // Dont allow author to vote for his own photo 13 //$concours_default_values['author_vote_available'] = false; // Dont allow author to vote for his own photo 14 $concours_default_values['author_vote_available'] = 0; // 0: Disable check between curent user and Author/AddedBy info for a photo ==> All user cound vote 15 // 1: Check between "Author" (of photo) and "User" 16 // 2: Check between "AddedBy" (of photo) and "User" 17 // 3: Check between "Author" OR "AddedBy" and "User" 18 13 19 $concours_default_values['concours_change_score'] = true; // Allow a user to change his score afer a validation 20 $concours_default_values['concours_deadline'] = 2; // 0: dont show deadline; 1: deadline version 1; 2: deadline version 2 21 $concours_default_values['mask_thumbnail'] = true; // Mask thumbnail on category page before the contest start 22 $concours_default_values['nb_concours_page'] = 10; // nb of contest by page (on admin page) 23 $concours_default_values['active_global_score_page'] = false; // activate global page for vote/score (all image in 1 page) 24 $concours_default_values['score_mode'] = 1; // score mode. 0: text box / 1: stars 25 $concours_default_values['text_overlay'] = "Vote déjà enregistré <br>"; // text to display when the score is already present and the option concours_change_score is false (allow the user to change the score after vote) 14 26 15 27 ?> -
extensions/ConcoursPhoto/language/en_UK/plugin.lang.php
r9370 r32457 16 16 $lang['concours_name'] = 'Name'; 17 17 $lang['concours_descr'] = 'Description'; 18 $lang['concours_activation_date'] 18 $lang['concours_activation_date'] = 'Contest Period'; 19 19 $lang['concours_nb_jours'] = 'During'; 20 20 $lang['jours'] = 'Days'; … … 69 69 $lang['concours_hour_to'] = 'End hour'; 70 70 71 $lang['concours_mask_author'] = 'Mask author for prepared inactive contest'; 72 $lang['concours_mask_exif'] = 'Mask EXIF/IPTC datas for prepared inactive contest'; 73 74 $lang['thumbnail_global_note'] = 'Contest score'; 71 $lang['concours_mask_author'] = 'Mask author for prepared inactive or active contest'; 72 //$lang['concours_mask_exif'] = 'Mask EXIF/IPTC datas for prepared inactive contest'; 73 $lang['concours_mask_meta'] = 'Mask Metadata on picture for prepared inactive or active contest'; 74 75 $lang['thumbnail_global_note'] = 'Contest'; 75 76 $lang['concours_thumb_note'] = 'Add the global note under thumbnails'; 76 77 $lang['concours_global_user_note'] = 'Total registered'; … … 82 83 $lang['concours_method1'] = 'Sum of scored'; 83 84 $lang['concours_method2'] = 'Average of scores'; 85 $lang['concours_method3'] = 'Average of scores with moderation type 1'; 86 $lang['concours_method4'] = 'Average of scores with moderation type 2'; 84 87 85 88 $lang['concours_note'] = 'Global score'; … … 87 90 $lang['concours_nbvotant'] = 'Number of voting'; 88 91 $lang['concours_usernote'] = 'Your score'; 92 $lang['concours_moderation1'] = 'Average (moderation 1)'; 93 $lang['concours_moderation2'] = 'average (moderation 2)'; 94 $lang['concours_warn_moderation'] = 'Warning : Average with moderation only calculated at the end of contest'; 89 95 $lang['concours_infos'] = 'Contest information'; 90 96 $lang['concours_audit'] = 'Audit'; … … 95 101 $lang['all_users'] = '-- All --'; 96 102 $lang['concours_check_exaequo'] = 'Manage exaequos'; 97 $lang['concours_author_vote'] = 'Allow author of a photo to vote (disable the check based on username/author)'; 103 $lang['concours_author_vote'] = 'Control user/author for the contest vote : '; 104 $lang['concours_author_vote0'] = '0- No control (vote for any photos)'; 105 $lang['concours_author_vote1'] = '1- Author control (vote not allowed if User=Author)'; 106 $lang['concours_author_vote2'] = '2- Added_by control (vote not allowed if User=Added_by)'; 107 $lang['concours_author_vote3'] = '3- Author or Added_by control (vote not allowed if User=Author or User=Added_by)'; 108 $lang['concours_author_vote_detail'] = '<i> 109 <ul> 110 <li style="list-style-type: none;">0- No control : All users could show and vot for any photos .</li> 111 <li style="list-style-type: none;">1- Author control : User cound not vote for photos whith same author information as user name .</li> 112 <li style="list-style-type: none;">2- Added_by control : User cound not vote for photos added by himself.</li> 113 <li style="list-style-type: none;">3- Author OR Added_by control: User cound not vote for photos whith same author information as user name or if photos are added by himself.</li> 114 </ul></i> 115 '; 116 117 98 118 $lang['concours_change_score'] = 'Allow user to change his score after a validation'; 99 119 $lang['concours_end_date_change_to'] = 'End date changed to %s'; … … 106 126 $lang['concours_admin_help'] = 'Guide/Help to use the ConcoursPhoto plugin'; 107 127 $lang['concours_audit_page'] = 'Contest Audit'; 128 129 130 $lang['manage_criteria'] = 'Manage default criterias'; 131 132 133 $lang['concours_stuffs_name'] = 'Photo Contest'; 134 $lang['concours_stuffs_description'] = 'Display the result of one photo contest (podium)'; 135 136 $lang['ConcoursPhoto_Fonctionality'] = 'Concours Photo plugin functionnalities'; 137 $lang['ConcoursPhoto_Fonctionality_txt'] = ' 138 <ul> 139 <li> 140 General Principle: On one album, allow a user list to note for photos during a set period. The result is then generated and displayed on a dedicated page accessible by users. 141 <br/> 142 Details below are steps to add a contest: 143 </li> 144 <li style="list-style-type: none;"><br/></li> 145 <li ><span class="throw"> Step 1 : Add a new contest on Piwigo:</span></li> 146 147 <li style="list-style-type: none;"></li> 148 <li style="list-style-type: none;">- Click on the "Add Contests\" tab to add 1 new contest.</li> 149 <li style="list-style-type: none;">- Enter the name and description of the contest (eg Name = "Flowers" / Description = "Contest on the theme of flowers from xx / xx to xx / xx with Black & White photos).</li> 150 <li style="list-style-type: none;">- Select Groups Allowed to note Photos (if no group is present, all users are allowed).</li> 151 <li style="list-style-type: none;">- Set the start and end time of the contest.</li> 152 <li style="list-style-type: none;">- Choose the method of calculating the result (see details below for more details).</li> 153 <li style="list-style-type: none;">- Select the album in which the photos will be present for the contest.</li> 154 <li style="list-style-type: none;">- Confirm and go to step 2.</li> 155 <li style="list-style-type: none;"><br/></li> 156 <li ><span class="throw"> Step 2 : Selection of rating criteria:</span></li> 157 <li style="list-style-type: none;">Note: The criteria of a contest are pre-initialized with the default criteria (see below to modify them)</li> 158 <li style="list-style-type: none;"></li> 159 <li style="list-style-type: none;">- Modify criteria / sub-criteria present.</li> 160 <li style="list-style-type: none;">- Or add new ones by clicking on "Add new criteria.</li> 161 <li style="list-style-type: none;"><i>To add a sub-criterion to an existing criterion, click on the icon to the right of the criterion (in the table).</i></li> 162 <li style="list-style-type: none;"><br/></li> 163 <li ><span class="throw">Step 3 : The voting period:</span></li> 164 <li style="list-style-type: none;"></li> 165 <li style="list-style-type: none;">- During the voting period, the admin page allows you to view the intermediate result by clicking on the contest (<b> Manage Contests </b> tab).</li> 166 <li style="list-style-type: none;"><br/></li> 167 <li ><span class="throw">Step 4 :Results:</span></li> 168 <li style="list-style-type: none;"></li> 169 <li style="list-style-type: none;">- At the end of the contest period, the result is generable on the admin page (<b> Manage Contests </b>).</li> 170 <li style="list-style-type: none;">- It is needed to click on the button to the right of the contest to generate the result (otherwise it will not be visible to users).</li> 171 <li style="list-style-type: none;">- After generating the result, a CSV file could be generated (click on the icon corresponding to the right of the contest).</li> 172 <li style="list-style-type: none;"><br/></li> 173 </ul>'; 174 175 176 $lang['ConcoursPhoto_Options'] = 'Options and details of plugin Concours Photo'; 177 $lang['ConcoursPhoto_Options_txt'] = ' 178 <ul> 179 <li> 180 Main options and rules for Photo Contest. 181 <br/> 182 </li> 183 <li style="list-style-type: none;"><br/></li> 184 <li ><span class="throw"> Criteria, sub-criteria and default criteria</span></li> 185 <li style="list-style-type: none;">- The default criteria are those that are loaded when creating a new contest.</li> 186 <li style="list-style-type: none;">- The criteria and sub-criteria contain the following parameters: Name / Description / Note min / Note max / coefficient multipl.</li> 187 <li style="list-style-type: none;">- When a criterion contains sub-criteria, it is the latter that are used for the notation. In this case, the main criterion is used only as grouping.</li> 188 <li style="list-style-type: none;">- You can change the default criteria at any time, they will not affect competitions already in progress or completed.</li> 189 <li style="list-style-type: none;">- You can add as many default criteria and sub-criteria as you want.</li> 190 <li style="list-style-type: none;"><br/></li> 191 <li ><span class="throw"> Methods of calculating the result</span></li> 192 <li style="list-style-type: none;">There are 4 methods of calculating the final score :</li> 193 <li style="list-style-type: none;">- "Sum" -> It corresponds to the simple sum of the scores / scores obtained per photo that defines the ranking regardless of the number of voters for the photos.</li> 194 <li style="list-style-type: none;">- "Average" -> It corresponds the average of the scores / scores obtained by photo between the voters (for the same photo) which defines the ranking.</li> 195 <li style="list-style-type: none;">- "Average (ponderation1)" -> It corresponds is the average of the scores / scores obtained per photo that defines the ranking. If a user does not vote for all the photos, they are awarded a score corresponding to the average score of the same voter</li> 196 <li style="list-style-type: none;">- "Average (ponderation2)" -> This is the average of the scores / scores obtained per photo that defines the ranking. An increase / decrease is calculated as a function of the difference between the minimum and maxi scores of the same voter. This mark-up is added to the photo\'s score before calculating the result.</li> 197 <li style="list-style-type: none;"></li> 198 <li style="list-style-type: none;"><i>Moderation 1 and 2 reduce the significant difference in score and rebalance the votes.</i></li> 199 <li style="list-style-type: none;"><br/></li> 200 <li ><span class="throw"> Use of PWG_Stuffs modules</span></li> 201 <li style="list-style-type: none;">- Once the contest is closed (<u> and the result generated </u>), the result is accessible via the link present in the piwigo menu.</li> 202 <li style="list-style-type: none;">- You can also add a module with PWG_Stuffs which allows to highlight the podium of winning photos.</li> 203 <li style="list-style-type: none;"><br/></li> 204 </ul>'; 205 206 $lang['concours_deadline'] = 'Contest deadline '; 207 $lang['concours_begin'] = 'Contest starts in'; 208 $lang['concours_deadline_days'] = ' Days '; //':' 209 $lang['concours_deadline_hours'] = ' Hours '; //':' 210 $lang['concours_deadline_mins'] = ' Minutes '; //':' 211 $lang['concours_deadline_secs'] = ' Seconds '; //'.' 212 $lang['concours_deadline_param'] = 'Display deadline contest '; 213 $lang['concours_deadline_param0'] = '0-No display'; 214 $lang['concours_deadline_param1'] = '1-Display v1'; 215 $lang['concours_deadline_param2'] = '2-Display v2'; 216 217 $lang['concours_begin'] = 'Contest begin in '; 218 $lang['mask_thumbnail'] = 'Mask thumbnails before contest start'; 219 220 $lang['concours_nb_concours_total'] = '<b>%d Contests saved </b> (<i>%d Prepared contest(s) / %d Active contest(s) / %d Closed contest(s)</i>)'; 221 $lang['concours_nb_concours_page'] = 'Number by page'; 222 $lang['concours_status'] = 'Status'; 223 $lang['concours_delete_selected'] = 'Delete the contest'; 224 $lang['concours_delete_all_closed'] = 'Delete all closed contests'; 225 $lang['concours_no_concours'] = 'No contest saved in database'; 226 $lang['concours_no_criteria'] = 'No criteria saved'; 227 228 $lang['concours_global_score_title'] = 'Global score page'; 229 $lang['concours_global_score'] = 'Click to display Global score page'; 230 $lang['concours_global_score_admin'] = 'Active global score page (all pictures)'; 231 $lang['concours_score_mode'] = 'Score display mode '; 232 $lang['concours_score_mode0'] = '0-Text mode'; 233 $lang['concours_score_mode1'] = '1-Star v1 mode'; 234 $lang['concours_notation'] = 'Global note of all contest pictures'; 235 236 $lang['CR_select_contest'] = 'Closed contest to display'; 237 $lang['closed-noresult_concours'] = 'closed contest (withouyt results)'; 238 $lang['concours_comment_short'] = 'Picture comment'; 239 $lang['concours_nbscore'] = 'Number of votes'; 240 241 $lang['prepared_concours_1'] = 'prepared '; 242 $lang['active_concours_1'] = 'actived '; 243 $lang['closed_concours_1'] = 'closed '; 244 $lang['closed_noresult_concours_1'] = 'closed (without result) '; 245 $lang['concours_allow_admin'] = 'Allow Admin'; 246 $lang['concours_overlay_text'] = 'Text to display'; 247 108 248 ?> -
extensions/ConcoursPhoto/language/fr_FR/plugin.lang.php
r9370 r32457 19 19 $lang['concours_nb_jours'] = 'Pendant'; 20 20 $lang['jours'] = 'Jours'; 21 $lang['concours_category_select'] = ' Catégorie sélectionnée';21 $lang['concours_category_select'] = 'Album sélectionné'; 22 22 $lang['concours_authorized_group'] = 'Groupes authorisés'; 23 23 $lang['concours_begin_date'] = 'Date de début'; … … 69 69 $lang['concours_hour_to'] = 'Heure de Fin'; 70 70 71 $lang['concours_mask_author'] = 'Masquer l\'auteur pour les concours préparés non actifs'; 72 $lang['concours_mask_exif'] = 'Masquer les données EXIF/IPTC pour les concours préparés non actifs'; 73 74 $lang['thumbnail_global_note'] = 'Note concours'; 71 $lang['concours_mask_author'] = 'Masquer l\'auteur pour les concours préparés non actifs et actifs'; 72 //$lang['concours_mask_exif'] = 'Masquer les données EXIF/IPTC pour les concours préparés non actifs'; 73 $lang['concours_mask_meta'] = 'Masquer les metadonnées pour les concours préparés non actifs et actifs'; 74 75 $lang['thumbnail_global_note'] = 'Concours'; 75 76 $lang['concours_thumb_note'] = 'Ajouter la note globale sous les miniatures'; 76 77 $lang['concours_global_user_note'] = 'Total enregistré'; … … 82 83 $lang['concours_method1'] = 'Somme des notes'; 83 84 $lang['concours_method2'] = 'Moyenne des notes'; 85 $lang['concours_method3'] = 'Moyenne des notes avec modération type 1'; 86 $lang['concours_method4'] = 'Moyenne des notes avec modération type 2'; 84 87 85 88 $lang['concours_note'] = 'Note globale'; … … 87 90 $lang['concours_nbvotant'] = 'Nombre de votant'; 88 91 $lang['concours_usernote'] = 'Votre note'; 92 $lang['concours_moderation1'] = 'Moyenne (modération 1)'; 93 $lang['concours_moderation2'] = 'Moyenne (modération 2)'; 94 $lang['concours_warn_moderation'] = 'Attention : moyenne moderée appliquée en fin de concours'; 89 95 $lang['concours_infos'] = 'Information sur le concours'; 90 96 $lang['concours_audit'] = 'Audit'; … … 95 101 $lang['all_users'] = '-- Tous --'; 96 102 $lang['concours_check_exaequo'] = 'Gérer les exaequos'; 97 $lang['concours_author_vote'] = 'Autoriser les auteurs à voter pour leur propres photos (désactive le contrôle username=auteur)'; 103 $lang['concours_author_vote'] = 'Contrôle des utilisateurs / auteurs pour le vote : '; 104 $lang['concours_author_vote0'] = '0- Aucun contrôle (vote pour toutes les photos)'; 105 $lang['concours_author_vote1'] = '1- Contrôle Auteur (vote impossible si User=Auteur)'; 106 $lang['concours_author_vote2'] = '2- Contrôle Ajout (vote impossible si User="Ajouté par")'; 107 $lang['concours_author_vote3'] = '3- Contrôle Auteur ou Ajout (vote impossible si User=Auteur ou User="Ajouté Par")'; 108 $lang['concours_author_vote_detail'] = '<i> 109 <ul> 110 <li style="list-style-type: none;">0- Aucun contrôle : tous les participants peuvent noter toutes les photos.</li> 111 <li style="list-style-type: none;">1- Contrôle Auteur: l\'utilisateur ne peut pas vôter pour les photos dont l\'auteur est identique au login de l\'utilisateur.</li> 112 <li style="list-style-type: none;">2- Contrôle Ajouté Par: l\'utilisateur ne peut pas vôter pour les photos qui ont été ajoutées par lui même.</li> 113 <li style="list-style-type: none;">3- Contrôle Auteur et Ajouté Par: l\'utilisateur XXX ne peut pas vôter pour les photos dont l\'auteur est identique au login de l\'utilisateur où qui ont été ajouté par lui même.</li> 114 </ul></i> 115 '; 116 117 98 118 $lang['concours_change_score'] = 'Autoriser les votants à modifier les notes après validation'; 99 119 $lang['concours_end_date_change_to'] = 'La date de fin du concours a été modifié : %s'; … … 106 126 $lang['concours_admin_help'] = 'Guide/Aide d\'utilisation du plugin ConcoursPhoto'; 107 127 $lang['concours_audit_page'] = 'Audit de concours'; 128 129 130 $lang['manage_criteria'] = 'Gestion des critères par défaut'; 131 132 133 $lang['concours_stuffs_name'] = 'Concours Photo'; 134 $lang['concours_stuffs_description'] = 'Affiche le résultat d\'un concours photo (podium)'; 135 136 $lang['ConcoursPhoto_Fonctionality'] = 'Fonctionnalités du plugin Concours Photo'; 137 $lang['ConcoursPhoto_Fonctionality_txt'] = ' 138 <ul> 139 <li> 140 Principe général : Sur un album, autoriser une liste d\'utilisateur à noter les différentes photos présentes pendant une période paramétrée. Le résultat est ensuite généré et affiché sur une page dédié accessible aux utilisateurs. 141 <br/> 142 Détail ci dessous des étapes pour l\'ajout d\'un concours: 143 </li> 144 <li style="list-style-type: none;"><br/></li> 145 <li ><span class="throw"> Etape 1 : Ajout d\'un nouveau concours sur Piwigo:</span></li> 146 147 <li style="list-style-type: none;"></li> 148 <li style="list-style-type: none;">- Cliquez sur l\'onglet \"Ajouter un concours\" pour ajouter 1 nouveau concours.</li> 149 <li style="list-style-type: none;">- Renseigner le nom et la description du concours (ex. Nom = "Les fleurs" / Description = "Concours sur le thème des fleurs du xx/xx au xx/xx. Photos Noir & Blanc").</li> 150 <li style="list-style-type: none;">- Sélectionnez les groupes autorisés à notes les photos (si aucun groupe n\'est présent, tous les utilisateurs sont autorisés).</li> 151 <li style="list-style-type: none;">- Définissez la période de début et de fin du concours.</li> 152 <li style="list-style-type: none;">- Choississez la méthode de calcul du résultat (voir détail ci-dessous pour plus de précisions).</li> 153 <li style="list-style-type: none;">- Sélectionnez l\'album dans lequel les photos seront présentes pour le concours.</li> 154 <li style="list-style-type: none;">- Validez pour passer à l\'étape 2.</li> 155 <li style="list-style-type: none;"><br/></li> 156 <li ><span class="throw"> Etape 2 : Sélection des critères de notation:</span></li> 157 <li style="list-style-type: none;">Remarque : les critères d\'un concours sont pré-initialisés avec les critères par défaut (voir ci-dessous pour les modifier)</li> 158 <li style="list-style-type: none;"></li> 159 <li style="list-style-type: none;">- Modifier les critères / sous-critères présents.</li> 160 <li style="list-style-type: none;">- Ou ajoutez-en de nouveau en cliquant sur "Ajouter un nouveau critère.</li> 161 <li style="list-style-type: none;"><i>Pour ajouter un sous-critère à un critère existant, cliquez sur l\'icone à droite du critère (dans le tableau).</i></li> 162 <li style="list-style-type: none;"><br/></li> 163 <li ><span class="throw">Etape 3 : La période de vote:</span></li> 164 <li style="list-style-type: none;"></li> 165 <li style="list-style-type: none;">- pendant la période de vote, la page d\'admin permet de visualiser le résultat intermédiaire en cliquant sur le concours (onglet <b>Gérer les concours</b>).</li> 166 <li style="list-style-type: none;"><br/></li> 167 <li ><span class="throw">Etape 4 :Les résultats:</span></li> 168 <li style="list-style-type: none;"></li> 169 <li style="list-style-type: none;">- A la fin de la période du concours, le résultat est générable dans la page admin (onglet <b>Gérer les concours</b>).</li> 170 <li style="list-style-type: none;">- Il est impératif de cliquer sur le bouton à droite du concours pour génére le résultat (sinon ce dernier ne sera pas visible par les utilisateurs).</li> 171 <li style="list-style-type: none;">- Après la génération du résultat, un fichier CVS est exportable (cliquez sur l\'icone correspondant à droite du concours).</li> 172 <li style="list-style-type: none;"><br/></li> 173 </ul>'; 174 175 176 $lang['ConcoursPhoto_Options'] = 'Options et détails du plugin Concours Photo'; 177 $lang['ConcoursPhoto_Options_txt'] = ' 178 <ul> 179 <li> 180 Principales options et règles de Concours Photo. 181 <br/> 182 </li> 183 <li style="list-style-type: none;"><br/></li> 184 <li ><span class="throw"> Critères, sous-critères et critères par défaut</span></li> 185 <li style="list-style-type: none;">- Les critères par défaut sont ceux qui sont chargés lors de la création d\'un nouveau concours.</li> 186 <li style="list-style-type: none;">- Les critères et sous-critères contiennent les paramètres suivants : Nom / Description / Note min / Note max / coefficient multipl.</li> 187 <li style="list-style-type: none;">- Lorsqu\'un critère contient des sous-critères, ce sont ces derniers qui sont utilisés pour la notation. Dans ce cas, le critère principal n\'est utilisé que comme regroupement.</li> 188 <li style="list-style-type: none;">- Vous pouvez modifier les critères par défaut à tout moment, ils n\'influeront pas sur les concours déjà en cours ou terminés.</li> 189 <li style="list-style-type: none;">- Vous pouvez ajouter autant de critères et sous-critères par défaut que vous souhaitez.</li> 190 <li style="list-style-type: none;"><br/></li> 191 <li ><span class="throw"> Les méthodes de calcul du résultat</span></li> 192 <li style="list-style-type: none;">Il y a 4 méthodes de calcul du score final :</li> 193 <li style="list-style-type: none;">- "la somme" --> C\'est la somme des scores/notes obtenus par photo qui définit le classement quelque soit le nombre de votant pour les photos.</li> 194 <li style="list-style-type: none;">- "la moyenne" --> C\'est la moyenne des scores/notes obtenus par photo entre les votants (pour 1 même photo) qui définit le classement.</li> 195 <li style="list-style-type: none;">- "la moyenne (pondération1)" --> C\'est la moyenne des scores/notes obtenus par photo qui définit le classement. Si un utilisateur ne vote pas pour toutes les photos, ces dernières se voient attribuées un score correspondant à la moyenne des notes du même votant </li> 196 <li style="list-style-type: none;">- "la moyenne (pondération2)" --> C\'est la moyenne des scores/notes obtenus par photo qui définit le classement. une majoration/minoration est calculée en fonction de l\'écart entre les notes mini et maxi d\'un même votant. Cette majoration/minoration est ajoutée au score de la photo avant de calculer le résultat.</li> 197 <li style="list-style-type: none;"></li> 198 <li style="list-style-type: none;"><i>la modération 1 et 2 permettent de réduire les écarts important de score et rééquilibrer les votes.</i></li> 199 <li style="list-style-type: none;"><br/></li> 200 <li ><span class="throw"> Utilisation de PWG_Stuffs</span></li> 201 <li style="list-style-type: none;">- Une fois le concours clos (<u>et le résultat généré</u>), le résultat est accessible via le lien présent dans le menu piwigo.</li> 202 <li style="list-style-type: none;">- Vous pouvez également ajouter un module avec PWG_Stuffs qui permet de mettre en avant le podium de photos gagnantes.</li> 203 <li style="list-style-type: none;"><br/></li> 204 </ul>'; 205 206 $lang['concours_deadline'] = 'Fin du concours dans '; 207 $lang['concours_begin'] = 'Début du concours dans '; 208 $lang['concours_deadline_days'] = ' Jours '; //':' 209 $lang['concours_deadline_hours'] = ' Heures '; //':' 210 $lang['concours_deadline_mins'] = ' Minutes '; //':' 211 $lang['concours_deadline_secs'] = ' Secondes '; //'.' 212 $lang['concours_deadline_param'] = 'Affichage de la deadline du concours '; 213 $lang['concours_deadline_param0'] = '0-Pas d\'affichage'; 214 $lang['concours_deadline_param1'] = '1-Affichage v1'; 215 $lang['concours_deadline_param2'] = '2-Affichage v2'; 216 217 $lang['concours_begin'] = 'Début du concours dans '; 218 $lang['mask_thumbnail'] = 'Masquer les mignatures avant le démarrage du concours'; 219 220 $lang['concours_nb_concours_total'] = '<b>%d Concours stockés </b> (<i>%d Concours préparé(s) / %d Concours actif(s) / %d Concours clôturé(s)</i>)'; 221 $lang['concours_nb_concours_page'] = 'Nombre par page'; 222 $lang['concours_status'] = 'Statut'; 223 $lang['concours_delete_selected'] = 'Suppression de concours'; 224 $lang['concours_delete_all_closed'] = 'Supprimer tous les concours clos'; 225 $lang['concours_no_concours'] = 'Aucun Concours %sdans la base de données'; 226 $lang['concours_no_criteria'] = 'Aucun critère enregistré'; 227 228 $lang['concours_global_score_title'] = 'Page de vote globale'; 229 $lang['concours_global_score'] = 'Cliquez ici pour ouvrir la page de vote globale'; 230 $lang['concours_global_score_admin'] = 'Activer la page de vote globale (toutes images)'; 231 $lang['concours_score_mode'] = 'Mode de notation '; 232 $lang['concours_score_mode0'] = '0-Mode texte'; 233 $lang['concours_score_mode1'] = '1-Mode étoile v1'; 234 $lang['concours_notation'] = 'Score global de toutes photos du concours'; 235 236 $lang['CR_select_contest'] = 'Concours terminé a afficher'; 237 $lang['closed-noresult_concours'] = 'Concours terminés (sans résultats)'; 238 $lang['concours_comment_short'] = 'Commentaire sur la photo'; 239 $lang['concours_nbscore'] = 'votant(s)'; 240 241 $lang['prepared_concours_1'] = 'préparé '; 242 $lang['active_concours_1'] = 'actif '; 243 $lang['closed_concours_1'] = 'terminé '; 244 $lang['closed_noresult_concours_1'] = 'terminé (sans résultat) '; 245 $lang['concours_allow_admin'] = 'Autoriser les Administrateurs'; 246 $lang['concours_overlay_text'] = 'Message à afficher'; 247 108 248 ?> -
extensions/ConcoursPhoto/language/it_IT/index.php
r11529 r32457 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Piwigo - a PHP based photo gallery | 3 // | PhpWebGallery - a PHP based picture gallery | 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | 4 6 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | 7 // | file : $Id: index.php 1912 2007-03-16 06:30:07Z rub $ 8 // | last update : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $ 9 // | last modifier : $Author: rub $ 10 // | revision : $Revision: 1912 $ 8 11 // +-----------------------------------------------------------------------+ 9 12 // | This program is free software; you can redistribute it and/or modify | -
extensions/ConcoursPhoto/language/lv_LV/plugin.lang.php
r11507 r32457 70 70 71 71 $lang['concours_mask_author'] = 'Maskēt sagatavota neaktīva konkursa autoru'; 72 $lang['concours_mask_exif'] = 'Maskēt EXIF/IPTC sagatavota neaktīvas konkursa datus'; 72 //$lang['concours_mask_exif'] = 'Maskēt EXIF/IPTC sagatavota neaktīvas konkursa datus'; 73 $lang['concours_mask_meta'] = 'Mask Metadata on picture for prepared inactive or active contest'; 73 74 74 75 $lang['thumbnail_global_note'] = 'Konkursa reitings'; … … 82 83 $lang['concours_method1'] = 'Novērtēto Summa'; 83 84 $lang['concours_method2'] = 'Vidējie vērtējumi'; 85 $lang['concours_method3'] = 'Average of scores with moderation type 1'; 86 $lang['concours_method4'] = 'Average of scores with moderation type 2'; 84 87 85 88 $lang['concours_note'] = 'Globālais vērtējums'; … … 87 90 $lang['concours_nbvotant'] = 'Balsojušo skaits'; 88 91 $lang['concours_usernote'] = 'Jūsu vērtējums'; 92 $lang['concours_moderation1'] = 'Average (moderation 1)'; 93 $lang['concours_moderation2'] = 'average (moderation 2)'; 94 $lang['concours_warn_moderation'] = 'Warning : Average with moderation only calculated at the end of contest'; 89 95 $lang['concours_infos'] = 'Konkursa informācija'; 90 96 $lang['concours_audit'] = 'Pārbaude'; … … 95 101 $lang['all_users'] = '-- Visi --'; 96 102 $lang['concours_check_exaequo'] = 'Pārvaldīt exaequos'; 97 $lang['concours_author_vote'] = 'Atļaut foto autoram balsot (atslēgt pārbaudi, kas balstās uz lietotājvārds/autors)'; 103 $lang['concours_author_vote'] = 'Control user/author for the contest vote : '; 104 $lang['concours_author_vote0'] = '0- No control (vote for any photos)'; 105 $lang['concours_author_vote1'] = '1- Author control (vote not allowed if User=Author)'; 106 $lang['concours_author_vote2'] = '2- Added_by control (vote not allowed if User=Added_by)'; 107 $lang['concours_author_vote3'] = '3- Author or Added_by control (vote not allowed if User=Author or User=Added_by)'; 108 $lang['concours_author_vote_detail'] = '<i> 109 <ul> 110 <li style="list-style-type: none;">0- No control : All users could show and vot for any photos .</li> 111 <li style="list-style-type: none;">1- Author control : User cound not vote for photos whith same author information as user name .</li> 112 <li style="list-style-type: none;">2- Added_by control : User cound not vote for photos added by himself.</li> 113 <li style="list-style-type: none;">3- Author OR Added_by control: User cound not vote for photos whith same author information as user name or if photos are added by himself.</li> 114 </ul></i> 115 '; 116 117 98 118 $lang['concours_change_score'] = 'Atļaut lietotājam izmainīt savu vērtējumu pēc validācijas'; 99 119 $lang['concours_end_date_change_to'] = 'Beigu datums iznainīts uz %s'; … … 106 126 $lang['concours_admin_help'] = 'Ceļvedis/Palīdzība ConcoursPhoto spraudņa lietošanā'; 107 127 $lang['concours_audit_page'] = 'Konkursa Audits (pārbaude)'; 128 129 130 $lang['manage_criteria'] = 'Manage default criterias'; 131 132 133 $lang['concours_stuffs_name'] = 'Photo Contest'; 134 $lang['concours_stuffs_description'] = 'Display the result of one photo contest (podium)'; 135 136 $lang['ConcoursPhoto_Fonctionality'] = 'ConcoursPhoto spraudnis Funkcionalitātes (Functionnalities)'; 137 $lang['ConcoursPhoto_Fonctionality_txt'] = ' 138 <ul> 139 <li> 140 General Principle: On one album, allow a user list to note for photos during a set period. The result is then generated and displayed on a dedicated page accessible by users. 141 <br/> 142 Details below are steps to add a contest: 143 </li> 144 <li style="list-style-type: none;"><br/></li> 145 <li ><span class="throw"> Step 1 : Add a new contest on Piwigo:</span></li> 146 147 <li style="list-style-type: none;"></li> 148 <li style="list-style-type: none;">- Click on the "Add Contests\" tab to add 1 new contest.</li> 149 <li style="list-style-type: none;">- Enter the name and description of the contest (eg Name = "Flowers" / Description = "Contest on the theme of flowers from xx / xx to xx / xx with Black & White photos).</li> 150 <li style="list-style-type: none;">- Select Groups Allowed to note Photos (if no group is present, all users are allowed).</li> 151 <li style="list-style-type: none;">- Set the start and end time of the contest.</li> 152 <li style="list-style-type: none;">- Choose the method of calculating the result (see details below for more details).</li> 153 <li style="list-style-type: none;">- Select the album in which the photos will be present for the contest.</li> 154 <li style="list-style-type: none;">- Confirm and go to step 2.</li> 155 <li style="list-style-type: none;"><br/></li> 156 <li ><span class="throw"> Step 2 : Selection of rating criteria:</span></li> 157 <li style="list-style-type: none;">Note: The criteria of a contest are pre-initialized with the default criteria (see below to modify them)</li> 158 <li style="list-style-type: none;"></li> 159 <li style="list-style-type: none;">- Modify criteria / sub-criteria present.</li> 160 <li style="list-style-type: none;">- Or add new ones by clicking on "Add new criteria.</li> 161 <li style="list-style-type: none;"><i>To add a sub-criterion to an existing criterion, click on the icon to the right of the criterion (in the table).</i></li> 162 <li style="list-style-type: none;"><br/></li> 163 <li ><span class="throw">Step 3 : The voting period:</span></li> 164 <li style="list-style-type: none;"></li> 165 <li style="list-style-type: none;">- During the voting period, the admin page allows you to view the intermediate result by clicking on the contest (<b> Manage Contests </b> tab).</li> 166 <li style="list-style-type: none;"><br/></li> 167 <li ><span class="throw">Step 4 :Results:</span></li> 168 <li style="list-style-type: none;"></li> 169 <li style="list-style-type: none;">- At the end of the contest period, the result is generable on the admin page (<b> Manage Contests </b>).</li> 170 <li style="list-style-type: none;">- It is needed to click on the button to the right of the contest to generate the result (otherwise it will not be visible to users).</li> 171 <li style="list-style-type: none;">- After generating the result, a CSV file could be generated (click on the icon corresponding to the right of the contest).</li> 172 <li style="list-style-type: none;"><br/></li> 173 </ul>'; 174 175 176 $lang['ConcoursPhoto_Options'] = 'Options and details of plugin Concours Photo'; 177 $lang['ConcoursPhoto_Options_txt'] = ' 178 <ul> 179 <li> 180 Main options and rules for Photo Contest. 181 <br/> 182 </li> 183 <li style="list-style-type: none;"><br/></li> 184 <li ><span class="throw"> Criteria, sub-criteria and default criteria</span></li> 185 <li style="list-style-type: none;">- The default criteria are those that are loaded when creating a new contest.</li> 186 <li style="list-style-type: none;">- The criteria and sub-criteria contain the following parameters: Name / Description / Note min / Note max / coefficient multipl.</li> 187 <li style="list-style-type: none;">- When a criterion contains sub-criteria, it is the latter that are used for the notation. In this case, the main criterion is used only as grouping.</li> 188 <li style="list-style-type: none;">- You can change the default criteria at any time, they will not affect competitions already in progress or completed.</li> 189 <li style="list-style-type: none;">- You can add as many default criteria and sub-criteria as you want.</li> 190 <li style="list-style-type: none;"><br/></li> 191 <li ><span class="throw"> Methods of calculating the result</span></li> 192 <li style="list-style-type: none;">There are 4 methods of calculating the final score :</li> 193 <li style="list-style-type: none;">- "Sum" -> It corresponds to the simple sum of the scores / scores obtained per photo that defines the ranking regardless of the number of voters for the photos.</li> 194 <li style="list-style-type: none;">- "Average" -> It corresponds the average of the scores / scores obtained by photo between the voters (for the same photo) which defines the ranking.</li> 195 <li style="list-style-type: none;">- "Average (ponderation1)" -> It corresponds is the average of the scores / scores obtained per photo that defines the ranking. If a user does not vote for all the photos, they are awarded a score corresponding to the average score of the same voter</li> 196 <li style="list-style-type: none;">- "Average (ponderation2)" -> This is the average of the scores / scores obtained per photo that defines the ranking. An increase / decrease is calculated as a function of the difference between the minimum and maxi scores of the same voter. This mark-up is added to the photo\'s score before calculating the result.</li> 197 <li style="list-style-type: none;"></li> 198 <li style="list-style-type: none;"><i>Moderation 1 and 2 reduce the significant difference in score and rebalance the votes.</i></li> 199 <li style="list-style-type: none;"><br/></li> 200 <li ><span class="throw"> Use of PWG_Stuffs modules</span></li> 201 <li style="list-style-type: none;">- Once the contest is closed (<u> and the result generated </u>), the result is accessible via the link present in the piwigo menu.</li> 202 <li style="list-style-type: none;">- You can also add a module with PWG_Stuffs which allows to highlight the podium of winning photos.</li> 203 <li style="list-style-type: none;"><br/></li> 204 </ul>'; 205 206 $lang['concours_deadline'] = 'Contest deadline '; 207 $lang['concours_begin'] = 'Contest starts in'; 208 $lang['concours_deadline_days'] = ' Days '; //':' 209 $lang['concours_deadline_hours'] = ' Hours '; //':' 210 $lang['concours_deadline_mins'] = ' Minutes '; //':' 211 $lang['concours_deadline_secs'] = ' Seconds '; //'.' 212 $lang['concours_deadline_param'] = 'Display deadline contest '; 213 $lang['concours_deadline_param0'] = '0-No display'; 214 $lang['concours_deadline_param1'] = '1-Display v1'; 215 $lang['concours_deadline_param2'] = '2-Display v2'; 216 217 $lang['concours_begin'] = 'Contest begin in '; 218 $lang['mask_thumbnail'] = 'Mask thumbnails before contest start'; 219 220 $lang['concours_nb_concours_total'] = '<b>%d Contests saved </b> (<i>%d Prepared contest(s) / %d Active contest(s) / %d Closed contest(s)</i>)'; 221 $lang['concours_nb_concours_page'] = 'Number by page'; 222 $lang['concours_status'] = 'Status'; 223 $lang['concours_delete_selected'] = 'Delete the contest'; 224 $lang['concours_delete_all_closed'] = 'Delete all closed contests'; 225 $lang['concours_no_concours'] = 'No contest saved in database'; 226 $lang['concours_no_criteria'] = 'No criteria saved'; 227 228 $lang['concours_global_score_title'] = 'Global score page'; 229 $lang['concours_global_score'] = 'Click to display Global score page'; 230 $lang['concours_global_score_admin'] = 'Active global score page (all pictures)'; 231 $lang['concours_score_mode'] = 'Score display mode '; 232 $lang['concours_score_mode0'] = '0-Text mode'; 233 $lang['concours_score_mode1'] = '1-Star v1 mode'; 234 $lang['concours_notation'] = 'Global note of all contest pictures'; 235 236 $lang['CR_select_contest'] = 'Closed contest to display'; 237 $lang['closed-noresult_concours'] = 'closed contest (withouyt results)'; 238 $lang['concours_comment_short'] = 'Picture comment'; 239 $lang['concours_nbscore'] = 'Number of votes'; 240 241 $lang['prepared_concours_1'] = 'prepared '; 242 $lang['active_concours_1'] = 'actived '; 243 $lang['closed_concours_1'] = 'closed '; 244 $lang['closed_noresult_concours_1'] = 'closed (without result) '; 245 $lang['concours_allow_admin'] = 'Allow Admin'; 246 $lang['concours_overlay_text'] = 'Text to display'; 247 108 248 ?> -
extensions/ConcoursPhoto/language/sk_SK/plugin.lang.php
r9512 r32457 70 70 71 71 $lang['concours_mask_author'] = 'Zakryť autora pre pripravené neaktívne hodnotenie'; 72 $lang['concours_mask_exif'] = 'Zakryť EXIF/IPTC údaje pre pripravené neaktívne hodnotenie'; 72 //$lang['concours_mask_exif'] = 'Zakryť EXIF/IPTC údaje pre pripravené neaktívne hodnotenie'; 73 $lang['concours_mask_meta'] = 'Mask Metadata on picture for prepared inactive or active contest'; 73 74 74 75 $lang['thumbnail_global_note'] = 'Bodovanie hodnotenia'; … … 82 83 $lang['concours_method1'] = 'Súčet bodov'; 83 84 $lang['concours_method2'] = 'Priemer bodov'; 85 $lang['concours_method3'] = 'Priemer bodov (moderation type 1)'; 86 $lang['concours_method4'] = 'Priemer bodov (moderation type 2)'; 84 87 85 88 $lang['concours_note'] = 'Celkovo bodov'; … … 87 90 $lang['concours_nbvotant'] = 'Počet hlasovaní'; 88 91 $lang['concours_usernote'] = 'Vaše body'; 92 $lang['concours_moderation1'] = 'Priemer (moderation 1)'; 93 $lang['concours_moderation2'] = 'Priemer (moderation 2)'; 94 $lang['concours_warn_moderation'] = 'Warning : Average with moderation only calculated at the end of contest'; 89 95 $lang['concours_infos'] = 'Informácia o hodnotení'; 90 96 $lang['concours_audit'] = 'Kontrola'; … … 95 101 $lang['all_users'] = '-- Všetci --'; 96 102 $lang['concours_check_exaequo'] = 'Ovládanie exaequos'; 97 $lang['concours_author_vote'] = 'Povoliť autorovi fotografie hlasovať (zakázať kontrolu na používateľ/autor)'; 103 $lang['concours_author_vote'] = 'Control user/author for the contest vote : '; 104 $lang['concours_author_vote0'] = '0- No control (vote for any photos)'; 105 $lang['concours_author_vote1'] = '1- Author control (vote not allowed if User=Author)'; 106 $lang['concours_author_vote2'] = '2- Added_by control (vote not allowed if User=Added_by)'; 107 $lang['concours_author_vote3'] = '3- Author or Added_by control (vote not allowed if User=Author or User=Added_by)'; 108 $lang['concours_author_vote_detail'] = '<i> 109 <ul> 110 <li style="list-style-type: none;">0- No control : All users could show and vot for any photos .</li> 111 <li style="list-style-type: none;">1- Author control : User cound not vote for photos whith same author information as user name .</li> 112 <li style="list-style-type: none;">2- Added_by control : User cound not vote for photos added by himself.</li> 113 <li style="list-style-type: none;">3- Author OR Added_by control: User cound not vote for photos whith same author information as user name or if photos are added by himself.</li> 114 </ul></i> 115 '; 116 117 98 118 $lang['concours_change_score'] = 'Povoliť používateľovi zmeniť jeho bodovanie po kontrole'; 99 119 $lang['concours_end_date_change_to'] = 'Konečný dátum zmenený na %s'; … … 106 126 $lang['concours_admin_help'] = 'Návod/Pomoc pre doplnok ConcoursPhoto'; 107 127 $lang['concours_audit_page'] = 'Kontrola hodnotenia'; 128 129 130 $lang['manage_criteria'] = 'Manage default criterias'; 131 132 133 $lang['concours_stuffs_name'] = 'Photo Contest'; 134 $lang['concours_stuffs_description'] = 'Display the result of one photo contest (podium)'; 135 136 $lang['ConcoursPhoto_Fonctionality'] = 'Concours Photo plugin functionnalities'; 137 $lang['ConcoursPhoto_Fonctionality_txt'] = ' 138 <ul> 139 <li> 140 General Principle: On one album, allow a user list to note for photos during a set period. The result is then generated and displayed on a dedicated page accessible by users. 141 <br/> 142 Details below are steps to add a contest: 143 </li> 144 <li style="list-style-type: none;"><br/></li> 145 <li ><span class="throw"> Step 1 : Add a new contest on Piwigo:</span></li> 146 147 <li style="list-style-type: none;"></li> 148 <li style="list-style-type: none;">- Click on the "Add Contests\" tab to add 1 new contest.</li> 149 <li style="list-style-type: none;">- Enter the name and description of the contest (eg Name = "Flowers" / Description = "Contest on the theme of flowers from xx / xx to xx / xx with Black & White photos).</li> 150 <li style="list-style-type: none;">- Select Groups Allowed to note Photos (if no group is present, all users are allowed).</li> 151 <li style="list-style-type: none;">- Set the start and end time of the contest.</li> 152 <li style="list-style-type: none;">- Choose the method of calculating the result (see details below for more details).</li> 153 <li style="list-style-type: none;">- Select the album in which the photos will be present for the contest.</li> 154 <li style="list-style-type: none;">- Confirm and go to step 2.</li> 155 <li style="list-style-type: none;"><br/></li> 156 <li ><span class="throw"> Step 2 : Selection of rating criteria:</span></li> 157 <li style="list-style-type: none;">Note: The criteria of a contest are pre-initialized with the default criteria (see below to modify them)</li> 158 <li style="list-style-type: none;"></li> 159 <li style="list-style-type: none;">- Modify criteria / sub-criteria present.</li> 160 <li style="list-style-type: none;">- Or add new ones by clicking on "Add new criteria.</li> 161 <li style="list-style-type: none;"><i>To add a sub-criterion to an existing criterion, click on the icon to the right of the criterion (in the table).</i></li> 162 <li style="list-style-type: none;"><br/></li> 163 <li ><span class="throw">Step 3 : The voting period:</span></li> 164 <li style="list-style-type: none;"></li> 165 <li style="list-style-type: none;">- During the voting period, the admin page allows you to view the intermediate result by clicking on the contest (<b> Manage Contests </b> tab).</li> 166 <li style="list-style-type: none;"><br/></li> 167 <li ><span class="throw">Step 4 :Results:</span></li> 168 <li style="list-style-type: none;"></li> 169 <li style="list-style-type: none;">- At the end of the contest period, the result is generable on the admin page (<b> Manage Contests </b>).</li> 170 <li style="list-style-type: none;">- It is needed to click on the button to the right of the contest to generate the result (otherwise it will not be visible to users).</li> 171 <li style="list-style-type: none;">- After generating the result, a CSV file could be generated (click on the icon corresponding to the right of the contest).</li> 172 <li style="list-style-type: none;"><br/></li> 173 </ul>'; 174 175 176 $lang['ConcoursPhoto_Options'] = 'Options and details of plugin Concours Photo'; 177 $lang['ConcoursPhoto_Options_txt'] = ' 178 <ul> 179 <li> 180 Main options and rules for Photo Contest. 181 <br/> 182 </li> 183 <li style="list-style-type: none;"><br/></li> 184 <li ><span class="throw"> Criteria, sub-criteria and default criteria</span></li> 185 <li style="list-style-type: none;">- The default criteria are those that are loaded when creating a new contest.</li> 186 <li style="list-style-type: none;">- The criteria and sub-criteria contain the following parameters: Name / Description / Note min / Note max / coefficient multipl.</li> 187 <li style="list-style-type: none;">- When a criterion contains sub-criteria, it is the latter that are used for the notation. In this case, the main criterion is used only as grouping.</li> 188 <li style="list-style-type: none;">- You can change the default criteria at any time, they will not affect competitions already in progress or completed.</li> 189 <li style="list-style-type: none;">- You can add as many default criteria and sub-criteria as you want.</li> 190 <li style="list-style-type: none;"><br/></li> 191 <li ><span class="throw"> Methods of calculating the result</span></li> 192 <li style="list-style-type: none;">There are 4 methods of calculating the final score :</li> 193 <li style="list-style-type: none;">- "Sum" -> It corresponds to the simple sum of the scores / scores obtained per photo that defines the ranking regardless of the number of voters for the photos.</li> 194 <li style="list-style-type: none;">- "Average" -> It corresponds the average of the scores / scores obtained by photo between the voters (for the same photo) which defines the ranking.</li> 195 <li style="list-style-type: none;">- "Average (ponderation1)" -> It corresponds is the average of the scores / scores obtained per photo that defines the ranking. If a user does not vote for all the photos, they are awarded a score corresponding to the average score of the same voter</li> 196 <li style="list-style-type: none;">- "Average (ponderation2)" -> This is the average of the scores / scores obtained per photo that defines the ranking. An increase / decrease is calculated as a function of the difference between the minimum and maxi scores of the same voter. This mark-up is added to the photo\'s score before calculating the result.</li> 197 <li style="list-style-type: none;"></li> 198 <li style="list-style-type: none;"><i>Moderation 1 and 2 reduce the significant difference in score and rebalance the votes.</i></li> 199 <li style="list-style-type: none;"><br/></li> 200 <li ><span class="throw"> Use of PWG_Stuffs modules</span></li> 201 <li style="list-style-type: none;">- Once the contest is closed (<u> and the result generated </u>), the result is accessible via the link present in the piwigo menu.</li> 202 <li style="list-style-type: none;">- You can also add a module with PWG_Stuffs which allows to highlight the podium of winning photos.</li> 203 <li style="list-style-type: none;"><br/></li> 204 </ul>'; 205 206 $lang['concours_deadline'] = 'Contest deadline '; 207 $lang['concours_begin'] = 'Contest starts in'; 208 $lang['concours_deadline_days'] = ' Days '; //':' 209 $lang['concours_deadline_hours'] = ' Hours '; //':' 210 $lang['concours_deadline_mins'] = ' Minutes '; //':' 211 $lang['concours_deadline_secs'] = ' Seconds '; //'.' 212 $lang['concours_deadline_param'] = 'Display deadline contest '; 213 $lang['concours_deadline_param0'] = '0-No display'; 214 $lang['concours_deadline_param1'] = '1-Display v1'; 215 $lang['concours_deadline_param2'] = '2-Display v2'; 216 217 $lang['concours_begin'] = 'Contest begin in '; 218 $lang['mask_thumbnail'] = 'Mask thumbnails before contest start'; 219 220 $lang['concours_nb_concours_total'] = '<b>%d Contests saved </b> (<i>%d Prepared contest(s) / %d Active contest(s) / %d Closed contest(s)</i>)'; 221 $lang['concours_nb_concours_page'] = 'Number by page'; 222 $lang['concours_status'] = 'Status'; 223 $lang['concours_delete_selected'] = 'Delete the contest'; 224 $lang['concours_delete_all_closed'] = 'Delete all closed contests'; 225 $lang['concours_no_concours'] = 'No contest saved in database'; 226 $lang['concours_no_criteria'] = 'No criteria saved'; 227 228 $lang['concours_global_score_title'] = 'Global score page'; 229 $lang['concours_global_score'] = 'Click to display Global score page'; 230 $lang['concours_global_score_admin'] = 'Active global score page (all pictures)'; 231 $lang['concours_score_mode'] = 'Score display mode '; 232 $lang['concours_score_mode0'] = '0-Text mode'; 233 $lang['concours_score_mode1'] = '1-Star v1 mode'; 234 $lang['concours_notation'] = 'Global note of all contest pictures'; 235 236 $lang['CR_select_contest'] = 'Closed contest to display'; 237 $lang['closed-noresult_concours'] = 'closed contest (withouyt results)'; 238 $lang['concours_comment_short'] = 'Picture comment'; 239 $lang['concours_nbscore'] = 'Number of votes'; 240 241 $lang['prepared_concours_1'] = 'prepared '; 242 $lang['active_concours_1'] = 'actived '; 243 $lang['closed_concours_1'] = 'closed '; 244 $lang['closed_noresult_concours_1'] = 'closed (without result) '; 245 $lang['concours_allow_admin'] = 'Allow Admin'; 246 $lang['concours_overlay_text'] = 'Text to display'; 247 108 248 ?> -
extensions/ConcoursPhoto/main.inc.php
r9370 r32457 1 1 <?php 2 2 /* 3 * Plugin Name: ConcoursPhoto 4 * Version: 2.0.0 5 * Description: Concours de photo paramétrable 6 * Plugin URI: http://piwigo.org/ext/extension_view.php?eid=323 7 * Author: Tiico 8 * Author URI: 9 * */ 3 Plugin Name: ConcoursPhoto 4 Version: 11.0.0 5 Description: Concours de photo paramétrable 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=323 7 Author: Tiico 8 Author URI: 9 Has Settings: true 10 */ 10 11 /********* Fichier main.inc.php *********/ 11 12 … … 17 18 global $prefixeTable; 18 19 19 define('CONCOURS_VERSION', ' 2.0.0 [BETA]'); //20 define('CONCOURS_VERSION', '11.0.1'); // 20 21 21 22 … … 48 49 $concours = new Concours(); 49 50 51 // disable meta to picture page (if param) 52 add_event_handler('loc_begin_picture',array(&$concours, 'disable_meta_to_picture')); 53 54 50 55 // Add concours to picture page 51 56 add_event_handler('loc_end_picture', array(&$concours, 'display_concours_to_picture')); 52 // Add admin page 53 add_event_handler('get_admin_plugin_menu_links', array(&$concours, 'concours_admin_menu') );57 // Add admin page - DEPRECATED 58 //add_event_handler('get_admin_plugin_menu_links', array(&$concours, 'concours_admin_menu') ); 54 59 55 60 // MenuBar … … 59 64 add_event_handler('loc_end_section_init', array(&$concours, 'section_init_concours')); 60 65 66 // Publish result page 61 67 add_event_handler('loc_end_index', array(&$concours, 'index_concours')); 68 69 // Global vote page (with all thumbnails) 70 add_event_handler('loc_end_index', array(&$concours, 'index_vote_concours')); 71 62 72 63 73 // Add Global note under thumbnail 64 74 add_event_handler('loc_end_index_thumbnails', array(&$concours, 'thumbnail_note'), 50, 2); 75 76 // Add PWG Stuffs 77 add_event_handler('get_stuffs_modules', array(&$concours, 'concours_stuffs_module')); 78 79 // Add description with contest informations on category 80 add_event_handler ('render_category_description', array(&$concours, 'add_contest_desc'), EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 81 82 83 84 /* +-----------------------------------------------------------------------+ 85 * | CSS/JS Style | 86 * +-----------------------------------------------------------------------+ */ 87 add_event_handler('loc_end_page_header', 'ConcoursPhoto_css_js'); 88 89 function ConcoursPhoto_css_js() { 90 global $template; 91 92 $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.CONCOURS_PATH . 'template/style.css">'); 93 } 94 65 95 66 96 -
extensions/ConcoursPhoto/publish.php
r8946 r32457 35 35 'BEGIN_DATE' => $concours->concours_infos['begin_date'], 36 36 'END_DATE' => $concours->concours_infos['end_date'], 37 'METHOD' => l10n("concours_method".$concours->concours_infos['method']) 37 'METHOD' => l10n("concours_method".$concours->concours_infos['method']), 38 'METHODNB' => $concours->concours_infos['method'] 38 39 )); 39 40 … … 44 45 $concours->concours_infos['method'] = 1; 45 46 46 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img. tn_ext,img.author,47 ic.category_id, cat.name AS catname, conc.note, conc.moyenne, conc. nbvotant'47 $query = 'SELECT DISTINCT(img.id), img.name, img.file, img.path, img.author, 48 ic.category_id, cat.name AS catname, conc.note, conc.moyenne, conc.moderation1, conc.moderation2, conc.nbvotant' 48 49 .' FROM ' . IMAGES_TABLE.' AS img' 49 50 .' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON img.id = ic.image_id' … … 51 52 .' INNER JOIN '.CONCOURS_RESULT_TABLE.' AS conc ON conc.img_id = img.id' 52 53 .' WHERE ic.category_id = '.$concours->concours_infos['category'] 53 .' AND conc.id_concours = '.$concours->concours_infos['id'] 54 ; 54 .' AND conc.id_concours = '.$concours->concours_infos['id']; 55 55 56 if ($concours->concours_infos['method'] == 1) // total 57 $query .= ' ORDER BY note DESC'; 58 elseif ($concours->concours_infos['method'] == 2) // moyenne 59 $query .= ' ORDER BY moyenne DESC'; 56 57 switch ($concours->concours_infos['method']) 58 { 59 case 1 :// total 60 $query .= ' ORDER BY note DESC'; 61 break; 62 case 2 :// moyenne 63 $query .= ' ORDER BY moyenne DESC'; 64 break; 65 case 3 :// moderation1 66 $query .= ' ORDER BY moderation1 DESC'; 67 break; 68 case 4 :// moderation2 69 $query .= ' ORDER BY moderation2 DESC'; 70 break; 71 } 72 60 73 61 74 $query .=';'; … … 64 77 $rang = 1; 65 78 $previousNote = $previousMoy = 0; 66 while ($row = mysql_fetch_assoc($result))79 while ($row = pwg_db_fetch_array($result)) 67 80 { 68 81 // link on picture.php page … … 101 114 AND ($row['note'] == $previousNote)) 102 115 OR ($concours->concours_infos['method'] == 2 // moyenne 103 AND ($row['moyenne'] == $previousMoy))) 116 AND ($row['moyenne'] == $previousMoy)) 117 OR ($concours->concours_infos['method'] == 3 // moderation1 118 AND ($row['moderation1'] == $previousMoy)) 119 OR ($concours->concours_infos['method'] == 4 // moderation2 120 AND ($row['moderation2'] == $previousMoy))) 121 104 122 { 105 123 // echo "Rang=".$rang."\n"; … … 108 126 } 109 127 } 110 128 $usernote = $concours->get_img_globalnote_user($row['id'], null, null, $user['ipguest']); 111 129 $template->append( 'concours_note', array( 112 130 'img_id' => $row['id'], … … 115 133 'author' => $row['author'], 116 134 'rang' => $rang, 117 'thumb' => get_thumbnail_url($row), 135 // 'thumb' => DerivativeImage::thumb_url($row), 136 'thumb' => DerivativeImage::url(IMG_XXSMALL, $row), 118 137 'url' => $url, 119 138 'note' => ($row['note'] == 0 ? 'N/A' :$row['note']), 120 'moyenne' => ($row['moyenne'] == 0 ? 'N/A' :$row['moyenne']), 139 'moyenne' => ($row['moyenne'] == 0 ? 'N/A' : round($row['moyenne'] , 2)), 140 'moderation1' => ($row['moderation1'] == 0 ? 'N/A' : round($row['moderation1'], 2) ), 141 'moderation2' => ($row['moderation2'] == 0 ? 'N/A' : round($row['moderation2'], 2)), 121 142 'nbvotant' => $row['nbvotant'], 122 'usernote' => $concours->get_img_globalnote_user($row['id'], null, null, $user['ipguest'])143 'usernote' => ($usernote < 0 ? "N/A" : $usernote) 123 144 124 145 )); -
extensions/ConcoursPhoto/template/concours.tpl
r8946 r32457 1 {combine_css path= 'plugins/ConcoursPhoto/template/overlay.css'} 2 3 4 {if $SCORE_MODE ==1} 5 {combine_css path= 'plugins/ConcoursPhoto/template/rating1.css'} 6 {/if} 7 8 9 {if $concours_infos.deadline_type == 1} 10 11 {combine_css path= 'plugins/ConcoursPhoto/template/concours-1.css'} 12 13 {literal} 14 <script type="text/javascript"> 15 const second = 1000, 16 minute = second * 60, 17 hour = minute * 60, 18 day = hour * 24; 19 20 let countDown = new Date({/literal}'{$concours_infos.end_date}'{literal}).getTime(), 21 x = setInterval(function() { 22 23 let now = new Date().getTime(), 24 distance = countDown - now; 25 26 document.getElementById('days').innerText = Math.floor(distance / (day)), 27 document.getElementById('hours').innerText = Math.floor((distance % (day)) / (hour)), 28 document.getElementById('minutes').innerText = Math.floor((distance % (hour)) / (minute)), 29 document.getElementById('seconds').innerText = Math.floor((distance % (minute)) / second); 30 31 }, second) 32 33 34 </script> 35 {/literal} 36 37 <div class="concours"> 38 <form method="post" action="{$CONCOURS_F_ACTIONS}" class="concours"> 39 <div class="counter"> 40 <div id="head">{'concours_deadline'|@translate}</div> 41 <ul> 42 <li><span id="days"></span>{'concours_deadline_days'|@translate}</li> 43 <li><span id="hours"></span>{'concours_deadline_hours'|@translate}</li> 44 <li><span id="minutes"></span>{'concours_deadline_mins'|@translate}</li> 45 <li><span id="seconds"></span>{'concours_deadline_secs'|@translate}</li> 46 </ul> 47 </div> 48 49 50 {elseif $concours_infos.deadline_type == 2} 51 52 53 {strip} 54 55 {combine_css path='plugins/ConcoursPhoto/template/concours-2.css'} 56 {combine_script id='moment' load='footer' path='plugins/ConcoursPhoto/template/moment.js'} 57 {combine_script id='vue.min' load='footer' path='plugins/ConcoursPhoto/template/vue.min.js'} 58 {combine_script id='deadline' load='footer' require='vue.min' path='plugins/ConcoursPhoto/template/deadline.js'} 59 {/strip} 60 61 <div class="concours"> 62 <form method="post" action="{$CONCOURS_F_ACTIONS}" class="concours"> 63 <div class="counter"> 64 <div class="countdown-head">{'concours_deadline'|@translate}</div> 65 {literal} 66 67 <div id="countdown"> 68 {/literal} 69 <countdown duration="{$concours_infos.end_concours_min} second"></countdown> 70 {literal} 71 </div> 72 </div> 73 74 <template id="countdown-template"> 75 <div class="countdown"> 76 <div class="blockdeadline" :class="clDays"> 77 <div class="digit">{{ days | two_digits }}</div> 78 {/literal} 79 <div class="text">{'concours_deadline_days'|@translate}</div> 80 {literal} 81 </div> 82 <div class="blockdeadline" :class="clHours"> 83 <div class="digit">{{ hours | two_digits }}</div> 84 {/literal} 85 <div class="text">{'concours_deadline_hours'|@translate}</div> 86 {literal} 87 </div> 88 <div class="blockdeadline" :class="clMinutes"> 89 <div class="digit">{{ minutes | two_digits }}</div> 90 {/literal} 91 <div class="text">{'concours_deadline_mins'|@translate}</div> 92 {literal} 93 </div> 94 <div class="blockdeadline" :class="clSeconds"> 95 <div class="digit">{{ seconds | two_digits }}</div> 96 {/literal} 97 <div class="text">{'concours_deadline_secs'|@translate}</div> 98 </div> 99 </div> 100 </template> 101 102 103 104 {else if $concours_infos.deadline_type == 0} 105 1 106 <div class="concours"> 2 107 <form method="post" action="{$CONCOURS_F_ACTIONS}" class="concours"> 108 {/if} 109 3 110 <fieldset> 4 111 <legend>Concours Photo</legend> 112 113 {if !$CONCOURS_CHANGE_SCORE} 114 <div class="container_mod"> 115 {/if} 116 5 117 <table> 6 118 <tr> … … 9 121 </td> 10 122 <td align="right" colspan="2"> 11 {'concours_global_user_note'|@translate} : <input type="text" size="4" maxlength="4" name="global_note" value="{$concours_infos.note}" disabled="disabled"/> 123 {'concours_global_user_note'|@translate} : <b>{$concours_infos.note}</b> / {$concours_infos.max_note} 124 {if $SCORE_MODE ==1} 125 <fieldset class="rating1" align="left"> 126 {for $var={$concours_infos.max_note} to 1 step -1} 127 <input type="radio" id="star_{$concours_infos}__{$var}" name="{$concours_infos}_" value="{$var}" {if $var==$concours_infos.note}checked="checked"{/if} disabled="disabled" /> 128 <label class = "full" for="star_{$concours_infos}__{$var}" title="{$var}"></label> 129 <input type="radio" id="star_{$concours_infos}__{$var-1}_half" name="{$concours_infos}_" value="{$var-0.5}" {if $var-0.5==$concours_infos.note}checked="checked"{/if} disabled="disabled"/> 130 <label class = "half" for="star_{$concours_infos}__{$var-1}_half" title="{$var-0.5}"></label> 131 {/for} 132 </fieldset> 133 {/if} 134 12 135 </td> 13 136 <td> … … 15 138 </tr> 16 139 <tr><td colspan="5"><br></td></tr> 17 {foreach from=$concours_criteria item=concours_criteria}18 <tr >19 {if $concours_criteria .level == 1}20 <td align="left" colspan="2"><b><u>{$concours_criteria .name}</u></b> 21 (<b><i>{$concours_criteria .lib}</i></b>) </td>140 {foreach $concours_criteria as $concours_criteria1} 141 <tr align="left"> 142 {if $concours_criteria1.level == 1} 143 <td align="left" colspan="2"><b><u>{$concours_criteria1.name}</u></b> 144 (<b><i>{$concours_criteria1.lib}</i></b>) </td> 22 145 {else} 23 146 <td> </td> 24 <td><i>{$concours_criteria .name} </i></td>25 {/if} 26 {if $concours_criteria .level == 1}147 <td><i>{$concours_criteria1.name} </i></td> 148 {/if} 149 {if $concours_criteria1.level == 1} 27 150 <td align="left" > </td> 28 151 {else} 29 <td><i>{$concours_criteria.lib} </i></td> 30 {/if} 31 {if $concours_criteria.nosub} 32 <td><input type="text" size="4" maxlength="4" value="{$concours_criteria.val}" name="{$concours_criteria.id}" /></td> 33 <td><i>(Min={$concours_criteria.min} ;Max={$concours_criteria.max}) </i></td> 152 <td><i>{$concours_criteria1.lib} </i></td> 153 {/if} 154 {if $concours_criteria1.nosub} 155 <td width=200> 156 {if $SCORE_MODE == 0} 157 <input type="text" size="4" maxlength="4" value="{$concours_criteria1.val}" name="{$concours_criteria1.id}" {if !$CONCOURS_CHANGE_SCORE}disabled="disabled"{/if}/> 158 {elseif $SCORE_MODE ==1} 159 160 <fieldset class="rating"> 161 {for $var={$concours_criteria1.max} to {$concours_criteria1.min + 1} step -1} 162 <input type="radio" id="star_{$concours_criteria1.id}_{$var}" name="{$concours_criteria1.id}" value="{$var}" {if $var==$concours_criteria1.val}checked{/if} {if !$CONCOURS_CHANGE_SCORE}disabled="disabled"{/if}/> 163 <label class = "full" for="star_{$concours_criteria1.id}_{$var}" title="{$var}"></label> 164 <input type="radio" id="star_{$concours_criteria1.id}_{$var-1}_half" name="{$concours_criteria1.id}" value="{$var-0.5}" {if $var-0.5==$concours_criteria1.val}checked{/if} {if !$CONCOURS_CHANGE_SCORE}disabled="disabled"{/if}/> 165 <label class = "half" for="star_{$concours_criteria1.id}_{$var-1}_half" title="{$var-0.5}"></label> 166 {/for} 167 </fieldset> 168 169 {****** 170 <section id="rateConcours" class="ratingConcours"> 171 {for $var={$concours_criteria1.max} to {$concours_criteria1.min} step -1} 172 <input type="radio" id="star_{$concours_criteria1.id}_{$var}" name="{$concours_criteria1.id}" value="{$var}" {if $var==$concours_criteria1.val}checked{/if}/> 173 <label for="star_{$concours_criteria1.id}_{$var}" title="{$var}">★</label> 174 {/for} 175 </section> 176 ******} 177 178 179 {/if} 180 </td> 181 182 <td><i>(Min={$concours_criteria1.min} ;Max={$concours_criteria1.max}) </i></td> 34 183 {else} 35 184 <td colspan="2"> </td> … … 41 190 <td colspan="2">{'concours_comment'|@translate} </td> 42 191 <td colspan="3"> 43 <textarea cols="50" rows="4" name="concours_comment" id="concours_comment" >{$CONCOURS_COMMENT}</textarea>192 <textarea cols="50" rows="4" name="concours_comment" id="concours_comment" {if !$CONCOURS_CHANGE_SCORE}disabled="disabled"{/if}>{$CONCOURS_COMMENT} </textarea> 44 193 </td> 45 194 </tr> 46 195 196 197 {if !$CONCOURS_CHANGE_SCORE} 198 <div class="middle_mod"> 199 <div class="text_mod">{$TEXT_OVERLAY}</div><br> 200 <div class="text_mod">{$TEXT_OVERLAY}</div><br> 201 </div> 202 {/if} 47 203 </table> 204 {if !$CONCOURS_CHANGE_SCORE} 205 </div>{/if} 206 48 207 <p> 49 208 {if $CONCOURS_CHANGE_SCORE} -
extensions/ConcoursPhoto/template/concours_menu.tpl
r8946 r32457 1 <dt>{'Concours'|@translate}</dt> 2 <dd> 3 <ul>{strip} 4 {foreach from=$block->data item=link} 5 {if is_array($link)} 6 <li><a href="{$link.URL}" title="{$link.TITLE}"{if isset($link.REL)} {$link.REL}{/if}>{$link.NAME}</a>{if isset($link.COUNTER)} ({$link.COUNTER}){/if} 7 {if $link.edit!=""} [<a href="{$link.edit}">{"concours_admin_edit"|@translate}</a>] 8 {/if} 9 </li> 1 10 2 {if isset($block->data) and count($block->data)} 3 <!-- Concours menu bar --> 4 {if $block->get_title() !="" } 5 <dt>{$block->get_title()}</dt> 6 {/if} 7 <dd> 8 <ul> 9 {foreach from=$block->data key=name item=link} 10 <li> 11 {$link.nfo}<a href="{$link.link}">{$link.text}</a> 12 {if $link.edit!=""} [<a href="{$link.edit}">{"concours_admin_edit"|@translate}</a>] 13 {/if} 14 </li> 15 {/foreach} 16 </ul> 17 </dd> 18 {/if} 11 {/if} 12 {/foreach} 13 {/strip}</ul> 14 </dd> 15 16 17 18 -
extensions/ConcoursPhoto/template/result.tpl
r8946 r32457 16 16 <table> 17 17 <tr><td colspan="5"><br></td></tr> 18 {foreach from=$concours_note item=concours_note}18 {foreach $concours_note as $concours_note1} 19 19 <tr> 20 <td><b><i> {if $concours_note .nbvotant != 0}21 ({$concours_note .rang}{if $concours_note.rang == 1}{'concours_1st'|@translate}22 {elseif $concours_note .rang == 2}{'concours_2nd'|@translate}23 {elseif $concours_note .rang == 3}{'concours_3rd'|@translate}20 <td><b><i> {if $concours_note1.nbvotant != 0} 21 ({$concours_note1.rang}{if $concours_note1.rang == 1}{'concours_1st'|@translate} 22 {elseif $concours_note1.rang == 2}{'concours_2nd'|@translate} 23 {elseif $concours_note1.rang == 3}{'concours_3rd'|@translate} 24 24 {else}{'concours_4th'|@translate}{/if} 25 25 ) 26 26 {else}(N/A){/if} </i></b></td> 27 <td><b>Photo {$concours_note .img_id} </b></td>28 <td >29 <a href="{$concours_note .url}">30 <img class="thumbnail" src="{$concours_note .thumb}" alt="{$concours_note.name}" title="{$concours_note.name}"/>27 <td><b>Photo {$concours_note1.img_id} </b></td> 28 <td align="center"> 29 <a href="{$concours_note1.url}"> 30 <img class="thumbnail" src="{$concours_note1.thumb}" alt="{$concours_note1.name}" title="{$concours_note1.name}"/> 31 31 </a> 32 <br><u>{'concours_name'|@translate}</u> : {$concours_note .name}33 <br><u>{'concours_author'|@translate}</u> : {$concours_note .author}32 <br><u>{'concours_name'|@translate}</u> : {$concours_note1.name} 33 <br><u>{'concours_author'|@translate}</u> : {$concours_note1.author} 34 34 </td> 35 35 <td> 36 36 <fieldset> 37 <i>{'concours_note'|@translate} : <b>{$concours_note.note}</b> </i> 38 <br><i>{'concours_moyenne'|@translate} : <b>{$concours_note.moyenne}</b> </i> 39 <br><i>{'concours_nbvotant'|@translate} : {$concours_note.nbvotant} </i> 37 {if ($CONCOURS.METHODNB == 1)} 38 <i><b>{'concours_note'|@translate} : {$concours_note1.note}</b> </i> 39 {else} 40 <i>{'concours_note'|@translate} : {$concours_note1.note} </i> 41 {/if} 42 {if ($CONCOURS.METHODNB == 2)} 43 <br><i><b>{'concours_moyenne'|@translate} : {$concours_note1.moyenne}</b> </i> 44 {else} 45 <br><i>{'concours_moyenne'|@translate} : {$concours_note1.moyenne} </i> 46 {/if} 47 {if ($CONCOURS.METHODNB == 3)} 48 <br><i><b>{'concours_moderation1'|@translate} : {$concours_note1.moderation1}</b> </i> 49 {else} 50 <br><i>{'concours_moderation1'|@translate} : {$concours_note1.moderation1} </i> 51 {/if} 52 {if ($CONCOURS.METHODNB == 4)} 53 <br><i><b>{'concours_moderation2'|@translate} : {$concours_note1.moderation2}</b> </i> 54 {else} 55 <br><i>{'concours_moderation2'|@translate} : {$concours_note1.moderation2} </i> 56 {/if} 40 57 <br> 41 <br>{'concours_usernote'|@translate} : <b>{$concours_note.usernote}</b> 58 <br><i>{'concours_nbvotant'|@translate} : {$concours_note1.nbvotant} </i> 59 <br> 60 <br> ==> {'concours_usernote'|@translate} : <b>{$concours_note1.usernote}</b> 42 61 </fieldset> 43 62 </td> 44 {if $concours_note .rang > 3}63 {if $concours_note1.rang > 3} 45 64 <td> </td> 46 65 {else} 47 <td><img src="{$IMG_URL}trophee-{$concours_note .rang}.png" width="75" height="75"></td>66 <td><img src="{$IMG_URL}trophee-{$concours_note1.rang}.png" width="75" height="75"></td> 48 67 {/if} 49 68 </tr>
Note: See TracChangeset
for help on using the changeset viewer.