/** * Show a representation of a digital object image. * * @param sfWebRequest $request * */ public function execute($request) { // Get representation by usage type $this->representation = $this->resource->getRepresentationByUsage($this->usageType); // If we can't find a representation for this object, try their parent if (!$this->representation && ($parent = $this->resource->parent)) { $this->representation = $parent->getRepresentationByUsage($this->usageType); } // Set up display of video in flowplayer if ($this->representation) { $this->response->addJavaScript('/vendor/flowplayer/example/flowplayer-3.1.4.min.js'); $this->response->addJavaScript('flowplayer'); // If this is a reference movie, get the thumbnail representation for the // place holder image $this->showFlashPlayer = true; if (QubitTerm::REFERENCE_ID == $this->usageType) { $this->thumbnail = $this->resource->getRepresentationByUsage(QubitTerm::THUMBNAIL_ID); } list($this->width, $this->height) = QubitDigitalObject::getImageMaxDimensions($this->usageType); // For javascript_tag() $this->representationFullPath = public_path($this->representation->getFullPath()); } else { $this->showFlashPlayer = false; $this->representation = QubitDigitalObject::getGenericRepresentation($this->resource->mimeType, $this->usageType); } }
/** * Show a representation of a digital object image. * * @param sfWebRequest $request * */ public function execute($request) { // Get representation by usage type $this->representation = $this->resource->getRepresentationByUsage($this->usageType); // If we can't find a representation for this object, try their parent if (!$this->representation && ($parent = $this->resource->parent)) { $this->representation = $parent->getRepresentationByUsage($this->usageType); } // If representation is not a valid digital object, return a generic icon if (!$this->representation) { $this->representation = QubitDigitalObject::getGenericRepresentation($this->resource->mimeType, $this->usageType); } }
/** * Show a representation of a digital object image. * * @param sfWebRequest $request * */ public function execute($request) { // Get representation by usage type $this->representation = $this->resource->getRepresentationByUsage($this->usageType); // If we can't find a representation for this object, try their parent if (!$this->representation && ($parent = $this->resource->parent)) { $this->representation = $parent->getRepresentationByUsage($this->usageType); } // Set up display of video in flowplayer if ($this->representation) { $this->showFlashPlayer = true; $this->response->addJavaScript('/vendor/flowplayer/example/flowplayer-3.1.4.min.js'); $this->response->addJavaScript('flowplayer'); } else { $this->showFlashPlayer = false; $this->representation = QubitDigitalObject::getGenericRepresentation($this->resource->mimeType, $this->usageType); } }
/** * Show a representation of a digital object image. * * @param sfWebRequest $request * */ public function execute($request) { switch ($this->usageType) { case QubitTerm::REFERENCE_ID: $this->representation = $this->resource->getRepresentationByUsage(QubitTerm::REFERENCE_ID); break; case QubitTerm::THUMBNAIL_ID: $this->representation = $this->resource->getRepresentationByUsage(QubitTerm::THUMBNAIL_ID); break; case QubitTerm::MASTER_ID: default: $this->representation = QubitDigitalObject::getGenericRepresentation($this->resource->mimeType, $this->usageType); } // If no representation found, then default to generic rep if (!$this->representation) { $this->representation = QubitDigitalObject::getGenericRepresentation($this->resource->mimeType, $this->usageType); } // Build a fully qualified URL to this digital object asset if ((QubitTerm::IMAGE_ID != $this->resource->mediaTypeId || QubitTerm::REFERENCE_ID == $this->usageType) && QubitAcl::check($this->resource->informationObject, 'readMaster')) { $this->link = public_path($this->resource->getFullPath(), true); } }
public function execute($request) { $this->thumbnails = array(); // Set limit (null for no limit) if (!isset($request->showFullImageflow) || 'true' != $request->showFullImageflow) { $this->limit = sfConfig::get('app_hits_per_page', 10); } // Add thumbs $criteria = new Criteria(); $criteria->addJoin(QubitInformationObject::ID, QubitDigitalObject::INFORMATION_OBJECT_ID); $criteria->add(QubitInformationObject::LFT, $this->resource->lft, Criteria::GREATER_THAN); $criteria->add(QubitInformationObject::RGT, $this->resource->rgt, Criteria::LESS_THAN); if (isset($this->limit)) { $criteria->setLimit($this->limit); } foreach (QubitDigitalObject::get($criteria) as $item) { $thumbnail = $item->getRepresentationByUsage(QubitTerm::THUMBNAIL_ID); if (!$thumbnail) { $thumbnail = QubitDigitalObject::getGenericRepresentation($item->mimeType, QubitTerm::THUMBNAIL_ID); $thumbnail->setParent($item); } $this->thumbnails[] = $thumbnail; } // Get total number of descendant digital objects $this->total = 0; if (isset($this->resource)) { $criteria = new Criteria(); $criteria->addJoin(QubitInformationObject::ID, QubitDigitalObject::INFORMATION_OBJECT_ID); $criteria->add(QubitInformationObject::LFT, $this->resource->lft, Criteria::GREATER_THAN); $criteria->add(QubitInformationObject::RGT, $this->resource->rgt, Criteria::LESS_THAN); $this->total = BasePeer::doCount($criteria)->fetchColumn(0); } if (2 > count($this->thumbnails)) { return sfView::NONE; } }
<?php $doc = $hit->getDocument(); ?> <div class="clearfix search-results <?php echo 0 == @++$row % 2 ? 'even' : 'odd'; ?> "> <?php if ('true' == $doc->hasDigitalObject) { ?> <?php if (null == $doc->do_mediaTypeId) { ?> <?php echo link_to(image_tag(QubitDigitalObject::getGenericRepresentation($doc->do_mediaTypeId, QubitTerm::THUMBNAIL_ID)->getFullPath(), array('alt' => $doc->title)), array('slug' => $doc->slug, 'module' => 'informationobject')); ?> <?php } elseif (QubitTerm::AUDIO_ID == $doc->do_mediaTypeId) { ?> <?php echo link_to(image_tag('play.png', array('alt' => $doc->title)), array('slug' => $doc->slug, 'module' => 'informationobject')); ?> <?php } elseif (null !== $doc->do_thumbnail_FullPath) { ?> <?php echo link_to(image_tag(public_path($doc->do_thumbnail_FullPath), array('alt' => $doc->title)), array('slug' => $doc->slug, 'module' => 'informationobject')); ?> <?php }