0337d704 |
1 | <?php |
2 | /*************************************************************************** |
5ddeb07c |
3 | * Copyright (C) 2003-2007 Polytechnique.org * |
0337d704 |
4 | * http://opensource.polytechnique.org/ * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License, or * |
9 | * (at your option) any later version. * |
10 | * * |
11 | * This program is distributed in the hope that it will be useful, * |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
14 | * GNU General Public License for more details. * |
15 | * * |
16 | * You should have received a copy of the GNU General Public License * |
17 | * along with this program; if not, write to the Free Software * |
18 | * Foundation, Inc., * |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
20 | ***************************************************************************/ |
21 | |
22 | // {{{ class EvtReq |
23 | |
24 | class EvtReq extends Validate |
25 | { |
26 | // {{{ properties |
27 | |
612a2d8a |
28 | public $evtid; |
29 | public $titre; |
30 | public $texte; |
31 | public $pmin; |
32 | public $pmax; |
33 | public $peremption; |
34 | public $comment; |
0337d704 |
35 | |
36 | // }}} |
37 | // {{{ constructor |
38 | |
612a2d8a |
39 | public function __construct($_titre, $_texte, $_pmin, $_pmax, $_peremption, $_comment, $_uid) |
40 | { |
41 | parent::__construct($_uid, false, 'evts'); |
0337d704 |
42 | $this->titre = $_titre; |
43 | $this->texte = $_texte; |
44 | $this->pmin = $_pmin; |
45 | $this->pmax = $_pmax; |
46 | $this->peremption = $_peremption; |
47 | $this->comment = $_comment; |
48 | } |
49 | |
50 | // }}} |
51 | // {{{ function formu() |
52 | |
612a2d8a |
53 | public function formu() |
54 | { |
55 | return 'include/form.valid.evts.tpl'; |
56 | } |
0337d704 |
57 | |
58 | // }}} |
6aa01fed |
59 | // {{{ functon editor() |
60 | |
612a2d8a |
61 | public function editor() |
62 | { |
63 | return 'include/form.valid.edit-evts.tpl'; |
64 | } |
6aa01fed |
65 | |
66 | // }}} |
67 | // {{{ function handle_editor() |
68 | |
612a2d8a |
69 | protected function handle_editor() |
6aa01fed |
70 | { |
71 | $this->titre = Env::v('titre'); |
72 | $this->texte = Env::v('texte'); |
73 | $this->pmin = Env::i('promo_min'); |
74 | $this->pmax = Env::i('promo_max'); |
75 | $this->peremption = Env::v('peremption'); |
76 | return true; |
77 | } |
78 | |
79 | // }}} |
0337d704 |
80 | // {{{ function _mail_subj |
81 | |
612a2d8a |
82 | protected function _mail_subj() |
0337d704 |
83 | { |
a7de4ef7 |
84 | return "[Polytechnique.org/EVENEMENTS] Proposition d'événement"; |
0337d704 |
85 | } |
86 | |
87 | // }}} |
88 | // {{{ function _mail_body |
89 | |
612a2d8a |
90 | protected function _mail_body($isok) |
0337d704 |
91 | { |
92 | if ($isok) { |
a7de4ef7 |
93 | return " L'annonce que tu avais proposée ({$this->titre}) vient d'être validée."; |
0337d704 |
94 | } else { |
a7de4ef7 |
95 | return " L'annonce que tu avais proposée ({$this->titre}) a été refusée."; |
0337d704 |
96 | } |
97 | } |
98 | |
99 | // }}} |
100 | // {{{ function commit() |
101 | |
612a2d8a |
102 | public function commit() |
0337d704 |
103 | { |
08cce2ff |
104 | return XDB::execute( |
0337d704 |
105 | "INSERT INTO evenements |
106 | SET user_id = {?}, creation_date=NOW(), titre={?}, texte={?}, |
107 | peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide')", |
108 | $this->uid, $this->titre, $this->texte, |
109 | $this->peremption, $this->pmin, $this->pmax); |
110 | } |
111 | |
112 | // }}} |
113 | } |
114 | |
115 | // }}} |
116 | |
a7de4ef7 |
117 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
0337d704 |
118 | ?> |