Exemplo n.º 1
0
 /**
  * Retrieve playlist for playing purpose
  * @disableTags TAG_WIDGET_SESSION
  *
  * @action execute
  * @param string $id
  * @param string $detailed
  * @param KalturaContext $playlistContext
  * @param KalturaMediaEntryFilterForPlaylist $filter
  * @param KalturaFilterPager $pager
  * @return KalturaBaseEntryArray
  */
 function executeAction($id, $detailed = false, KalturaContext $playlistContext = null, $filter = null, $pager = null)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     $playlist = entryPeer::retrieveByPK($id);
     if (!$playlist) {
         throw new KalturaAPIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $id);
     }
     if ($playlist->getType() != entryType::PLAYLIST) {
         throw new KalturaAPIException(APIErrors::INVALID_PLAYLIST_TYPE);
     }
     $entryFilter = null;
     if ($filter) {
         $coreFilter = new entryFilter();
         $filter->toObject($coreFilter);
         $entryFilter = $coreFilter;
     }
     if ($this->getKs() && is_object($this->getKs()) && $this->getKs()->isAdmin()) {
         myPlaylistUtils::setIsAdminKs(true);
     }
     $corePlaylistContext = null;
     if ($playlistContext) {
         $corePlaylistContext = $playlistContext->toObject();
         myPlaylistUtils::setPlaylistContext($corePlaylistContext);
     }
     // the default of detrailed should be true - most of the time the kuse is needed
     if (is_null($detailed)) {
         $detailed = true;
     }
     try {
         $entryList = myPlaylistUtils::executePlaylist($this->getPartnerId(), $playlist, $entryFilter, $detailed, $pager);
     } catch (kCoreException $ex) {
         throw $ex;
     }
     myEntryUtils::updatePuserIdsForEntries($entryList);
     return KalturaBaseEntryArray::fromDbArray($entryList, $this->getResponseProfile());
 }