id, self::$mb_group_type); $t = array("s"); $insert_result = db_prep_query($sql_group_create, $v, $t); if(!$insert_result) { return false; } return true; } public function load() { $sql_group = <<id); $t = array("i", "i"); $res_group = db_prep_query($sql_group,$v,$t); if ($row = db_fetch_array($res_group)) { $this->name = $row['mb_group_name']; //FIXME: needs checking $tmpuser = new User($row['mb_group_owner']); $this->owner = $tmpuser->name; $this->description = $row['mb_group_description']; } else { throw new Exception("RegistrarGroup with ID " . $this->id . " does not exist. " . serialize($v)); } return true; } /* * @return Array of Groups * @param $filter UNUSED! AssocArray, valid keys "id","name". Use SQL's % and _ to perform simple matching */ public static function getList($filter) { //set up filters: $name = $filter->name ? $filter->name . "%" : "*"; $groups = Array(); $sql_grouplist = <<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."); $registrars = array(); for ($i = count($groups) - 1; $i >= 0; $i--) { $registrar = new self($groups[$i]); if ($registrar->isValid()) { $registrars[]= $registrar; } } return $registrars; } } ?>