コード例 #1
0
 protected function getPresentationFields()
 {
     $categorySource = Summit::ActiveSummit()->Categories()->map('ID', 'FormattedTitleAndDescription')->toArray();
     $categorySource['other'] = '<h4 class="category-label">Other topic...</h4>';
     $fields = FieldList::create()->text('Title', 'Proposed Presentation Title')->configure()->setAttribute('autofocus', 'TRUE')->end()->dropdown('Level', 'Please select the level of your presentation content')->configure()->setEmptyString('-- Select one --')->setSource(Presentation::create()->dbObject('Level')->enumValues())->end()->literal('AbstractHelp', '<hr/><p>YouTube and other services limit the length of your presentation\'s description. We will take the first 100 characters of your abstract to display in the YouTube description.</p>')->tinyMCEEditor('ShortDescription', 'Abstract (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->tinyMCEEditor('ProblemAddressed', 'What is the problem or use case you’re addressing in this session? (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->tinyMCEEditor('AttendeesExpectedLearnt', 'What should attendees expect to learn? (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->tinyMCEEditor('SelectionMotive', 'Why should this session be selected? (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->literal('PresentationMaterialsTitle', '<h3>Please provide any relevant links to additional information, such as code repositories, case studies, papers, blog posts etc. (Up to 5 links)</h3>')->text('PresentationLink[1]', '#1')->text('PresentationLink[2]', '#2')->text('PresentationLink[3]', '#3')->text('PresentationLink[4]', '#4')->text('PresentationLink[5]', '#5')->literal('HR', '<hr/>')->optionset('CategoryID', 'What is the general topic of the presentation?')->configure()->setSource($categorySource)->end()->text('OtherTopic', 'Other topic (if one above does not match)')->configure()->displayIf('CategoryID')->isEqualTo('other')->end()->end()->hidden('ID', 'ID');
     return $fields;
 }
コード例 #2
0
 protected function getPresentationFields()
 {
     $categorySource = Summit::get_active()->Categories()->map('ID', 'FormattedTitleAndDescription')->toArray();
     $categorySource['other'] = '<h4 class="category-label">Other topic...</h4>';
     $fields = FieldList::create()->text('Title', 'Proposed Presentation Title')->configure()->setAttribute('autofocus', 'TRUE')->end()->dropdown('Level', 'Please select the level of your presentation content')->configure()->setEmptyString('-- Select one --')->setSource(Presentation::create()->dbObject('Level')->enumValues())->end()->tinyMCEEditor('Description', 'Abstract')->configure()->setRows(20)->end()->literal('ShortDescriptionHelp', '<hr/><p>YouTube and other services limit the length of your presentation\'s description. Please provide a shorter, YouTube-friendly summary below.</p>')->literal('ShortDescriptionWordCount', '<p id="word-count"></p>')->tinyMCEEditor('ShortDescription', 'Short Description (450 Word Max)')->configure()->setRows(7)->setWordCount(450)->end()->literal('HR', '<hr/>')->optionset('CategoryID', 'What is the general topic of the presentation?')->configure()->setSource($categorySource)->end()->text('OtherTopic', 'Other topic (if one above does not match)')->configure()->displayIf('CategoryID')->isEqualTo('other')->end()->end()->literal('TagHelp', '<p>You can optionally add tags help attendees find presentations that interest them. Examples: <i>nova, ubuntu, ldap.</i></p>')->bootstrapTag('Tags', 'Presentation Tags (Optional)')->configure()->setLabelField('Tag')->setSource(Tag::get())->setPrefetch(Tag::get()->leftJoin('Presentation_Tags', 'TagID = Tag.ID')->sort('COUNT(Tag.ID)', 'DESC')->limit(10)->alterDataQuery(function ($query) {
         $query->groupby('Tag.ID');
     }))->setFreeInput(true)->end();
     return $fields;
 }
コード例 #3
0
 protected function getPresentationFields()
 {
     $private_groups = $this->presentation_manager->getPrivateCategoryGroupsFor(Member::currentUser(), $this->summit);
     if ($this->summit->isCallForSpeakersOpen()) {
         $public_groups = $this->summit->CategoryGroups()->filter('ClassName', 'PresentationCategoryGroup')->toArray();
         $category_groups = array_merge($public_groups, $private_groups);
     } else {
         $category_groups = $private_groups;
     }
     $category_groups_map = array();
     foreach ($category_groups as $group) {
         $group_type = $group->ClassName == 'PrivatePresentationCategoryGroup' ? 'private' : 'public';
         $category_groups_map[] = array('id' => $group->ID, 'title' => $group->Name, 'group_type' => $group_type);
     }
     usort($category_groups_map, function ($a, $b) {
         return strcmp($a["title"], $b["title"]);
     });
     $fields = FieldList::create()->text('Title', 'Proposed Presentation Title')->configure()->setAttribute('autofocus', 'TRUE')->end()->dropdown('TypeID', 'Select the format (Presentation: Max 3 speakers; Panel: Max 4 speakers, 1 moderator)')->configure()->setEmptyString('-- Select one --')->setSource(PresentationType::get()->filter('SummitID', $this->summit->ID)->exclude('Type', 'Keynotes')->map('ID', 'Type'))->end()->literal('CategoryContainer', '<div id="category_options"></div>')->dropdown('Level', 'Select the technical level of your presentation content')->configure()->setEmptyString('-- Select one --')->setSource(Presentation::create()->dbObject('Level')->enumValues())->end()->literal('AbstractHelp', '<hr/><p>YouTube and other services limit the length of your presentation\'s description. We will take the first 100 characters of your abstract to display in the YouTube description.</p>')->tinyMCEEditor('ShortDescription', 'Abstract (1000 chars)')->configure()->setRows(20)->setColumns(8)->end()->tinyMCEEditor('ProblemAddressed', 'What is the problem or use case you’re addressing in this session? (1000 chars)')->configure()->setRows(20)->setColumns(8)->end()->tinyMCEEditor('AttendeesExpectedLearnt', 'What should attendees expect to learn? (1000 chars)')->configure()->setRows(20)->setColumns(8)->end()->literal('PresentationMaterialsTitle', '<h3>Please provide any relevant links to additional information, such as code repositories, case studies, papers, blog posts etc. (Up to 5 links)</h3>')->text('PresentationLink[1]', '#1')->text('PresentationLink[2]', '#2')->text('PresentationLink[3]', '#3')->text('PresentationLink[4]', '#4')->text('PresentationLink[5]', '#5')->hidden('ID', 'ID')->hidden('SummitID', '', $this->summit->ID)->hidden('CategoryIDbis', '');
     $CategoryGroupField = new CategoryGroupField('GroupID', 'Select the <a href="' . $this->summit->Link . 'categories" target="_blank">Summit Category</a> of your presentation');
     $CategoryGroupField->setSource($category_groups_map);
     $fields->insertAfter($CategoryGroupField, 'TypeID');
     return $fields;
 }
コード例 #4
0
 /**
  * Hand off presentation CRUD to a sub controller. Ensure the user
  * can write to the presentation first
  * 
  * @param   $r SS_HTTPRequest
  * @return  RequestHandler
  */
 public function handleManage(SS_HTTPRequest $r)
 {
     if ($r->param('PresentationID') === 'new') {
         $presentation = Presentation::create();
         $presentation->CreatorID = Member::currentUserID();
         $presentation->write();
         return $this->redirect($presentation->EditLink());
     } else {
         $presentation = Presentation::get()->byID($r->param('PresentationID'));
     }
     if (!$presentation) {
         return $this->httpError(404);
     }
     if ($presentation->isInDB() && !$presentation->canEdit()) {
         return $this->httpError(403, "You can't edit this presentation");
     }
     if (!$presentation->isInDB() && !$presentation->canCreate()) {
         return $this->httpError(403);
     }
     $request = PresentationPage_ManageRequest::create($presentation, $this);
     return $request->handleRequest($r, DataModel::inst());
 }
コード例 #5
0
 /**
  * Hand off presentation CRUD to a sub controller. Ensure the user
  * can write to the presentation first
  * @param   $r SS_HTTPRequest
  * @return  RequestHandler
  */
 public function handleManage(SS_HTTPRequest $r)
 {
     $summit = $this->Summit();
     if (is_null($summit) || $summit->ID == 0 || !$summit->isPresentationEditionAllowed()) {
         return $this->httpError(403, 'Call for speaker closed!');
     }
     if ($r->param('PresentationID') === 'new') {
         if (Member::currentUser()->getSpeakerProfile()->hasReachPresentationLimitBy($summit->ID)) {
             return $this->httpError(403, "You reached presentations submissions limit");
         }
         $presentation = Presentation::create();
         $presentation->SummitID = $summit->ID;
         $presentation->CreatorID = Member::currentUserID();
         $presentation->write();
         return $this->redirect($presentation->EditLink());
     } else {
         $presentation = Presentation::get()->byID($r->param('PresentationID'));
     }
     if (!$presentation) {
         return $this->httpError(404);
     }
     if ($presentation->isInDB() && !$presentation->canEdit()) {
         return $this->httpError(403, "You can't edit this presentation");
     }
     if (!$presentation->isInDB() && !$presentation->canCreate()) {
         return $this->httpError(403);
     }
     $request = PresentationPage_ManageRequest::create($presentation, $this);
     return $request->handleRequest($r, DataModel::inst());
 }
コード例 #6
0
 /**
  * Given a VideoPresentation object, create a Presentation
  * @param  int $id A forced ID (SummitEvent and Presentation tables are offset)
  * @param  VideoPresentation $v
  * @return Presentation
  */
 private function createLegacyPresentation($id, VideoPresentation $v)
 {
     return Presentation::create(['ID' => $id, 'Title' => $v->Name, 'Description' => $v->Description, 'StartDate' => $v->StartTime ?: $v->Summit()->SummitBeginDate, 'EndDate' => $v->EndTime ?: $v->Summit()->SummitBeginDate, 'Published' => true, 'PublishedDate' => $v->Created, 'SummitID' => $v->SummitID, 'Legacy' => true]);
 }
コード例 #7
0
 /**
  * Hand off presentation CRUD to a sub controller. Ensure the user
  * can write to the presentation first
  * @param   $r SS_HTTPRequest
  * @return  RequestHandler
  */
 public function handleManage(SS_HTTPRequest $r)
 {
     $summit = $this->Summit();
     if (is_null($summit) || !$summit->exists() || !$this->presentation_manager->isPresentationEditionAllowed(Member::currentUser(), $summit)) {
         $r->setUrl($this->Link());
         //clean up dir parts so we could redirect without 404
         return $this->redirect($this->Link(), 301);
     }
     $presentation_id = Convert::raw2sql($r->param('PresentationID'));
     $presentation = $presentation_id === 'new' ? Presentation::create() : Presentation::get()->byID($presentation_id);
     if (!$presentation) {
         return $this->httpError(404);
     }
     if ($presentation->isInDB() && !$this->canEditPresentation($presentation->ID)) {
         return $this->httpError(403, "You can't edit this presentation");
     }
     if (!$presentation->isInDB() && !$presentation->canCreate()) {
         return $this->httpError(403);
     }
     $request = PresentationPage_ManageRequest::create($presentation, $this);
     return $request->handleRequest($r, DataModel::inst());
 }
コード例 #8
0
 /**
  * @param ISummit $summit
  * @param Member $creator
  * @param array $data
  * @return IPresentation
  */
 public function registerPresentationOn(ISummit $summit, Member $creator, array $data)
 {
     return $this->tx_manager->transaction(function () use($summit, $creator, $data) {
         $speaker = $creator->getSpeakerProfile();
         $presentation = Presentation::create();
         $presentation->Title = trim($data['Title']);
         $presentation->TypeID = intval($data['TypeID']);
         $presentation->Level = trim($data['Level']);
         $presentation->ShortDescription = trim($data['ShortDescription']);
         $presentation->ProblemAddressed = trim($data['ProblemAddressed']);
         $presentation->AttendeesExpectedLearnt = trim($data['AttendeesExpectedLearnt']);
         $presentation->CategoryID = intval(trim($data['CategoryID']));
         if (intval($presentation->CategoryID) > 0) {
             $category = PresentationCategory::get()->byID($presentation->CategoryID);
             if (is_null($category)) {
                 throw new NotFoundEntityException('category not found!.');
             }
             $limit = $this->getSubmissionLimitFor($speaker, $category);
             $count = $summit->isPublicCategory($category) ? intval($speaker->getPublicCategoryPresentationsBySummit($summit)->count()) + intval($speaker->getPublicCategoryOwnedPresentationsBySummit($summit)->count()) : intval($speaker->getPrivateCategoryPresentationsBySummit($summit, $summit->getPrivateGroupFor($category))->count()) + intval($speaker->getPrivateCategoryOwnedPresentationsBySummit($summit, $summit->getPrivateGroupFor($category))->count());
             if ($count >= $limit) {
                 throw new EntityValidationException(sprintf('*You reached the limit (%s) of presentations.', $limit));
             }
         }
         if (isset($data['OtherTopic'])) {
             $presentation->OtherTopic = trim($data['OtherTopic']);
         }
         $presentation->SummitID = $summit->getIdentifier();
         $presentation->CreatorID = $creator->ID;
         $presentation->Progress = Presentation::PHASE_SUMMARY;
         $presentation->write();
         if (isset($data["PresentationLink"])) {
             foreach ($data["PresentationLink"] as $id => $val) {
                 if (empty($val)) {
                     continue;
                 }
                 $presentation->Materials()->add(PresentationLink::create(array('Name' => trim($val), 'Link' => trim($val))));
             }
         }
         $extra_questions = $presentation->Category()->Exists() ? $presentation->Category()->ExtraQuestions() : array();
         foreach ($extra_questions as $question) {
             if (!isset($data[$question->Name])) {
                 continue;
             }
             $answer_value = $data[$question->Name];
             if (empty($answer_value)) {
                 continue;
             }
             if (!($answer = $presentation->findAnswerByQuestion($question))) {
                 $answer = new TrackAnswer();
             }
             if (is_array($answer_value)) {
                 $answer_value = str_replace('{comma}', ',', $answer_value);
                 $answer->Value = implode(',', $answer_value);
             } else {
                 $answer->Value = $answer_value;
             }
             $answer->QuestionID = $question->getIdentifier();
             $answer->write();
             $presentation->ExtraAnswers()->add($answer);
         }
         return $presentation;
     });
 }