Пример #1
0
 protected function itemToRSS($item)
 {
     $entry = array();
     set_current_record('item', $item, true);
     // Title is a CDATA section, so no need for extra escaping.
     $entry['title'] = strip_formatting(metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true)));
     $entry['description'] = $this->buildDescription($item);
     $entry['link'] = xml_escape(record_url($item, null, true));
     $entry['lastUpdate'] = strtotime($item->added);
     //List the first file as an enclosure (only one per RSS feed)
     if (($files = $item->Files) && ($file = current($files))) {
         $entry['enclosure'] = array();
         $fileDownloadUrl = file_display_url($file);
         $enc['url'] = $fileDownloadUrl;
         $enc['type'] = $file->mime_type;
         $enc['length'] = (int) $file->size;
         $entry['enclosure'][] = $enc;
     }
     return $entry;
 }
Пример #2
0
/**
 * Create the bag, generate tar.
 *
 * @param array $file_ids Array of ids, posted from the form.
 * @param string $name The name of the bag.
 *
 * @return boolean $success True if the new bag validates.
 */
function bagithelpers_doBagIt($collection_id, $collection_name)
{
    $db = get_db();
    $key = sha1(microtime(true) . mt_rand(10000, 90000));
    $collection_name = $collection_name . '-' . $key;
    // Instantiate the bag, get the collection.
    $bag = new BagIt(BAGIT_BAG_DIRECTORY . '/' . $collection_name);
    $collection = $db->getTable('BagitFileCollection')->find($collection_id);
    // Get the files associated with the collection.
    $files = $collection->getFiles();
    // Retrieve the files and add them to the new bag.
    foreach ($files as $file) {
        $bagurl = file_display_url($file);
        $bag->fetch->add($bagurl, 'data/' . $file->original_filename);
    }
    // Update the hashes.
    $bag->update();
    // Tar it up.
    $bag->package(BAGIT_BAG_DIRECTORY . '/' . $collection_name);
    return $bag->isValid() ? $collection_name : false;
}
Пример #3
0
					                        <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) . '">';
            echo '    <div class="overlay"></div>';
            if (metadata('item', 'has thumbnail')) {
                echo '<div style="background-image: url(' . file_display_url($image[0], 'fullsize') . ');" class="img"></div>';
            } else {
                echo '<div style="background-image: url(/themes/cornishmemory/images/fallback-video.png);" class="img"></div>';
            }
            echo '    <span class="title">' . metadata('item', array('Dublin Core', 'Title')) . '</span>';
            echo '  </a>';
            ?>
					                            </div>
					                            <?php 
        }
        ?>

					                        <?php 
    }
    ?>
					                        </div>
Пример #4
0
	<div class="image-thumb">
		<a href="<?php 
    echo file_display_url($files[0], $format = 'original');
    ?>
"><?php 
    echo file_image('fullsize', array(), $files[0]);
    ?>
</a>
		<p class="post-image">(click image to see high quality files)</p>
	</div>
    <?php 
}
?>
    <div class='content'>
    <h1><a target='_blank' href="<?php 
echo file_display_url($files[0], $format = 'original');
?>
"><?php 
echo metadata('item', array('Dublin Core', 'Title'));
?>
</a></h1>

        <p><strong>Type of Document: </strong><?php 
echo metadata('item', array('Item Type Metadata', 'Type of Document'));
?>
.
	<?php 
