public static function getAllListsByCategory($SummitCategoryID)
 {
     $category = PresentationCategory::get()->byID($SummitCategoryID);
     // An empty array list that we'll use to return results
     $results = ArrayList::create();
     // Get any existing lists made for this category
     $AllLists = SummitSelectedPresentationList::get()->filter('CategoryID', $SummitCategoryID)->sort('ListType', 'ASC');
     // Filter to lists of any other track chairs
     $OtherTrackChairLists = $AllLists->filter('ListType', 'Individual')->exclude('MemberID', Member::currentUser()->ID);
     $MemberList = $category->MemberList(Member::currentUser()->ID);
     $GroupList = $category->GroupList();
     if ($MemberList) {
         $results->push($MemberList);
     }
     foreach ($OtherTrackChairLists as $list) {
         $results->push($list);
     }
     if ($GroupList) {
         $results->push($GroupList);
     }
     // Add each of those lists to our results
     foreach ($results as $list) {
         if ($list->ListType == "Individual") {
             $list->name = $list->Member()->FirstName . ' ' . $list->Member()->Surname;
         }
         if ($list->ListType == "Group") {
             $list->name = 'Team Selections';
         }
     }
     return $results;
 }
 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     if ($this->SchedID) {
         return $fields->tab('SchedData')->readonly('Title')->readonly('Description')->readonly('EventStart')->readonly('EventEnd')->readonly('EventKey')->readonly('EventType')->readonly('Goers')->readonly('SchedID')->readonly('InviteOnly')->readonly('Seats')->readonly('Venue')->readonly('VenueID')->tab('EditableData')->checkbox('DisplayOnSite')->text('YouTubeID')->dropdown('CategoryID', 'Category', PresentationCategory::get()->map('ID', 'Title'))->listbox('PresentationSpeakers')->configure()->setSource(PresentationSpeaker::get()->map('ID', 'Title')->toArray())->setMultiple(true)->end()->imageUpload('VideoThumbnail')->upload('RelatedMedia')->tag('Tags', 'Tags', Tag::get(), $this->Tags());
     } else {
         return $fields->text('Title')->dropdown('CategoryID', 'Category', PresentationCategory::get()->map('ID', 'Title'))->tag('Tags', 'Tags', Tag::get(), $this->Tags())->date('EventStart')->configure()->setConfig('showcalendar', true)->end()->date('EventEnd')->configure()->setConfig('showcalendar', true)->end()->htmlEditor('Description')->checkbox('InviteOnly')->numeric('Seats')->text('Venue')->text('YouTubeID')->imageUpload('VideoThumbnail')->upload('RelatedMedia')->checkbox('DisplayOnSite');
     }
 }
 function doUp()
 {
     global $database;
     $categories = PresentationCategory::get()->toArray();
     foreach ($categories as $cat) {
         $clean_title = preg_replace("/[^a-zA-Z0-9 ]/", "", $cat->Title);
         $slug = preg_replace('/\\s+/', '-', strtolower($clean_title));
         DB::query("UPDATE PresentationCategory SET Slug = '{$slug}' WHERE ID = " . $cat->ID);
     }
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $summit_id = @$_REQUEST['SummitID'];
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldsToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     $f->addFieldsToTab('Root.Main', new MemberAutoCompleteField('Member', 'Member'));
     if ($this->ID > 0) {
         $config = GridFieldConfig_RelationEditor::create(25);
         $config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchList(PresentationCategory::get()->filter('SummitID', $summit_id));
         $categories = new GridField('Categories', 'Presentation Categories', $this->Categories(), $config);
         $f->addFieldToTab('Root.Presentation Categories', $categories);
     }
     return $f;
 }
 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(PresentationCategory::get()->filter(array('SummitID' => $summit->ID, 'Title' => trim($this->Title), 'ID:ExactMatch:not' => $this->ID))->count());
     if ($count > 0) {
         return $valid->error(sprintf('Presentation Category "%s" already exists!. please set another one', $this->Title));
     }
     return $valid;
 }
 public function getCMSFields()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', new TextField('Name', 'Name'));
     $f->addFieldToTab('Root.Main', new ColorField('Color', 'Color'));
     if ($this->ID > 0) {
         $config = new GridFieldConfig_RelationEditor(100);
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $config->addComponent(new GridFieldDeleteAction('unlinkrelation'));
         $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter');
         $completer->setSearchList(PresentationCategory::get()->filter('SummitID', $summit_id));
         $categories = new GridField('Categories', 'Presentation Category', $this->Categories(), $config);
         $f->addFieldToTab('Root.Main', $categories);
     }
     $f->addFieldToTab('Root.Main', new HtmlEditorField('Description', 'Description'));
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     return $f;
 }
 public static function addChair($member, $catgoryID)
 {
     $priorChair = SummitTrackChair::get()->filter('MemberID', $member->ID)->first();
     $category = PresentationCategory::get()->byID($catgoryID);
     if (!$priorChair) {
         $chair = new self();
         $chair->MemberID = $member->ID;
         $chair->SummitID = Summit::get_active()->ID;
         $chair->write();
         $chair->Categories()->add($category);
         //Find or create the 'track-chairs' group
         if (!($Group = Group::get()->filter('Code', 'track-chairs')->first())) {
             $Group = new Group();
             $Group->Code = "track-chairs";
             $Group->Title = "Track Chairs";
             $Group->Write();
             $Member->Groups()->add($Group);
         }
         //Add member to the group
         $member->Groups()->add($Group);
     } else {
         $priorChair->Categories()->add($category);
     }
 }
