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

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

[extensions] Contest Results

  • New bloc for PWG Stuffs
  • Use new admin links and javascript implementation
  • Distinguish pending and running contests (both pending before)
File size: 2.2 KB
RevLine 
[6768]1<?php
2if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4// +-----------------------------------------------------------------------+
[9200]5//                              Suppression d'un concours
[6768]6// +-----------------------------------------------------------------------+
[9200]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'] . ';');
[9745]10        $page['infos'][] = l10n('CR_contest_deleted');
[6768]11}
12
[9419]13if (isset($_GET['msg'])){
[9745]14        $_GET['msg'] = explode('.', $_GET['msg']);
15        $page[$_GET['msg'][0]][] = l10n('CR_'. $_GET['msg'][1]);
[9419]16}
17
[6768]18// +-----------------------------------------------------------------------+
[9200]19//                              Affichage des concours
[6768]20// +-----------------------------------------------------------------------+
[9572]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;");
[6768]30
[9572]31while ($contest = pwg_db_fetch_assoc($contests)) {
[9745]32        $contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end']));
33
[9572]34        $template->append('contests_'.$contest['status'], array(
[9745]35                'NAME' =>               trigger_event('render_CR_content', $contest['name']),
36                'VISIBLE' =>    $contest['visible'],
[9572]37                'DATE_BEGIN' => format_date($contest['date_begin']),
[9745]38                'DATE_END' =>   format_date($contest['date_end']),
39                'LOGO' =>               $contest['logo'],
40                'U_RESULTS' =>  CR_ADMIN . '-results&amp;contest_id=' . $contest['id'],
41                'U_EDIT' =>     CR_ADMIN . '-edit&amp;contest_id=' . $contest['id'],
42                'U_DELETE' =>   CR_ADMIN . '-manage&amp;delete_contest=' . $contest['id'],
43                'URL' =>                CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
44                'DAYS' =>               $contest['days'],
[9572]45        ));
[6768]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');
[9745]53
[6768]54?>
Note: See TracBrowser for help on using the repository browser.