Ignore:
Timestamp:
Mar 17, 2011, 8:25:13 PM (13 years ago)
Author:
mistic100
Message:

[extensions] Contest Results

  • New bloc for PWG Stuffs
  • Use new admin links and javascript implementation
  • Distinguish pending and running contests (both pending before)
File:
1 edited

Legend:

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

    r9572 r9745  
    1414        'menubar_block' => array(
    1515                'number' => 5
    16         )
     16        ),
     17        'truncate_summary' => 350,
    1718)));
    1819
    19 // Installtion
     20// Installation
    2021function plugin_install() {
    2122        global $prefixeTable;
     
    2930                `logo` VARCHAR( 255 ) NULL ,
    3031                `banner` VARCHAR( 255 ) NULL ,
     32                `summary` TEXT NULL ,
    3133                `description` TEXT NULL ,
    3234                PRIMARY KEY ( `id` )
    33         );");
     35        ) DEFAULT CHARSET=utf8;");
    3436       
    3537        pwg_query("CREATE TABLE `" . $prefixeTable . "contests_results` (
     
    4042                `comment` TEXT NULL,
    4143                UNIQUE ( `image_id` , `contest_id` )
    42         );");
     44        ) DEFAULT CHARSET=utf8;");
    4345       
    4446        pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');");
     
    4951        global $conf, $prefixeTable;
    5052
    51         // compatibilité avec les versions < 1.1 (ajout d'une entrée de configuration)
    52         if (!isset($conf['ContestResults'])) {
    53                 pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');");
    54         }
    55        
    56         // compatibilité avec les versions < 1.2 (suppression option d'affichage)
    57         $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'presentation_display'");
    58         if (pwg_db_num_rows($field)) {
    59                 pwg_query("ALTER TABLE `" . $prefixeTable . "contests`
    60                         DROP `presentation_display`,
    61                         DROP `rules_display`,
    62                         DROP `prices_display`,
    63                         DROP `final_display`;"
    64                 );
    65         }
    66        
    67         // compatibilité avec les versions < 1.3 (suppression option status, regroupement des champs de description)
    68         $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'status'");
    69         if (pwg_db_num_rows($field)) {
    70                 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `status`");
    71                 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` ADD `description` TEXT NULL");
    72                
    73                 $contests = pwg_query("SELECT * FROM `" . $prefixeTable . "contests`");
    74                 while ($contest = pwg_db_fetch_assoc($contests)) {
    75                         $new_description = array();
    76                         if (!empty($contest['presentation'])) {
    77                                 $new_description[] = array(
    78                                         'name' => 'Presentation[lang=fr]Présentation[/lang][lang=es]Presentación[/lang][lang=lv]Prezentacija[/lang]',
    79                                         'content' => $contest['presentation'],
    80                                 );
    81                         }
    82                         if (!empty($contest['rules'])) {
    83                                 $new_description[] = array(
    84                                         'name' => 'Rules[lang=fr]Règles[/lang][lang=es]Restricciones[/lang][lang=lv]Noteikumi[/lang]',
    85                                         'content' => $contest['rules'],
    86                                 );
    87                         }
    88                         if (!empty($contest['prices'])) {
    89                                 $new_description[] = array(
    90                                         'name' => 'Prices[lang=fr]Prix[/lang][lang=es]Precios[/lang][lang=lv]Cenas[/lang]',
    91                                         'content' => $contest['prices'],
    92                                 );
    93                         }
    94                         if (!empty($contest['final'])) {
    95                                 $new_description[] = array(
    96                                         'name' => 'Conclusion[lang=fr]Conclusion[/lang][lang=es]Conclusión[/lang][lang=lv]Beigsana[/lang]',
    97                                         'content' => $contest['final'],
    98                                 );
    99                         }
    100                
    101                         $new_description = base64_encode(serialize($new_description));
    102                         pwg_query("UPDATE `" . $prefixeTable . "contests`
    103                                 SET description = '". $new_description ."'
    104                                 WHERE id = ". $contest['id'] .";"
    105                         );
    106                 }
    107                
    108                 pwg_query("ALTER TABLE `" . $prefixeTable . "contests`
    109                         DROP `presentation`,
    110                         DROP `rules`,
    111                         DROP `prices`,
    112                         DROP `final`;"
    113                 );
    114         }
    115        
     53        include('include/compatibility.inc.php');
    11654}
    11755
Note: See TracChangeset for help on using the changeset viewer.