Example #8
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;
 }
Example #9
0
 public function handleCategoryChangeRequest(SS_HTTPResponse $r)
 {
     if (!Member::currentUser()) {
         return $this->httpError(403);
     }
     if (!is_numeric($r->getVar('new_cat'))) {
         return $this->httpError(500, "Invalid category id");
     }
     $c = PresentationCategory::get()->byID((int) $r->getVar('new_cat'));
     if ($c) {
         $request = new SummitCategoryChange();
         $request->PresentationID = $this->presentation->ID;
         $request->NewCategoryID = $r->getVar('new_cat');
         $request->ReqesterID = Member::currentUserID();
         $request->write();
         $m = Member::currentUser();
         $comment = $m->FirstName . ' ' . $m->Surname . ' suggested that this presentation be moved to the category ' . $c->Title . '.';
         $this->presentation->addComment($comment, Member::currentUserID());
         return new SS_HTTPResponse("change request made.", 200);
     }
 }
 function Presentation()
 {
     $presID = $this->request->param("ID");
     //set headers to NOT cache a page
     header("Cache-Control: no-cache, max-age=0, must-revalidate, no-store");
     //HTTP 1.1
     // Send them to the done page if they are finished
     if ($presID == 'none') {
         $this->redirect($this->Link() . 'Done');
         return;
     }
     // Otherwise, look for an ID
     if ($presID) {
         $presentation = $this->PresentationByID($presID);
     } else {
         $CategoryID = Session::get('CategoryID');
         $this->redirect($this->Link() . 'Presentation/' . $this->RandomPresentationID($CategoryID));
         return;
     }
     if ($presentation) {
         $data["Presentation"] = $presentation;
         $data["VoteValue"] = $this->CurrentVote($presentation->ID);
         $CategoryID = Session::get('CategoryID');
         $data["CategoryID"] = $CategoryID;
         if (is_numeric($CategoryID)) {
             $Category = PresentationCategory::get()->byID($CategoryID);
         }
         if (isset($Category)) {
             $data["CategoryName"] = $Category->Title;
         }
         $data["Search"] = isset($_GET['s']) ? $_GET['s'] : null;
         if (isset($data['Search']) && strlen($data['Search']) > 1) {
             $data["PresentationWithSearch"] = TRUE;
             return $this->doSearch($data, null);
         } else {
             //return our $Data to use on the page
             return $this->Customise($data);
         }
     } else {
         //Talk not found
         return $this->httpError(404, 'Sorry that talk could not be found');
     }
 }
