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/admin/manage.php

    r9419 r9572  
    1818//                              Affichage des concours
    1919// +-----------------------------------------------------------------------+
    20 foreach (array('pending','finished') AS $status) {
    21         $result = pwg_query("SELECT id, name, visible, date_begin, date_end, logo
    22                 FROM " . CR_TABLE_1 . "
    23                 WHERE status = '" . $status . "'
    24                 ORDER BY date_begin DESC;");
     20$contests = pwg_query("SELECT
     21                id,
     22                name,
     23                visible,
     24                date_begin,
     25                date_end,
     26                logo
     27        FROM " . CR_TABLE_1 . "
     28        ORDER BY date_begin DESC;");
    2529
    26         while ($contest = pwg_db_fetch_assoc($result)) {
    27                 $template->append('contests_'.$status, array(
    28                         'NAME' => trigger_event('render_CR_content', $contest['name']),
    29                         'VISIBLE' => $contest['visible'],
    30                         'DATE_BEGIN' => format_date($contest['date_begin']),
    31                         'DATE_END' => format_date($contest['date_end']),
    32                         'LOGO' => $contest['logo'],
    33                         'U_RESULTS' => CR_ADMIN . '&tab=results&contest_id=' . $contest['id'],
    34                         'U_EDIT' => CR_ADMIN . '&tab=edit&contest_id=' . $contest['id'],
    35                         'U_DELETE' => CR_ADMIN . '&delete_contest=' . $contest['id'],
    36                         'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
    37                 ));
     30while ($contest = pwg_db_fetch_assoc($contests)) {
     31        if (is_date_passed($contest['date_end'])) {
     32                $contest['status'] = 'finished';
     33        } else {
     34                $contest['status'] = 'pending';
    3835        }
     36        $template->append('contests_'.$contest['status'], array(
     37                'NAME' => trigger_event('render_CR_content', $contest['name']),
     38                'VISIBLE' => $contest['visible'],
     39                'DATE_BEGIN' => format_date($contest['date_begin']),
     40                'DATE_END' => format_date($contest['date_end']),
     41                'LOGO' => $contest['logo'],
     42                'U_RESULTS' => CR_ADMIN . '&tab=results&contest_id=' . $contest['id'],
     43                'U_EDIT' => CR_ADMIN . '&tab=edit&contest_id=' . $contest['id'],
     44                'U_DELETE' => CR_ADMIN . '&delete_contest=' . $contest['id'],
     45                'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
     46                'DAYS' => DateDiff($contest['date_end'],date('Y-m-d')),
     47        ));
    3948}
    4049
Note: See TracChangeset for help on using the changeset viewer.