Ignore:
Timestamp:
Aug 20, 2010, 12:33:47 PM (14 years ago)
Author:
mistic100
Message:

Fixs some errors. Add results previews. Code revision.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContestResults/main.inc.php

    r6768 r6782  
    2525define('CR_PUBLIC', make_index_url(array('section' => 'contests')) . '/');
    2626
     27
     28// +-----------------------------------------------------------------------+
     29//                              Trigger
     30// +-----------------------------------------------------------------------+
     31add_event_handler('get_admin_plugin_menu_links', 'CR_admin_menu');      // Lien d'administration
     32add_event_handler('loc_end_section_init', 'CR_section_init');           // Paramètre URL
     33add_event_handler('loc_end_index', 'CR_index');                                         // Contenu du la page
     34add_event_handler('loc_end_picture', 'CR_comment_picture', 10);         // Commentaire sur la page image
     35
     36$ED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
     37if($ED['state'] == 'active') add_event_handler('render_CR_content', 'get_user_language_desc');  // Textes multilangues
     38
     39// Langues
     40load_language('plugin.lang', CR_PATH);
     41
    2742// Gestion du menu
    2843include(CR_PATH . 'include/cr_menubar.php');
     
    3954// Paramètre URL
    4055function CR_section_init(){
    41     global $tokens, $page;
    42         load_language('plugin.lang', CR_PATH);
     56    global $tokens, $page, $conf;
     57        include(CR_PATH . 'include/functions.php');
     58       
    4359    if($tokens[0] == 'contests'){
    4460                $page['section'] = 'contests';
     
    4763                        $page['contest'] = explode('-', $tokens[1]);
    4864                        $page['contest'] = $page['contest'][0];
    49                         $page['title'] .= trigger_event('render_CR_content', get_contest_name($page['contest']));
     65                        $page['title'] .= $conf['level_separator'] . trigger_event('render_CR_content', get_contest_name($page['contest']));
    5066                }
    5167        }
     
    5470// Contenu du la page
    5571function CR_index(){
    56     global $template, $page, $conf, $menu;
     72    global $template, $page, $conf;
    5773    if(isset($page['section']) and $page['section'] == 'contests'){
    58                 include(CR_PATH . 'include/functions.php');
    5974                if(isset($page['contest']))
    6075                        include(CR_PATH . 'include/cr_page.php');
     
    6782function CR_comment_picture(){
    6883        global $page, $template, $conf;
    69         include(CR_PATH . 'include/functions.php');
    7084        include(CR_PATH . 'include/cr_comment_picture.php'); 
    7185}
    7286
    73 function get_contest_name($contest){
    74         global $conf;
    75         $query = pwg_query("SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $contest . ";");
    76         if(pwg_db_num_rows($query)){
    77                 $result = pwg_db_fetch_assoc($query);
    78                 return $conf['level_separator'] . $result['name'];
    79         }else{
    80                 return null;
    81         }
    82 }
    83 
    84 add_event_handler('get_admin_plugin_menu_links', 'CR_admin_menu'); // Lien d'administration
    85 add_event_handler('loc_end_section_init', 'CR_section_init'); // Paramètre URL
    86 add_event_handler('loc_end_index', 'CR_index'); // Contenu du la page
    87 add_event_handler('loc_end_picture', 'CR_comment_picture', 10); // Ajoute le commentaire sur la page image
    88 add_event_handler('render_CR_content', 'get_user_language_desc'); // Textes multilangues
    89 
    9087?>
Note: See TracChangeset for help on using the changeset viewer.