예제 #1
0
function printRows($lag, $level)
{
    global $processMap;
    $tpl = Template::getInstance();
    foreach ($lag as $l) {
        if (($l->total < 500000 || LAG_ONLY && $l->lagTotal < 500000) && !NOFILTER) {
            continue;
        }
        $lagTicks = (int) $tpl->masterHandler->lagCount;
        $count = (int) (LAG_ONLY ? $l->lagCount : $l->count);
        if ($count === 0 || LAG_ONLY && $lagTicks === 0) {
            continue;
        }
        openRow($level, $l);
        printRecord($l);
        $id = $l->id->id;
        $h = $tpl->handlerData[$id];
        if (!empty($h->children) && ++$processMap[$id] == 1) {
            if (!NOFILTER) {
                $children = array_filter($h->children, 'lagFilter');
            } else {
                $children = $h->children;
            }
            if (!empty($children)) {
                $children = array_map(function ($v) {
                    $tpl = Template::getInstance();
                    $h = $tpl->handlerData[$v->id->id];
                    $v->children = $h->children;
                    return $v;
                }, $children);
                usort($children, 'lagSort');
                echo '<div class="children">';
                printRows($children, $level + 1);
                echo '</div>';
            }
            --$processMap[$id];
        }
        closeRow();
    }
}
예제 #2
0
function printRows($lag, $level)
{
    global $processMap;
    $tpl = Template::getInstance();
    foreach ($lag as $l) {
        if ($l->lagTotal < 500000) {
            //			continue;
        }
        printRecord($l, $level);
        $id = $l->id->id;
        $h = $tpl->handlerData[$id];
        if (!empty($h->children) && ++$processMap[$id] == 1) {
            $children = array_filter($h->children, 'lagFilter');
            if (!empty($children)) {
                $children = array_map(function ($v) {
                    $tpl = Template::getInstance();
                    $h = $tpl->handlerData[$v->id->id];
                    $v->children = $h->children;
                    return $v;
                }, $children);
                usort($children, 'lagSort');
                printRows($children, $level + 1);
            }
            --$processMap[$id];
        }
    }
}
예제 #3
0
 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $asset = $this->getAsset();
     $repositoryId = $this->getRepositoryId();
     // function links
     ob_start();
     AssetPrinter::printAssetFunctionLinks($harmoni, $asset);
     $layout = new Block(ob_get_contents(), STANDARD_BLOCK);
     ob_end_clean();
     $actionRows->add($layout, "100%", null, LEFT, CENTER);
     // Columns for Description and thumbnail.
     $xLayout = new XLayout();
     $contentCols = new Container($xLayout, OTHER, 1);
     $actionRows->add($contentCols, "100%", null, LEFT, CENTER);
     // Description and dates
     ob_start();
     $assetId = $asset->getId();
     print "\n\t<dl>";
     if ($asset->getDescription()) {
         $description = HtmlString::withValue($asset->getDescription());
         $description->clean();
         print "\n\t\t<dt style='font-weight: bold;'>" . _("Description:") . "</dt>";
         print "\n\t\t<dd>" . $description->asString() . "</dd>";
     }
     print "\n\t\t<dt style='font-weight: bold;'>";
     print _("ID#");
     print ":</dt>\n\t\t<dd >";
     print $assetId->getIdString();
     print "</dd>";
     print "\n\t\t<dt style='font-weight: bold;'>";
     print _("Type");
     print ":</dt>\n\t\t<dd >";
     try {
         print $asset->getAssetType()->asString();
     } catch (UnimplementedException $e) {
         print "unknown";
     }
     print "</dd>";
     try {
         $date = $asset->getModificationDate();
         print "\n\t\t<dt style='font-weight: bold;'>";
         print _("Modification Date");
         print ":</dt>\n\t\t<dd >";
         print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
         print "</dd>";
     } catch (UnimplementedException $e) {
     }
     try {
         $date = $asset->getCreationDate();
         print "\n\t\t<dt style='font-weight: bold;'>";
         print _("Creation Date");
         print ":</dt>\n\t\t<dd >";
         print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
         print "</dd>";
     } catch (UnimplementedException $e) {
     }
     try {
         if (is_object($asset->getEffectiveDate())) {
             $date = $asset->getEffectiveDate();
             print "\n\t\t<dt style='font-weight: bold;'>";
             print _("Effective Date");
             print ":</dt>\n\t\t<dd >";
             print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
             print "</dd>";
         }
     } catch (UnimplementedException $e) {
     }
     try {
         if (is_object($asset->getExpirationDate())) {
             $date = $asset->getExpirationDate();
             print "\n\t\t<dt style='font-weight: bold;'>";
             print _("Expiration Date");
             print ":</dt>\n\t\t<dd >";
             print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
             print "</dd>";
         }
         print "\n\t</dl>";
     } catch (UnimplementedException $e) {
     }
     $contentCols->add(new Block(ob_get_clean(), STANDARD_BLOCK), "60%", null, LEFT, TOP);
     // Add the tagging manager script to the header
     $outputHandler = $harmoni->getOutputHandler();
     $outputHandler->setHead($outputHandler->getHead() . "\n\t\t<script type='text/javascript' src='" . POLYPHONY_PATH . "javascript/Tagger.js'></script>" . "\n\t\t<link rel='stylesheet' type='text/css' href='" . POLYPHONY_PATH . "javascript/Tagger.css' />");
     // Tags
     ob_start();
     print "\n\t<div style='font-weight: bold; margin-bottom: 10px;'>" . _("Tags given to this Asset: ") . "</div>";
     print "\n\t<div style=' text-align: justify;'>";
     print TagAction::getTagCloudForItem(TaggedItem::forId($assetId, 'concerto'), 'view');
     print "\n\t</div>";
     $contentCols->add(new Block(ob_get_clean(), STANDARD_BLOCK), "40%", null, LEFT, TOP);
     //***********************************
     // Info Records
     //***********************************
     ob_start();
     $printedRecordIds = array();
     // Get the set of RecordStructures so that we can print them in order.
     $setManager = Services::getService("Sets");
     $structSet = $setManager->getPersistentSet($repositoryId);
     if ($structSet->hasNext()) {
         // First, lets go through the info structures listed in the set and print out
         // the info records for those structures in order.
         while ($structSet->hasNext()) {
             $structureId = $structSet->next();
             $records = $asset->getRecordsByRecordStructure($structureId);
             while ($records->hasNext()) {
                 $record = $records->next();
                 $recordId = $record->getId();
                 $printedRecordIds[] = $recordId->getIdString();
                 print "<hr />";
                 printRecord($repositoryId, $assetId, $record);
             }
         }
     } else {
         $structures = $asset->getRecordStructures();
         while ($structures->hasNext()) {
             $structure = $structures->next();
             $structureId = $structure->getId();
             $records = $asset->getRecordsByRecordStructure($structureId);
             while ($records->hasNext()) {
                 $record = $records->next();
                 $recordId = $record->getId();
                 $printedRecordIds[] = $recordId->getIdString();
                 print "<hr />";
                 printRecord($repositoryId, $assetId, $record);
             }
         }
     }
     $layout = new Block(ob_get_contents(), STANDARD_BLOCK);
     ob_end_clean();
     $actionRows->add($layout, "100%", null, LEFT, CENTER);
     //***********************************
     // Content
     //	If we can, we may want to print the content here.
     // 	@todo Add some sniffing of content so that we can either put it in if
     // 	it is text, image, etc, or do otherwise with it if it is some other form
     // 	of data.
     //***********************************
     try {
         $content = $asset->getContent();
         if ($string = $content->asString()) {
             ob_start();
             print "\n<textarea readonly='readonly' rows='30' cols='80'>";
             print htmlspecialchars($string);
             print "</textarea>";
             $layout = new Block(ob_get_contents(), STANDARD_BLOCK);
             ob_end_clean();
             $actionRows->add($layout, "100%", null, LEFT, CENTER);
         }
     } catch (UnimplementedException $e) {
     }
 }
