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 | redirect(CR_ADMIN .'&tab=manage&msg=deleted'); |
---|
11 | } |
---|
12 | |
---|
13 | if (isset($_GET['msg'])){ |
---|
14 | array_push($page['infos'], l10n('CR_contest_'. $_GET['msg'])); |
---|
15 | } |
---|
16 | |
---|
17 | // +-----------------------------------------------------------------------+ |
---|
18 | // Affichage des concours |
---|
19 | // +-----------------------------------------------------------------------+ |
---|
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;"); |
---|
25 | |
---|
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 | )); |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | // +-----------------------------------------------------------------------+ |
---|
42 | // Template |
---|
43 | // +-----------------------------------------------------------------------+ |
---|
44 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/manage.tpl')); |
---|
45 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
46 | ?> |
---|