$primary_parties = metadata('item', array('Item Type Metadata', 'Primary Parties'));
if (count($primary_parties) > 0) {
    ?>
			Primary Parties: <?php 
Пример #5
0
<?php 
if (count($item->Files) < 2) {
    ?>
	<?php 
    foreach (loop('files', $item->Files) as $index => $file) {
        ?>
 
         <div id="left-panel">
		<div class="note">Click on the image to magnify, scroll to adjust the zoom</div>
		<div class="item-file">
			<img class="zoom-file" src="<?php 
        echo file_display_url($file, 'thumbnail');
        ?>
" data-zoom-image="<?php 
        echo file_display_url($file, 'original');
        ?>
"/>
        	</div>
	<h3><?php 
        echo link_to_file_show(array('class' => 'show', 'target' => __('_blank'), 'title' => __('View Page Metadata')), 'View Page Details');
        ?>
</h3>
	</div>
	<div id="right-panel">
    		<div class="element">
			<h3>Transcription</h3>
				<div class="element-text">
					<?php 
        echo metadata($file, array('PDF Text', 'Text'));
        ?>
Пример #6
0
function mh_video_files($item, $html = null)
{
    if (!$item) {
        $item = set_loop_records('files', $item);
    }
    $videoIndex = 0;
    $localVid = 0;
    $videoTypes = array('video/mp4', 'video/mpeg', 'video/quicktime');
    $videoPoster = mh_poster_url();
    foreach (loop('files', $item->Files) as $file) {
        $videoMime = metadata($file, 'MIME Type');
        if (in_array($videoMime, $videoTypes)) {
            $videoFile = file_display_url($file, 'original');
            $videoTitle = metadata($file, array('Dublin Core', 'Title'));
            $videoClass = $videoIndex == 0 ? 'first' : 'not-first';
            $videoDesc = metadata($file, array('Dublin Core', 'Description'));
            $videoTitle = metadata($file, array('Dublin Core', 'Title'));
            $embeddable = embeddableVersion($file, $videoTitle, $videoDesc);
            if ($embeddable) {
                // If a video has an embeddable streaming version, use it.
                $html .= $embeddable;
                $videoIndex++;
                //break;
            } else {
                $html .= '<div class="item-file-container">';
                $html .= '<video width="640" height="360" id="video-' . $localVid . '" class="' . $videoClass . ' video-js vjs-default-skin" controls poster="' . $videoPoster . '" preload="auto" data-setup="{}">';
                $html .= '<source src="' . $videoFile . '" type="video/mp4">';
                $html .= '</video>';
                $html .= $videoTitle ? '<h4 class="title video-title sib">' . $videoTitle . ' <i class="icon-info-sign"></i></h4>' : '';
                $html .= $videoDesc ? '<p class="description video-description sib">' . $videoDesc . ' ' . link_to($file, 'show', '<span class="view-file-link"> [View Additional File Details]</span>', array('class' => 'view-file-record', 'rel' => 'nofollow')) . '</p>' : '';
                $html .= '</div>';
                $localVid++;
                $videoIndex++;
            }
        }
    }
    if ($videoIndex > 0) {
        echo '<h3><i class="icon-film"></i>' . ($videoIndex > 1 ? __('Videos ') : __('Video ')) . '<span class="toggle instapaper_ignore">' . __('Show ') . '<i class="icon-chevron-right"></i></span></h3>';
        if ($localVid > 0) {
            //echo $videoJS.$videoSWF;
            echo $html;
        }
        //if($localVid>0) echo mh_video_ResponsifyVideoScript($localVid);
    }
}
 public function hookPublicHead($args)
 {
     $title = '';
     $description = '';
     $image_url = '';
     // Is the curent record an exhibit?  Use its metadata.
     try {
         $exhibit = get_current_record('exhibit');
         $title = metadata($exhibit, 'title', array('no_escape' => false));
         $description = metadata($exhibit, 'description', array('no_escape' => false));
         $file = $exhibit->getFile();
         if ($file) {
             $image_url = file_display_url($file, 'fullsize');
         }
     } catch (Omeka_View_Exception $ove) {
         //  no exhibit, don't do anything
     }
     // Is the curent record an item?  Use its metadata.
     try {
         $item = get_current_record('item');
         $title = metadata('item', array('Dublin Core', 'Title'));
         $description = metadata('item', array('Dublin Core', 'Description'));
         if (strlen($title) > 0 && strlen($description) > 0) {
             foreach (loop('files', $item->Files) as $file) {
                 if ($file->hasThumbnail()) {
                     $image_url = file_display_url($file, 'fullsize');
                     break;
                 }
             }
         }
     } catch (Omeka_View_Exception $ove) {
         //  no item, don't do anything
     }
     // Is the curent record an collection?  Use its metadata.
     try {
         $collection = get_current_record('collection');
         $title = metadata('collection', array('Dublin Core', 'Title'));
         $description = metadata('collection', array('Dublin Core', 'Description'));
         $file = $collection->getFile();
         if ($file) {
             $image_url = file_display_url($file, 'fullsize');
         }
     } catch (Omeka_View_Exception $ove) {
         //  no collection, don't do anything
     }
     // Default to the site settings if we didn't find anything else to use
     if (strlen($title) < 1 || strlen($description) < 1) {
         $title = option('site_title');
         $description = option('description');
         $items = get_random_featured_items(1, true);
         if (isset($items[0])) {
             foreach (loop('files', $items[0]->Files) as $file) {
                 if ($file->hasThumbnail()) {
                     $image_url = file_display_url($file, 'fullsize');
                     break;
                 }
             }
         }
     }
     if (strlen($title) > 0 && strlen($description) > 0) {
         echo '<meta property="twitter:card" content="summary" />';
         echo '<meta property="twitter:site" content="' . get_option(TWITTER_CARDS_SITE_HANDLE_OPTION) . '" />';
         echo '<meta property="twitter:title" content="' . strip_tags(html_entity_decode($title)) . '" />';
         echo '<meta property="twitter:description" content="' . strip_tags(html_entity_decode($description)) . '" />';
         echo '<meta property="og:title" content="' . strip_tags(html_entity_decode($title)) . '" />';
         echo '<meta property="og:description" content="' . strip_tags(html_entity_decode($description)) . '" />';
         if (strlen($image_url) > 0) {
             echo '<meta property="twitter:image:src" content="' . $image_url . '" />';
             echo '<meta property="og:image" content="' . $image_url . '" />';
             echo '<link rel="image_src" type="image/jpeg" href="' . $image_url . '" />';
         }
     }
 }
Пример #8
0
                   </div>
               </div>
           </div>
       
           <?php 
   foreach (loop('items') as $item) {
       ?>
           <div class="item">
               <div class="row" style="background-color:#eee; margin-bottom:15px; padding-top:5px; padding-bottom:5px;">
 <!--                   <div class="col-sm-2 col-md-2">
                       <?php 
       $image = $item->Files;
       ?>
                       <?php 
       if ($image) {
           echo link_to_item('<div style="background-image: url(' . file_display_url($image[0], 'original') . ');" class="img"></div>');
       } else {
           echo link_to_item('<div style="background-image: url(' . img('*****@*****.**') . ');" class="img"></div>');
       }
       ?>
                   </div> -->
                   <div class="col-sm-3 col-md-2">
                       <?php 
       echo link_to_item(metadata('item', array('Dublin Core', 'Title')), array('class' => 'permalink'));
       ?>
                   </div>
                   <div class="col-sm-3 col-md-2">
                       <?php 
       echo metadata('item', array('Dublin Core', 'Creator'));
       ?>
                   </div>
Пример #9
0
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;
}