本文整理汇总了PHP中Asset::getRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::getRepository方法的具体用法?PHP Asset::getRepository怎么用?PHP Asset::getRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset
的用法示例。
在下文中一共展示了Asset::getRepository方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrlParams
/**
* Answer a list of parameters to pass through urls
*
* @return array
* @access public
* @since 10/16/07
*/
public static function getUrlParams(Asset $asset)
{
$repository = $asset->getRepository();
$params = array("collection_id" => $repository->getId()->getIdString(), "asset_id" => $asset->getId()->getIdString(), RequestContext::name("starting_number") => RequestContext::value("starting_number"), RequestContext::name("limit_by_type") => RequestContext::value("limit_by_type"), RequestContext::name("order") => RequestContext::value("order"), RequestContext::name("direction") => RequestContext::value("direction"), RequestContext::name("type") => RequestContext::value("type"), RequestContext::name("searchtype") => RequestContext::value("searchtype"));
if (RequestContext::value("searchtype")) {
$searchModuleManager = Services::getService("RepositorySearchModules");
foreach ($searchModuleManager->getCurrentValues(HarmoniType::fromString(RequestContext::value("searchtype"))) as $key => $value) {
$params[$key] = $value;
}
}
// if we are limiting by type
if (RequestContext::value("limit_by_type") == 'true') {
$types = $repository->getAssetTypes();
$selectedTypes = array();
while ($types->hasNext()) {
$type = $types->next();
if (RequestContext::value("type___" . $type->asString()) == 'true') {
$params[RequestContext::name("type___" . $type->asString())] = RequestContext::value("type___" . $type->asString());
}
}
}
return $params;
}
示例2: createForContentAsset
/**
* Create a new Asset attached to a content asset. To access this asset as
* a mediaAsset, use
* MediaAsset::withAsset(MediaAsset::createForContentAsset($contentAsset));
*
* @param object Asset $contentAsset
* @return object Asset
* @access public
* @since 1/24/08
* @static
*/
public static function createForContentAsset(Asset $contentAsset)
{
$repository = $contentAsset->getRepository();
// Create the asset
$asset = $repository->createAsset("Untitled", '', self::getMediaFileType());
$contentAsset->addAsset($asset->getId());
return $asset;
}
示例3: forAsset
/**
* Create an instance of the Director for a particular Asset
*
* @param object Asset $asset
* @return object AssetSiteDirector
* @access public
* @since 10/25/07
* @static
*/
public static function forAsset(Asset $asset)
{
return new AssetSiteDirector($asset->getRepository());
}
示例4: printAssetXML
/**
* Function for printing the asset block of the slideshow XML file
*
* @param object Asset $asset
* @param optional object Id $recordId
* @return void
* @access public
* @since 10/14/05
*/
function printAssetXML(Asset $asset, Id $recordId = null)
{
$assetId = $asset->getId();
$repository = $asset->getRepository();
$repositoryId = $repository->getId();
$idManager = Services::getService("Id");
// ------------------------------------------
print "\t<slide>\n";
// Title
print "\t\t<title><![CDATA[";
print htmlspecialchars($asset->getDisplayName(), ENT_COMPAT, 'UTF-8');
print "]]></title>\n";
// Caption
print "\t\t<caption><![CDATA[";
$this->printAsset($asset);
print "]]></caption>\n";
// Text-Position
print "\t\t<text-position>";
print "right";
print "</text-position>\n";
$fileRecords = new MultiIteratorIterator();
$fileRecords->addIterator($asset->getRecordsByRecordStructure($idManager->getId("FILE")));
$fileRecords->addIterator($asset->getRecordsByRecordStructure($idManager->getId("REMOTE_FILE")));
/*********************************************************
* Files
*********************************************************/
$harmoni = Harmoni::instance();
$harmoni->request->startNamespace("polyphony-repository");
$imgProcessor = Services::getService("ImageProcessor");
while ($fileRecords->hasNext()) {
$this->printFileRecord($fileRecords->next(), $repositoryId, $assetId);
}
$harmoni->request->endNamespace();
print "\t</slide>\n";
}
示例5: printAssetXML
/**
* Function for printing the asset block of the slideshow XML file
*
* @param object Asset $asset
* @param optional object Id $recordId
* @return void
* @access public
* @since 10/14/05
*/
function printAssetXML(Asset $asset, Id $recordId = null)
{
$harmoni = Harmoni::instance();
$assetId = $asset->getId();
$repository = $asset->getRepository();
$repositoryId = $repository->getId();
$idManager = Services::getService("Id");
// ------------------------------------------
print "\t<slide>\n";
// Title
print "\t\t<title><![CDATA[";
// print htmlspecialchars($asset->getDisplayName(), ENT_COMPAT, 'UTF-8');
print "]]></title>\n";
// Caption
print "\t\t<caption><![CDATA[";
// $this->printAsset($asset);
print "]]></caption>\n";
// Text-Position
print "\t\t<text-position>";
print "none";
print "</text-position>\n";
$fileRecords = $asset->getRecordsByRecordStructure($idManager->getId("FILE"));
/*********************************************************
* Files
*********************************************************/
while ($fileRecords->hasNext()) {
$fileRecord = $fileRecords->next();
$fileRecordId = $fileRecord->getId();
if ($fileRecordId->isEqual($recordId)) {
$this->printFileRecord($fileRecord, $repositoryId, $assetId);
}
}
print "\t</slide>\n";
}