public $shortname;
private $data = array();
- private $members = null;
- private $admins = null;
-
private function __construct(array $data)
{
foreach ($data as $key=>$value) {
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()
+ private function getUF($admin = false, $extra_cond = null, $sort = null)
{
- if (is_null($this->admins)) {
- $this->admins = XDB::fetchColumn('SELECT uid
- FROM groupex.membres
- WHERE asso_id = {?} AND perms = \'admin\'', $this->id);
+ $cond = new UFC_Group($this->id, $admin);
+ if (!is_null($extra_cond)) {
+ $cond = new UFC_And($cond, $extra_cond);
}
- return $this->admins;
+ return new UserFilter($cond, $sort);
}
- public function getAdmins($sortby = null, $count = null, $offset = null)
+ public function getMembers($extra_cond = null, $sort = null)
{
- return User::getBuildUsersWithUIDs($this->getAdminUIDs(), $sortby, $count, $offset);
+ return $this->getUF(false, $extra_cond, $sort);
}
- public function getAdminCount()
+ public function getAdmins($extra_cond = null, $sort = null)
{
- return count($this->getAdminUIDs());
+ return $this->getUF(true, $extra_cond, $sort);
}
static public function get($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
+ FROM #groupex#.asso AS a
+ LEFT JOIN #groupex#.dom AS d ON d.id = a.dom
WHERE ' . $where);
if ($res->numRows() != 1) {
return null;