function emiglio_exhibit_builder_page_nav($exhibitPage = null, $currentPageId) { if (!$exhibitPage) { $exhibitPage = get_current_record('exhibit_page'); } $parents = array(); $currentPage = get_record_by_id('Exhibit Page', $currentPageId); while ($currentPage->parent_id) { $currentPage = $currentPage->getParent(); array_unshift($parents, $currentPage->id); } $class = ''; $class .= $exhibitPage->id == $currentPageId ? 'current' : ''; $parent = array_search($exhibitPage->id, $parents) !== false ? ' parent' : ''; $html = '<li class="' . $class . $parent . '">' . '<a href="' . exhibit_builder_exhibit_uri(get_current_record('exhibit'), $exhibitPage) . '">' . metadata($exhibitPage, 'title') . '</a>'; $children = $exhibitPage->getChildPages(); if ($children) { $html .= '<ul>'; foreach ($children as $child) { $html .= emiglio_exhibit_builder_page_nav($child, $currentPageId); release_object($child); } $html .= '</ul>'; } $html .= '</li>'; return $html; }
public function sliderExhibitAttachment($attachment) { $item = $attachment->getItem(); $file = $attachment->getFile(); if ($file) { if (!isset($fileOptions['imgAttributes']['alt'])) { $fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true)); } if ($forceImage) { $imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail'; $image = file_image($imageSize, $fileOptions['imgAttributes'], $file); $html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item); } else { if (!isset($fileOptions['linkAttributes']['href'])) { $fileOptions['linkAttributes']['href'] = exhibit_builder_exhibit_item_uri($item); } $html = file_markup($file, $fileOptions, null); } } else { if ($item) { $html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item); } } // Don't show a caption if we couldn't show the Item or File at all if (isset($html)) { if (!is_string($attachment['caption']) || $attachment['caption'] == '') { return ''; } $html .= '<div class="exhibit-item-caption">' . $attachment['caption'] . '</div>'; return apply_filters('exhibit_attachment_caption', $html, array('attachment' => $attachment)); } else { $html = ''; } return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage')); }
public function itemGoogleMap($item = null, $width = '200px', $height = '200px', $hasBalloonForMarker = false, $markerHtmlClassName = 'geolocation_balloon') { $divId = "item-map-{$item->id}"; $location = get_db()->getTable('Location')->findLocationByItem($item, true); // Only set the center of the map if this item actually has a location // associated with it if ($location) { $center['latitude'] = $location->latitude; $center['longitude'] = $location->longitude; $center['zoomLevel'] = $location->zoom_level; $center['show'] = true; if ($hasBalloonForMarker) { $titleLink = link_to_item(metadata($item, array('Dublin Core', 'Title'), array(), $item), array(), 'show', $item); $thumbnailLink = !item_image('thumbnail') ? '' : link_to_item(item_image('thumbnail', array(), 0, $item), array(), 'show', $item); $description = metadata($item, array('Dublin Core', 'Description'), array('snippet' => 150), $item); $center['markerHtml'] = '<div class="' . $markerHtmlClassName . '">' . '<div class="geolocation_balloon_title">' . $titleLink . '</div>' . '<div class="geolocation_balloon_thumbnail">' . $thumbnailLink . '</div>' . '<p class="geolocation_balloon_description">' . $description . '</p></div>'; } $options = array(); $options['mapType'] = get_option('geolocation_map_type'); $center = js_escape($center); $options = js_escape($options); $style = "width: {$width}; height: {$height}"; $html = '<div id="' . $divId . '" class="map geolocation-map" style="' . $style . '"></div>'; $js = "var " . Inflector::variablize($divId) . ";"; $js .= "OmekaMapSingle = new OmekaMapSingle(" . js_escape($divId) . ", {$center}, {$options}); "; $html .= "<script type='text/javascript'>{$js}</script>"; } else { $html = '<p class="map-notification">' . __('This item has no location info associated with it.') . '</p>'; } return $html; }
/** * Return the markup for displaying an exhibit attachment. * * @param ExhibitBlockAttachment $attachment * @param array $fileOptions Array of options for file_markup * @param array $linkProps Array of options for exhibit_builder_link_to_exhibit_item * @param boolean $forceImage Whether to display the attachment as an image * always Defaults to false. * @return string */ public function exhibitAttachmentLightboxBook($attachment, $fileOptions = array(), $linkProps = array(), $forceImage = false, $pageCount = 0) { $item = $attachment->getItem(); $file = $attachment->getFile(); $caption = $attachment['caption']; if ($file) { if (!isset($fileOptions['imgAttributes']['alt'])) { $fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title')); } if (!isset($fileOptions['linkAttributes']['data-lightbox'])) { $fileOptions['linkAttributes']['data-lightbox'] = 'lightbox-gallery'; } if ($caption) { $fileOptions['linkAttributes']['data-title'] = $caption; } if ($pageCount > 0) { $fileOptions['linkAttributes']['class'] = "download-file later-pages"; } if ($forceImage) { $imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail'; $image = file_image($imageSize, $fileOptions['imgAttributes'], $file); $html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item); } else { $html = file_markup($file, $fileOptions, null); } } else { if ($item) { $html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item); } } return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage')); }
public function viewAction() { $id = $this->getParam('id'); $item = get_record_by_id('Item', $id); if (empty($item)) { throw new Omeka_Controller_Exception_404(); } $relations = metadata($item, array('Dublin Core', 'Relation'), array('all' => true, 'no_escape' => true, 'no_filter' => true)); // Currently, only support gDoc urls. $tableUrl = ''; $baseUrl = 'https://spreadsheets.google.com/feeds/list/'; $endUrl = '/public/values'; foreach ($relations as $relation) { if (strpos($relation, $baseUrl) === 0 && substr_compare($relation, $endUrl, -strlen($endUrl), strlen($endUrl)) === 0) { $tableUrl = $relation; break; } } if (empty($tableUrl)) { $this->_helper->flashMessenger(__('This item has no table of images.'), 'error'); return $this->forward('show', 'items', 'default', array('module' => null, 'controller' => 'items', 'action' => 'show', 'id' => $item->id)); } $this->_prepareViewer($item); $this->view->tableUrl = $tableUrl . '?alt=json-in-script&callback=spreadsheetLoaded'; }
/** * Get the sources for a video stream. * * @param Item $item * @return array The list of sources. */ public function videoStreamSources($item = null) { $view = $this->view; if (is_null($item)) { $item = get_current_record('item'); } $sources = array(); if (get_option('videostream_jwplayer_flash_streaming')) { $segmentFlashUrl = metadata($item, array('Streaming Video', 'Video Streaming URL')); $segmentFlashType = metadata($item, array('Streaming Video', 'Video Type')); $segmentFlashFile = metadata($item, array('Streaming Video', 'Video Filename')); $sources[] = array('file' => $segmentFlashUrl . $segmentFlashType . $segmentFlashFile); } if (get_option('videostream_jwplayer_http_streaming')) { $segmentHttpDir = metadata($item, array('Streaming Video', 'HTTP Streaming Directory')); $segmentHttpFile = metadata($item, array('Streaming Video', 'HTTP Video Filename')); $sources[] = array('file' => $segmentHttpDir . $segmentHttpFile); } if (get_option('videostream_jwplayer_hls_streaming')) { $segmentHlsDir = metadata($item, array('Streaming Video', 'HLS Streaming Directory')); $segmentHlsFile = metadata($item, array('Streaming Video', 'HLS Video Filename')); $sources[] = array('file' => $segmentHlsDir . $segmentHlsFile); } return $sources; }
/** * This takes an Omeka_Record instance and returns a populated * Apache_Solr_Document. * * @param Omeka_Record $item The record to index. * * @return Apache_Solr_Document * @author Eric Rochester <*****@*****.**> **/ public static function itemToDocument($item) { $fields = get_db()->getTable('SolrSearchField'); $doc = new Apache_Solr_Document(); $doc->setField('id', "Item_{$item->id}"); $doc->setField('resulttype', 'Item'); $doc->setField('model', 'Item'); $doc->setField('modelid', $item->id); // extend $doc to to include and items public / private status $doc->setField('public', $item->public); // Title: $title = metadata($item, array('Dublin Core', 'Title')); $doc->setField('title', $title); // Elements: self::indexItem($fields, $item, $doc); // Tags: foreach ($item->getTags() as $tag) { $doc->setMultiValue('tag', $tag->name); } // Collection: if ($collection = $item->getCollection()) { $doc->collection = metadata($collection, array('Dublin Core', 'Title')); } // Item type: if ($itemType = $item->getItemType()) { $doc->itemtype = $itemType->name; } $doc->featured = (bool) $item->featured; // File metadata foreach ($item->getFiles() as $file) { self::indexItem($fields, $file, $doc); } return $doc; }
public function filterDisplayElements($elementSets) { if (!($item = get_current_record('item', false))) { return $elementSets; } if (!metadata($item, array('Item Type Metadata', 'Player'))) { return $elementSets; } $newElementSets = array(); foreach ($elementSets as $set => $elements) { $newElements = $elements; if ($set === "Moving Image Item Type Metadata") { $newElements = array(); foreach ($elements as $key => $element) { if ($key === "Player") { $playerElement = $element; } else { $newElements[$key] = $element; } } } $newElementSets[$set] = $newElements; } if (isset($playerElement)) { return array_merge(array('Player' => array('' => $playerElement)), $newElementSets); } else { return $elementSets; } }
/** * Return the markup for displaying an exhibit attachment. * * @param ExhibitBlockAttachment $attachment * @param array $fileOptions Array of options for file_markup * @param array $linkProps Array of options for exhibit_builder_link_to_exhibit_item * @param boolean $forceImage Whether to display the attachment as an image * always Defaults to false. * @return string */ public function exhibitAttachment($attachment, $fileOptions = array(), $linkProps = array(), $forceImage = false) { $item = $attachment->getItem(); $file = $attachment->getFile(); if ($file) { if (!isset($fileOptions['imgAttributes']['alt'])) { $fileOptions['imgAttributes']['alt'] = metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true)); } if ($forceImage) { $imageSize = isset($fileOptions['imageSize']) ? $fileOptions['imageSize'] : 'square_thumbnail'; $image = file_image($imageSize, $fileOptions['imgAttributes'], $file); $html = exhibit_builder_link_to_exhibit_item($image, $linkProps, $item); } else { if (!isset($fileOptions['linkAttributes']['href'])) { $fileOptions['linkAttributes']['href'] = exhibit_builder_exhibit_item_uri($item); } $html = file_markup($file, $fileOptions, null); } } else { if ($item) { $html = exhibit_builder_link_to_exhibit_item(null, $linkProps, $item); } } // Don't show a caption if we couldn't show the Item or File at all if (isset($html)) { $html .= $this->view->exhibitAttachmentCaption($attachment); } else { $html = ''; } return apply_filters('exhibit_attachment_markup', $html, compact('attachment', 'fileOptions', 'linkProps', 'forceImage')); }
public function recordAction() { $item = get_record_by_id("Item", $this->getParam('id')); $this->view->item = $item; $this->view->title = is_object($item) ? metadata($this->view->item, array('Dublin Core', 'Title')) : "Untitled"; $this->view->username = is_object($user = current_user()) ? $user->name : ""; $this->view->email = is_object($user) ? $user->email : ""; }
function rhythm_display_date_added($format = 'F j, Y', $item = null) { if (!$item) { $item = get_current_record('item'); } $dateAdded = metadata($item, 'added'); return date($format, strtotime($dateAdded)); }
function all_items_with_this_subject($args) { if (metadata("item", 'Item Type Name') == "Volksverhaaltype") { $search_url = url(array('module' => 'items', 'controller' => 'browse'), 'default', array("search" => "", "submit_search" => "Zoeken", "advanced[0][element_id]" => "49", "advanced[0][type]" => "is exactly", "advanced[0][terms]" => "{$args}")); return "{$args} <a class='small blue advanced-search-link button' href='{$search_url}'>alle items van dit type</a>"; } return $args; }
/** * Return a item's title. * * @param Item $item The item. * @return string */ public static function getItemTitle($item) { $title = metadata($item, array('Dublin Core', 'Title'), array('no_filter' => true)); if (!trim($title)) { $title = '#' . $item->id; } return $title; }
function listContent($fileId, $user, $password) { $token = autentication($user, $password); $data_response = executeCurl($token); if (array_key_exists('error', $data_response)) { echo "Error: " . $data_response->error->code . " :: " . $data_response->error->message; } else { if (array_key_exists('access', $data_response)) { if (array_key_exists('token', $data_response->access) && array_key_exists('id', $data_response->access->token)) { $idToken = $data_response->access->token->id; } if (array_key_exists('serviceCatalog', $data_response->access) && count($data_response->access->serviceCatalog) > 0 && array_key_exists('endpoints', $data_response->access->serviceCatalog[0]) && array_key_exists('publicURL', $data_response->access->serviceCatalog[0]->endpoints[0])) { $url = $data_response->access->serviceCatalog[0]->endpoints[0]->publicURL; } } if (strlen($idToken) > 0 && strlen($url) > 0) { $metadata = metadata($fileId, $idToken, $url); $list = executeCurl($metadata); if (array_key_exists('error', $list)) { echo "Error: {$list->error} :: {$list->description}"; } else { if (array_key_exists('filename', $list)) { if ($list->is_folder) { echo "<div style=\"font-family:'Verdana';font-size:15px;\"><p><b><span style='text-decoration:underline'>{$list->filename}</span></b> (Directorio)</p>"; if (array_key_exists('contents', $list)) { $childrens = count($list->contents); if ($childrens > 0) { echo "Número de elementos contenidos: {$childrens}<br><br></div>"; echo "<table width=\"100%\" border=\"1\">"; echo "<tr style=\"font-family:'Verdana';font-size:15px;font-weight:bold;background-color:lightgrey\" align='center'><td width=\"10%\">Tipo</td><td width=\"35%\">Id</td><td width=\"35%\">Nombre</td><td width=\"20%\">Tamaño</td></tr>"; foreach ($list->contents as $meta) { if ($meta->is_folder) { $data = "<img src=\"/eyeos/extern/images/48x48/places/folder-documents.png\" align=\"middle\"/>"; } else { $path = "/eyeos/extern/images/48x48/mimetypes/text-plain.png"; if (strrpos($meta->filename, 'jpg') !== false || strrpos($meta->filename, 'png') !== false) { $path = "/eyeos/extern/images/48x48/mimetypes/application-x-egon.png"; } elseif (strrpos($meta->filename, 'pdf') !== false) { $path = "/eyeos/extern/images/48x48/mimetypes/application-pdf.png"; } $data = "<img src='" . $path . "' align=\"middle\"/>"; } echo "<tr style=\"font-family:'Verdana';font-size:13px;\" align='center'><td>{$data}</td><td>{$meta->file_id}</td><td>{$meta->filename}</td><td>{$meta->size}</td></tr>"; } echo "</table>"; } else { echo "<br><br>No contiene ni ficheros ni directorios<br></div>"; } } } else { echo "<div style=\"font-family:'Verdana';font-size:15px;\"><p><b><span style='text-decoration:underline'>{$list->filename}</span></b> (Fichero)</p>"; echo "No se pueden encontrar dependencias de un archivo</div>"; } } } } } }
public function testRandomFeaturedItems() { $randomFeaturedItems = get_random_featured_items(); $this->assertEquals(5, count($randomFeaturedItems)); $randomFeaturedItemsWithImages = get_random_featured_items('5', true); $this->assertEquals(5, count($randomFeaturedItemsWithImages)); foreach ($randomFeaturedItemsWithImages as $randomItem) { $this->assertTrue(metadata($randomItem, 'has files')); } }
/** * Get metadata, returning null if the metadata element is absent * * @param Record $item The item * @param string|array $key The metadata key * @param array $options Metadata options * @return The metadata values * * @see metadata */ function safe_metadata($item, $key, $options = null) { try { return metadata($item, $key, $options); } catch (Omeka_View_Exception $ex) { return null; } catch (Omeka_Record_Exception $ex) { return null; } }
/** * Returns the form code for segmenting video for items. * * @param Item $item * @return string Html string. */ public function segmentTuningForm($item = null) { $view = $this->view; $db = get_db(); if (is_null($item)) { $item = get_current_record('item'); } $sources = $view->videoStreamSources($item); $sources = version_compare(phpversion(), '5.4.0', '<') ? json_encode($sources) : json_encode($sources, JSON_UNESCAPED_SLASHES); $html = $view->partial('common/segment-tuning-form.php', array('item' => $item, 'sources' => $sources, 'segment_start' => (string) metadata($item, array('Streaming Video', 'Segment Start')), 'segment_end' => (string) metadata($item, array('Streaming Video', 'Segment End')), 'segment_description' => (string) metadata($item, array('Dublin Core', 'Description')))); return $html; }
function custom_item_image_gallery($attrs = array(), $imageType = 'square_thumbnail', $filesShow = false, $item = null) { if (!$item) { $item = get_current_record('item'); } $files = $item->Files; if (!$files) { return ''; } $defaultAttrs = array('wrapper' => array('id' => 'item-images'), 'linkWrapper' => array(), 'link' => array(), 'image' => array()); $attrs = array_merge($defaultAttrs, $attrs); $html = ''; if ($attrs['wrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['wrapper']) . '>' . "\n"; } foreach ($files as $file) { if ($attrs['linkWrapper'] !== null) { $html .= '<div ' . tag_attributes($attrs['linkWrapper']) . '>' . "\n"; } $fileTitle = metadata($file, 'display title'); $webPath = $file->getWebPath('original'); // Taille de l'image en fonction du type de fichier if (preg_match("/\\.jpg\$/", $webPath)) { $imageType = 'fullsize'; $attrs['image'] = array('style' => 'max-width: 100%'); } else { $imageType = 'thumbnail'; $attrs['image'] = array('style' => 'width:5em;vertical-align:middle;'); } $image = file_image($imageType, $attrs['image'], $file); $html .= '<h2 class="title" style="text-align:center;">' . $fileTitle . '</h2>' . "\n"; if ($filesShow) { $html .= link_to($file, 'show', $image, $attrs['link']); } else { if (preg_match("/\\.pdf\$/", $webPath)) { $html .= '<p style="padding:0 1em 1em 1em;color: #333333;">Télécharger le fichier PDF : '; } $linkAttrs = $attrs['link'] + array('href' => $webPath); $html .= '<a ' . tag_attributes($linkAttrs) . '>' . $image . '</a>' . "\n"; if (preg_match("/\\.pdf\$/", $webPath)) { $html .= '</p>'; } } if ($attrs['linkWrapper'] !== null) { $html .= '</div>' . "\n"; } } if ($attrs['wrapper'] !== null) { $html .= '</div>' . "\n"; } return $html; }
public function testCanSetValidPropertiesForCollection() { // build the collection $this->builder->setRecordMetadata(array('public' => true, 'featured' => false, 'owner_id' => self::USER_ID)); $elementTexts = array('Dublin Core' => array('Title' => array(array('text' => 'foobar', 'html' => false)), 'Description' => array(array('text' => 'foobar desc', 'html' => false)))); $this->builder->setElementTexts($elementTexts); $collection = $this->builder->build(); $this->assertEquals('foobar', strip_formatting(metadata($collection, array('Dublin Core', 'Title')))); $this->assertEquals('foobar desc', strip_formatting(metadata($collection, array('Dublin Core', 'Description')))); $this->assertEquals("1", $collection->public); $this->assertEquals("0", $collection->featured); $this->assertEquals(self::USER_ID, $collection->owner_id, "Collection's 'owner_id' column should have been set."); }
function sort_files($files) { foreach ($files as $file) { $weight = metadata($file, array('Scripto', 'Weight')); if (!is_null($weight)) { $file->order = $weight; } } if (!is_null($files[0]->order)) { usort($files, 'sort_by_order'); } return $files; }
/** * Tests whether exhibit() returns the correct value. * * @uses exhibit() **/ public function testCanRetrieveCorrectExhibitValue() { $this->helper->createNewExhibit(1, 0, 'Exhibit Title', 'Exhibit Description', 'Jim Safley'); $this->dispatch('exhibits/show/exhibit-title'); // Exhibit Title $this->assertEquals('Exhibit Title', metadata('exhibit', 'Title')); // Exhibit Description $this->assertEquals('Exhibit Description', metadata('exhibit', 'Description')); // Exhibit Credits $this->assertEquals('Jim Safley', metadata('exhibit', 'Credits')); // Exhibit Slug $this->assertEquals('exhibit-title', metadata('exhibit', 'slug')); }
public function checkItemElement() { $elements = false; $title = ""; $elementTitle = ""; $output = ""; $returnLink = "<a href='javascript:window.history.back();'>" . __("Please return to the referring page.") . "</a>"; $itemId = isset($_GET["item"]) ? intval($_GET["item"]) : 0; $elementId = isset($_GET["element"]) ? intval($_GET["element"]) : 0; if (!$itemId) { $output .= __("No item ID specified.") . " " . $returnLink; } else { if (!$elementId) { $output .= __("No element ID specified.") . " " . $returnLink; } else { $db = get_db(); $itemExists = $db->fetchOne("SELECT count(*) FROM {$db->Items} WHERE id = {$itemId}"); $elementTitle = $db->fetchOne("SELECT name FROM {$db->Elements} WHERE id = {$elementId}"); if (!$itemExists) { $output .= __("Item not found.") . " " . $returnLink; } else { if (!$elementTitle) { $output .= __("Element not found.") . " " . $returnLink; } else { $sql = "SELECT * FROM {$db->ElementTexts}" . " WHERE record_id = {$itemId}" . " AND element_id = {$elementId}"; $elements = $db->fetchAll($sql); if (!$elements) { $output .= __("Specified elements not found in item.") . " " . $returnLink; } else { $title = __("Item") . " #" . $itemId; $item = get_record_by_id('Item', $itemId); $titleVerb = metadata($item, array('Dublin Core', 'Title')); if ($titleVerb) { $title .= ': "' . $titleVerb . '"'; } $sql = "\n SELECT es.name\n FROM {$db->ElementSets} es\n JOIN {$db->Elements} el\n ON es.id = el.element_set_id\n WHERE el.id = {$elementId}\n "; $elementSet = $db->fetchOne($sql); $elementsFiltered = metadata($item, array($elementSet, $elementTitle), array('all' => true, 'no_filter' => false)); foreach (array_keys($elements) as $idx) { $elements[$idx]["filtered"] = $elementsFiltered[$idx]; } // echo "<pre>" . print_r($elements,true) . "</pre>"; die(); } } } } } $result = array("elements" => $elements, "output" => $output, "title" => $title, "elementTitle" => $elementTitle); // echo "<pre>" . print_r($result,true) . "</pre>"; die(); return $result; }
/** * Return a link to an item within an exhibit. * * @param string $text Link text (by default, the item title is used) * @param array $props Link attributes * @param Item $item If null, will use the current item. * @return string */ function exhibit_builder_link_to_exhibit_item($text = null, $props = array(), $item = null) { if (!$item) { $item = get_current_record('item'); } if (!isset($props['class'])) { $props['class'] = 'exhibit-item-link'; } $uri = exhibit_builder_exhibit_item_uri($item); $text = !empty($text) ? $text : strip_formatting(metadata($item, array('Dublin Core', 'Title'))); $html = '<a href="' . html_escape($uri) . '" ' . tag_attributes($props) . '>' . $text . '</a>'; $html = apply_filters('exhibit_builder_link_to_exhibit_item', $html, array('text' => $text, 'props' => $props, 'item' => $item)); return $html; }
public function recordToDcmesXml($item) { $xml = "\n" . '<rdf:Description rdf:about="' . xml_escape(record_url($item, null, true)) . '">'; // Iterate throught the DCMES. foreach ($this->_dcElements as $elementName) { if ($text = metadata($item, array('Dublin Core', $elementName), array('all' => true, 'no_escape' => true))) { foreach ($text as $k => $v) { if (!empty($v)) { $xml .= "\n" . '<dc:' . strtolower($elementName) . '>' . xml_escape($v) . '</dc:' . strtolower($elementName) . '>'; } } } } $xml .= "\n" . '</rdf:Description>'; return $xml; }
/** * Get the specified JW Player to display a video stream. * * @param Item $item * @return string Html string. */ public function videoStream($item = null) { $view = $this->view; $db = get_db(); if (is_null($item)) { $item = get_current_record('item'); } $sources = $view->videoStreamSources($item); $sources = version_compare(phpversion(), '5.4.0', '<') ? json_encode($sources) : json_encode($sources, JSON_UNESCAPED_SLASHES); $partial = get_option('videostream_jwplayer_external_control') ? 'video-stream-external-control' : 'video-stream-internal-control'; $html = $view->partial('common/' . $partial . '.php', array('item' => $item, 'sources' => $sources, 'segment_start' => (string) metadata($item, array('Streaming Video', 'Segment Start')), 'segment_end' => (string) metadata($item, array('Streaming Video', 'Segment End')), 'segment_description' => (string) metadata($item, array('Dublin Core', 'Description')))); if (get_option('videostream_display_current')) { $html .= $view->partial('common/video-stream-current.php', array('item' => $item, 'video_filename' => (string) metadata($item, array('Streaming Video', 'Video Filename')))); } return $html; }
public function init() { $this->setAction(url('facet-by-metadata')); $elTable = get_db()->getTable('Element'); $elements = array(); $elementIds = json_decode(get_option('facet_by_metadata_elements'), true); foreach ($elementIds as $elementId) { $element = $elTable->find($elementId); $elements[$elementId] = metadata($element, 'name') . ': ' . metadata($this->item, array($element->getElementSet()->name, $element->name)); } $checkboxes = new Zend_Form_Element_MultiCheckbox('elements'); $checkboxes->setMultiOptions($elements); $this->addElement($checkboxes); $this->addElement('hidden', 'item_id', array('value' => $this->item->id)); $this->addElement('submit', __('Find')); }
public function tourJsonifier($tour) { // Add enumarations of the ordered items in this tour. $items = array(); foreach ($tour->Items as $item) { set_current_record('item', $item); $location = get_db()->getTable('Location')->findLocationByItem($item, true); // If it has a location, we'll build the itemMetadata array and push it to items if ($location) { $item_metadata = array('id' => $item->id, 'title' => metadata('item', array('Dublin Core', 'Title')), 'latitude' => $location['latitude'], 'longitude' => $location['longitude']); array_push($items, $item_metadata); } } // Create the array of data $tour_metadata = array('id' => $tour->id, 'title' => $tour->title, 'description' => $tour->description, 'items' => $items); return $tour_metadata; }
function hijack_exhibit_builder_random_featured_exhibit() { $html = '<div id="featured-exhibit">'; $featuredExhibit = exhibit_builder_random_featured_exhibit(); $html .= '<h2>' . __('Featured Exhibit') . '</h2>'; if ($featuredExhibit) { $html .= '<h3>' . exhibit_builder_link_to_exhibit($featuredExhibit) . '</h3>' . "\n"; if ($item = get_record('Item', array('sort_field' => 'random', 'exhibit' => $featuredExhibit->id, 'hasImage' => true))) { $html .= exhibit_builder_link_to_exhibit($featuredExhibit, item_image('square_thumbnail', array(), 0, $item), array('class' => 'image')); } $html .= '<p class="description">' . snippet_by_word_count(metadata($featuredExhibit, 'description', array('no_escape' => true))) . '</p>'; } else { $html .= '<p>' . __('You have no featured exhibits.') . '</p>'; } $html .= '</div>'; return $html; }
public function itemToDcRdf(Item $item) { $dces = new DublinCoreExtendedPlugin(); $xml = '<rdf:Description rdf:about="' . html_escape(record_url($item, 'show', true)) . '">'; foreach ($dces->getElements() as $element) { $elementTexts = metadata($item, array('Dublin Core', $element['label']), array('all' => true)); if ($elementTexts) { foreach ($elementTexts as $elementText) { if (strlen($elementText) != 0) { $xml .= "\n <dcterms:{$element['name']}><![CDATA[{$elementText}]]></dcterms:{$element['name']}>"; } } } } $xml .= "\n</rdf:Description>"; return $xml; }
public function indexAction() { $elementIds = $this->getParam('elements'); $itemId = $this->getParam('item_id'); $db = $this->_helper->db; $item = $db->getTable('Item')->find($itemId); $advanced = array(); foreach ($elementIds as $elementId) { $element = $db->getTable('Element')->find($elementId); $term = metadata($item, array($element->getElementSet()->name, $element->name), array('no_filter' => true)); if (!empty($term)) { $advanced[] = array('element_id' => $elementId, 'terms' => $term, 'type' => 'is exactly'); } } $paramArray = array('search' => '', 'advanced' => $advanced); $params = http_build_query($paramArray); $this->_helper->redirector->gotoUrl('items/browse?' . $params); }