From: Raphaël Barrois Date: Sat, 20 Mar 2010 00:39:40 +0000 (+0100) Subject: Add function for fetching more info about a user's groups X-Git-Tag: xorg/1.0.0~332^2~30 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=fa589f9001c44a41537d1f75ead96368d7202f3b;p=platal.git Add function for fetching more info about a user's groups Signed-off-by: Raphaël Barrois --- diff --git a/classes/user.php b/classes/user.php index 83d7b0a..1ce06bc 100644 --- a/classes/user.php +++ b/classes/user.php @@ -506,6 +506,20 @@ class User extends PlUser return $this->groups; } + public function groupNames($institutions = false) + { + if ($institutions) { + $where = ' AND (g.cat = \'GroupesX\' OR g.cat = \'Institutions\')'; + } else { + $where = ''; + } + return XDB::fetchAllAssoc('SELECT g.diminutif, g.nom, g.site + FROM group_members AS gm + LEFT JOIN groups AS g ON (g.id = gm.asso_id) + WHERE gm.uid = {?}' . $where, + $this->id()); + } + /** * Clears a user. * *always deletes in: account_lost_passwords, register_marketing,