当前位置: 首页>>代码示例>>PHP>>正文


PHP Container::addStyle方法代码示例

本文整理汇总了PHP中Container::addStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::addStyle方法的具体用法?PHP Container::addStyle怎么用?PHP Container::addStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Container的用法示例。


在下文中一共展示了Container::addStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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(' &raquo; ', $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 . "'";
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:segue,代码行数:101,代码来源:list.act.php

示例2: printAssetShort

 function printAssetShort($asset, $params, $num)
 {
     $harmoni = Harmoni::instance();
     $container = new Container(new YLayout(), BLOCK, EMPHASIZED_BLOCK);
     $fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container.");
     $fillContainerSC->addSP(new MinHeightSP("88%"));
     $container->addStyle($fillContainerSC);
     $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text");
     $centered->addSP(new TextAlignSP("center"));
     $assetId = $asset->getId();
     if ($_SESSION["show_thumbnail"] == 'true') {
         try {
             $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($asset);
         } catch (Exception $e) {
             $thumbnailURL = false;
         }
         if ($thumbnailURL !== FALSE) {
             if (RepositoryInputOutputModuleManager::hasThumbnailNotIcon($asset)) {
                 $thumbClass = 'thumbnail_image';
             } else {
                 $thumbClass = 'thumbnail_icon';
             }
         } else {
             $thumbnailURL = POLYPHONY_PATH . "/icons/filetypes/unknown.png";
             $thumbClass = 'thumbnail_icon';
         }
         $thumbSize = $_SESSION["thumbnail_size"] . "px";
         ob_start();
         print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto;'>";
         print "\n\t<a style='cursor: pointer;'";
         print " onclick='Javascript:window.open(";
         print '"' . AssetPrinter::getSlideshowLink($asset, $num) . '", ';
         // 		print '"'.preg_replace("/[^a-z0-9]/i", '_', $assetId->getIdString()).'", ';
         print '"_blank", ';
         print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"';
         print ")'>";
         print "\n\t\t<img src='{$thumbnailURL}' class='thumbnail {$thumbClass}' alt='Thumbnail Image' style='max-height: {$thumbSize}; max-width: {$thumbSize};' />";
         print "\n\t</a>";
         print "\n</div>";
         $component = new UnstyledBlock(ob_get_contents());
         $component->addStyle($centered);
         ob_end_clean();
         $container->add($component, "100%", null, CENTER, CENTER);
     }
     ob_start();
     if ($_SESSION["show_displayName"] == 'true') {
         print "\n\t<div style='font-weight: bold; height: 50px; overflow: auto;'>" . htmlspecialchars($asset->getDisplayName()) . "</div>";
     }
     if ($_SESSION["show_id"] == 'true') {
         print "\n\t<div>" . _("ID#") . ": " . $assetId->getIdString() . "</div>";
     }
     if ($_SESSION["show_description"] == 'true') {
         $description = HtmlString::withValue($asset->getDescription());
         $description->trim(16);
         $descriptionShort = preg_replace('/\\.\\.\\.$/', "<a onclick=\"" . "var panel = Panel.run(" . "'" . addslashes(htmlspecialchars($asset->getDisplayName())) . "', " . "100, 400, this.parentNode); " . "if (!panel.contentElement.innerHTML) " . "{panel.contentElement.innerHTML = this.parentNode.nextSibling.innerHTML;}" . "\">...</a>", $description->asString());
         print "\n\t<div style='font-size: smaller; height: 50px; overflow: auto;'>";
         print $descriptionShort;
         print "</div>";
         if (preg_match('/\\.\\.\\.$/', $description->asString())) {
             print "<div style='display: none'>" . $asset->getDescription() . "</div>";
         }
     }
     if ($_SESSION["show_tags"] == 'true') {
         // Tags
         print "\n\t<div style='font-size: smaller; height: 50px; overflow: auto; text-align: justify; margin-top: 5px;'>";
         print TagAction::getTagCloudForItem(TaggedItem::forId($assetId, 'concerto'), 'view', array('font-size: 90%;', 'font-size: 100%;'));
         print "\n\t</div>";
     }
     $component = new UnstyledBlock(ob_get_contents());
     ob_end_clean();
     $container->add($component, "100%", null, LEFT, TOP);
     // Bottom controls
     if ($_SESSION["show_controls"] == 'true') {
         $authZ = Services::getService("AuthZ");
         $idManager = Services::getService("Id");
         ob_start();
         print "\n<div style='margin-top: 5px; font-size: small; white-space: nowrap;'>";
         AssetPrinter::printAssetFunctionLinks($harmoni, $asset, NULL, $num, false);
         print " | ";
         $harmoni->request->startNamespace("AssetMultiEdit");
         print "\n<input type='checkbox'";
         print " name='" . RequestContext::name("asset") . "'";
         print " value='" . $assetId->getIdString() . "'";
         print "/>";
         print "\n<input type='hidden'";
         print " name='" . RequestContext::name("asset_can_modify_" . $assetId->getIdString()) . "'";
         try {
             if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $assetId)) {
                 print " value='true'";
             } else {
                 print " value='false'";
             }
         } catch (UnknownIdException $e) {
             // allow non-harmoni Repositories.
             print " value='true'";
         }
         print "/>";
         print "\n<input type='hidden'";
         print " name='" . RequestContext::name("asset_can_delete_" . $assetId->getIdString()) . "'";
         try {
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:concerto,代码行数:101,代码来源:browse.act.php

示例3: printSlideShort

function printSlideShort($asset, $params, $slideshowIdString, $num)
{
    $harmoni = Harmoni::instance();
    $container = new Container(new YLayout(), BLOCK, EMPHASIZED_BLOCK);
    $fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container.");
    $fillContainerSC->addSP(new MinHeightSP("88%"));
    $container->addStyle($fillContainerSC);
    $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text");
    $centered->addSP(new TextAlignSP("center"));
    $idManager = Services::getService("Id");
    $repositoryManager = Services::getService("Repository");
    $authZ = Services::getService("AuthZ");
    // Get our record and its data
    $slideRecords = $asset->getRecordsByRecordStructure($idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure"));
    if ($slideRecords->hasNext()) {
        $slideRecord = $slideRecords->next();
        // Text-Position
        $textPosition = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.text_position", $slideRecord);
        // Display Metadata
        $displayMetadata = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.display_metadata", $slideRecord);
        // Media
        $mediaIdStringObj = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.target_id", $slideRecord);
        if (strlen($mediaIdStringObj->asString())) {
            $mediaId = $idManager->getId($mediaIdStringObj->asString());
        } else {
            $mediaId = null;
        }
    }
    // ------------------------------------------
    ob_start();
    print "\n\t<a style='cursor: pointer;'";
    print " onclick='Javascript:window.open(";
    print '"' . VIEWER_URL . "?&amp;source=";
    print urlencode($harmoni->request->quickURL('exhibitions', "slideshowOutlineXml", array('slideshow_id' => $slideshowIdString)));
    print '&amp;start=' . ($num - 1) . '", ';
    print '"_blank", ';
    print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"';
    print ")'>";
    $viewerATag = ob_get_clean();
    /*********************************************************
     * Media
     *********************************************************/
    if (isset($mediaId) && $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId) && $_SESSION["show_thumbnail"] == 'true') {
        $mediaAsset = $repositoryManager->getAsset($mediaId);
        $mediaAssetId = $mediaAsset->getId();
        $mediaAssetRepository = $mediaAsset->getRepository();
        $mediaAssetRepositoryId = $mediaAssetRepository->getId();
        $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($mediaAsset);
        if ($thumbnailURL !== FALSE) {
            $thumbSize = $_SESSION["thumbnail_size"] . "px";
            ob_start();
            print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto;'>";
            print $viewerATag;
            print "\n\t\t<img src='{$thumbnailURL}' alt='Thumbnail Image' style='max-height: {$thumbSize}; max-width: {$thumbSize};' class='thumbnail_image' />";
            print "\n\t</a>";
            print "\n</div>";
            $component = new UnstyledBlock(ob_get_clean());
            $component->addStyle($centered);
            $container->add($component, "100%", null, CENTER, CENTER);
        }
        // other files
        $fileRecords = $mediaAsset->getRecordsByRecordStructure($idManager->getId("FILE"));
    }
    // Link to viewer
    $numFiles = 0;
    if (isset($fileRecords)) {
        while ($fileRecords->hasNext()) {
            $record = $fileRecords->next();
            $numFiles++;
        }
    }
    ob_start();
    print "\n<div height='15px; font-size: small;'>";
    print $viewerATag;
    print _("Open in Viewer");
    if ($numFiles > 1) {
        print " (" . ($numFiles - 1) . " " . _("more files") . ")";
    }
    print "\n\t</a>";
    print "\n</div>";
    $component = new UnstyledBlock(ob_get_clean());
    $component->addStyle($centered);
    $container->add($component, "100%", null, CENTER, CENTER);
    // Title
    ob_start();
    if ($_SESSION["show_displayName"] == 'true') {
        print "\n\t<div style='font-weight: bold; height: 50px; overflow: auto;'>" . htmlspecialchars($asset->getDisplayName()) . "</div>";
    }
    // Caption
    if ($_SESSION["show_description"] == 'true') {
        $description = HtmlString::withValue($asset->getDescription());
        $description->clean();
        if (isset($thumbnailURL)) {
            print "\n\t<div style='font-size: smaller; height: 100px; overflow: auto;'>";
        } else {
            print "\n\t<div style='font-size: smaller; height: " . ($_SESSION["thumbnail_size"] + 100) . "px; overflow: auto;'>";
        }
        print $description->asString();
        if (isset($displayMetadata) && $displayMetadata->isTrue() && isset($mediaId) && $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId)) {
            print "\t\t\t<hr/>\n";
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:concerto,代码行数:101,代码来源:browseSlideshow.act.php

示例4: printAssetShort

function printAssetShort($assetId, $num)
{
    $harmoni = Harmoni::instance();
    $repositoryManager = Services::getService("Repository");
    $asset = $repositoryManager->getAsset($assetId);
    $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%"));
    $container->addStyle($fillContainerSC);
    $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text");
    $centered->addSP(new TextAlignSP("center"));
    $assetId = $asset->getId();
    if ($_SESSION["show_thumbnail"] == 'true') {
        $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($asset);
        if ($thumbnailURL !== FALSE) {
            $xmlStart = $num - 1;
            $thumbSize = $_SESSION["thumbnail_size"] . "px";
            ob_start();
            print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto;'>";
            print "\n\t<a style='cursor: pointer;'";
            print " onclick='Javascript:window.open(";
            print '"' . VIEWER_URL . "?&amp;source=";
            print urlencode($harmoni->request->quickURL("basket", "browse_xml"));
            print '&amp;start=' . $xmlStart . '", ';
            print '"_blank", ';
            print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"';
            print ")'>";
            print "\n\t\t<img src='{$thumbnailURL}' class='thumbnail thumbnail_image' alt='Thumbnail Image' style='max-height: {$thumbSize}; max-width: {$thumbSize};' />";
            print "\n\t</a>";
            print "\n</div>";
            $component = new UnstyledBlock(ob_get_contents());
            $component->addStyle($centered);
            ob_end_clean();
            $container->add($component, "100%", null, CENTER, CENTER);
        }
    }
    ob_start();
    if ($_SESSION["show_displayName"] == 'true') {
        print "\n\t<div style='font-weight: bold; height: 50px; overflow: auto;'>" . htmlspecialchars($asset->getDisplayName()) . "</div>";
    }
    if ($_SESSION["show_id"] == 'true') {
        print "\n\t<div>" . _("ID#") . ": " . $assetId->getIdString() . "</div>";
    }
    if ($_SESSION["show_description"] == 'true') {
        $description = HtmlString::withValue($asset->getDescription());
        $description->trim(25);
        print "\n\t<div style='font-size: smaller; height: 50px; overflow: auto;'>" . $description->asString() . "</div>";
    }
    $component = new UnstyledBlock(ob_get_contents());
    ob_end_clean();
    $container->add($component, "100%", null, LEFT, TOP);
    ob_start();
    print "\n<a href='";
    print $harmoni->request->quickURL("basket", "remove", array('asset_id' => $assetId->getIdString()));
    print "' title='" . _("Remove from Selection") . "'>";
    print _('remove');
    print "</a>";
    print "\n | <a href='";
    print $harmoni->request->quickURL("basket", "up", array('asset_id' => $assetId->getIdString()));
    print "' title='" . _('move up') . "'>";
    // 	print "<img src='".POLYPHONY_PATH."/icons/basket/arrowleft.png' width='25px' border='0' alt='"._("Move Up")."' />";
    print "&lt;--";
    print "</a>";
    print "\n | <a href='";
    print $harmoni->request->quickURL("basket", "down", array('asset_id' => $assetId->getIdString()));
    print "' title='" . _('move down') . "'>";
    // 	print "<img src='".POLYPHONY_PATH."/icons/basket/arrowright.png' width='25px' border='0'  alt='"._("Move Down")."'  />";
    print "--&gt;";
    print "</a>";
    $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, RIGHT, BOTTOM);
    return $container;
}
开发者ID:adamfranco,项目名称:polyphony,代码行数:72,代码来源:view.act.php


注:本文中的Container::addStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。