Esempio n. 1
0
 function show_list_item($item)
 {
     echo '<li>';
     echo '<h4>' . $item->get_value('name') . '</h4>' . "\n";
     echo '<div class="media">' . "\n";
     $displayer_chrome = MediaWorkFactory::displayer_chrome($item, 'default');
     if ($displayer_chrome) {
         $displayer_chrome->set_media_work($item);
         if ($this->params['height']) {
             $displayer_chrome->set_media_height($this->params['height']);
         }
         if ($this->params['width']) {
             $displayer_chrome->set_media_width($this->params['width']);
         }
         $embed_markup = $displayer_chrome->get_html_markup();
         echo $embed_markup;
         echo '</div>' . "\n";
         if ($this->params['show_descriptions'] && $item->get_value('description')) {
             echo '<div class="description">' . $item->get_value('description') . '</div>' . "\n";
         }
         if ($this->params['show_authors'] && $item->get_value('author')) {
             echo '<div class="author">By ' . $item->get_value('author') . '</div>' . "\n";
         }
     } else {
         echo 'Media unavailable.';
     }
     echo '</li>' . "\n";
 }
Esempio n. 2
0
		function init($args = array())
		{	
			if(isset($this->params['num_per_page']))
				$this->num_per_page = $this->params['num_per_page'];
			
			// only load javascript and css for integrated items
			if ( !empty($this->request[ $this->query_string_frag.'_id' ]) )
			{
				$media_work = new entity($this->request[ $this->query_string_frag.'_id' ]);
				if ($media_work->get_values() && $media_work->get_value('type') == id_of('av'))
				{
					$head_items = $this->get_head_items();
					$head_items->add_javascript(JQUERY_URL, true);
					
					$this->displayer_chrome = MediaWorkFactory::displayer_chrome($media_work, 'av');
					if ($this->displayer_chrome)
					{
						$this->displayer_chrome->set_module($this);
						$this->displayer_chrome->set_head_items($head_items);
					}
				}
			}
	
			parent::init($args);
		}
 function get_av_info($media_works_id, $width = 400, $height = 300, $crop_style = "fill")
 {
     $ret = array();
     //the object that gets returned
     $this->media_works_id = $media_works_id;
     $this->width = $width;
     $this->height = $height;
     $this->crop_style = $crop_style;
     $media_work = new entity($this->media_works_id);
     $es = new entity_selector();
     $es->add_type(id_of('image'));
     $es->add_right_relationship($media_works_id, relationship_id_of('av_to_primary_image'));
     $images = $es->run_one();
     $this->img_results = $images;
     if (count($images) > 0) {
         $image = current($images);
         $av_img_url = $this->get_av_img_url($image);
         $ret['av_img_url'] = $av_img_url;
         //set the av_image_alt to the image description
         $ret['av_img_alt'] = $image->get_value('description');
         $ret['av_img_id'] = $image->get_value('id');
     } else {
         /**
          * This is not working
          */
         //get a blank image with a play button blitted into it
         // set the av_image_alt to "play"
         $ret['av_img_url'] = $this->get_watermark_relative_path($this->media_works_type);
         if ($this->use_absolute_urls) {
             $ret['av_img_url'] = '//' . HTTP_HOST_NAME . $ret['av_img_url'];
         }
         $ret['av_img_alt'] = "play";
         $ret['av_img_id'] = "none";
     }
     if ($media_work->get_value('integration_library') && $media_work->get_value('integration_library') != 'default') {
         reason_include_once('classes/media/factory.php');
         $displayer_chrome = MediaWorkFactory::displayer_chrome($media_work, 'default');
         if ($displayer_chrome) {
             $displayer_chrome->set_media_work($media_work);
             $displayer_chrome->set_media_height($height);
             $displayer_chrome->set_media_width($width);
             $ret['av_html'] = $displayer_chrome->get_html_markup();
             $ret['type'] = $media_work->get_value('av_type');
             $ret['format'] = 'HTML5';
         } else {
             // TODO: test this?
             $ret['av_html'] = '<p>Not available.</p>';
             $ret['type'] = $media_work->get_value('av_type');
             $ret['format'] = 'HTML5';
         }
     } else {
         $avd = new reasonAVDisplay();
         $es = new entity_selector();
         $es->add_type(id_of('av_file'));
         $es->add_right_relationship($media_works_id, relationship_id_of('av_to_av_file'));
         $es->set_order('av.media_format ASC, av.av_part_number ASC');
         $results = $es->run_one();
         $this->avf_results = $results;
         $avf = null;
         $taf = array();
         $taf = $this->get_type_and_format();
         $avf = $this->get_avf($taf['type'], $taf['format']);
         $ret['type'] = $taf['type'];
         $ret['format'] = $taf['format'];
         $this->media_works_type = $taf['type'];
         $avd->set_video_dimensions($width, $height);
         $avd->disable_automatic_play_start();
         if (!empty($image)) {
             $avd->set_placard_image($image);
             // This could be an entity, an ID, or a URL string
             //get the image with a play button blitted into it
         }
         $embed_markup = "";
         if ($avf != null) {
             $embed_markup = $avd->get_embedding_markup($avf);
         }
         $ret['av_html'] = $embed_markup;
     }
     return $ret;
 }
Esempio n. 4
0
 /**
  * Get the markup for the media section
  * @todo support classic media somehow
  */
 function get_media_section($media_works)
 {
     $class = count($media_works) > 1 ? 'mediaGallery' : 'basicMedia';
     $str = '<ul class="' . $class . '">';
     foreach ($media_works as $media) {
         $str .= '<li>';
         $str .= '<div class="titleBlock">';
         if ($placard_info = $this->get_media_placard_info($media)) {
             $str .= '<img src="' . $placard_info['url'] . '" alt="Placeholder image for ' . reason_htmlspecialchars($media->get_value('name')) . '" class="placard" width="' . $placard_info['width'] . '" height="' . $placard_info['height'] . '" style="display:none;" />';
         }
         $str .= '<div class="mediaName">' . $media->get_value('name') . '</div>';
         $str .= '</div>';
         //$str .= $media->get_value('integration_library').'<br />';
         $displayer_chrome = MediaWorkFactory::displayer_chrome($media, 'default');
         if ($displayer_chrome) {
             $str .= '<div class="mediaDisplay">';
             $displayer_chrome->set_media_work($media);
             if ($height = $this->get_media_display_height()) {
             }
             $displayer_chrome->set_media_height($height);
             if ($width = $this->get_media_display_width()) {
             }
             $displayer_chrome->set_media_width($width);
             //$str .= get_class($displayer_chrome);
             $str .= $displayer_chrome->get_html_markup();
             $str .= '</div>';
         }
         $str .= '</li>';
     }
     $str .= '</ul>';
     return $str;
 }