Ignore:
Timestamp:
Feb 13, 2011, 11:12:58 AM (13 years ago)
Author:
mistic100
Message:

ContestResults :

  • Code revision
  • Add Letton (lv_LV) language, thanks to Aivars Baldone
  • Delete display options
  • Fix languages bugs
  • Improve public appearence
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContestResults/include/cr_page.php

    r6782 r9200  
    33
    44// +-----------------------------------------------------------------------+
    5 //                      Page d'un concours
     5//                              Page d'un concours
    66// +-----------------------------------------------------------------------+
    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']);
     7if (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']);
    1010}
    1111
    1212// 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'] . ";");
    1614
    17 if(pwg_db_num_rows($results) AND ($contest['visible'] OR is_admin())){
     15if (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       
    1823        // Paramètres généraux
    1924        $template->assign(array(
     
    2934        ));
    3035       
    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) {
    3638                $template->assign(strtoupper($key), trigger_event('render_CR_content', $contest[$key]));
    3739        }
    3840       
    3941        // Affichage des résultats
    40         if($contest['status'] == 'finished'){
     42        if ($contest['status'] == 'finished') {
    4143                // 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;");
    4445               
    45                 while($result = pwg_db_fetch_assoc($results)){
     46                while ($result = pwg_db_fetch_assoc($results)) {
    4647                        // Infos de l'image
    4748                        $query = "SELECT
     
    5960
    6061                        // retrieving category informations
    61                         $query = "SELECT id, name, permalink, uppercats
     62                        $query = "SELECT
     63                                        id,
     64                                        name,
     65                                        permalink,
     66                                        uppercats
    6267                                FROM " . CATEGORIES_TABLE."
    6368                                WHERE id = " . $image['category_id'] . ";";
     
    7277                       
    7378                        // Template
    74                         if(in_array($result['rank'], array(1,2,3))){
     79                        if (in_array($result['rank'], array(1,2,3))) {
    7580                                $data = array(
    7681                                        'RANK' => $result ['rank'],
     
    8085                                        'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'],
    8186                                        'COMMENT' => CR_cut_string(trigger_event('render_CR_content', $result['comment']), 450),
    82                                         );
     87                                );
    8388                        }else{
    8489                                $data = array(
     
    96101        $template->set_filenames(array('index'=> dirname(__FILE__).'/../template/cr_page.tpl'));
    97102       
    98 }else{
     103} else {
    99104        page_not_found(l10n('CR_notavailable'));
    100105}
Note: See TracChangeset for help on using the changeset viewer.