/**
  * Lists all TV shows in the library
  */
 public function actionIndex()
 {
     // Get the appropriate request parameters from the filter
     $filterForm = new TVShowFilterForm();
     $tvshows = VideoLibrary::getTVShows($filterForm->buildRequestParameters());
     $this->renderIndex($tvshows, $filterForm);
 }
 protected function renderControls()
 {
     echo $this->form->typeaheadFieldControlGroup($this->model, 'name', CJavaScript::encode($this->getTypeaheadData(VideoLibrary::getTVShows(array('properties' => array())))));
     echo $this->form->dropDownListControlGroup($this->model, 'genre', $this->model->getGenres(), array('empty' => ' '));
     echo $this->form->dropDownListControlGroup($this->model, 'watchedStatus', VideoFilterForm::getWatchedStatuses(), array('empty' => ' ', 'style' => 'width: 120px;'));
     echo $this->form->typeaheadFieldControlGroup($this->model, 'actor', $this->getActorNameTypeaheadData(Actor::MEDIA_TYPE_TVSHOW));
 }
 /**
  * Returns the typeahead data for the TV Show name field
  */
 public function actionGetTVShowNames()
 {
     $cacheId = 'MovieFilterTVShowNameTypeahead';
     $this->renderJson($this->getTypeaheadSource($cacheId, function () {
         return $this->getTypeaheadData(VideoLibrary::getTVShows(array('properties' => array())));
     }));
 }
示例#4
0
 /**
  * Returns a list of all actors. 
  * @param string $mediaType the media type to fetch actors for (movies or 
  * TV shows)
  * @return Actor[] the actors
  */
 public static function getActors($mediaType)
 {
     // Fetch the list of all works
     $works = array();
     if ($mediaType === Actor::MEDIA_TYPE_MOVIE) {
         $works = VideoLibrary::getMovies(array('properties' => array('cast')));
     } elseif ($mediaType === Actor::MEDIA_TYPE_TVSHOW) {
         $works = VideoLibrary::getTVShows(array('properties' => array('cast')));
     }
     // Build a list of all unique actors
     $actors = array();
     foreach ($works as $work) {
         $actors = array_merge($actors, $work->cast);
     }
     // array_unique compares by string
     return array_unique($actors);
 }