Exemplo n.º 1
0
 function populate_images($images)
 {
     $image_option_array = array();
     foreach ($images as $k => $v) {
         $image_option_array['options'][$k] = get_show_image_html($k, false, true, false);
     }
     return $image_option_array;
 }
 function get_image_markup($page)
 {
     $image_markup = '';
     if ($this->params['provide_images']) {
         $image = $this->get_page_image($page->id());
         if (!empty($image)) {
             if ($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0) {
                 $rsi = new reasonSizedImage();
                 if (!empty($rsi)) {
                     $rsi->set_id($image->id());
                     if ($this->params['thumbnail_width'] != 0) {
                         $rsi->set_width($this->params['thumbnail_width']);
                     }
                     if ($this->params['thumbnail_height'] != 0) {
                         $rsi->set_height($this->params['thumbnail_height']);
                     }
                     if ($this->params['thumbnail_crop'] != '') {
                         $rsi->set_crop_style($this->params['thumbnail_crop']);
                     }
                     $image_markup = get_show_image_html($rsi, true, false, false, '', '', false);
                 }
             } else {
                 $image_markup = get_show_image_html($image->id(), true, false, false, '', '', false);
             }
         }
     }
     return $image_markup;
 }
Exemplo n.º 3
0
		function show_child_page($child,$counter,$even_odd)
		{
			/* If the page has a link name, use that; otherwise, use its name */
			$page_name = $this->get_page_name($child);
			$title_attr = '';
			if( $page_name != $child->get_value('name') )
			{
				$title_attr = ' title="'.reason_htmlspecialchars(strip_tags($child->get_value('name')),ENT_QUOTES).'"';
			}
			$page_name = strip_tags($page_name,'<span><strong><em>');
			$link = $this->get_page_link($child);
			$classes = array('number'.$counter, $even_odd);
			$uname = '';
			if($child->get_value( 'unique_name' ))
			{
				$classes[] = 'uname-'.reason_htmlspecialchars($child->get_value( 'unique_name' ));
			}
			if($child->get_value('url'))
			{
				$classes[] = 'jump';
			}
				
			echo '<li class="'.implode(' ',$classes).'">';
			
			if($this->params['provide_az_links'] && array_key_exists($child->id(),$this->az))
			{
				echo '<a name="child_'.$this->az[$child->id()].'"></a>';
			}
			$image_markup = '';
			if($this->params['provide_images'])
			{
				$image = $this->get_page_image($child->id());
				
				if(!empty($image))
				{
					if($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0)
					{
						$rsi = new reasonSizedImage();
						if(!empty($rsi))
						{
							$rsi->set_id($image->id());
							if($this->params['thumbnail_width'] != 0)
							{
								$rsi->set_width($this->params['thumbnail_width']);
							}
							if($this->params['thumbnail_height'] != 0)
							{
								$rsi->set_height($this->params['thumbnail_height']);
							}
							if($this->params['thumbnail_crop'] != '')
							{
								$rsi->set_crop_style($this->params['thumbnail_crop']);
							}
							if(!$this->params['html5'])
								$image_markup = get_show_image_html($rsi, true, false, false, '' , '', false, $link);
							else
								$image_markup = get_show_image_html($rsi, true, false, false, '' , '', false );
						}
					}
					else
					{
						if(!$this->params['html5'])
							$image_markup = get_show_image_html( $image->id(), true, false, false, '' , '', false, $link );
						else
							$image_markup = get_show_image_html( $image->id(), true, false, false, '' , '', false );
					}
				}
				if(!$this->params['html5'])
					echo $image_markup;
			}
			if($this->params['description_part_of_link'])
			{
				$element = $this->params['html5'] ? 'h4' : 'strong';
				echo '<a href="'.$link.'"'.$title_attr.'>';
				if($this->params['html5'])
					echo $image_markup;
				echo '<'.$element.'>'.$page_name.'</'.$element.'>';
				if(!$this->params['html5'])
					echo '<br />';
				if ( $child->get_value( 'description' ))
				{
					$element = $this->params['html5'] ? 'div' : 'span';
					echo "\n".'<'.$element.' class="childDesc">'.$child->get_value( 'description' ).'</'.$element.'>';
				}
				echo '</a>';
			}
			else
			{
				echo '<h4><a href="'.$link.'"'.$title_attr.'>'.$page_name.'</a></h4>';
				if ( $child->get_value( 'description' ))
				{
					echo "\n".'<div class="childDesc">'.$child->get_value( 'description' ).'</div>';
				}
			}
			echo '</li>'."\n";
		}
