/** * Get an array of all leaves (or all non-leaves) of an item in order to * display them with BookReader. * * Difference with the default method is that multiple views and missing * pages are added when needed, so the parity remains clean. * * @param boolean $invert * * @return array * Array of files or nulls. */ protected function _get_list_of_leaves($invert = false) { if (empty($this->_item)) { return; } if (is_null($this->_leaves)) { $this->_leaves = array(); $this->_nonleaves = array(); $supportedFormats = array('jpeg' => 'JPEG Joint Photographic Experts Group JFIF format', 'jpg' => 'Joint Photographic Experts Group JFIF format', 'png' => 'Portable Network Graphics', 'gif' => 'Graphics Interchange Format', 'tif' => 'Tagged Image File Format', 'tiff' => 'Tagged Image File Format'); // Set the regular expression to match selected/supported formats. $supportedFormatRegex = '/\\.(' . implode('|', array_keys($supportedFormats)) . ')$/i'; // Retrieve image files from the item. set_loop_records('files', $this->_item->getFiles()); foreach (loop('files') as $file) { if ($file->hasThumbnail() && preg_match($supportedFormatRegex, $file->filename)) { $this->_leaves[] = $file; } else { $this->_nonleaves[] = $file; } } // Sorting by original filename or keep attachment order. if (get_option('bookreader_sorting_mode')) { $this->sortFilesByOriginalName($this->_leaves); $this->sortFilesByOriginalName($this->_nonleaves); } // Insert missing pages and multiple views. $this->_leaves = $this->_complete_list_of_leaves(); // Reset keys, because the important is to get files by order. $this->_leaves = array_values($this->_leaves); $this->_nonleaves = array_values($this->_nonleaves); } return $invert ? $this->_nonleaves : $this->_leaves; }
/** * Corresponds to regular function loop('items'). * * @see loop() * @param $num */ function multicollections_loop_items_in_collection($num = 10) { // Cache this so we don't end up calling the DB query over and over again // inside the loop. static $loopIsRun = false; if (!$loopIsRun) { // Retrieve a limited # of items based on the collection given. $items = multicollections_get_items_in_collection($num); set_loop_records('items', $items); $loopIsRun = true; } $item = loop('items'); if (!$item) { $loopIsRun = false; } return $item; }
/** * Set a exhibit's pages as the pages for looping. * * @param Exhibit|null If null, uses the current exhibit */ function set_exhibit_pages_for_loop_by_exhibit($exhibit = null) { if (!$exhibit) { $exhibit = get_current_record('exhibit'); } set_loop_records('exhibit_page', $exhibit->TopPages); }
</div> </div> <?php } ?> <div class="homepage-recent"> <div class="container"> <div class="row"> <div class="col-sm-12"> <div class="content-block"> <h5 class="header-label">What's New</h6> <?php $homepageRecentItems = '6'; set_loop_records('items', get_recent_items($homepageRecentItems)); if (has_loop_records('items')) { ?> <div class="items-list slider"> <?php foreach (loop('items') as $item) { ?> <?php $image = $item->Files; ?> <?php if ($image) { ?> <div class="item"> <?php echo ' <a href="' . record_url($item, null, true) . '">';
/** * Create collection folders if needed. * * @return void. */ protected function _createCollectionFolders() { if (get_option('archive_repertory_collection_convert') != 'None') { $collections = get_records('Collection', array(), 0); $collectionNames = unserialize(get_option('archive_repertory_collection_names')); set_loop_records('collections', $collections); foreach (loop('collections') as $collection) { $result = $this->_createArchiveFolders($collectionNames[$collection->id]); } } }
function mh_display_random_item($num = 1) { echo $num <= 1 ? '<h2>Random ' . mh_item_label() . '</h2>' : '<h2>Random ' . mh_item_label('plural') . '</h2>'; set_loop_records('items', get_random_featured_items($num, true)); if (has_loop_records('items')) { foreach (loop('items') as $item) { echo '<article class="item-result">'; echo '<h3>' . link_to_item(metadata($item, array('Dublin Core', 'Title'))) . '</h3>'; echo '<div class="item-thumb">' . link_to_item(item_image('square_thumbnail')) . '</div>'; if ($desc = metadata($item, array('Dublin Core', 'Description'), array('snippet' => 200))) { echo '<div class="item-description">' . $desc . '</div>'; } else { echo '<div class="item-description">Text preview unavailable.</div>'; } echo '</article>'; } } echo '<p class="view-more-link">' . link_to_items_browse('View all ' . mh_item_label('plural') . '') . '</p>'; }
if ($collections) { ?> <?php foreach (loop('collections') as $collection) { ?> <div class="content-block browse-page"> <h1><?php echo link_to_collection(); ?> <small>(<?php echo metadata('collection', 'total_items'); ?> Items)</small></h1> <?php $items = get_records('Item', array('collection' => $collection->id), 8); set_loop_records('items', $items); if (has_loop_records('items')) { ?> <div class="items-list slider"> <?php foreach (loop('items') as $item) { ?> <?php $image = $item->Files; ?> <?php if ($image) { ?> <div class="item"> <?php
<ul class="items-list"> <?php asort($collections); ?> <?php foreach ($collections as $collection) { ?> <?php set_current_record('collection', $collection); ?> <?php if (metadata($collection, 'total_items') > 0) { ?> <?php $cid = metadata($collection, 'id'); set_loop_records('items', get_item_obj(array('sort_field' => 'random', 'collection' => $cid, 'type' => 'Text')), 1); ?> <?php foreach (loop('items') as $item) { ?> <li class="item"> <?php if (metadata('item', 'has thumbnail')) { ?> <?php echo files_for_item(array('item_image' => 'square_thumbnail', 'imgAttributes' => array('alt' => 'Thumbnail for the first content page of the item, linking to the full file.'))); ?> <?php } ?> <h3><?php
function _pimped_recent_items() { $recent_html = '<h2>' . __('Recent Items') . '</h2>'; set_loop_records('items', get_recent_items(5)); foreach (loop('items') as $item) { $recent_html .= '<div class="recent-row">'; $recent_html .= '<p class="recent">' . metadata($item, array('Dublin Core', 'Identifier')) . ' - ' . link_to_item() . '</p>'; $recent_html .= '<p class="recent">' . (metadata($item, 'item_type_name') ? metadata($item, 'item_type_name') : "NO ITEMTYPE!") . " in " . (metadata($item, 'collection_name') ? metadata($item, 'collection_name') : "NO COLLECTION !") . '</p>'; if (is_allowed($item, 'edit')) { $recent_html .= '<p class="dash-edit">' . link_to_item(__('Edit'), array(), 'edit') . '</p>'; } $recent_html .= '</div>'; } return $recent_html; }
$recentItems = get_theme_option('Homepage Recent Items'); if ($recentItems === null || $recentItems === '') { $recentItems = 3; } else { $recentItems = (int) $recentItems; } if ($recentItems) { ?> <div id="recent-items"> <h2><?php echo __('Recently Added Items'); ?> </h2> <?php $homepageRecentItems = (int) get_theme_option('Homepage Recent Items') ? get_theme_option('Homepage Recent Items') : '3'; set_loop_records('items', get_item_obj(array('recent' => true, 'type' => 'Text'), $homepageRecentItems)); if (has_loop_records('items')) { ?> <ul class="items-list"> <?php foreach (loop('items') as $item) { ?> <li class="item"> <?php if (metadata('item', 'has thumbnail')) { ?> <?php echo files_for_item(array('item_image' => 'square_thumbnail', 'imgAttributes' => array('alt' => 'Thumbnail for the first content page of the item, linking to the full file.'))); ?>
</a></p></div> <?php } ?> </div> </section> <section class="five columns omega"> <div class="panel"> <h2><?php echo __('Recent Collections'); ?> </h2> <?php $collections = get_recent_collections(5); set_loop_records('collections', $collections); foreach (loop('collections') as $collection) { ?> <div class="recent-row"> <p class="recent"><?php echo link_to_collection(); ?> </p> <?php if (is_allowed($collection, 'edit')) { ?> <p class="dash-edit"><?php echo link_to_collection(__('Edit'), array(), 'edit'); ?> </p> <?php
/** * Returns answers to a query. * * @return array * Result can be returned by leaf index or by file id. The custom * highlightFiles() function should use the same. * Associative array of leaf indexes or file ids as keys and an array * values for each result in the page (words and start position): * array( * leaf index = array( * array( * 'answer' => answer, findable in the original text, * 'position' => position of the answer in the original text, * ), * ), * ); */ public function searchFulltext($query) { if (empty($this->_item)) { return; } $minimumQueryLength = 3; $maxResult = 10; // Simplify checks, because arrays are 0-based. $maxResult--; $results = array(); // Normalize query because the search occurs inside a normalized text. $cleanQuery = $this->_alnumString($query); if (strlen($cleanQuery) < $minimumQueryLength) { return $results; } $queryWords = explode(' ', $cleanQuery); $countQueryWords = count($queryWords); if ($countQueryWords > 1) { $queryWords[] = $cleanQuery; } $iResult = 0; $list = array(); set_loop_records('files', $this->_item->getFiles()); foreach (loop('files') as $file) { if ($file->mime_type == 'application/xml') { $xml_file = $file; } elseif ($file->hasThumbnail() && preg_match('/\\.(jpg|jpeg|png|gif)$/i', $file->filename)) { $list[] = $file; } } $widths = array(); $heights = array(); foreach ($list as $file) { $imageSize = $this->getImageSize($file, $imageType); $widths[] = $imageSize['width']; $heights[] = $imageSize['height']; } if ($xml_file) { $results = array(); // To use the local path is discouraged, because it bypasses the // storage, so it's not compatible with Amazon S3, etc. $string = file_get_contents($xml_file->getWebPath('original')); if (empty($string)) { throw new Exception('Error:Cannot get XML file!'); } $string = preg_replace('/\\s{2,}/ui', ' ', $string); $string = preg_replace('/<\\/?b>/ui', '', $string); $string = preg_replace('/<\\/?i>/ui', '', $string); $string = str_replace('<!doctype pdf2xml system "pdf2xml.dtd">', '<!DOCTYPE pdf2xml SYSTEM "pdf2xml.dtd">', $string); $xml = simplexml_load_string($string); if (!$xml) { throw new Exception('Error:Invalid XML!'); } $result = array(); try { // We need to store the name of the function to be used // for string length. mb_strlen() is better (especially // for diacrictics) but not available on all systems so // sometimes we need to use the default strlen() $strlen_function = "strlen"; if (function_exists('mb_strlen')) { $strlen_function = "mb_strlen"; } foreach ($xml->page as $page) { foreach ($page->attributes() as $a => $b) { if ($a == 'height') { $page_height = (string) $b; } if ($a == 'width') { $page_width = (string) $b; } if ($a == 'number') { $page_number = (string) $b; } } $t = 1; foreach ($page->text as $row) { $boxes = array(); $zone_text = strip_tags($row->asXML()); foreach ($queryWords as $q) { if ($strlen_function($q) >= 3) { if (preg_match("/{$q}/Uui", $zone_text) > 0) { foreach ($row->attributes() as $a => $b) { if ($a == 'top') { $zone_top = (string) $b; } if ($a == 'left') { $zone_left = (string) $b; } if ($a == 'height') { $zone_height = (string) $b; } if ($a == 'width') { $zone_width = (string) $b; } } $zone_right = $page_width - $zone_left - $zone_width; $zone_bottom = $page_height - $zone_top - $zone_height; $zone_width_char = strlen($zone_text); $word_start_char = stripos($zone_text, $q); $word_width_char = strlen($q); $word_left = $zone_left + $word_start_char * $zone_width / $zone_width_char; $word_right = $word_left + ($word_width_char + 2) * $zone_width / $zone_width_char; $word_left = round($word_left * $widths[$page_number - 1] / $page_width); $word_right = round($word_right * $widths[$page_number - 1] / $page_width); $word_top = round($zone_top * $heights[$page_number - 1] / $page_height); $word_bottom = round($word_top + $zone_height * $heights[$page_number - 1] / $page_height); $boxes[] = array('r' => $word_right, 'l' => $word_left, 'b' => $word_bottom, 't' => $word_top, 'page' => $page_number); $zone_text = str_ireplace($q, '{{{' . $q . '}}}', $zone_text); $result['text'] = $zone_text; $result['par'] = array(); $result['par'][] = array('t' => $zone_top, 'r' => $zone_right, 'b' => $zone_bottom, 'l' => $zone_left, 'page' => $page_number, 'boxes' => $boxes); $results[] = $result; } $t += 1; } } } } } catch (Exception $e) { throw new Exception('Error:PDF to XML conversion failed!'); } } return $results; }
<?php } ?> </div> <div id="type-items"> <h2><?php echo __('Recently Added Items'); ?> </h2> <?php if ($item_type->Items != null) { ?> <ul> <?php set_loop_records('items', $item_type->Items); ?> <?php foreach (loop('items') as $item) { ?> <li><span class="date"><?php echo format_date(metadata('item', 'Added')); ?> </span> <?php echo link_to_item('<span class="title">' . metadata('item', array('Dublin Core', 'Title')) . '</span>'); ?> </li> <?php } ?> </ul>
function sckls_exhibit_builder_get_images($exhibit) { $html = ''; if (!$exhibit) { $exhibit = get_current_record('exhibit'); } set_loop_records('exhibit_page', $exhibit->TopPages); foreach (loop('exhibit_page') as $exhibitPage) { $attachments = $exhibitPage->getAllAttachments(); foreach ($attachments as $attachment) { $item = $attachment->getItem(); $file = $attachment->getFile(); $html .= '<div class="item">'; //$html .= ' <a href="' . record_url($item, null, true) . '" class="featured">'; $html .= ' <a>'; //$html .= ' <div class="overlay"></div>'; $html .= ' <div style="background-image: url(' . file_display_url($file, 'fullsize') . ');" class="img"></div>'; //$html .= ' <span class="title">' . metadata($item, array('Dublin Core', 'Title')) . '</span>'; $html .= ' </a>'; $html .= '</div>'; } } return $html; }
public function append($args) { ?> <?php if (get_option('jwplayer_external_control')) { ?> <?php if (metadata('item', array('Streaming Video', 'Segment Start'))) { ?> <div id="vid_player"> <div id="jwplayer_plugin">Player failed to load... </div> <div id="vidcontrols"> <ul class="vidControlsLayout" style="width='<?php echo get_option("jwplayer_width_public"); ?> '"> <li id="start_img"><img src="<?php echo img('pause.png'); ?> " title="Start/Stop" class="btnPlay"/></li> <li id="playback-display"><span class="current">0:00:00</span></li> <li class="progressBar"></li> <li id="slider-display"><span class="duration">0:00:00</span> </li> <li id="vol_img"><img class="muted" src="<?php echo img('volume_speaker.png'); ?> " /></a></li> <li class="volumeBar"></li> </ul> </div> <script type="text/javascript"> var is_play = true; var startTime= calculateTime("<?php echo metadata('item', array('Streaming Video', 'Segment Start')); ?> "); var endTime = calculateTime("<?php echo metadata('item', array('Streaming Video', 'Segment End')); ?> "); jwplayer("jwplayer_plugin").setup({ playlist: [{ sources: [ <?php if (get_option('jwplayer_hls_streaming')) { ?> { file: '<?php echo metadata('item', array("Streaming Video", "HLS Streaming Directory")); echo metadata('item', array("Streaming Video", "HLS Video Filename")); ?> ' }, <?php } ?> <?php if (get_option('jwplayer_flash_streaming')) { ?> { file: '<?php echo metadata("item", array("Streaming Video", "Video Streaming URL")); echo metadata("item", array("Streaming Video", "Video Type")); echo metadata('item', array("Streaming Video", "Video Filename")); ?> '} , <?php } ?> <?php if (get_option('jwplayer_http_streaming')) { ?> { file: '<?php echo metadata("item", array("Streaming Video", "HTTP Streaming Directory")); echo metadata("item", array("Streaming Video", "HTTP Video Filename")); ?> '}, <?php } ?> ] } ], <?php if (get_option('jwplayer_flash_primary')) { ?> primary: "flash", <?php } ?> autostart: false, controls: false, width: "100%", height: "<?php echo get_option('jwplayer_height_public'); ?> ", } ); jwplayer("jwplayer_plugin").onReady(function(){ jQuery('.current').text(getFormattedTimeString(startTime)); jQuery('.duration').text(getFormattedTimeString(endTime)); jwplayer("jwplayer_plugin").seek(startTime); <?php if (get_option('jwplayer_autostart') == 0) { ?> jwplayer("jwplayer_plugin").pause(); <?php } ?> } ); jQuery( ".progressBar" ).slider( { min: startTime, max: endTime, range: "max", slide: function(event, ui) { jwplayer().seek(ui.value); }, change: function(event,ui){ if (jwplayer().getPosition() > endTime){ jwplayer().seek(startTime); } } }); jQuery( ".volumeBar" ).slider( { min: 0, max: 100, range: "max", slide: function(event, ui) { jwplayer().setVolume(ui.value); }, change: function(event,ui){ jwplayer().setVolume(ui.value); } }); jwplayer("jwplayer_plugin").onTime(function(event){ jQuery(".progressBar").slider("value", jwplayer("jwplayer_plugin").getPosition()); jQuery('.current').text(getFormattedTimeString(jwplayer("jwplayer_plugin").getPosition())); }); jwplayer("jwplayer_plugin").onPlay(function(){ jQuery('.btnPlay').attr("src","<?php echo img('pause.png'); ?> "); }); jwplayer("jwplayer_plugin").onPause(function(){ jQuery('.btnPlay').attr("src","<?php echo img('play.png'); ?> "); }); jwplayer("jwplayer_plugin").onMute(function(event){ if (event.mute){ jQuery('.muted').attr("src","<?php echo img('volume_speaker_mute.png'); ?> "); }else{ jQuery('.muted').attr("src","<?php echo img('volume_speaker.png'); ?> "); } } ); jwplayer("jwplayer_plugin").onVolume(function(event){ if (event.volume <= 0 ){ jQuery('.muted').attr("src","<?php echo img('volume_speaker_mute.png'); ?> "); }else{ jQuery('.muted').attr("src","<?php echo img('volume_speaker.png'); ?> "); } } ); jQuery('.btnPlay').on('click', function() { if (jwplayer().getPosition() > endTime){ jwplayer().seek(startTime); } jwplayer().play(); return false; }); jQuery('.btnStop').on('click', function() { jwplayer().stop(); jwplayer().seek(startTime); jQuery(".progressBar").slider("value", jwplayer().getPosition()); jQuery('.current').text(getFormattedTimeString(jwplayer().getPosition())); return false; }); jQuery('.muted').click(function() { jwplayer().setMute(); return false; }); jQuery('#vid_player')[0].onmouseover = (function() { var onmousestop = function() { jQuery('#vidcontrols').css('display', 'none'); }, thread; return function() { jQuery('#vidcontrols').css('display', 'block'); clearTimeout(thread); thread = setTimeout(onmousestop, 3000); }; })(); jQuery('#vid_player')[0].onmousedown = (function() { var moveend = function() { jQuery('#vidcontrols').css('display', 'none'); }, thread; return function() { jQuery('#vidcontrols').css('display', 'block'); clearTimeout(thread); thread = setTimeout(moveend, 3000); }; })(); </script> </div> <?php } ?> <?php } else { //use jwplayer control ?> <?php if ($bText = metadata('item', array('Streaming Video', 'Segment Start'))) { ?> <div id="vid_player" style="width:100%; margin:0 auto;"> <div id="jwplayer_plugin" style="margin:0 auto;">Player failed to load... </div> </div> <?php } ?> <script type="text/javascript"> var is_play = true; var startTime= calculateTime("<?php echo metadata('item', array('Streaming Video', 'Segment Start')); ?> "); var endTime = calculateTime("<?php echo metadata('item', array('Streaming Video', 'Segment End')); ?> "); jwplayer("jwplayer_plugin").setup({ playlist: [{ sources: [ <?php if (get_option('jwplayer_hls_streaming')) { ?> { file: '<?php echo metadata('item', array("Streaming Video", "HLS Streaming Directory")); echo metadata('item', array("Streaming Video", "HLS Video Filename")); ?> ' }, <?php } ?> <?php if (get_option('jwplayer_flash_streaming')) { ?> { file: '<?php echo metadata("item", array("Streaming Video", "Video Streaming URL")); echo metadata("item", array("Streaming Video", "Video Type")); echo metadata('item', array("Streaming Video", "Video Filename")); ?> '} , <?php } ?> <?php if (get_option('jwplayer_http_streaming')) { ?> { file: '<?php echo metadata("item", array("Streaming Video", "HTTP Streaming Directory")); echo metadata("item", array("Streaming Video", "HTTP Video Filename")); ?> '}, <?php } ?> ] } ], <?php if (get_option('jwplayer_flash_primary')) { ?> primary: "flash", <?php } ?> autostart: false, width: "95%", height: <?php echo get_option('jwplayer_height_public'); ?> } ); jwplayer("jwplayer_plugin").onReady(function(){ jwplayer("jwplayer_plugin").seek(startTime); <?php if (get_option('jwplayer_autostart') == 0) { ?> jwplayer("jwplayer_plugin").pause(); <?php } ?> } ); <?php } ?> </script> <?php if (get_option('jwplayer_display_current')) { ?> <?php $orig_item = get_current_record('item'); $orig_video = metadata("item", array("Streaming Video", "Video Filename")); ?> <?php $items = get_records('item', array('collection' => metadata('item', 'collection id'), 'sort_field' => 'Streaming Video,Segment Start'), null); ?> <?php set_loop_records('items', $items); if (has_loop_records('items')) { $items = get_loop_records('items'); } ?> <?php foreach (loop('items') as $item) { ?> <?php if (metadata('item', array('Streaming Video', 'Segment Type')) == 'Scene' && metadata('item', array('Streaming Video', 'Video Filename')) == $orig_video) { ?> <div class="scene" id="<?php echo metadata('item', array('Streaming Video', 'Segment Start')); ?> " title="<?php echo metadata('item', array('Streaming Video', 'Segment End')); ?> " style="display:none;"> <h2>Current video segment:</h2> <h3><?php echo link_to_item(metadata('item', array('Dublin Core', 'Title'))); ?> </h3> <div style="overflow:auto; max-height:150px;"> <p> <?php echo metadata('item', array('Dublin Core', 'Description')); ?> </p> </div> <p>Segment: <?php echo metadata('item', array('Streaming Video', 'Segment Start')); ?> -- <?php echo metadata('item', array('Streaming Video', 'Segment End')); ?> </p> </div> <!-- end of loop div for display --> <?php } ?> <?php } ?> <hr style="color:lt-gray;"/> <?php set_current_record('item', $orig_item); ?> <script type="text/javascript"> function getElementsByClass(searchClass, domNode, tagName) { if (domNode == null) { domNode = document; } if (tagName == null) { tagName = '*'; } var el = new Array(); var tags = domNode.getElementsByTagName(tagName); var tcl = " "+searchClass+" "; for (i=0,j=0; i<tags.length; i++) { var test = " " + tags[i].className + " "; if (test.indexOf(tcl) != -1) { el[j++] = tags[i]; } } return el; } jwplayer("jwplayer_plugin").onTime(function(event){ var ctime = "0:00:00"; var scenes; var sel; var i = 0; ctime = getTimeString(jwplayer("jwplayer_plugin").getPosition()); scenes = getElementsByClass("scene"); for (i; i < scenes.length; i++) { sel = scenes[i]; if (sel.getAttribute('id') <= ctime && sel.getAttribute('title') >= ctime) { sel.style.display = 'block'; } else { sel.style.display = 'none'; } } } ); </script> <?php } ?> <?php }
?> </h2> <div id="description" class="element"> <div class="element-text"><?php echo metadata('collection', array('Dublin Core', 'Description')); ?> </div> </div><!-- end description --> <div id="collection-items span12"> <ul class="thumbnails"> <?php $collection_items = get_records('Item', array('collection' => $collection['id'], 'sort_field' => 'Scripto,Weight', 'sort_dir' => 'a'), 999); set_loop_records('items', $collection_items); foreach (loop('items') as $item) { set_current_record('item', $item); if (metadata($item, 'has thumbnail')) { ?> <li> <div id="col-images" class="thumbnail right-caption span4"> <?php echo link_to_item(item_image('square_thumbnail', array('alt' => metadata($item, array('Dublin Core', 'Title')), 'class' => 'span2'))); ?> <div class="caption"> <?php echo link_to_item(metadata($item, array('Dublin Core', 'Title'), array('snippet' => 60)), array('class' => 'permalink')); ?> <br /><br /> <div id="col-progress">
} if (isset($dublin_sep['Dublin Core']['Rights'])) { $dados_neatline_pos = $dados_neatline_pos . " <div class='element-text'> <b> Permissões: </b>" . $dublin_sep['Dublin Core']['Rights'][0] . "</div>"; } //php echo all_element_texts('item',array( // 'return_type' => 'html')); ?> <!-- Files. --> <!-- The following returns all of the files associated with an item. --> <?php if (metadata('item', 'has files')) { ?> <div id="itemfiles" class="element"> <?php set_loop_records('files', get_current_record('item')->Files); foreach (loop('files') as $file) { ?> <div class="file-display"> <!-- Display the file itself--> <?php //getting data file $dublin_files = all_element_texts($file, array('show_element_sets' => array('Dublin Core'), 'return_type' => 'array')); //Verify if the file is a image, if is insert code to the lightbox if (stripos(get_current_record('file')->mime_type, 'image') !== false) { //Construct label to picture view on lightbox $label_pic = ""; if (isset($dublin_files['Dublin Core']['Title'])) { $label_pic = $label_pic . "<p><span class='lb-caption-bold'>Título: </span><span class='lb-content'>" . $dublin_files['Dublin Core']['Title'][0] . "</span><p>"; }