$value) { $this->data[$key] = $value; } $this->id = intval($this->data['id']); $this->shortname = $this->data['diminutif']; } public function __get($name) { if (property_exists($this, $name)) { return $this->$name; } if (isset($this->data[$name])) { return $this->data[$name]; } return null; } public function __isset($name) { return property_exists($this, $name) || isset($this->data[$name]); } public function getMemberUIDs() { if (is_null($this->members)) { $this->members = XDB::fetchColumn('SELECT uid FROM groupex.membres WHERE asso_id = {?}', $this->id); } return $this->members; } public function getMembers($sortby = null, $count = null, $offset = null) { return User::getBuildUsersWithUIDs($this->getMemberUIDs(), $sortby, $count, $offset); } public function getMemberCount() { return count($this->getMemberUIDs()); } public function getAdminUIDs() { if (is_null($this->admins)) { $this->admins = XDB::fetchColumn('SELECT uid FROM groupex.membres WHERE asso_id = {?} AND perms = \'admin\'', $this->id); } return $this->admins; } public function getAdmins($sortby = null, $count = null, $offset = null) { return User::getBuildUsersWithUIDs($this->getAdminUIDs(), $sortby, $count, $offset); } public function getAdminCount() { return count($this->getAdminUIDs()); } static public function get($id) { if (!$id) { return null; } if (ctype_digit($id)) { $where = XDB::format('id = {?}', $id); } else { $where = XDB::format('diminutif = {?}', $id); } $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 FROM groupex.asso AS a LEFT JOIN groupex.dom AS d ON d.id = a.dom WHERE ' . $where); if ($res->numRows() != 1) { return null; } return new Group($res->fetchOneAssoc()); } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>