public function add_set() { if ($this->token->validate('add_set')) { if (!trim($this->post('gsName'))) { $this->error->add(t("Specify a name for your group set.")); } $gsName = trim($this->post('gsName')); if (!Loader::helper('validation/strings')->alphanum($gsName, true)) { $this->error->add(t('Set Names must only include alphanumerics and spaces.')); } if (!$this->error->has()) { $gs = GroupSet::add($gsName); if (is_array($_POST['gID'])) { foreach ($_POST['gID'] as $gID) { $g = Group::getByID($gID); if (is_object($g)) { $gs->addGroup($g); } } } $this->redirect('dashboard/users/group_sets', 'set_added'); } } else { $this->error->add($this->token->getErrorMessage()); } }
public function add_set() { if ($this->token->validate('add_set')) { if (!trim($this->post('gsName'))) { $this->error->add(t("Specify a name for your group set.")); } if (!$this->error->has()) { $gs = GroupSet::add($this->post('gsName')); if (is_array($_POST['gID'])) { foreach ($_POST['gID'] as $gID) { $g = Group::getByID($gID); if (is_object($g)) { $gs->addGroup($g); } } } $this->redirect('dashboard/users/group_sets', 'set_added'); } } else { $this->error->add($this->token->getErrorMessage()); } }
/** * Return a ConversationSet for all challenges in the database; */ function getConversationSetData($parts) { $groupSet = new GroupSet(); $allGroups = getGroupsByGlobal(0, -1, 'date', 'ASC'); if (!$allGroups instanceof Error) { $count = count($allGroups->groups); for ($i = 0; $i < $count; $i++) { $group = $allGroups->groups[$i]; if (!$group instanceof Error) { $groupdata = getConversationData($group->groupid); if (count($parts) > 3) { $subtype = check_param($parts[3], PARAM_ALPHA); $group->filter = $subtype; } if ($groupdata instanceof Group) { $groupSet->add($groupdata); } } } } return $groupSet; }