Пример #1
0
function printAssetShort($asset, $harmoni)
{
    $idManager = Services::getService("Id");
    $harmoni = Harmoni::instance();
    /*********************************************************
     * Get number of slides and first thumbnail.
     *********************************************************/
    $slides = $asset->getAssets();
    $count = 0;
    while ($slides->hasNext()) {
        $slideAsset = $slides->next();
        $count++;
        if (!isset($firstMediaUrl)) {
            $slideRecords = $slideAsset->getRecordsByRecordStructure($idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure"));
            if ($slideRecords->hasNext()) {
                $slideRecord = $slideRecords->next();
                // Media
                $mediaIdStringObj = browse_exhibitionAction::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());
                    $firstMediaUrl = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($mediaId);
                }
            }
        }
    }
    $assetId = $asset->getId();
    ob_start();
    if (isset($firstMediaUrl) && $firstMediaUrl) {
        print "<a href='#' onclick='window.open(";
        print '"' . VIEWER_URL . "?&source=";
        print urlencode($harmoni->request->quickURL("exhibitions", "slideshowOutlineXml", array("slideshow_id" => $assetId->getIdString())));
        print '", ';
        print '"_blank", ';
        print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"';
        print "); return false;'>";
        print "\n<img src='" . $firstMediaUrl . "' style='float: right; max-height: 200px; max-width: 200px;' class='thumbnail_image'/>";
        print "</a>";
    }
    print "\n\t<div style='font-weight: bold' title='" . _("ID#") . ": " . $assetId->getIdString() . "'>" . $asset->getDisplayName() . "</div>";
    print "\n\t<div style='font-size: smaller; margin-bottom: 10px; margin-left: 20px; margin-right: 20px; white-space: nowrap;'>(" . $count . " " . _("slides") . ")</div>";
    $description = HtmlString::withValue($asset->getDescription());
    $description->clean();
    print "\n\t<div style='font-size: smaller;'>" . $description->asString() . "</div>";
    print "\n<div style='clear: both; white-space: nowrap;'>";
    SlideShowPrinter::printFunctionLinks($asset);
    print "</div>";
    $layout = new Block(ob_get_contents(), EMPHASIZED_BLOCK);
    ob_end_clean();
    return $layout;
}
Пример #2
0
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $this->registerDisplayProperties();
     $this->registerState();
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $harmoni->request->passthrough("collection_id");
     $harmoni->request->passthrough("asset_id");
     $asset = $this->getAsset();
     $assetId = $asset->getId();
     // function links
     ob_start();
     SlideShowPrinter::printFunctionLinks($asset);
     $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), null, null, CENTER, CENTER);
     ob_start();
     $description = HtmlString::withValue($asset->getDescription());
     $description->clean();
     print "\n\t<div style='font-size: smaller;'>" . $description->asString() . "</div>";
     $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, CENTER);
     $searchBar = new Container(new YLayout(), BLOCK, STANDARD_BLOCK);
     $actionRows->add($searchBar, "100%", null, CENTER, CENTER);
     //***********************************
     // Get the assets to display
     //***********************************
     $setManager = Services::getService("Sets");
     $slideshowSet = $setManager->getPersistentSet($asset->getId());
     $slideIterator = $asset->getAssets();
     $orderedSlides = array();
     $unorderedSlides = array();
     while ($slideIterator->hasNext()) {
         $slideAsset = $slideIterator->next();
         $slideAssetId = $slideAsset->getId();
         if ($slideshowSet->isInSet($slideAssetId)) {
             $orderedSlides[$slideshowSet->getPosition($slideAssetId)] = $slideAsset;
         } else {
             $unorderedSlides[] = $slideAsset;
         }
     }
     ksort($orderedSlides);
     $slides = array_merge($orderedSlides, $unorderedSlides);
     unset($orderedSlides, $unorderedSlides);
     //***********************************
     // print the results
     //***********************************
     $resultPrinter = new ArrayResultPrinter($slides, $_SESSION["asset_columns"], $_SESSION["assets_per_page"], "printSlideShort", $this->getParams(), $assetId->getIdString());
     $resultPrinter->setStartingNumber($this->_state['startingNumber']);
     $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
     $resultLayout = $resultPrinter->getLayout("canView");
     $resultLayout->setPreHTML("<form id='AssetMultiEditForm' name='AssetMultiEditForm' action='' method='post'>");
     $resultLayout->setPostHTML("</form>");
     $actionRows->add($resultLayout, "100%", null, LEFT, CENTER);
     /*********************************************************
      * Display options
      *********************************************************/
     $currentUrl = $harmoni->request->mkURL();
     $searchBar->setPreHTML("\n<form action='" . $currentUrl->write() . "' method='post'>\n\t<input type='hidden' name='" . RequestContext::name('form_submitted') . "' value='true'/>");
     $searchBar->setPostHTML("\n</form");
     ob_start();
     $searchBar->add(new UnstyledBlock(ob_get_clean()), null, null, LEFT, TOP);
     $searchBar->add($this->getDisplayOptions($resultPrinter, false), null, null, LEFT, TOP);
 }