Changeset 9200 for extensions/ContestResults/include/cr_page.php
- Timestamp:
- Feb 13, 2011, 11:12:58 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ContestResults/include/cr_page.php
r6782 r9200 3 3 4 4 // +-----------------------------------------------------------------------+ 5 // Page d'un concours5 // Page d'un concours 6 6 // +-----------------------------------------------------------------------+ 7 if (is_admin()){8 $template->assign('U_EDIT', CR_ADMIN . '& tab=edit&contest_id=' . $page['contest']);9 $template->assign('U_RESULTS', CR_ADMIN . '& tab=results&contest_id=' . $page['contest']);7 if (is_admin()) { 8 $template->assign('U_EDIT', CR_ADMIN . '&tab=edit&contest_id=' . $page['contest'] . '&redirect=page'); 9 $template->assign('U_RESULTS', CR_ADMIN . '&tab=results&contest_id=' . $page['contest']); 10 10 } 11 11 12 12 // Infos du concours 13 $query = "SELECT * FROM " . CR_TABLE_1 . " WHERE id=" . $page['contest'] . ";"; 14 $results = pwg_query($query); 15 $contest = pwg_db_fetch_assoc($results); 13 $contest = pwg_query("SELECT * FROM " . CR_TABLE_1 . " WHERE id=" . $page['contest'] . ";"); 16 14 17 if(pwg_db_num_rows($results) AND ($contest['visible'] OR is_admin())){ 15 if (pwg_db_num_rows($contest)) { 16 $contest = pwg_db_fetch_assoc($contest); 17 18 // Concours non-publique 19 if (!$contest['visible']) { 20 check_status(ACCESS_ADMINISTRATOR); 21 } 22 18 23 // Paramètres généraux 19 24 $template->assign(array( … … 29 34 )); 30 35 31 // Quatre zones texte 32 foreach(array('presentation','rules','prices','final') AS $key){ 33 $contest[$key.'_display'] = unserialize($contest[$key.'_display']); 34 if($contest[$key.'_display']['pending']) $template->assign(strtoupper($key).'_PENDING', true); 35 if($contest[$key.'_display']['finished']) $template->assign(strtoupper($key).'_FINISHED', true); 36 // Les quatre zones texte 37 foreach (array('presentation','rules','prices','final') AS $key) { 36 38 $template->assign(strtoupper($key), trigger_event('render_CR_content', $contest[$key])); 37 39 } 38 40 39 41 // Affichage des résultats 40 if ($contest['status'] == 'finished'){42 if ($contest['status'] == 'finished') { 41 43 // Infos des résultats 42 $query = "SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id=" . $contest['id'] . " ORDER BY rank ASC;"; 43 $results = pwg_query($query); 44 $results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id=" . $contest['id'] . " ORDER BY rank ASC;"); 44 45 45 while ($result = pwg_db_fetch_assoc($results)){46 while ($result = pwg_db_fetch_assoc($results)) { 46 47 // Infos de l'image 47 48 $query = "SELECT … … 59 60 60 61 // retrieving category informations 61 $query = "SELECT id, name, permalink, uppercats 62 $query = "SELECT 63 id, 64 name, 65 permalink, 66 uppercats 62 67 FROM " . CATEGORIES_TABLE." 63 68 WHERE id = " . $image['category_id'] . ";"; … … 72 77 73 78 // Template 74 if (in_array($result['rank'], array(1,2,3))){79 if (in_array($result['rank'], array(1,2,3))) { 75 80 $data = array( 76 81 'RANK' => $result ['rank'], … … 80 85 'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'], 81 86 'COMMENT' => CR_cut_string(trigger_event('render_CR_content', $result['comment']), 450), 82 87 ); 83 88 }else{ 84 89 $data = array( … … 96 101 $template->set_filenames(array('index'=> dirname(__FILE__).'/../template/cr_page.tpl')); 97 102 98 } else{103 } else { 99 104 page_not_found(l10n('CR_notavailable')); 100 105 }
Note: See TracChangeset
for help on using the changeset viewer.