source: extensions/ContestResults/admin/manage.php @ 9572

Last change on this file since 9572 was 9572, checked in by mistic100, 13 years ago

[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 size: 2.2 KB
Line 
1<?php
2if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4// +-----------------------------------------------------------------------+
5//                              Suppression d'un concours
6// +-----------------------------------------------------------------------+
7if (isset($_GET['delete_contest'])) {
8        pwg_query('DELETE FROM ' . CR_TABLE_1 . ' WHERE id = ' . $_GET['delete_contest'] . ';');
9        pwg_query('DELETE FROM ' . CR_TABLE_2 . ' WHERE contest_id = ' . $_GET['delete_contest'] . ';');
10        redirect(CR_ADMIN .'&amp;tab=manage&amp;msg=deleted');
11}
12
13if (isset($_GET['msg'])){
14        array_push($page['infos'], l10n('CR_contest_'. $_GET['msg']));
15}
16
17// +-----------------------------------------------------------------------+
18//                              Affichage des concours
19// +-----------------------------------------------------------------------+
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;");
29
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';
35        }
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 . '&amp;tab=results&amp;contest_id=' . $contest['id'],
43                'U_EDIT' => CR_ADMIN . '&amp;tab=edit&amp;contest_id=' . $contest['id'],
44                'U_DELETE' => CR_ADMIN . '&amp;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        ));
48}
49
50// +-----------------------------------------------------------------------+
51//                              Template
52// +-----------------------------------------------------------------------+
53$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/manage.tpl'));
54$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
55?>
Note: See TracBrowser for help on using the repository browser.