1 | <?php |
---|
2 | if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // Suppression d'un concours |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | if (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 | $page['infos'][] = l10n('CR_contest_deleted'); |
---|
11 | } |
---|
12 | |
---|
13 | if (isset($_GET['msg'])){ |
---|
14 | $_GET['msg'] = explode('.', $_GET['msg']); |
---|
15 | $page[$_GET['msg'][0]][] = l10n('CR_'. $_GET['msg'][1]); |
---|
16 | } |
---|
17 | |
---|
18 | // +-----------------------------------------------------------------------+ |
---|
19 | // Affichage des concours |
---|
20 | // +-----------------------------------------------------------------------+ |
---|
21 | $contests = pwg_query("SELECT |
---|
22 | id, |
---|
23 | name, |
---|
24 | visible, |
---|
25 | date_begin, |
---|
26 | date_end, |
---|
27 | logo |
---|
28 | FROM " . CR_TABLE_1 . " |
---|
29 | ORDER BY date_begin DESC;"); |
---|
30 | |
---|
31 | while ($contest = pwg_db_fetch_assoc($contests)) { |
---|
32 | $contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end'])); |
---|
33 | |
---|
34 | $template->append('contests_'.$contest['status'], array( |
---|
35 | 'NAME' => trigger_event('render_CR_content', $contest['name']), |
---|
36 | 'VISIBLE' => $contest['visible'], |
---|
37 | 'DATE_BEGIN' => format_date($contest['date_begin']), |
---|
38 | 'DATE_END' => format_date($contest['date_end']), |
---|
39 | 'LOGO' => $contest['logo'], |
---|
40 | 'U_RESULTS' => CR_ADMIN . '-results&contest_id=' . $contest['id'], |
---|
41 | 'U_EDIT' => CR_ADMIN . '-edit&contest_id=' . $contest['id'], |
---|
42 | 'U_DELETE' => CR_ADMIN . '-manage&delete_contest=' . $contest['id'], |
---|
43 | 'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])), |
---|
44 | 'DAYS' => $contest['days'], |
---|
45 | )); |
---|
46 | } |
---|
47 | |
---|
48 | // +-----------------------------------------------------------------------+ |
---|
49 | // Template |
---|
50 | // +-----------------------------------------------------------------------+ |
---|
51 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/manage.tpl')); |
---|
52 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
53 | |
---|
54 | ?> |
---|