public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kAssetParamsResourceContainer();
     }
     if ($this->resource) {
         $object_to_fill->setResource($this->resource->toObject());
     }
     $object_to_fill->setAssetParamsId($this->assetParamsId);
     return $object_to_fill;
 }
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (is_null($this->operationAttributes) || !count($this->operationAttributes)) {
         return $this->resource->toObject();
     }
     if (!$object_to_fill) {
         $object_to_fill = new kOperationResource();
     }
     $operationAttributes = array();
     foreach ($this->operationAttributes as $operationAttributesObject) {
         $operationAttributes[] = $operationAttributesObject->toObject();
     }
     $object_to_fill->setOperationAttributes($operationAttributes);
     $object_to_fill->setResource($this->resource->toObject());
     return parent::toObject($object_to_fill, $props_to_skip);
 }
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kUrlResource();
     }
     return parent::toObject($object_to_fill, $props_to_skip);
 }
예제 #4
0
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kLocalFileResource();
     }
     file_put_contents($fname = tempnam(myContentStorage::getFSUploadsPath(), "KFR"), $this->content);
     $object_to_fill->setLocalFilePath($fname);
     $object_to_fill->setSourceType(entry::ENTRY_MEDIA_SOURCE_TEXT);
     return parent::toObject($object_to_fill, $props_to_skip);
 }
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kRemoteStorageResources();
     }
     $resources = array();
     if ($this->resources) {
         foreach ($this->resources as $resource) {
             /* @var $resource KalturaRemoteStorageResource */
             $resources[] = $resource->toObject();
         }
     }
     $object_to_fill->setResources($resources);
     return parent::toObject($object_to_fill, $props_to_skip);
 }
 /**
  * Update content of attachment asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaAttachmentAsset
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED 
  * @validateUser asset::entry id edit
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbAttachmentAsset = assetPeer::retrieveById($id);
     if (!$dbAttachmentAsset || !$dbAttachmentAsset instanceof AttachmentAsset) {
         throw new KalturaAPIException(KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbAttachmentAsset->getentry();
     if (!$dbEntry || !in_array($dbEntry->getType(), $this->mediaTypes)) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbAttachmentAsset->getEntryId());
     }
     $previousStatus = $dbAttachmentAsset->getStatus();
     $contentResource->validateEntry($dbAttachmentAsset->getentry());
     $contentResource->validateAsset($dbAttachmentAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbAttachmentAsset, $kContentResource);
     $contentResource->entryHandled($dbAttachmentAsset->getentry());
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAttachmentAsset));
     $newStatuses = array(AttachmentAsset::ASSET_STATUS_READY, AttachmentAsset::ASSET_STATUS_VALIDATING, AttachmentAsset::ASSET_STATUS_TEMP);
     if ($previousStatus == AttachmentAsset::ASSET_STATUS_QUEUED && in_array($dbAttachmentAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbAttachmentAsset));
     }
     $attachmentAsset = new KalturaAttachmentAsset();
     $attachmentAsset->fromObject($dbAttachmentAsset);
     return $attachmentAsset;
 }
예제 #7
0
 /**
  * Update content of caption asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaCaptionAsset
  * @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED
  * @validateUser asset::entry id edit 
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbCaptionAsset = assetPeer::retrieveById($id);
     if (!$dbCaptionAsset || !$dbCaptionAsset instanceof CaptionAsset) {
         throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbCaptionAsset->getentry();
     if (!$dbEntry || !in_array($dbEntry->getType(), $this->getEnabledMediaTypes()) || !in_array($dbEntry->getMediaType(), array(KalturaMediaType::VIDEO, KalturaMediaType::AUDIO))) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbCaptionAsset->getEntryId());
     }
     $previousStatus = $dbCaptionAsset->getStatus();
     $contentResource->validateEntry($dbCaptionAsset->getentry());
     $contentResource->validateAsset($dbCaptionAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbCaptionAsset, $kContentResource);
     $contentResource->entryHandled($dbCaptionAsset->getentry());
     $newStatuses = array(CaptionAsset::ASSET_STATUS_READY, CaptionAsset::ASSET_STATUS_VALIDATING, CaptionAsset::ASSET_STATUS_TEMP);
     if ($previousStatus == CaptionAsset::ASSET_STATUS_QUEUED && in_array($dbCaptionAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbCaptionAsset));
     } else {
         kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbCaptionAsset));
     }
     $captionAsset = new KalturaCaptionAsset();
     $captionAsset->fromObject($dbCaptionAsset, $this->getResponseProfile());
     return $captionAsset;
 }
 /**
  * Update content of thumbnail asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaThumbAsset
  * @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED
  * @validateUser asset::entry id edit 
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbThumbAsset = assetPeer::retrieveById($id);
     if (!$dbThumbAsset || !$dbThumbAsset instanceof thumbAsset) {
         throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbThumbAsset->getentry();
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbThumbAsset->getEntryId());
     }
     $previousStatus = $dbThumbAsset->getStatus();
     $contentResource->validateEntry($dbThumbAsset->getentry());
     $contentResource->validateAsset($dbThumbAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbThumbAsset, $kContentResource);
     $contentResource->entryHandled($dbThumbAsset->getentry());
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbThumbAsset));
     $newStatuses = array(thumbAsset::ASSET_STATUS_READY, thumbAsset::ASSET_STATUS_VALIDATING, thumbAsset::ASSET_STATUS_TEMP);
     if ($previousStatus == thumbAsset::ASSET_STATUS_QUEUED && in_array($dbThumbAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbThumbAsset));
     }
     $thumbAssetsCount = assetPeer::countThumbnailsByEntryId($dbThumbAsset->getEntryId());
     $defaultThumbKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     //If the thums has the default tag or the entry is in no content and this is the first thumb
     if ($dbEntry->getCreateThumb() && ($dbThumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB) || $dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT && $thumbAssetsCount == 1 && !kFileSyncUtils::fileSync_exists($defaultThumbKey))) {
         $this->setAsDefaultAction($dbThumbAsset->getId());
     }
     $thumbAsset = new KalturaThumbAsset();
     $thumbAsset->fromObject($dbThumbAsset);
     return $thumbAsset;
 }
예제 #9
0
 /**
  * Update content of flavor asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaFlavorAsset
  * @throws KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED 
  * @validateUser asset::entry id edit
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbFlavorAsset = assetPeer::retrieveById($id);
     if (!$dbFlavorAsset || !$dbFlavorAsset instanceof flavorAsset) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $id);
     }
     $dbEntry = $dbFlavorAsset->getentry();
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $dbFlavorAsset->getEntryId());
     }
     $contentResource->validateEntry($dbFlavorAsset->getentry());
     $contentResource->validateAsset($dbFlavorAsset);
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbFlavorAsset, $kContentResource);
     $contentResource->entryHandled($dbFlavorAsset->getentry());
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbFlavorAsset));
     $newStatuses = array(asset::ASSET_STATUS_EXPORTING, flavorAsset::FLAVOR_ASSET_STATUS_READY, flavorAsset::FLAVOR_ASSET_STATUS_QUEUED, flavorAsset::FLAVOR_ASSET_STATUS_TEMP);
     if (in_array($dbFlavorAsset->getStatus(), $newStatuses)) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbFlavorAsset));
     }
     $flavorAsset = KalturaFlavorAsset::getInstance($dbFlavorAsset, $this->getResponseProfile());
     return $flavorAsset;
 }
예제 #10
0
 /**
  * Set content of file asset
  *
  * @action setContent
  * @param string $id
  * @param KalturaContentResource $contentResource
  * @return KalturaFileAsset
  * @throws KalturaErrors::FILE_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED 
  */
 function setContentAction($id, KalturaContentResource $contentResource)
 {
     $dbFileAsset = FileAssetPeer::retrieveByPK($id);
     if (!$dbFileAsset) {
         throw new KalturaAPIException(KalturaErrors::FILE_ASSET_ID_NOT_FOUND, $id);
     }
     $kContentResource = $contentResource->toObject();
     $this->attachContentResource($dbFileAsset, $kContentResource);
     $fileAsset = new KalturaFileAsset();
     $fileAsset->fromObject($dbFileAsset, $this->getResponseProfile());
     return $fileAsset;
 }