/**
  * @param PresentationSpeaker $s
  * @return array
  */
 protected function createSpeakerJSON(PresentationSpeaker $s)
 {
     return ['id' => $s->ID, 'name' => $s->getName(), 'jobTitle' => $s->Title, 'imageURL' => $s->Photo()->exists() && Director::fileExists($s->Photo()->Filename) ? $s->Photo()->CroppedImage(263, 148)->URL : 'summit-video-app/production/images/placeholder-image.jpg', 'videoCount' => $s->Presentations()->innerJoin('PresentationMaterial', 'PresentationMaterial.PresentationID = Presentation.ID')->innerJoin('PresentationVideo', 'PresentationVideo.ID = PresentationMaterial.ID')->count()];
 }
 /**
  * @param $presentation_id
  * @param PresentationSpeaker $speaker
  * @return bool
  */
 public function canEditPresentation($presentation_id, PresentationSpeaker $speaker)
 {
     $presentation = Presentation::get()->byID($presentation_id);
     if (is_null($presentation) || !$presentation->canEdit()) {
         return false;
     }
     $summit = $presentation->Summit();
     if (!$summit->Active) {
         return false;
     }
     $category = $presentation->Category();
     if ($summit->isCallForSpeakersOpen() && $summit->isPublicCategory($category)) {
         return true;
     }
     // check member private categories groups
     if ($speaker->Member()->exists() && ($groups = $this->getPrivateCategoryGroupsFor($speaker->Member(), $summit))) {
         foreach ($groups as $g) {
             if (!$g->hasCategory($category)) {
                 continue;
             }
             if (!$g->isSubmissionOpen()) {
                 continue;
             }
             return true;
         }
     }
     //check if we have presentations for the current summit that are private categories
     foreach ($speaker->Presentations() as $presentation) {
         $category = $presentation->Category();
         if (!$summit->isPrivateCategory($category)) {
             continue;
         }
         $group = $summit->getPrivateGroupFor($category);
         if (is_null($group)) {
             continue;
         }
         if (!$group->isSubmissionOpen()) {
             continue;
         }
         return true;
     }
     return false;
 }