1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | // Configuration par défaut |
---|
5 | if (!isset($datas)) { |
---|
6 | $datas = array( |
---|
7 | 'contest_id' => array(0), |
---|
8 | 'nb_per_line' => 2, |
---|
9 | ); |
---|
10 | } |
---|
11 | |
---|
12 | // Enregistrement de la configuration |
---|
13 | if (isset($_POST['submit'])) { |
---|
14 | $datas = array( |
---|
15 | 'contest_id' => implode(',', $_POST['contest_id']), |
---|
16 | 'nb_per_line' => $_POST['nb_per_line'], |
---|
17 | ); |
---|
18 | } |
---|
19 | |
---|
20 | // Récupère la liste des concours |
---|
21 | $contests = pwg_query("SELECT |
---|
22 | id, |
---|
23 | name |
---|
24 | FROM " . CR_TABLE_1 . " |
---|
25 | ORDER BY id ASC;" |
---|
26 | ); |
---|
27 | |
---|
28 | // Concours selectionnés |
---|
29 | $template->assign('COUNT',pwg_db_num_rows($contests)); |
---|
30 | $selected_ids = explode(',', $datas['contest_id']); |
---|
31 | |
---|
32 | // Liste des concours |
---|
33 | while ($contest = pwg_db_fetch_assoc($contests)) { |
---|
34 | $template->append('contests', array( |
---|
35 | 'ID' => $contest['id'], |
---|
36 | 'NAME' => trigger_event('render_category_name', $contest['name']), |
---|
37 | 'SELECTED' => in_array($contest['id'], $selected_ids) ? true : false, |
---|
38 | )); |
---|
39 | } |
---|
40 | |
---|
41 | // Nombre de cadres |
---|
42 | $template->assign('NB_PER_LINE', array( |
---|
43 | 'OPTIONS' => array(1 => 1, 2 => 2, 3 => 3), |
---|
44 | 'SELECTED' => $datas['nb_per_line'], |
---|
45 | )); |
---|
46 | |
---|
47 | |
---|
48 | // +-----------------------------------------------------------------------+ |
---|
49 | // Template |
---|
50 | // +-----------------------------------------------------------------------+ |
---|
51 | $template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl')); |
---|
52 | $template->assign_var_from_handle('MODULE_OPTIONS', 'module_options'); |
---|
53 | |
---|
54 | ?> |
---|