X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fnewsletter.php;h=809caef00b1ddb042793d548efe9707a548e0c2b;hb=821198c7f5394839f6421c54a32ae2a0dca19b3d;hp=7ea958e13871b062dada55e33339212272ba4272;hpb=bfe9f4c752e8889ab5a269bddd27ea43b31d567e;p=platal.git diff --git a/modules/newsletter.php b/modules/newsletter.php index 7ea958e..809caef 100644 --- a/modules/newsletter.php +++ b/modules/newsletter.php @@ -216,14 +216,36 @@ class NewsletterModule extends PLModule $page->assign('nl_list', $nl->listAllIssues()); } - function handler_admin_nl_groups($page) + function handler_admin_nl_groups($page, $sort = 'id', $order = 'ASC') { require_once 'newsletter.inc.php'; + static $titles = array( + 'id' => 'Id', + 'group_name' => 'Groupe', + 'name' => 'Titre', + 'custom_css' => 'CSS spécifique', + 'criteria' => 'Critères actifs' + ); + static $next_orders = array( + 'ASC' => 'DESC', + 'DESC' => 'ASC' + ); + + if (!array_key_exists($sort, $titles)) { + $sort = 'id'; + } + if (!in_array($order, array('ASC', 'DESC'))) { + $order = 'ASC'; + } + $page->changeTpl('newsletter/admin_all.tpl'); $page->setTitle('Administration - Newsletters : Liste des Newsletters'); - - $page->assign('nls', Newsletter::getAll()); + $page->assign('nls', Newsletter::getAll($sort, $order)); + $page->assign('sort', $sort); + $page->assign('order', $order); + $page->assign('next_order', $next_orders[$order]); + $page->assign('titles', $titles); } function handler_admin_nl_edit($page, $nid = 'last', $aid = null, $action = 'edit') { @@ -247,6 +269,7 @@ class NewsletterModule extends PLModule // Convert NLIssue error messages to human-readable errors $error_msgs = array( + NLIssue::ERROR_INVALID_REPLY_TO => "L'adresse de réponse est invalide.", NLIssue::ERROR_INVALID_SHORTNAME => "Le nom court est invalide ou vide.", NLIssue::ERROR_INVALID_UFC => "Le filtre des destinataires est invalide.", NLIssue::ERROR_TOO_LONG_UFC => "Le nombre de matricules AX renseigné est trop élevé.", @@ -261,6 +284,7 @@ class NewsletterModule extends PLModule $issue->title_mail = Post::s('title_mail'); $issue->head = Post::s('head'); $issue->signature = Post::s('signature'); + $issue->reply_to = Post::s('reply_to'); if ($issue->isEditable()) { // Date and shortname may only be modified for pending NLs, otherwise all links get broken.