/** * @param SimpleXMLElement $scene * @param int $partnerId * @param CuePoint $newCuePoint * @return CuePoint */ public static function parseXml(SimpleXMLElement $scene, $partnerId, CuePoint $newCuePoint = null) { $cuePoint = null; if (isset($scene['sceneId']) && $scene['sceneId']) { $cuePoint = CuePointPeer::retrieveByPK($scene['sceneId']); } if (!$cuePoint && isset($scene['systemName']) && $scene['systemName']) { $cuePoint = CuePointPeer::retrieveBySystemName($scene['entryId'], $scene['systemName']); } if (!$cuePoint) { $cuePoint = $newCuePoint; } $cuePoint->setPartnerId($partnerId); $cuePoint->setStartTime(kXml::timeToInteger($scene->sceneStartTime)); $tags = array(); foreach ($scene->tags->children() as $tag) { $value = "{$tag}"; if ($value) { $tags[] = $value; } } $cuePoint->setTags(implode(',', $tags)); $cuePoint->setEntryId($scene['entryId']); if (isset($scene['systemName'])) { $cuePoint->setSystemName($scene['systemName']); } return $cuePoint; }
public static function parseXml(SimpleXMLElement $scene, $partnerId, CuePoint $cuePoint = null) { if ($scene->getName() != 'scene-annotation') { return $cuePoint; } if (!$cuePoint) { $cuePoint = kCuePointManager::parseXml($scene, $partnerId, new Annotation()); } if (!$cuePoint instanceof Annotation) { return null; } $cuePoint->setEndTime(kXml::timeToInteger($scene->sceneEndTime)); if (isset($scene->sceneText)) { $cuePoint->setText($scene->sceneText); } $parentCuePoint = null; if (isset($scene->parentId)) { $parentCuePoint = CuePointPeer::retrieveByPK($scene->parentId); } elseif (isset($scene->parent)) { $parentCuePoint = CuePointPeer::retrieveBySystemName($cuePoint->getEntryId(), $scene->parent); } if ($parentCuePoint) { $cuePoint->setParentId($parentCuePoint->getId()); } return $cuePoint; }
/** * Update cue point by id * * @action update * @param string $id * @param KalturaCuePoint $cuePoint * @return KalturaCuePoint * @throws KalturaCuePointErrors::INVALID_CUE_POINT_ID * @validateUser CuePoint id editcuepoint */ function updateAction($id, KalturaCuePoint $cuePoint) { $dbCuePoint = CuePointPeer::retrieveByPK($id); if (!$dbCuePoint) { throw new KalturaAPIException(KalturaCuePointErrors::INVALID_CUE_POINT_ID, $id); } if ($this->getCuePointType() && $dbCuePoint->getType() != $this->getCuePointType()) { throw new KalturaAPIException(KalturaCuePointErrors::INVALID_CUE_POINT_ID, $id); } if ($cuePoint->systemName) { $existingCuePoint = CuePointPeer::retrieveBySystemName($dbCuePoint->getEntryId(), $cuePoint->systemName); if ($existingCuePoint && $existingCuePoint->getId() != $id) { throw new KalturaAPIException(KalturaCuePointErrors::CUE_POINT_SYSTEM_NAME_EXISTS, $cuePoint->systemName, $existingCuePoint->getId()); } } $dbCuePoint = $cuePoint->toUpdatableObject($dbCuePoint); $this->validateUserLog($dbCuePoint); $dbCuePoint->setKuserId($this->getKuser()->getId()); $dbCuePoint->save(); $cuePoint->fromObject($dbCuePoint, $this->getResponseProfile()); return $cuePoint; }
/** * @param SimpleXMLElement $scene * @param int $partnerId * @param CuePoint $newCuePoint * @return CuePoint */ public static function parseXml(SimpleXMLElement $scene, $partnerId, CuePoint $newCuePoint = null) { $cuePoint = null; $entryId = $scene['entryId']; $entry = entryPeer::retrieveByPK($entryId); if (!$entry) { throw new kCoreException("Entry [{$entryId}] not found", kCoreException::INVALID_ENTRY_ID); } if (isset($scene['sceneId']) && $scene['sceneId']) { $cuePoint = CuePointPeer::retrieveByPK($scene['sceneId']); } if (!$cuePoint && isset($scene['systemName']) && $scene['systemName']) { $cuePoint = CuePointPeer::retrieveBySystemName($entryId, $scene['systemName']); } if (!$cuePoint) { $cuePoint = $newCuePoint; } $cuePoint->setPartnerId($partnerId); $cuePoint->setStartTime(kXml::timeToInteger($scene->sceneStartTime)); $tags = array(); foreach ($scene->tags->children() as $tag) { $value = "{$tag}"; if ($value) { $tags[] = $value; } } $cuePoint->setTags(implode(',', $tags)); $cuePoint->setEntryId($entryId); if (isset($scene['systemName'])) { $cuePoint->setSystemName($scene['systemName']); } return $cuePoint; }