X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2Fgroup.php;h=db1a7efe9202fd521bd4a6937fc0a473e48131b3;hb=a43cdc7aab599efc9ebc698e91c131d3a40d6bee;hp=e3f3b62025eccd17cd1fbf98db5f59e4a5584770;hpb=f6e35ff3fefafe908e1675690340ab93265192a0;p=platal.git diff --git a/classes/group.php b/classes/group.php index e3f3b62..db1a7ef 100644 --- a/classes/group.php +++ b/classes/group.php @@ -1,6 +1,6 @@ id = intval($this->data['id']); $this->shortname = $this->data['diminutif']; + if (!is_null($this->axDate)) { + $this->axDate = format_datetime($this->axDate, '%d/%m/%Y'); + } } public function __get($name) @@ -54,9 +62,12 @@ class Group private function getUF($admin = false, $extra_cond = null, $sort = null) { - $cond = new UFC_Group($this->id, $admin); + $cond = new PFC_And(new UFC_Group($this->id, $admin), new PFC_Not(new UFC_Dead())); if (!is_null($extra_cond)) { - $cond = new PFC_And($cond, $extra_cond); + $cond->addChild($extra_cond); + } + if ($this->cat == self::CAT_PROMOTIONS) { + $cond->addChild(new UFC_Registered()); } return new UserFilter($cond, $sort); } @@ -105,9 +116,11 @@ class Group } $res = XDB::query('SELECT a.*, d.nom AS domnom, FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc, - FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub + FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub, + (nls.id IS NOT NULL) AS has_nl FROM groups AS a LEFT JOIN group_dom AS d ON d.id = a.dom + LEFT JOIN newsletters AS nls ON (nls.group_id = a.id) WHERE ' . $where); if ($res->numRows() != 1) { if ($can_be_shortname && (is_int($id) || ctype_digit($id))) { @@ -115,7 +128,13 @@ class Group } return null; } - return new Group($res->fetchOneAssoc()); + $data = $res->fetchOneAssoc(); + $positions = XDB::fetchAllAssoc('SELECT position, uid + FROM group_members + WHERE asso_id = {?} AND position IS NOT NULL + ORDER BY position', + $data['id']); + return new Group(array_merge($data, array('positions' => $positions))); } }