Exemplo n.º 4
0
	/**
	 * Get a teaser image for a given event
	 * @param mixed $event_id Event ID or Event object
	 * @param string $link
	 * @return string html
	 * @todo move into a markup class
	 */
	function get_teaser_image_html($event_id, $link = '')
	{
		if(empty($this->params['show_images']))
			return '';
		
		if(is_object($event_id))
			$event_id = $event_id->id();
		
		static $image_cache = array();
		if(!array_key_exists($event_id, $image_cache))
		{
			$es = new entity_selector();
        	$es->description = 'Selecting images for event';
        	$es->add_type( id_of('image') );
        	$es->add_right_relationship( $event_id, relationship_id_of('event_to_image') );
        	$es->add_rel_sort_field($event_id, relationship_id_of('event_to_image'));
        	$es->set_order('rel_sort_order ASC');
        	$es->set_num(1);
        	$images = $es->run_one();
        	if(!empty($images))
        	{
        		$image_cache[$event_id] = current($images);
        	}
        	elseif($image = $this->_get_list_thumbnail_default_image())
        	{
        		$image_cache[$event_id] = $image;
        	}
        	else
        	{
        		$image_cache[$event_id] = NULL;
        	}
        }

        if(!empty($image_cache[$event_id]))
        {
        	if($this->params['list_thumbnail_width'] || $this->params['list_thumbnail_height'])
        	{
        		$rsi = new reasonSizedImage;
        		$rsi->set_id($image_cache[$event_id]->id());
        		if(0 != $this->params['list_thumbnail_height']) $rsi->set_height($this->params['list_thumbnail_height']);
				if(0 != $this->params['list_thumbnail_width']) $rsi->set_width($this->params['list_thumbnail_width']);
				if('' != $this->params['list_thumbnail_crop']) $rsi->set_crop_style($this->params['list_thumbnail_crop']);
				return get_show_image_html( $rsi, true, false, false, '', $this->textonly, false, $link );
        	}
        	else
        	{
        		return get_show_image_html( $image_cache[$event_id], true, false, false, '', $this->textonly, false, $link );
        	}
        }
	}
Exemplo n.º 5
0
 /**
  * Get the images markup for a given event
  * @param object $event
  * @return string markup
  */
 protected function get_image_markup($event)
 {
     $ret = '';
     if ($images = $this->bundle->images($event)) {
         $ret .= '<div class="images">';
         foreach ($images as $image) {
             $ret .= '<div class="tnBlock">';
             $ret .= get_show_image_html($image, false, true, true, '');
             $ret .= "</div>";
         }
         $ret .= "</div>";
     }
     return $ret;
 }
Exemplo n.º 6
0
 function run()
 {
     if ($this->params['previous_next']) {
         $siblings = $this->_get_previous_next($this->siblings);
     } else {
         $siblings = $this->siblings;
     }
     $classes = array('siblingList');
     if ($this->params['provide_images']) {
         $classes[] = 'siblingListWithImages';
     }
     if ($this->params['previous_next']) {
         $classes[] = 'prevNext';
     }
     echo '<div class="siblingsModule">' . "\n";
     if ($this->params['use_parent_title_as_header']) {
         echo '<h3>' . $this->parent_page->get_value('name') . '</h3>' . "\n";
     }
     echo '<ul class="' . implode(' ', $classes) . '">' . "\n";
     $counter = 1;
     $even_odd = 'odd';
     foreach ($siblings as $key => $sibling) {
         $classes = array('number' . $counter, $even_odd);
         $uname = '';
         if ($sibling->get_value('unique_name')) {
             $classes[] = 'uname-' . reason_htmlspecialchars($sibling->get_value('unique_name'));
         }
         /* If the page has a link name, use that; otherwise, use its name */
         $page_name = $sibling->get_value('link_name') ? $sibling->get_value('link_name') : $sibling->get_value('name');
         $image_html = '';
         $is_current_page = false;
         if ($this->parent->cur_page->id() == $sibling->id()) {
             $classes[] = 'currentPage';
             $is_current_page = true;
         }
         $link = '';
         if (!$is_current_page) {
             /* Check for a url (that is, the page is an external link); otherwise, use its relative address */
             if ($sibling->get_value('url')) {
                 $link = $sibling->get_value('url');
                 $classes[] = 'jump';
             } else {
                 $link = '../' . $sibling->get_value('url_fragment') . '/';
                 if (!empty($this->parent->textonly)) {
                     $link .= '?textonly=1';
                 }
                 //pray($this->parent->site_info);
                 //$base_url = $this->parent->site_info[ 'base_url' ];
                 //$link = '/'.$base_url.$this->get_nice_url( $child->id() ).'/';
             }
         }
         if ($this->params['provide_images']) {
             $image = $this->get_page_image($sibling->id());
             if (!empty($image)) {
                 if ($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0) {
                     $rsi = new reasonSizedImage();
                     if (!empty($rsi)) {
                         $rsi->set_id($image->id());
                         if ($this->params['thumbnail_width'] != 0) {
                             $rsi->set_width($this->params['thumbnail_width']);
                         }
                         if ($this->params['thumbnail_height'] != 0) {
                             $rsi->set_height($this->params['thumbnail_height']);
                         }
                         if ($this->params['thumbnail_crop'] != '') {
                             $rsi->set_crop_style($this->params['thumbnail_crop']);
                         }
                         $image_html = get_show_image_html($rsi, true, false, false, '', '', false, $link);
                     }
                 } else {
                     $image_html = get_show_image_html($image->id(), true, false, false, '', '', false, $link);
                 }
             }
         }
         if (!$is_current_page) {
             if ('previous' == $key || 'next' == $key) {
                 $classes[] = $key;
             }
             echo '<li class="' . implode(' ', $classes) . '">';
             if (!empty($prevnext)) {
                 echo '<strong>' . ucfirst($key) . ':</strong> ';
             }
             echo $image_html;
             echo '<a href="' . $link . '">' . $page_name . '</a>';
             /* if ( $sibling->get_value( 'description' ))
             			echo "\n".'<div class="smallText">'.$sibling->get_value( 'description' ).'</div>'; */
             echo "</li>\n";
         } else {
             echo '<li class="' . implode(' ', $classes) . '">';
             echo $image_html;
             echo '<strong>' . $page_name . '</strong>';
             echo '</li>' . "\n";
         }
         $counter++;
         if ($even_odd == 'even') {
             $even_odd = 'odd';
         } else {
             $even_odd = 'even';
         }
     }
     echo '</ul>' . "\n";
     echo '</div>' . "\n";
 }