コード例 #1
0
ファイル: UiConfService.php プロジェクト: richhl/kalturaCE
 /**
  * Update an existing UIConf
  * 
  * @action update
  * @param int $id 
  * @param KalturaUiConf $uiConf
  * @return KalturaUiConf
  *
  * @throws APIErrors::INVALID_UI_CONF_ID
  */
 function updateAction($id, KalturaUiConf $uiConf)
 {
     $dbUiConf = uiConfPeer::retrieveByPK($id);
     if (!$dbUiConf) {
         throw new KalturaAPIException(APIErrors::INVALID_UI_CONF_ID, $id);
     }
     $uiConfUpdate = $uiConf->toUiConf();
     $allowEmpty = true;
     // TODO - what is the policy  ?
     baseObjectUtils::autoFillObjectFromObject($uiConfUpdate, $dbUiConf, $allowEmpty);
     $dbUiConf->save();
     $uiConf->fromUiConf($dbUiConf);
     return $uiConf;
 }
コード例 #2
0
ファイル: WidgetService.php プロジェクト: richhl/kalturaCE
 /**
  * Update exisiting widget
  * 
  * @action update
  * @param string $id 
  * @param KalturaWidget $widget
  * @return KalturaWidget
  */
 function updateAction($id, KalturaWidget $widget)
 {
     $dbWidget = widgetPeer::retrieveByPK($id);
     if (!$dbWidget) {
         throw new KalturaAPIException(APIErrors::INVALID_WIDGET_ID, $id);
     }
     $widgetUpdate = $widget->toWidget();
     $allow_empty = true;
     // TODO - what is the policy  ?
     baseObjectUtils::autoFillObjectFromObject($widgetUpdate, $dbWidget, $allow_empty);
     $dbWidget->save();
     // TODO: widget in cache, should drop from cache
     $widget->fromWidget($dbWidget);
     return $widget;
 }
コード例 #3
0
ファイル: PlaylistService.php プロジェクト: wzur/server
 /**
  * Update existing playlist
  * Note - you cannot change playlist type. updated playlist must be of the same type.
  *
  * @action update
  * @param string $id
  * @param KalturaPlaylist $playlist
  * @param bool $updateStats
  * @return KalturaPlaylist
  *
  * @throws APIErrors::INVALID_ENTRY_ID
  * @throws APIErrors::INVALID_PLAYLIST_TYPE
  * @validateUser entry id edit
  *
  * @disableRelativeTime $playlist
  */
 function updateAction($id, KalturaPlaylist $playlist, $updateStats = false)
 {
     $dbPlaylist = entryPeer::retrieveByPK($id);
     if (!$dbPlaylist) {
         throw new KalturaAPIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $id);
     }
     if ($dbPlaylist->getType() != entryType::PLAYLIST) {
         throw new KalturaAPIException(APIErrors::INVALID_PLAYLIST_TYPE);
     }
     $playlist->playlistType = $dbPlaylist->getMediaType();
     // Added the following 2 lines in order to make the permission verifications in toUpdatableObject work on the actual db object
     // TODO: the following use of autoFillObjectFromObject should be replaced by a normal toUpdatableObject
     $playlistUpdate = clone $dbPlaylist;
     $playlistUpdate = $playlist->toUpdatableObject($playlistUpdate);
     $this->checkAndSetValidUserUpdate($playlist, $dbPlaylist);
     $this->checkAdminOnlyUpdateProperties($playlist);
     $this->validateAccessControlId($playlist);
     $this->validateEntryScheduleDates($playlist, $dbPlaylist);
     $allowEmpty = true;
     // TODO - what is the policy  ?
     if ($playlistUpdate->getMediaType() && $playlistUpdate->getMediaType() != $dbPlaylist->getMediaType()) {
         throw new KalturaAPIException(APIErrors::INVALID_PLAYLIST_TYPE);
     } else {
         $playlistUpdate->setMediaType($dbPlaylist->getMediaType());
         // incase  $playlistUpdate->getMediaType() was empty
     }
     // copy properties from the playlistUpdate to the $dbPlaylist
     baseObjectUtils::autoFillObjectFromObject($playlistUpdate, $dbPlaylist, $allowEmpty);
     // after filling the $dbPlaylist from  $playlist - make sure the data content is set properly
     if (!is_null($playlistUpdate->getDataContent(true)) && $playlistUpdate->getDataContent(true) != $dbPlaylist->getDataContent()) {
         $dbPlaylist->setDataContent($playlistUpdate->getDataContent(true));
         myPlaylistUtils::validatePlaylist($dbPlaylist);
     }
     if ($updateStats) {
         myPlaylistUtils::updatePlaylistStatistics($this->getPartnerId(), $dbPlaylist);
     }
     //, $extra_filters , $detailed );
     $dbPlaylist->save();
     $playlist->fromObject($dbPlaylist, $this->getResponseProfile());
     return $playlist;
 }
コード例 #4
0
ファイル: WidgetService.php プロジェクト: DBezemer/server
 /**
  * Update exisiting widget
  * 
  * @action update
  * @param string $id 
  * @param KalturaWidget $widget
  * @return KalturaWidget
  */
 function updateAction($id, KalturaWidget $widget)
 {
     $dbWidget = widgetPeer::retrieveByPK($id);
     if (!$dbWidget) {
         throw new KalturaAPIException(APIErrors::INVALID_WIDGET_ID, $id);
     }
     if (!is_null($widget->enforceEntitlement) && $widget->enforceEntitlement == false && kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DISABLE_ENTITLEMENT_FOR_WIDGET_WHEN_ENTITLEMENT_ENFORCEMENT_ENABLE);
     }
     if ($widget->entryId !== null) {
         $entry = entryPeer::retrieveByPK($widget->entryId);
         if (!$entry) {
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $widget->entryId);
         }
     } elseif ($widget->enforceEntitlement != null && $widget->enforceEntitlement == false) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DISABLE_ENTITLEMENT_WITH_NO_ENTRY_ID);
     }
     $widgetUpdate = $widget->toWidget();
     if ($entry && $entry->getType() == entryType::PLAYLIST) {
         $dbWidget->setIsPlayList(true);
     } else {
         $dbWidget->setIsPlayList(false);
     }
     $allow_empty = true;
     // TODO - what is the policy  ?
     baseObjectUtils::autoFillObjectFromObject($widgetUpdate, $dbWidget, $allow_empty);
     $dbWidget->save();
     // TODO: widget in cache, should drop from cache
     $widget->fromObject($dbWidget, $this->getResponseProfile());
     return $widget;
 }