Example #11
0
 /**
  * @param ISummitEvent $event
  * @param array $event_data
  * @return ISummitEvent
  * @throws NotFoundEntityException
  * @throws ValidationException
  * @throws null
  */
 public static function updatePresentation(ISummitEvent $event, array $event_data)
 {
     // Speakers, if one of the added members is not a speaker, we need to make him one
     if ($event instanceof Presentation) {
         foreach ($event_data['speakers'] as $speaker) {
             if (!isset($speaker['speaker_id']) || !isset($speaker['member_id'])) {
                 throw new EntityValidationException('missing parameter on speakers collection!');
             }
             $speaker_id = intval($speaker['speaker_id']);
             $member_id = intval($speaker['member_id']);
             $speaker = $speaker_id > 0 ? PresentationSpeaker::get()->byID($speaker_id) : null;
             $speaker = is_null($speaker) && $member_id > 0 ? PresentationSpeaker::get()->filter('MemberID', $member_id)->first() : $speaker;
             if (is_null($speaker)) {
                 $member = Member::get()->byID($member_id);
                 if (is_null($member)) {
                     throw new NotFoundEntityException('Member', sprintf(' member id %s', $member_id));
                 }
                 $speaker = new PresentationSpeaker();
                 $speaker->FirstName = $member->FirstName;
                 $speaker->LastName = $member->Surname;
                 $speaker->MemberID = $member->ID;
                 $speaker->write();
             }
             $speaker_ids[] = $speaker->ID;
             $event->ModeratorID = 0;
         }
         $event->Speakers()->setByIDList($speaker_ids);
         if ($event->Type()->Type == 'Keynotes' || $event->Type()->Type == 'Panel') {
             if (!isset($event_data['moderator'])) {
                 throw new EntityValidationException('moderator is required!');
             }
             $moderator = $event_data['moderator'];
             if (!isset($moderator['member_id']) || !isset($moderator['speaker_id'])) {
                 throw new EntityValidationException('missing parameter on moderator!');
             }
             $speaker_id = intval($moderator['speaker_id']);
             $member_id = intval($moderator['member_id']);
             $moderator = $speaker_id > 0 ? PresentationSpeaker::get()->byID($speaker_id) : null;
             $moderator = is_null($moderator) && $member_id > 0 ? PresentationSpeaker::get()->filter('MemberID', $member_id)->first() : $moderator;
             if (is_null($moderator)) {
                 $member = Member::get()->byID($member_id);
                 if (is_null($member)) {
                     throw new NotFoundEntityException('Member', sprintf(' member id %s', $member_id));
                 }
                 $moderator = PresentationSpeaker::create();
                 $moderator->FirstName = $member->FirstName;
                 $moderator->LastName = $member->Surname;
                 $moderator->MemberID = $member->ID;
                 $moderator->write();
             }
             $event->ModeratorID = $moderator->ID;
         }
         $track = PresentationCategory::get()->byID(intval($event_data['track']));
         if (is_null($track)) {
             throw new NotFoundEntityException('Track');
         }
         $event->CategoryID = $track->ID;
         $event->AttendeesExpectedLearnt = html_entity_decode($event_data['expect_learn']);
         $event->Level = $event_data['level'];
     }
     return $event;
 }
 public function FilterForm()
 {
     return Form::create($this, "FilterForm", FieldList::create()->text('Keywords')->dropdown('Category')->configure()->setSource(PresentationCategory::get()->map('ID', 'Title'))->setEmptyString('-- Any category --')->end()->dropdown('Speaker')->configure()->setSource(PresentationSpeaker::get()->map('ID', 'Title'))->setEmptyString('-- Any speaker --')->end()->dropdown('Summit')->configure()->setSource(Summit::get()->map('ID', 'Title'))->setEmptyString('-- Any summit --')->end(), FieldList::create(FormAction::create('doSearch', 'Search')))->disableSecurityToken()->setFormAction($this->Link())->loadDataFrom($_REQUEST)->setFormMethod('GET');
 }
 /**
  * @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;
     });
 }
 /**
  * @param SS_HTTPResponse $r
  * @return SS_HTTPResponse|void
  * @throws SS_HTTPResponse_Exception
  * @throws ValidationException
  * @throws null
  */
 public function handleCategoryChangeRequest(SS_HTTPResponse $r)
 {
     if (!Member::currentUser()) {
         return $this->httpError(403);
     }
     $newCat = $r->postVar('new_cat');
     if (!is_numeric($newCat)) {
         return $this->httpError(500, "Invalid category id");
     }
     $c = PresentationCategory::get()->byID($newCat);
     if ($c) {
         $request = SummitCategoryChange::create();
         $request->PresentationID = $this->presentation->ID;
         $request->NewCategoryID = $newCat;
         $request->ReqesterID = Member::currentUserID();
         $request->write();
         $this->presentation->addNotification('
         	{member} submitted a request to change the category from ' . $request->Presentation()->Category()->Title . ' to ' . $c->Title);
         return new SS_HTTPResponse("change request made.", 200);
     }
 }
 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()));
 }
 /**
  * @param array $params
  * @return array
  */
 public function getVideos($params = [])
 {
     $summit = $speaker = $tag = $track = null;
     $start = isset($params['start']) ? $params['start'] : 0;
     $defaultLimit = SummitVideoApp::config()->default_video_limit;
     $group = isset($params['group']) ? $params['group'] : 'all';
     $criteria = isset($params['id']) ? $params['id'] : 0;
     $videos = PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true])->sort('DateUploaded', 'DESC');
     switch ($group) {
         case 'summit':
             // legacy urls like /videos/summits/show/6
             if (is_numeric($criteria)) {
                 $summit = Summit::get()->byID($criteria);
             } else {
                 $summit = Summit::get()->filter('Slug', $criteria)->first();
             }
             if ($summit) {
                 $videos = $videos->innerJoin('SummitEvent', 'SummitEvent.ID = PresentationMaterial.PresentationID')->filter('SummitEvent.SummitID', $summit->ID);
             } else {
                 $videos = ArrayList::create();
             }
             break;
         case 'tag':
             $tag = Tag::get()->filter('Tag', $criteria)->first();
             if ($tag) {
                 $videos = $videos->innerJoin('SummitEvent_Tags', 'SummitEvent_Tags.SummitEventID = PresentationMaterial.PresentationID')->filter('SummitEvent_Tags.TagID', $tag->ID);
             } else {
                 $videos = ArrayList::create();
             }
             break;
         case 'track':
             $summit = isset($params['summit']) ? $params['summit'] : 0;
             $summit = Summit::get()->filter('Slug', $summit)->first();
             $track = PresentationCategory::get()->filter(['Slug' => $criteria, 'SummitID' => $summit->ID])->first();
             if ($track) {
                 $videos = $videos->innerJoin('Presentation', 'Presentation.ID = PresentationMaterial.PresentationID')->filter('Presentation.CategoryID', $track->ID);
             } else {
                 $videos = ArrayList::create();
             }
             break;
         case 'speaker':
             $speaker = PresentationSpeaker::get()->byID($criteria);
             if ($speaker) {
                 $videos = $videos->innerJoin('Presentation', 'Presentation.ID = PresentationMaterial.PresentationID')->innerJoin('Presentation_Speakers', 'Presentation_Speakers.PresentationID = Presentation.ID')->filter('Presentation_Speakers.PresentationSpeakerID', $speaker->ID);
             } else {
                 $videos = ArrayList::create();
             }
             break;
         case 'popular':
             $videos = $videos->sort('Views DESC');
             break;
         case 'highlighted':
             $videos = $videos->filter(['Highlighted' => true]);
             break;
         case 'search':
             $videos = $videos->innerJoin('Presentation', 'Presentation.ID = PresentationMaterial.PresentationID')->innerJoin('SummitEvent', 'SummitEvent.ID = Presentation.ID')->innerJoin('Summit', 'Summit.ID = SummitEvent.SummitID')->innerJoin('Presentation_Speakers', 'Presentation_Speakers.PresentationID = Presentation.ID')->innerJoin('PresentationSpeaker', 'PresentationSpeaker.ID = Presentation_Speakers.PresentationSpeakerID')->leftJoin('PresentationCategory', 'PresentationCategory.ID = Presentation.CategoryID');
             $search = trim($criteria);
             $parts = preg_split('/\\s+/', $criteria);
             // sniff out speaker first/last name search
             if (sizeof($parts) === 2) {
                 $speakerVideos = $videos->filter(['PresentationSpeaker.FirstName:PartialMatch' => $parts[0], 'PresentationSpeaker.LastName:PartialMatch' => $parts[1]]);
             } else {
                 $speakerVideos = $videos->filterAny(['PresentationSpeaker.FirstName:PartialMatch' => $search, 'PresentationSpeaker.LastName:PartialMatch' => $search]);
             }
             $titleVideos = $videos->filter(['Presentation.Title:PartialMatch' => $search])->limit($defaultLimit)->sort('DateUploaded DESC');
             $topicVideos = $videos->filter(['PresentationCategory.Title:PartialMatch' => $search])->limit($defaultLimit)->sort('DateUploaded DESC');
             $summitVideos = $videos->filter(['Summit.Title:PartialMatch' => $search])->limit($defaultLimit)->sort('DateUploaded DESC');
             //group results by youtubeID
             $speakerVideos = GroupedList::create($speakerVideos)->groupBy('YouTubeID');
             $titleVideos = GroupedList::create($titleVideos)->groupBy('YouTubeID');
             $topicVideos = GroupedList::create($topicVideos)->groupBy('YouTubeID');
             $summitVideos = GroupedList::create($summitVideos)->groupBy('YouTubeID');
             $response = ['results' => ['titleMatches' => [], 'speakerMatches' => [], 'topicMatches' => [], 'summitMatches' => []]];
             foreach ($titleVideos as $v) {
                 if (is_a($v, 'ArrayList')) {
                     $v = $v->first();
                 }
                 $response['results']['titleMatches'][] = $this->createVideoJSON($v);
             }
             foreach ($speakerVideos as $v) {
                 if (is_a($v, 'ArrayList')) {
                     $v = $v->first();
                 }
                 $response['results']['speakerMatches'][] = $this->createVideoJSON($v);
             }
             foreach ($topicVideos as $v) {
                 if (is_a($v, 'ArrayList')) {
                     $v = $v->first();
                 }
                 $response['results']['topicMatches'][] = $this->createVideoJSON($v);
             }
             foreach ($summitVideos as $v) {
                 if (is_a($v, 'ArrayList')) {
                     $v = $v->first();
                 }
                 $response['results']['summitMatches'][] = $this->createVideoJSON($v);
             }
             return $response;
     }
     $grouped_videos = GroupedList::create($videos)->groupBy('YouTubeID');
     $total = count($grouped_videos);
     $limit = $group == 'popular' ? SummitVideoApp::config()->popular_video_limit : $defaultLimit;
     $videos = $videos->limit($limit, $start);
     $grouped_videos_limited = GroupedList::create($videos)->groupBy('YouTubeID');
     $hasMore = $total > $start + count($grouped_videos_limited);
     $response = ['summit' => $summit ? $this->createSummitJSON($summit) : null, 'speaker' => $speaker ? $this->createSpeakerJSON($speaker) : null, 'tag' => $tag ? $this->createTagJSON($tag) : null, 'track' => $track ? $this->createTrackJSON($track) : null, 'has_more' => $hasMore, 'total' => $total, 'results' => []];
     foreach ($grouped_videos_limited as $v) {
         if (is_a($v, 'ArrayList')) {
             $v = $v->first();
         }
         $response['results'][] = $this->createVideoJSON($v);
     }
     return $response;
 }