Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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());
 }
Exemplo n.º 4
0
 /**
  * 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";
 }
Exemplo n.º 5
0
 /**
  * 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";
 }