protected function validate() { $valid = parent::validate(); if (!$valid->valid()) { return $valid; } $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID; $summit = Summit::get()->byID($summit_id); if (!$summit) { return $valid->error('Invalid Summit!'); } $count = intval(PresentationCategoryGroup::get()->filter(array('SummitID' => $summit->ID, 'Name' => trim($this->Name), 'ID:ExactMatch:not' => $this->ID))->count()); if ($count > 0) { return $valid->error(sprintf('Presentation Category Group "%s" already exists!. please set another one', $this->Name)); } return $valid; }
public function getCMSFields() { $f = parent::getCMSFields(); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionBeginDate', 'Submission Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionEndDate', 'Submission End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldsToTab('Root.Main', new NumericField('MaxSubmissionAllowedPerUser', 'Max. Submission Allowed Per User')); if ($this->ID > 0) { $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent(new GridFieldDeleteAction('unlinkrelation')); $groups = new GridField('AllowedGroups', 'Allowed Groups', $this->AllowedGroups(), $config); $f->addFieldToTab('Root.Main', $groups); } return $f; }
if (is_null($summit_event)) { return; } $summit_type_id = $item->ID; $event = new SummitEntityEvent(); $event->EntityClassName = 'SummitTypeFromEvent'; $event->EntityID = $summit_type_id; $event->Type = 'DELETE'; $event->OwnerID = Member::currentUserID(); $event->SummitID = $summit_event->SummitID; $event->Metadata = json_encode(array('event_id' => $event_id)); $event->write(); } if ($item instanceof PresentationCategory && $list->getJoinTable() === 'PresentationCategoryGroup_Categories') { $group_id = intval($list->getForeignID()); $group = PresentationCategoryGroup::get()->byID($group_id); if (is_null($group)) { return; } $track_id = $item->ID; $event = new SummitEntityEvent(); $event->EntityClassName = 'TrackFromTrackGroup'; $event->EntityID = $track_id; $event->Type = 'DELETE'; $event->OwnerID = Member::currentUserID(); $event->SummitID = $group->SummitID; $event->Metadata = json_encode(array('group_id' => $group_id)); $event->write(); } }); define('SUMMIT_ATTENDEE_CREATE_MEMBERSHIP_INVITATION_EMAIL_TEMPLATE', 'summit-attendee-create-membership-invitation');
public function getCategoriesByGroup(SS_HTTPRequest $request) { try { $group_id = intval($request->param('GROUP_ID')); $summit_id = intval($request->param('SUMMIT_ID')); $summit = $this->summit_repository->getById($summit_id); if (is_null($summit)) { throw new NotFoundEntityException('Summit', sprintf(' id %s', $summit_id)); } $category_group = PresentationCategoryGroup::get_by_id('PresentationCategoryGroup', $group_id); $categories = $category_group->Categories()->sort('Title'); $category_map = array(); foreach ($categories as $category) { $category_map[] = array('ID' => $category->ID, 'Html' => $category->FormattedTitleAndDescription); } return $this->ok($category_map); } catch (NotFoundEntityException $ex2) { SS_Log::log($ex2->getMessage(), SS_Log::WARN); return $this->notFound($ex2->getMessage()); } catch (Exception $ex) { SS_Log::log($ex->getMessage(), SS_Log::ERR); return $this->serverError(); } }