예제 #4
0
/**
 * Print out the full metadata for the Asset;
 * 
 * @param object Asset
 * @return void
 * @access public
 * @since 9/28/05
 */
function printTargetAsset($asset)
{
    /*********************************************************
     * Asset Info
     *********************************************************/
    $assetId = $asset->getId();
    print "\n\t<dl>";
    if ($asset->getDisplayName()) {
        print "\n\t\t<dt style='font-weight: bold;'>" . _("Title:") . "</dt>";
        print "\n\t\t<dd>" . $asset->getDisplayName() . "</dd>";
    }
    if ($asset->getDescription()) {
        $description = HtmlString::withValue($asset->getDescription());
        $description->clean();
        print "\n\t\t<dt style='font-weight: bold;'>" . _("Description:") . "</dt>";
        print "\n\t\t<dd>" . $description->asString() . "</dd>";
    }
    print "\n\t\t<dt style='font-weight: bold;'>";
    print _("ID#");
    print ":</dt>\n\t\t<dd >";
    print $assetId->getIdString();
    print "</dd>";
    $date = $asset->getModificationDate();
    print "\n\t\t<dt style='font-weight: bold;'>";
    print _("Modification Date");
    print ":</dt>\n\t\t<dd >";
    print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
    print "</dd>";
    $date = $asset->getCreationDate();
    print "\n\t\t<dt style='font-weight: bold;'>";
    print _("Creation Date");
    print ":</dt>\n\t\t<dd >";
    print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
    print "</dd>";
    if (is_object($asset->getEffectiveDate())) {
        $date = $asset->getEffectiveDate();
        print "\n\t\t<dt style='font-weight: bold;'>";
        print _("Effective Date");
        print ":</dt>\n\t\t<dd >";
        print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
        print "</dd>";
    }
    if (is_object($asset->getExpirationDate())) {
        $date = $asset->getExpirationDate();
        print "\n\t\t<dt style='font-weight: bold;'>";
        print _("Expiration Date");
        print ":</dt>\n\t\t<dd >";
        print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation();
        print "</dd>";
    }
    print "\n\t</dl>";
    /*********************************************************
     * Expanding to child assets
     *********************************************************/
    $children = $asset->getAssets();
    if ($children->hasNext()) {
        printChildViewerLink($asset);
    }
    /*********************************************************
     * Info Records
     *********************************************************/
    $printedRecordIds = array();
    // Get the set of RecordStructures so that we can print them in order.
    $setManager = Services::getService("Sets");
    $idManager = Services::getService("Id");
    $repository = $asset->getRepository();
    $structSet = $setManager->getPersistentSet($repository->getId());
    // First, lets go through the info structures listed in the set and print out
    // the info records for those structures in order.
    $structSet->reset();
    while ($structSet->hasNext()) {
        $structureId = $structSet->next();
        if (!$structureId->isEqual($idManager->getId("FILE"))) {
            $records = $asset->getRecordsByRecordStructure($structureId);
            while ($records->hasNext()) {
                $record = $records->next();
                $recordId = $record->getId();
                $printedRecordIds[] = $recordId->getIdString();
                print "\t<div style='padding: 5px; border-top: 1px solid;'>\n";
                printRecord($repository->getId(), $assetId, $record);
                print "\t</div>\n";
            }
        }
    }
    /*********************************************************
     * Asset Content
     *********************************************************/
    /*********************************************************
     * Close up our tags.
     *********************************************************/
    print "</div>\n";
}