/** * @param CuePoint $cuePoint * @param SimpleXMLElement $scene * @return SimpleXMLElement the created scene */ public static function syndicateCuePointXml(CuePoint $cuePoint, SimpleXMLElement $scene) { $scene->addAttribute('sceneId', $cuePoint->getId()); if ($cuePoint->getSystemName()) { $scene->addAttribute('systemName', kMrssManager::stringToSafeXml($cuePoint->getSystemName())); } $scene->addChild('sceneStartTime', kXml::integerToTime($cuePoint->getStartTime())); $scene->addChild('createdAt', $cuePoint->getCreatedAt(kMrssManager::FORMAT_DATETIME)); $scene->addChild('updatedAt', $cuePoint->getCreatedAt(kMrssManager::FORMAT_DATETIME)); if ($cuePoint->getPuserId()) { $scene->addChild('userId', kMrssManager::stringToSafeXml($cuePoint->getPuserId())); } if (trim($cuePoint->getTags(), " \r\n\t")) { $tags = $scene->addChild('tags'); foreach (explode(',', $cuePoint->getTags()) as $tag) { $tags->addChild('tag', kMrssManager::stringToSafeXml($tag)); } } return $scene; }
public static function generateXml(CuePoint $cuePoint, SimpleXMLElement $scenes, SimpleXMLElement $scene = null) { if (is_null($scene) || $scene->getName() != 'scene-annotation' || !$cuePoint instanceof Annotation) { return $scene; } $objectType = self::getMetadataObjectTypeCoreValue(AnnotationMetadataObjectType::ANNOTATION); return CuePointMetadataPlugin::generateCuePointXml($scene, $objectType, $cuePoint->getId()); }
public static function parseXml($objectType, SimpleXMLElement $scene, $partnerId, CuePoint $cuePoint) { $metadataElements = $scene->xpath('scene-customData'); if (!count($metadataElements)) { return $cuePoint; } foreach ($metadataElements as $metadataElement) { $metadata = null; $metadataProfile = null; if (isset($metadataElement['metadataId'])) { $metadata = MetadataPeer::retrieveByPK($metadataElement['metadataId']); } if ($metadata) { $metadataProfile = $metadata->getMetadataProfile(); } else { if (isset($metadataElement['metadataProfileId'])) { $metadataProfile = MetadataProfilePeer::retrieveByPK($metadataElement['metadataProfileId']); } elseif (isset($metadataElement['metadataProfile'])) { $metadataProfile = MetadataProfilePeer::retrieveBySystemName($metadataElement['metadataProfile']); } if ($metadataProfile) { $metadata = MetadataPeer::retrieveByObject($metadataProfile->getId(), $objectType, $cuePoint->getId()); } } if (!$metadataProfile) { continue; } if (!$metadata) { $metadata = new Metadata(); $metadata->setPartnerId($partnerId); $metadata->setMetadataProfileId($metadataProfile->getId()); $metadata->setMetadataProfileVersion($metadataProfile->getVersion()); $metadata->setObjectType($objectType); $metadata->setObjectId($cuePoint->getId()); $metadata->setStatus(KalturaMetadataStatus::VALID); foreach ($metadataElement->children() as $metadataContent) { $xmlData = $metadataContent->asXML(); $errorMessage = ''; if (kMetadataManager::validateMetadata($metadataProfile->getId(), $xmlData, $errorMessage)) { $metadata->save(); $key = $metadata->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA); kFileSyncUtils::file_put_contents($key, $xmlData); kEventsManager::raiseEvent(new kObjectDataChangedEvent($metadata)); } break; } } } return $cuePoint; }
public static function generateXml(CuePoint $cuePoint, SimpleXMLElement $scenes, SimpleXMLElement $scene = null) { if (is_null($scene) || $scene->getName() != 'scene-ad-cue-point' || !$cuePoint instanceof AdCuePoint) { return $scene; } $objectType = self::getMetadataObjectTypeCoreValue(AdCuePointMetadataObjectType::AD_CUE_POINT); return CuePointMetadataPlugin::generateCuePointXml($scene, $objectType, $cuePoint->getId()); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param CuePoint $value A CuePoint object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(CuePoint $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param CuePoint $value A CuePoint object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(CuePoint $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) { self::$instances[$key] = $obj; kMemoryManager::registerPeer('CuePointPeer'); } } }