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

Last change on this file since 6768 was 6768, checked in by mistic100, 14 years ago
File size: 1.9 KB
Line 
1<?php
2if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4// +-----------------------------------------------------------------------+
5//                      Suppression d'un concours
6// +-----------------------------------------------------------------------+
7if(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// +-----------------------------------------------------------------------+
16foreach(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?>
Note: See TracBrowser for help on using the repository browser.