/** * The url to the page with the member group edit/create form * @param Membergroup $group If member group is given, form page will be in edit mode, otherwise in create mode * @return string Returns the form page url */ protected function FormUrl(Membergroup $group = null) { $args = array(); if ($group) { $args['membergroup'] = $group->GetID(); } return BackendRouter::ModuleUrl(new MembergroupForm(), $args); }
/** * Saves the groups */ private function SaveGroups() { $assignedIDs = $this->AssignedGroupIDs(); $selectedIDs = Request::PostArray('Group'); $this->ClearMembergroups($selectedIDs); foreach ($selectedIDs as $selectedID) { if (!in_array($selectedID, $assignedIDs)) { $confirmGroup = new RegisterConfirmMembergroup(); $confirmGroup->SetConfirm($this->confirm); $confirmGroup->SetMemberGroup(Membergroup::Schema()->ByID($selectedID)); $confirmGroup->Save(); } } }
private function SaveMemberGroups() { $selectedIDs = Request::PostArray('MemberGroup'); if ($this->Content()->GetGuestsOnly()) { $selectedIDs = array(); } $exIDs = Membergroup::GetKeyList(MembergroupUtil::ContentMembergroups($this->Content())); $this->DeleteOldMemberGroups($selectedIDs); $this->SaveNewMemberGroups($selectedIDs, $exIDs); }
/** * Saves the group */ protected function OnSuccess() { $this->group->SetName($this->Value('Name')); $this->group->Save(); Response::Redirect(BackendRouter::ModuleUrl(new MembergroupList())); }
/** * Adds the member group options to the checklist * @param CheckList $field */ private static function AddMembergroupOptions(CheckList $field) { $sql = Access::SqlBuilder(); $tbl = Membergroup::Schema()->Table(); $orderBy = $sql->OrderList($sql->OrderAsc($tbl->Field('Name'))); $groups = Membergroup::Schema()->Fetch(false, null, $orderBy); foreach ($groups as $group) { $field->AddOption($group->GetID(), $group->GetName()); } }
private function SaveGroups() { $exGroupIDs = Membergroup::GetKeyList(MembergroupUtil::MemberMembergroups($this->member)); $selGroupIDs = Request::PostArray('MemberGroup'); $this->DeleteOldGroups($selGroupIDs); $this->SaveNewGroups($exGroupIDs, $selGroupIDs); }
/** * Checks access to an item by its properties and assigned groups * @param boolean $guestsOnly True if guests only see the item * @param boolean $publish True if item is generally published * @param Date $from The start date of publishing * @param Date $to The end date of publishing * @param Membergroup[] $groups Groups assigned to the item * @return GrantResult */ private function GrantByProperties($guestsOnly, $publish, Date $from = null, Date $to = null, array $groups = array()) { if (!PublishDateUtil::IsPublishedNow($publish, $from, $to)) { return GrantResult::NoAccess(); } if ($this->GetMember() && $guestsOnly) { return GrantResult::NoAccess(); } if (count($groups) == 0) { return GrantResult::Allowed(); } if (!$this->GetMember()) { return GrantResult::LoginRequired(); } $groupIDs = Membergroup::GetKeyList($groups); $memberGroupIDs = Membergroup::GetKeyList($this->Groups()); return count(array_intersect($groupIDs, $memberGroupIDs)) ? GrantResult::Allowed() : GrantResult::NoAccess(); }