1 | <?php |
---|
2 | if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // Suppression d'un concours |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | if(isset($_GET['delete'])){ |
---|
8 | pwg_query('DELETE FROM ' . CR_TABLE_1 . ' WHERE id = ' . $_GET['delete'] . ';'); |
---|
9 | pwg_query('DELETE FROM ' . CR_TABLE_2 . ' WHERE contest_id = ' . $_GET['delete'] . ';'); |
---|
10 | redirect(CR_ADMIN); |
---|
11 | } |
---|
12 | |
---|
13 | // +-----------------------------------------------------------------------+ |
---|
14 | // Affichage des concours |
---|
15 | // +-----------------------------------------------------------------------+ |
---|
16 | foreach(array('pending','finished') AS $status){ |
---|
17 | $query = "SELECT id, name, visible, date_begin, date_end, logo |
---|
18 | FROM " . CR_TABLE_1 . " |
---|
19 | WHERE status = '" . $status . "' |
---|
20 | ORDER BY date_begin DESC;"; |
---|
21 | $result = pwg_query($query); |
---|
22 | |
---|
23 | while($contest = pwg_db_fetch_assoc($result)){ |
---|
24 | $template->append('contests_'.$status, array( |
---|
25 | 'NAME' => trigger_event('render_CR_content', $contest['name']), |
---|
26 | 'VISIBLE' => $contest['visible'], |
---|
27 | 'DATE_BEGIN' => format_date($contest['date_begin']), |
---|
28 | 'DATE_END' => format_date($contest['date_end']), |
---|
29 | 'LOGO' => $contest['logo'], |
---|
30 | 'U_RESULTS' => CR_ADMIN . '&tab=results&contest_id=' . $contest['id'], |
---|
31 | 'U_EDIT' => CR_ADMIN . '&tab=edit&contest_id=' . $contest['id'], |
---|
32 | 'U_DELETE' => CR_ADMIN . '&delete=' . $contest['id'], |
---|
33 | 'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])), |
---|
34 | )); |
---|
35 | } |
---|
36 | } |
---|
37 | |
---|
38 | // +-----------------------------------------------------------------------+ |
---|
39 | // Template |
---|
40 | // +-----------------------------------------------------------------------+ |
---|
41 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/manage.tpl')); |
---|
42 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
43 | ?> |
---|