Ignore:
Timestamp:
Mar 8, 2011, 1:19:06 PM (13 years ago)
Author:
mistic100
Message:

[extensions] ContestResults 1.3

  • Add error and success messages on admin page
  • Add Spain (es_ES) thanks to jpr928
  • Contest status is automatic and shows remaining days
  • More flexibility for description fields
  • Compatibility with Piwigo 2.2.0
File:
1 edited

Legend:

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

    r9200 r9572  
    1515if (pwg_db_num_rows($contest)) {
    1616        $contest = pwg_db_fetch_assoc($contest);
     17        $contest['finished'] = is_date_passed($contest['date_end']);
    1718       
    1819        // Concours non-publique
     
    2526                'ID' => $contest['id'],
    2627                'NAME' => trigger_event('render_CR_content', $contest['name']),
    27                 'STATUS' => $contest['status'],
    2828                'VISIBLE' => $contest['visible'],
     29                'FINISHED' => $contest['finished'],
    2930                'DATE_BEGIN' => format_date($contest['date_begin']),
    3031                'DATE_END' => format_date($contest['date_end']),
     
    3233                'BANNER' => $contest['banner'],
    3334                'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
     35                'DAYS' => DateDiff($contest['date_end'], date('Y-m-d')),
    3436        ));
    3537       
    3638        // Les quatre zones texte
    37         foreach (array('presentation','rules','prices','final') AS $key) {
    38                 $template->assign(strtoupper($key), trigger_event('render_CR_content', $contest[$key]));
     39        if (!empty($contest['description'])) {
     40                $contest['description'] = unserialize(base64_decode($contest['description']));
     41                foreach ($contest['description'] as $desc) {
     42                        $template->append('description', array(
     43                                'NAME' => trigger_event('render_CR_content', stripslashes($desc['name'])),
     44                                'CONTENT' => trigger_event('render_CR_content', stripslashes($desc['content'])),
     45                        ));
     46                }
    3947        }
    4048       
    4149        // Affichage des résultats
    42         if ($contest['status'] == 'finished') {
     50        if ($contest['finished'] == true) {
    4351                // Infos des résultats
    4452                $results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id=" . $contest['id'] . " ORDER BY rank ASC;");
Note: See TracChangeset for help on using the changeset viewer.