id = self::$mb_group_id; try{ $this->load(); } catch(Exception $e) { new mb_exception($e->getMessage()); return; } } public function create () { if ($this->exists()) { return false; } return parent::create(); } public static function getList($filter) { return array($this); } public function isValid () { if (!is_null($this->name) && $this->id === self::$mb_group_id) { return true; } new mb_exception("Group with ID " . $this->id . " does not exist."); return false; } public static function byName($name) { if($name === $this->name) { return $this; } return null; } public static function getGroupsByUser ($id) { $user = new User($id); if (!$user->isValid()) { new mb_exception("User ID " . $id . " invalid."); return array(); } $groups = $user->getGroupsByUser(); if (!is_array($groups)) { new mb_notice("User " . $id . " is not member in any group."); return array(); } new mb_notice("User " . $id . " is member of " . count($groups) . " groups."); if (in_array(self::$mb_group_id, $groups)) { return array(self::$mb_group_id); } return array(); } } ?>