$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]); } private function getUF($admin = false, $extra_cond = null, $sort = null) { $cond = new UFC_Group($this->id, $admin); if (!is_null($extra_cond)) { $cond = new UFC_And($cond, $extra_cond); } return new UserFilter($cond, $sort); } public function getMembers($extra_cond = null, $sort = null) { return $this->getUF(false, $extra_cond, $sort); } public function getAdmins($extra_cond = null, $sort = null) { return $this->getUF(true, $extra_cond, $sort); } 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: ?>