本文整理汇总了PHP中Asset::getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::getDisplayName方法的具体用法?PHP Asset::getDisplayName怎么用?PHP Asset::getDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset
的用法示例。
在下文中一共展示了Asset::getDisplayName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: includeSite
/**
* Answer true if this site should be included
*
* @param object Asset $asset
* @return boolean
* @access protected
* @since 4/1/08
*/
protected function includeSite(Asset $asset)
{
$matches = false;
if ($this->match($asset->getDisplayName())) {
$matches = true;
} else {
if ($this->match($asset->getDescription())) {
$matches = true;
}
}
if (!$matches) {
$slotMgr = SlotManager::instance();
try {
$slot = $slotMgr->getSlotBySiteId($asset->getId());
} catch (UnknownIdException $e) {
}
if (isset($slot) && $this->match($slot->getShortname())) {
$matches = true;
}
}
if (!$matches) {
return false;
}
$authZ = Services::getService("AuthZ");
$idManager = Services::getService("Id");
// Since View AZs now cascade up, we don't need to check isAuthorizedBelow()
if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $asset->getId())) {
return TRUE;
} else {
return FALSE;
}
}
示例2: printSiteShort
/**
*
*
* @param <##>
* @return <##>
* @access public
* @since 1/18/06
*/
public function printSiteShort(Asset $asset, $action, $num, Slot $otherSlot = null)
{
$harmoni = Harmoni::instance();
$assetId = $asset->getId();
$authZ = Services::getService('AuthZ');
$idMgr = Services::getService('Id');
if (!$authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId) && !$otherSlot->isUserOwner()) {
return new UnstyledBlock('', BLANK);
}
$container = new Container(new YLayout(), BLOCK, STANDARD_BLOCK);
$fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container.");
$fillContainerSC->addSP(new MinHeightSP("88%"));
// $fillContainerSC->addSP(new WidthSP("100%"));
// $fillContainerSC->addSP(new BorderSP("3px", "solid", "#F00"));
$container->addStyle($fillContainerSC);
$centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text");
$centered->addSP(new TextAlignSP("center"));
// Use the alias instead of the Id if it is available.
$viewUrl = SiteDispatcher::getSitesUrlForSiteId($assetId->getIdString());
$slotManager = SlotManager::instance();
try {
$sitesTrueSlot = $slotManager->getSlotBySiteId($assetId);
} catch (Exception $e) {
}
// Print out the content
ob_start();
print "\n\t<div class='portal_list_slotname'>";
if (isset($sitesTrueSlot)) {
if (is_null($otherSlot) || $sitesTrueSlot->getShortname() == $otherSlot->getShortname()) {
print $sitesTrueSlot->getShortname();
} else {
print $otherSlot->getShortname();
$targets = array();
$target = $otherSlot->getAliasTarget();
while ($target) {
$targets[] = $target->getShortname();
if ($target->isAlias()) {
$target = $target->getAliasTarget();
} else {
$target = null;
}
}
print "\n<br/>";
print str_replace('%1', implode(' » ', $targets), _("(an alias of %1)"));
// Add Alias info.
// if ($otherSlot->isAlias()) {
// ob_start();
//
// print _("This slot is an alias of ").$slot->getAliasTarget()->getShortname();
//
// $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, LEFT, TOP);
// }
}
} else {
print _("ID#") . ": " . $assetId->getIdString();
}
print "\n\t</div>";
print "\n\t<div class='portal_list_site_title'>";
if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
print "\n\t\t<a href='" . $viewUrl . "'>";
print "\n\t\t\t<strong>" . HtmlString::getSafeHtml($asset->getDisplayName()) . "</strong>";
print "\n\t\t</a>";
print "\n\t\t<br/>";
print "\n\t\t<a href='" . $viewUrl . "' style='font-size: smaller;'>";
print "\n\t\t\t" . $viewUrl;
print "\n\t\t</a>";
}
print "\n\t</div>";
print "\n\t<div class='portal_list_controls'>\n\t\t";
$controls = array();
if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
$controls[] = "<a href='" . $viewUrl . "'>" . _("view") . "</a>";
}
// Hide all edit links if not authenticated to prevent web spiders from traversing them
if ($this->isAuthenticated) {
// While it is more correct to check modify permission permission, doing
// so forces us to check AZs on the entire site until finding a node with
// authorization or running out of nodes to check. Since edit-mode actions
// devolve into view-mode if no authorization is had by the user, just
// show the links all the time to cut page loads from 4-6 seconds to
// less than 1 second.
if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
$controls[] = "<a href='" . SiteDispatcher::quickURL($action->getUiModule(), 'editview', array('node' => $assetId->getIdString())) . "'>" . _("edit") . "</a>";
}
// if ($action->getUiModule() == 'ui2') {
// $controls[] = "<a href='".SiteDispatcher::quickURL($action->getUiModule(), 'arrangeview', array('node' => $assetId->getIdString()))."'>"._("arrange")."</a>";
// }
// add link to tracking
if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
$trackUrl = $harmoni->request->quickURL("participation", "actions", array('node' => $assetId->getIdString()));
ob_start();
print " <a target='_blank' href='" . $trackUrl . "'";
//.........这里部分代码省略.........
示例3: addDublinCoreRecord
/**
* Add a Dublin Core Record to a media Asset.
*
* @param object Asset $asset
* @param object DOMElement $element
* @return void
* @access protected
* @since 1/24/08
*/
protected function addDublinCoreRecord(Asset $asset, DOMElement $element)
{
$idManager = Services::getService("Id");
$record = $asset->createRecord($idManager->getId("dc"));
$element->setAttribute('new_id', $record->getId()->getIdString());
try {
$value = String::fromString(HtmlString::getSafeHtml($asset->getDisplayName()));
$id = $idManager->getId("dc.title");
$this->updateSingleValuedPart($record, $id, $value);
} catch (MissingNodeException $e) {
}
try {
$value = String::fromString(HtmlString::getSafeHtml($asset->getDescription()));
$id = $idManager->getId("dc.description");
$this->updateSingleValuedPart($record, $id, $value);
} catch (MissingNodeException $e) {
}
try {
$valueElement = $this->getSingleElement('./creator', $element);
if ($valueElement) {
$value = String::fromString(HtmlString::getSafeHtml($this->getStringValue($valueElement)));
$id = $idManager->getId("dc.creator");
$this->updateSingleValuedPart($record, $id, $value);
}
} catch (MissingNodeException $e) {
}
try {
$valueElement = $this->getSingleElement('./source', $element);
if ($valueElement) {
$value = String::fromString(HtmlString::getSafeHtml($this->getStringValue($valueElement)));
$id = $idManager->getId("dc.source");
$this->updateSingleValuedPart($record, $id, $value);
}
} catch (MissingNodeException $e) {
}
try {
$valueElement = $this->getSingleElement('./publisher', $element);
if ($valueElement) {
$value = String::fromString(HtmlString::getSafeHtml($this->getStringValue($valueElement)));
$id = $idManager->getId("dc.publisher");
$this->updateSingleValuedPart($record, $id, $value);
}
} catch (MissingNodeException $e) {
}
try {
$valueElement = $this->getSingleElement('./date', $element);
if ($valueElement) {
$value = DateAndTime::fromString($this->getStringValue($valueElement));
$id = $idManager->getId("dc.date");
$this->updateSingleValuedPart($record, $id, $value);
}
} catch (MissingNodeException $e) {
}
}
示例4: while
/**
* Recursively copies an asset and its children to a new parent.
*
* @access private
*/
function _copyAsset(Asset $asset, Id $newParentId)
{
// Create the new asset
$newAsset = $this->createAsset($asset->getDisplayName(), $asset->getDescription(), $asset->getAssetType());
// Move the new asset to the proper parent if it
// is not being copied to the dr root.
if (!$newParentId->isEqual($this->getId())) {
$newParent = $this->getAsset($newParentId);
$newParent->addAsset($newAsset->getId());
}
// Copy its data
// @todo
// Copy the children
$children = $asset->getAssets();
while ($children->hasNext()) {
$childAsset = $children->next();
$this->_copyAsset($childAsset, $newAsset->getId());
}
// Return its Id
return $newAsset->getId();
}
示例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)
{
$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";
}