X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fnewsletter.inc.php;h=7f1975c6bde36aa96be6fbd8ac2833264ee00a46;hb=47712f77e9718652c516c85cde99a58d142f67c9;hp=67bfc9cde1dc825e4641c1b4af7e719edc69acf7;hpb=fdf18de9a9354c97c5c0aecc0753b22ef40f8a0e;p=platal.git diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 67bfc9c..7f1975c 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -105,15 +105,13 @@ class NewsLetter /** Retrieve all newsletters * @return An array of $id => NewsLetter objects */ - public static function getAll() + public static function getAll($sort = 'id', $order = 'ASC') { - $res = XDB::query('SELECT id - FROM newsletters'); - $nls = array(); - foreach ($res->fetchColumn() as $id) { - $nls[$id] = new NewsLetter($id); - } - return $nls; + $res = XDB::fetchAllAssoc('SELECT n.id, g.nom AS group_name, n.name, n.custom_css, n.criteria, g.diminutif AS group_link + FROM newsletters AS n + INNER JOIN groups AS g ON (n.group_id = g.id) + ORDER BY ' . $sort . ' ' . $order); + return $res; } // }}}