function handler_ev(&$page, $action = 'list', $eid = null, $pound = null)
{
$page->changeTpl('events/index.tpl');
function handler_ev(&$page, $action = 'list', $eid = null, $pound = null)
{
$page->changeTpl('events/index.tpl');
+
+ /** XXX: Tips and reminder only for user with 'email' permission.
+ * We can do better in the future by storing a userfilter
+ * with the tip/reminder.
+ */
+ if ($user->checkPerms(User::PERM_MAIL)) {
+ $page->assign('tips', $this->get_tips());
+
+ }
+
+ // Adds a reminder onebox to the page.
require_once 'reminder.inc.php';
if (($reminder = Reminder::GetCandidateReminder($user))) {
$reminder->Prepare($page);
require_once 'reminder.inc.php';
if (($reminder = Reminder::GetCandidateReminder($user))) {
$reminder->Prepare($page);
// Direct link to the RSS feed, when available.
if (S::hasAuthToken()) {
$page->setRssLink('Polytechnique.org :: News',
// Direct link to the RSS feed, when available.
if (S::hasAuthToken()) {
$page->setRssLink('Polytechnique.org :: News',
XDB::execute('REPLACE INTO announce_read VALUES({?},{?})',
$eid, S::v('uid'));
pl_redirect('events#'.$pound);
XDB::execute('REPLACE INTO announce_read VALUES({?},{?})',
$eid, S::v('uid'));
pl_redirect('events#'.$pound);
p.x, p.y, p.attach IS NOT NULL AS img, FIND_IN_SET('wiki', e.flags) AS wiki,
FIND_IN_SET('important', e.flags) AS important,
e.creation_date > DATE_SUB(CURDATE(), INTERVAL 2 DAY) AS news,
p.x, p.y, p.attach IS NOT NULL AS img, FIND_IN_SET('wiki', e.flags) AS wiki,
FIND_IN_SET('important', e.flags) AS important,
e.creation_date > DATE_SUB(CURDATE(), INTERVAL 2 DAY) AS news,
ev.uid IS NULL AS nonlu, e.promo_min, e.promo_max
FROM announces AS e
LEFT JOIN announce_photos AS p ON (e.id = p.eid)
LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})
ev.uid IS NULL AS nonlu, e.promo_min, e.promo_max
FROM announces AS e
LEFT JOIN announce_photos AS p ON (e.id = p.eid)
LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})
- WHERE FIND_IN_SET('valide', e.flags) AND peremption >= NOW()
- ORDER BY important DESC, news DESC, end DESC, e.peremption, e.creation_date DESC",
+ WHERE FIND_IN_SET('valide', e.flags) AND expiration >= NOW()
+ ORDER BY important DESC, news DESC, end DESC, e.expiration, e.creation_date DESC",
S::i('uid'));
$cats = array('important', 'news', 'end', 'body');
S::i('uid'));
$cats = array('important', 'news', 'end', 'body');
$valid = Validate::get_request_by_id($valid);
if ($valid && $valid->img) {
pl_cached_dynamic_content_headers("image/" . $valid->imgtype);
$valid = Validate::get_request_by_id($valid);
if ($valid && $valid->img) {
pl_cached_dynamic_content_headers("image/" . $valid->imgtype);
$texte = Post::v('texte');
$promo_min = Post::i('promo_min');
$promo_max = Post::i('promo_max');
$texte = Post::v('texte');
$promo_min = Post::i('promo_min');
$promo_max = Post::i('promo_max');
$valid_mesg = Post::v('valid_mesg');
$action = Post::v('action');
$upload = new PlUpload(S::user()->login(), 'event');
$valid_mesg = Post::v('valid_mesg');
$action = Post::v('action');
$upload = new PlUpload(S::user()->login(), 'event');
$page->assign('texte', $texte);
$page->assign('promo_min', $promo_min);
$page->assign('promo_max', $promo_max);
$page->assign('texte', $texte);
$page->assign('promo_min', $promo_min);
$page->assign('promo_max', $promo_max);
$page->assign('valid_mesg', $valid_mesg);
$page->assign('action', strtolower($action));
$page->assign_by_ref('upload', $upload);
$page->assign('valid_mesg', $valid_mesg);
$page->assign('action', strtolower($action));
$page->assign_by_ref('upload', $upload);
$evtreq = new EvtReq($titre, $texte, $promo_min, $promo_max,
$evtreq = new EvtReq($titre, $texte, $promo_min, $promo_max,
- $peremption, $valid_mesg, S::user(), $upload);
+ $expiration, $valid_mesg, S::user(), $upload);
$evtreq->submit();
$page->assign('ok', true);
} elseif (!Env::v('preview')) {
$evtreq->submit();
$page->assign('ok', true);
} elseif (!Env::v('preview')) {
{
$page->setTitle('Administration - Astuces');
$page->assign('title', 'Gestion des Astuces');
{
$page->setTitle('Administration - Astuces');
$page->assign('title', 'Gestion des Astuces');
- $table_editor = new PLTableEditor('admin/tips', 'tips', 'id');
- $table_editor->describe('peremption', 'date de péremption', true);
+ $table_editor = new PLTableEditor('admin/tips', 'reminder_tips', 'id');
+ $table_editor->describe('expiration', 'date de péremption', true);
$table_editor->describe('promo_min', 'promo. min (0 aucune)', false);
$table_editor->describe('promo_max', 'promo. max (0 aucune)', false);
$table_editor->describe('promo_min', 'promo. min (0 aucune)', false);
$table_editor->describe('promo_max', 'promo. max (0 aucune)', false);
$table_editor->describe('state', 'actif', true);
$table_editor->describe('text', 'texte (html) de l\'astuce', false);
$table_editor->describe('state', 'actif', true);
$table_editor->describe('text', 'texte (html) de l\'astuce', false);
$table_editor->list_on_edit(false);
$table_editor->apply($page, $action, $id);
if (($action == 'edit' && !is_null($id)) || $action == 'update') {
$table_editor->list_on_edit(false);
$table_editor->apply($page, $action, $id);
if (($action == 'edit' && !is_null($id)) || $action == 'update') {
function handler_admin_events(&$page, $action = 'list', $eid = null)
{
$page->changeTpl('events/admin.tpl');
function handler_admin_events(&$page, $action = 'list', $eid = null)
{
$page->changeTpl('events/admin.tpl');
$page->setTitle('Administration - Evenements');
$page->register_modifier('hde', 'html_entity_decode');
$page->setTitle('Administration - Evenements');
$page->register_modifier('hde', 'html_entity_decode');
XDB::execute('UPDATE announces
SET creation_date = creation_date,
XDB::execute('UPDATE announces
SET creation_date = creation_date,
- titre={?}, texte={?}, peremption={?}, promo_min={?}, promo_max={?},
+ titre={?}, texte={?}, expiration={?}, promo_min={?}, promo_max={?},
- Post::v('titre'), Post::v('texte'), Post::v('peremption'),
+ Post::v('titre'), Post::v('texte'), Post::v('expiration'),
Post::v('promo_min'), Post::v('promo_max'),
$flags, $eid);
if ($upload->exists() && list($x, $y, $type) = $upload->imageInfo()) {
Post::v('promo_min'), Post::v('promo_max'),
$flags, $eid);
if ($upload->exists() && list($x, $y, $type) = $upload->imageInfo()) {
- $res = XDB::query('SELECT titre, texte, peremption, promo_min, promo_max, FIND_IN_SET(\'important\', flags),
+ $res = XDB::query('SELECT titre, texte, expiration, promo_min, promo_max, FIND_IN_SET(\'important\', flags),
- list($titre, $texte, $peremption, $promo_min, $promo_max, $important, $img) = $res->fetchOneRow();
+ list($titre, $texte, $expiration, $promo_min, $promo_max, $important, $img) = $res->fetchOneRow();
$page->assign('titre',$titre);
$page->assign('texte',$texte);
$page->assign('promo_min',$promo_min);
$page->assign('promo_max',$promo_max);
$page->assign('titre',$titre);
$page->assign('texte',$texte);
$page->assign('promo_min',$promo_min);
$page->assign('promo_max',$promo_max);
$page->assign('important', $important);
$page->assign('eid', $eid);
$page->assign('img', $img);
$page->assign('important', $important);
$page->assign('eid', $eid);
$page->assign('img', $img);
$day=substr($p_stamp,6,2);
$select .= "<option value=\"$p_stamp\""
$day=substr($p_stamp,6,2);
$select .= "<option value=\"$p_stamp\""
. "> $day / $month / $year</option>\n";
}
$page->assign('select',$select);
. "> $day / $month / $year</option>\n";
}
$page->assign('select',$select);
$pid = ($eid && $action == 'preview') ? $eid : -1;
$sql = "SELECT e.id, e.titre, e.texte,e.id = $pid AS preview, e.uid,
DATE_FORMAT(e.creation_date,'%d/%m/%Y %T') AS creation_date,
$pid = ($eid && $action == 'preview') ? $eid : -1;
$sql = "SELECT e.id, e.titre, e.texte,e.id = $pid AS preview, e.uid,
DATE_FORMAT(e.creation_date,'%d/%m/%Y %T') AS creation_date,
e.promo_min, e.promo_max,
FIND_IN_SET('valide', e.flags) AS fvalide,
FIND_IN_SET('archive', e.flags) AS farch,
FIND_IN_SET('wiki', e.flags) AS wiki
FROM announces AS e
WHERE ".($arch ? "" : "!")."FIND_IN_SET('archive',e.flags)
e.promo_min, e.promo_max,
FIND_IN_SET('valide', e.flags) AS fvalide,
FIND_IN_SET('archive', e.flags) AS farch,
FIND_IN_SET('wiki', e.flags) AS wiki
FROM announces AS e
WHERE ".($arch ? "" : "!")."FIND_IN_SET('archive',e.flags)
$page->assign('evs', XDB::iterator($sql));
}
$page->assign('arch', $arch);
$page->assign('evs', XDB::iterator($sql));
}
$page->assign('arch', $arch);