X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fgroup.php;h=c79b0d322d8703fad61640fb99aa12bf7c1dbe0d;hb=5ae3e9a9b7e095956904a2bedbc0845af88434f0;hp=b5f45007b879f5ceff6697d276be76e0eb8a752a;hpb=1c4a1d0a32c52851e9ffbbf585bb206c9a472dc9;p=platal.git diff --git a/classes/group.php b/classes/group.php index b5f4500..c79b0d3 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) @@ -113,9 +116,15 @@ 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, ad.text AS address, + p.display_tel AS phone, f.display_tel AS fax 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) + LEFT JOIN profile_phones AS p ON (p.link_type = \'group\' AND p.link_id = a.id AND p.tel_id = 0) + LEFT JOIN profile_phones AS f ON (f.link_type = \'group\' AND f.link_id = a.id AND f.tel_id = 1) + LEFT JOIN profile_addresses AS ad ON (ad.type = \'group\' AND ad.groupid = a.id) WHERE ' . $where); if ($res->numRows() != 1) { if ($can_be_shortname && (is_int($id) || ctype_digit($id))) { @@ -123,7 +132,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))); } }