protected function buildDescription($item) { $description = all_element_texts($item); //Output HTML that would display all the files in whatever way is possible $description .= file_markup($item->Files); return $description; }
/** * Tests that all_element_texts behaves the same when an item is * set on the view and when it is directly passed. */ public function testWithNoItemOnView() { $item = new Item(); $item->item_type_id = 1; $metadataOutput = all_element_texts($item, array('return_type' => 'array')); set_current_record('item', $item, true); // Compare runs with and without item set on view, they should be // the same. $this->assertEquals($metadataOutput, all_element_texts('item', array('return_type' => 'array'))); }
<?php echo $title; ?> </li> <?php } ?> </ul> <?php } ?> <!-- Items metadata --> <div id="item-metadata"> <?php echo all_element_texts('item'); ?> </div> <h3><?php echo __('Files'); ?> </h3> <div id="item-images"> <?php echo files_for_item(); ?> </div> <?php if (metadata('item', 'Collection Name')) {
<div class="container single-item"> <div class="content-block"> <h1><?php echo $fileTitle; ?> </h1> <div class="row"> <div class="col-sm-5"> <?php echo file_markup($file, array('imageSize' => 'original')); ?> </div> <div class="col-sm-7"> <?php echo all_element_texts('file'); ?> <div id="original-filename" class="element"> <h6><?php echo __('Original Filename'); ?> </h6> <p class="element-text"><?php echo metadata('file', 'Original Filename'); ?> </p> </div> <div id="file-size" class="element"> <h6><?php echo __('File Size'); ?>
<?php $collectionTitle = strip_formatting(metadata('collection', array('Dublin Core', 'Title'))); ?> <?php echo head(array('title' => $collectionTitle, 'bodyclass' => 'collections show')); ?> <h1><?php echo $collectionTitle; ?> </h1> <?php echo all_element_texts('collection'); ?> <div id="collection-items"> <!--<h2><?php echo link_to_items_browse(__('Items in the %', $collectionTitle), array('collection' => metadata('collection', 'id'))); ?> </h2>--> <?php if (metadata('collection', 'total_items') > 0) { ?> <?php foreach (loop('items') as $item) { ?> <?php $itemTitle = strip_formatting(metadata('item', array('Dublin Core', 'Title')));
<div id="primary"> <?php if (get_theme_option('Item FileGallery') == 0 && metadata('item', 'has files')) { ?> <div id="itemfiles" class="element"> <?php echo files_for_item(array('imageSize' => 'fullsize')); ?> </div> <?php } ?> <?php echo all_element_texts($item); ?> <?php fire_plugin_hook('public_items_show', array('view' => $this, 'item' => $item)); ?> </div><!-- end primary --> <div id="secondary"> <!-- The following returns all of the files associated with an item. --> <?php if (get_theme_option('Item FileGallery') == 1 && metadata($item, 'has files')) { ?> <div id="itemfiles" class="element">
<!-- Metadata column --> <div id="item-metadata"> <?php echo all_element_texts('item', array('show_element_sets' => array('Dublin Core'), 'show_element_set_headings' => false)); ?> <!-- Item Type Metadata --> <?php echo $item_type_metadata = all_element_texts('item', array('show_element_sets' => array('Item Type Metadata'), 'show_element_set_headings' => false)); ?> </div> <!-- Metadata column --> <?php fire_plugin_hook('public_items_show', array('view' => $this, 'item' => $item)); ?> <ul class="item-pagination navigation"> <li id="previous-item" class="previous"><?php echo link_to_previous_item_show();
?> "> <?php echo __('View correction'); ?> </a> </li> </ul> <p> <?php echo metadata($correction, 'comment'); ?> </p> <?php echo all_element_texts($correction); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php echo foot();
/** * Build the Atom feed using DOM. * * @param array $items An array of Item records. * @return void */ public function __construct(array $items) { $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; // feed $feedElement = $doc->createElement('feed'); $feedElement->setAttribute('xmlns', 'http://www.w3.org/2005/Atom'); // feed/id $feedIdElement = $doc->createElement('id'); $feedIdElement->appendChild($doc->createTextNode(get_view()->serverUrl(isset($_SERVER['REQUEST_URI'])))); $feedElement->appendChild($feedIdElement); // feed/title if (!($feedTitle = get_option('site_title'))) { $feedTitle = 'Unknown'; } $feedTitleElement = $doc->createElement('title'); $feedTitleElement->appendChild($doc->createCDATASection($feedTitle)); $feedElement->appendChild($feedTitleElement); // feed/subtitle if ($feedSubtitle = get_option('description')) { $feedSubtitleElement = $doc->createElement('subtitle'); $feedSubtitleElement->appendChild($doc->createCDATASection($feedSubtitle)); $feedElement->appendChild($feedSubtitleElement); } // feed/author/name if (!($feedAuthorName = get_option('author'))) { $feedAuthorName = 'Unknown'; } $feedAuthorElement = $doc->createElement('author'); $feedAuthorNameElement = $doc->createElement('name'); $feedAuthorNameElement->appendChild($doc->createCDATASection($feedAuthorName)); $feedAuthorElement->appendChild($feedAuthorNameElement); $feedElement->appendChild($feedAuthorElement); // feed/rights if ($feedRights = get_option('copyright')) { $feedRightsElement = $doc->createElement('rights'); $feedRightsElement->appendChild($doc->createCDATASection($feedRights)); $feedElement->appendChild($feedRightsElement); } // feed/updated $feedUpdated = $doc->createElement('updated', date(DATE_ATOM, time())); $feedElement->appendChild($feedUpdated); // feed/generator $feedGenerator = $doc->createElement('generator', 'Omeka'); $feedElement->appendChild($feedGenerator); // Get the feed self/next/prev links. $feedLinks = $this->_getFeedLinks($items); // feed/link[rel=self] $feedLinkSelfElement = $doc->createElement('link'); $feedLinkSelfElement->setAttribute('rel', 'self'); $feedLinkSelfElement->setAttribute('href', $feedLinks['self']); $feedElement->appendChild($feedLinkSelfElement); // feed/link[rel=first] $feedLinkFirstElement = $doc->createElement('link'); $feedLinkFirstElement->setAttribute('rel', 'first'); $feedLinkFirstElement->setAttribute('type', 'application/atom+xml'); $feedLinkFirstElement->setAttribute('href', $feedLinks['first']); $feedElement->appendChild($feedLinkFirstElement); // feed/link[rel=prev] if (isset($feedLinks['previous'])) { $feedLinkPrevElement = $doc->createElement('link'); $feedLinkPrevElement->setAttribute('rel', 'previous'); $feedLinkPrevElement->setAttribute('type', 'application/atom+xml'); $feedLinkPrevElement->setAttribute('href', $feedLinks['previous']); $feedElement->appendChild($feedLinkPrevElement); } // feed/link[rel=next] if (isset($feedLinks['next'])) { $feedLinkNextElement = $doc->createElement('link'); $feedLinkNextElement->setAttribute('rel', 'next'); $feedLinkNextElement->setAttribute('type', 'application/atom+xml'); $feedLinkNextElement->setAttribute('href', $feedLinks['next']); $feedElement->appendChild($feedLinkNextElement); } // feed/link[rel=last] $feedLinkLastElement = $doc->createElement('link'); $feedLinkLastElement->setAttribute('rel', 'last'); $feedLinkLastElement->setAttribute('type', 'application/atom+xml'); $feedLinkLastElement->setAttribute('href', $feedLinks['last']); $feedElement->appendChild($feedLinkLastElement); // feed/entry foreach ($items as $item) { $feedEntryElement = $doc->createElement('entry'); // feed/entry/id $feedEntryIdElement = $doc->createElement('id'); $feedEntryIdElement->appendChild($doc->createTextNode(record_url($item, null, true))); $feedEntryElement->appendChild($feedEntryIdElement); // feed/entry/title if (!($feedEntryTitle = metadata($item, array('Dublin Core', 'Title')))) { $feedEntryTitle = 'Untitled'; } $feedEntryTitleElement = $doc->createElement('title'); $feedEntryTitleElement->appendChild($doc->createCDATASection($feedEntryTitle)); $feedEntryElement->appendChild($feedEntryTitleElement); // feed/entry/summary if ($feedEntrySummary = metadata($item, array('Dublin Core', 'Description'))) { $feedEntrySummaryElement = $doc->createElement('summary'); $feedEntrySummaryElement->appendChild($doc->createCDATASection($feedEntrySummary)); $feedEntryElement->appendChild($feedEntrySummaryElement); } // feed/entry/updated $feedEntryUpdated = $doc->createElement('updated', date(DATE_ATOM, strtotime(metadata($item, 'Modified')))); $feedEntryElement->appendChild($feedEntryUpdated); // feed/entry/link[rel=alternate] $feedEntryLinkAlternateElement = $doc->createElement('link'); $feedEntryLinkAlternateElement->setAttribute('rel', 'alternate'); $feedEntryLinkAlternateElement->setAttribute('type', 'text/html'); $feedEntryLinkAlternateElement->setAttribute('href', record_url($item, null, true)); $feedEntryElement->appendChild($feedEntryLinkAlternateElement); // feed/entry/link[rel=enclosure] foreach ($item->Files as $file) { $feedEntryLinkEnclosureElement = $doc->createElement('link'); $feedEntryLinkEnclosureElement->setAttribute('rel', 'enclosure'); $feedEntryLinkEnclosureElement->setAttribute('href', $file->getWebPath('original')); $feedEntryLinkEnclosureElement->setAttribute('type', $file->mime_type); $feedEntryLinkEnclosureElement->setAttribute('length', $file->size); $feedEntryElement->appendChild($feedEntryLinkEnclosureElement); } // feed/entry/category foreach ($item->Tags as $tag) { $feedEntryCategoryElement = $doc->createElement('category'); $feedEntryCategoryElement->setAttribute('term', $tag->name); $feedEntryElement->appendChild($feedEntryCategoryElement); } // feed/entry/content $feedEntryContentElement = $doc->createElement('content'); $feedEntryContentElement->setAttribute('type', 'html'); $feedEntryContentElement->appendChild($doc->createCDATASection(all_element_texts($item))); $feedEntryElement->appendChild($feedEntryContentElement); $feedElement->appendChild($feedEntryElement); } $doc->appendChild($feedElement); $this->_feed = $doc; }
$file_markup = preg_replace($preg, $replace, $file_markup); } echo $file_markup; ?> <?php } ?> </div> </div> <?php } } ?> <?php echo all_element_texts('item', array('show_element_set_headings' => false)); ?> <?php if (!empty($style['item']['show']['files']) && metadata('item', 'has files')) { ?> <div id="itemfiles" class="element"> <?php if (is_string($style['item']['show']['files'])) { ?> <h3><?php echo $style['item']['show']['files']; ?> </h3> <?php }
<ul class="pager"> <li id="previous-item" class="previous"><?php echo link_to_previous_item_show('← Previous'); ?> </li> <li id="next-item" class="next"><?php echo link_to_next_item_show('Next →'); ?> </li> </ul> </nav> <div class="row"> <div class="col-sm-7"> <h2>About this item</h2> <?php echo all_element_texts('item', array(false, false)); ?> </div> <div class="col-sm-5"> <?php echo get_specific_plugin_hook_output('SocialBookmarking', 'public_items_show', array('view' => $this, 'item' => $item)); ?> <hr> <br> <h6><span class="fa fa-book"></span> Collection</h6> <p><?php
function csvAction() { $this->_helper->viewRenderer->setNoRender(); $items = explode(',', $this->getParam('id')); $correspondence['Contributor'] = 'Auteur'; $correspondence['Coverage'] = 'Lieu'; $correspondence['Creator'] = 'Producteur'; $correspondence['Date'] = 'Date'; $correspondence['Description'] = 'Contenu'; $correspondence['Format'] = 'Importance matérielle'; $correspondence['Identifier'] = 'Références'; $correspondence['Language'] = 'Langues'; $correspondence['Publisher'] = 'Lieu de conservation'; $correspondence['Relation'] = 'Lien vers la notice complète'; $correspondence['Rights'] = "Conditions d'accès"; $correspondence['Source'] = 'Source'; $correspondence['Subject'] = 'Sujet'; $correspondence['Title'] = 'Titre'; $correspondence['Type'] = 'Type'; $correspondence['Abstract'] = 'Légende'; $correspondence['Access Rights'] = 'Communicabilité'; $correspondence['Further Informations'] = 'Autres informations'; $correspondence['Relatedmaterial'] = 'Autres ressources'; $pdf = new Omeka_Html(); $record = get_record_by_id("Item", $items[0]); $sets = all_element_texts($record, array('show_empty_elements' => true, 'return_type' => 'array')); $csv = ''; $j = 0; $headers = array(); foreach ($items as $i) { $record = get_record_by_id("Item", $i); $sets = all_element_texts($record, array('show_empty_elements' => true, 'return_type' => 'array')); foreach ($sets as $key => $set) { foreach ($set as $key => $value) { if (count($value) > 0) { if (!in_array($key, $headers)) { array_push($headers, $key); } } } } } /* foreach($sets as $key => $set) { foreach($set as $key => $value) { if (isset($correspondence[$key])) $csv .= utf8_decode($correspondence[$key]) . ';'; else $csv .= $key . ';'; } } $csv .= "\n"; Titre > Titre Description > Contenu Date > Date Creator > Producteur Publisher > Lieu de conservation Identifier > Références Coverage > Lieu (indexation géographique) Tag > Mot clés Rights accessRights > Communicabilité Informations complémentaires > Autres informations */ /* foreach($headers as $header) { if (isset($correspondence[$header])) $csv .= utf8_decode($correspondence[$header]) . ';'; else $csv .= $header . ';'; } $csv .= "\n"; */ $head = ''; $counter = 0; foreach ($items as $i) { $record = get_record_by_id("Item", $i); $sets = all_element_texts($record, array('show_empty_elements' => true, 'return_type' => 'array')); // Debug //echo "\r\n---------\r\n\r\n"; foreach ($sets as $set) { if ($counter == 0) { /* // $set['Test'] = "coucou"; $new['Title'] = $set['Title']; $new['Description'] = $set['Description']; $new['Date'] = $set['Date']; $new['Creator'] = $set['Creator']; $new['Publisher'] = $set['Publisher']; $new['Identifier'] = $set['Identifier']; $new['Coverage'] = $set['Coverage']; $new['Rights'] = $set['Rights']; $new['Access Rights'] = $set['Access Rights']; $new['Further Informations'] = $set['Further Informations']; $res = array_merge($new, $set); // print_r($res); $set = $res; */ } foreach ($set as $key => $values) { if (in_array($key, $headers)) { if ($counter == 0) { if (isset($correspondence[$key])) { $head .= utf8_decode($correspondence[$key]) . ';'; } else { $head .= $key . ';'; } } $val = metadata($record, array("Dublin Core", $key)); // Debug //$val = str_replace(array('.', ' ', "\n", "\r"), '', $val); //echo $i." : ".$key." : " . substr($val,0,150) . "\r\n"; $csv .= str_replace(array(';', "\r", "\n", "\r\n", "\n\r"), ',', utf8_decode(strip_tags($val))) . " "; $csv .= ';'; } } } $csv .= "\n"; $counter++; } $filename = 'histoirealasource.ille-et-vilaine.csv'; header("Content-Type: text/plain; charset='utf-8'"); header('Content-Disposition: attachment; filename="' . $filename . '"'); header("Content-Length: " . strlen($csv)); echo $head . "\n" . $csv; exit; }
<!-- Display the file's metadata --> <div class="file-metadata"> <?php /*verificando se possui os campos*/ /*depois verificar quais campos serão exibidos*/ if (isset($dublin_files['Dublin Core']['Title'])) { ?> <h4> <?php echo $dublin_files['Dublin Core']['Title'][0]; ?> </h4> <?php } ?> </div> </div> <?php } ?> </div> <?php } $dublin_sep = all_element_texts('item', array('return_type' => 'array', 'show_element_sets' => array('Dublin Core'))); echo $dados_neatline_pos; ?> <hr /> <!-- Link. --> <?php echo link_to(get_current_record('item'), 'show', 'Ver os dados desse item na nossa biblioteca digital');