コード例 #1
0
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
     $f = parent::getCMSFields();
     $f->removeByName('TypeID');
     $f->dropdown('Level', 'Level', $this->dbObject('Level')->enumValues())->dropdown('CategoryID', 'Category', PresentationCategory::get()->map('ID', 'Title'))->listbox('Topics', 'Topics', PresentationTopic::get()->map('ID', 'Title')->toArray())->configure()->setMultiple(true)->end()->text('OtherTopic', 'Other topic')->htmleditor('ProblemAddressed', 'What is the problem or use case you’re addressing in this session?')->htmleditor('AttendeesExpectedLearnt', 'What should attendees expect to learn?')->tab('Preview')->literal('preview', sprintf('<iframe width="%s" height="%s" frameborder="0" src="%s"></iframe>', '100%', '400', Director::absoluteBaseURL() . $this->PreviewLink()));
     $f->addFieldToTab('Root.Main', $ddl_type = new DropdownField('TypeID', 'Event Type', SummitEventType::get()->filter(array('SummitID' => $summit_id))->where(" Type ='Presentation' OR Type ='Keynotes' OR Type ='Panel' ")->map('ID', 'Type')));
     $ddl_type->setEmptyString('-- Select a Presentation Type --');
     if ($this->ID > 0) {
         // speakers
         $config = new GridFieldConfig_RelationEditor(100);
         $config->removeComponentsByType('GridFieldAddNewButton');
         $speakers = new GridField('Speakers', 'Speakers', $this->Speakers(), $config);
         $f->addFieldToTab('Root.Speakers', $speakers);
         $config->getComponentByType('GridFieldAddExistingAutocompleter')->setResultsFormat('$Name - $Member.Email')->setSearchList($this->getAllowedSpeakers());
         // moderator
         $f->addFieldToTab('Root.Speakers', $ddl_moderator = new DropdownField('ModeratorID', 'Moderator', $this->Speakers()->map('ID', 'Name')));
         $ddl_moderator->setEmptyString('-- Select a Moderator --');
         $config = GridFieldConfig_RecordEditor::create(100);
         $config->removeComponentsByType('GridFieldAddNewButton');
         $multi_class_selector = new GridFieldAddNewMultiClass();
         $multi_class_selector->setClasses(array('PresentationVideo' => 'Video', 'PresentationSlide' => 'Slide', 'PresentationLink' => 'Link'));
         $config->addComponent($multi_class_selector);
         $config->addComponent($sort = new GridFieldSortableRows('Order'));
         $gridField = new GridField('Materials', 'Materials', $this->Materials(), $config);
         $f->addFieldToTab('Root.Materials', $gridField);
     }
     return $f;
 }
コード例 #2
0
 public function getCMSFields()
 {
     return FieldList::create(TabSet::create('Root'))->text('Title')->dropdown('Level', 'Level', $this->dbObject('Level')->enumValues())->dropdown('CategoryID', 'Category', PresentationCategory::get()->map('ID', 'Title'))->dropdown('Status', 'Status')->configure()->setSource(array_combine($this->config()->status_options, $this->config()->status_options))->end()->listbox('Topics', 'Topics', PresentationTopic::get()->map('ID', 'Title')->toArray())->configure()->setMultiple(true)->end()->tag('Tags', 'Tags', Tag::get(), $this->Tags())->text('OtherTopic', 'Other topic')->htmlEditor('Description')->htmlEditor('ShortDescription')->tab('Preview')->literal('preview', sprintf('<iframe width="%s" height="%s" frameborder="0" src="%s"></iframe>', '100%', '400', Director::absoluteBaseURL() . $this->PreviewLink()));
 }