Ejemplo n.º 1
0
 /**
  * get the images ids out of the database for this feature
  * and then get the sized images for the big pics
  * and thumbnails for the small clickable pics
  */
 function init_images()
 {
     //now get an image, if it exists
     $id = $this->get_value('id');
     $es = new entity_selector();
     $es->add_type(id_of('feature_type'));
     $es->add_left_relationship_field('feature_to_image', 'entity', 'id', 'image_id');
     $es->enable_multivalue_results();
     $es->add_relation('entity.id=' . $id);
     $results_array = $es->run_one("", "All");
     //if this feature has no images, set default values
     // for ids and cropping.
     $img_ids = "none";
     $crop_style = $this->crop_style;
     foreach ($results_array as $r) {
         if ($id == $r->get_value('id')) {
             $img_ids = $r->get_value('image_id');
             $cs = $r->get_value('crop_style');
             if ($cs != null) {
                 $crop_style = $cs;
             }
         }
     }
     //Now turn the image ids into url to the sized images
     // and thumbnails.
     $image_urls = array();
     $thumbnail_urls = array();
     if (isset($img_ids)) {
         if (is_array($img_ids)) {
             $this->img_ids = $img_ids;
             foreach ($img_ids as $img_id) {
                 $thumbnail_urls[] = reason_get_image_url($img_id, 'thumbnail');
                 $img_info = $this->get_image_url_and_alt($img_id, $crop_style);
                 $image_urls[] = $img_info['url'];
                 $image_alts[] = htmlspecialchars($img_info['alt'], ENT_QUOTES);
             }
         } else {
             if ($img_ids != 'none') {
                 $this->img_ids[] = $img_ids;
                 $thumbnail_urls[] = reason_get_image_url($img_ids, 'thumbnail');
                 $img_info = $this->get_image_url_and_alt($img_ids, $crop_style);
                 $image_urls[] = $img_info['url'];
                 $image_alts[] = htmlspecialchars($img_info['alt'], ENT_QUOTES);
             } else {
                 $thumbnail_urls[] = "none";
                 $image_urls[] = "none";
                 $this->img_ids[] = "none";
                 $image_alts[] = "";
             }
         }
     } else {
         $thumbnail_urls[] = "none";
         $image_urls[] = "none";
         $this->img_ids[] = "none";
         $image_alts[] = "";
     }
     $this->thumbnail_urls = $thumbnail_urls;
     $this->image_urls = $image_urls;
     $this->image_alts = $image_alts;
 }
 function get_pages_needing_change()
 {
     if (!isset($this->pages_needing_change)) {
         $es = new entity_selector();
         $es->add_type(id_of('minisite_page'));
         $es->enable_multivalue_results();
         $es->limit_tables('page_node');
         $es->limit_fields('custom_page');
         $es->add_relation('page_node.custom_page = "blurb"');
         $es->add_left_relationship_field('minisite_page_to_text_blurb', 'entity', 'id', 'blurb_id');
         $result = $es->run_one();
         foreach ($result as $k => $page) {
             $blurbs = is_array($page->get_value('blurb_id')) ? $page->get_value('blurb_id') : array($page->get_value('blurb_id'));
             foreach ($blurbs as $blurb_id) {
                 $blurb = new entity($blurb_id);
                 $content = $blurb->get_value('content');
                 $demoted_content = demote_headings($content, 1);
                 if ($content == $demoted_content) {
                     $pages_needing_page_type_change[$k] = $k;
                 }
             }
         }
         $this->pages_needing_change = isset($pages_needing_page_type_change) ? array_keys($pages_needing_page_type_change) : false;
     }
     return $this->pages_needing_change;
 }
Ejemplo n.º 3
0
 /**
  * @return array of media works associated with the feature
  */
 function get_avs_associated_with_feature($feature_id)
 {
     $es = new entity_selector();
     $es->add_type(id_of('feature_type'));
     $es->add_left_relationship_field('feature_to_media_work', 'entity', 'id', 'av_id');
     $es->enable_multivalue_results();
     $es->add_relation('entity.id=' . $feature_id);
     $results_array = $es->run_one();
     return $results_array;
 }
	/**
	 * Returns a reference to an array with data about ordered news items
	 */
	function &build_news_items($publication_unique_name = NULL)
	{
		$pub_id = $this->get_publication_id();
		if ($pub_id)
		{
			// The idea of this entity selector is to select all news items that are related to the publication
			// along with the news item owner and id and publication id(s) other than the named publication ...
			// The result should be news items along with a site entity id and publication id(s) - we'll use that
			// data to help build the link.
			
			$es = new entity_selector(); // try without site_id for now ... allows this to be used anywhere with a unique publication name
			$es->add_type(id_of('news'));
			$es->enable_multivalue_results();
			$es->limit_tables(array('press_release', 'dated', 'status'));
			$es->limit_fields(array('press_release.release_title', 'dated.datetime', 'status.status'));
			$es->add_left_relationship($pub_id, relationship_id_of('news_to_publication'));
			$alias = $es->add_left_relationship_field('news_to_publication', 'entity', 'id', 'pub_id');
			$es->add_relation($alias['pub_id']['table'] . '.' . $alias['pub_id']['field'] . " != " . $pub_id);
			$es->add_right_relationship_field('owns', 'entity', 'id', 'site_id');
			$es->add_relation('status.status = "published"');
			$es->set_order('dated.datetime DESC');
			$result = $es->run_one();
			
			if (!empty($result))
			{
				$result_keys = array_keys($result);
				$rpts =& get_reason_page_types();
				$valid_page_types = $rpts->get_page_type_names_that_use_module($this->publication_modules);
				foreach (array_keys($valid_page_types) as $k) quote_walk($valid_page_types[$k], NULL);
				foreach ($result_keys as $key)
				{
					$success = $this->augment_entity($result[$key], $valid_page_types);
					if ($success)
					{
						$result[$key]->unset_value('pub_id');
						$result[$key]->unset_value('site_id');
					}
					else unset($result[$key]);
				}
			}
			$news_items =& $this->set_order_and_limits($result);
			
		}
		else
		{
			trigger_error('The module needs a publication unique name or a page associated with a publication to select borrowed news items');
			$news_items = array();
		}
		
		
		return $news_items;
	}
Ejemplo n.º 5
0
 function _get_active_users_from_ids($ids, $affiliations)
 {
     @array_walk($ids, 'addslashes');
     $es = new entity_selector();
     $es->add_type(id_of('user'));
     $es->enable_multivalue_results();
     $es->add_relation('`entity`.`id` IN ("' . implode('","', $ids) . '")');
     $es->add_right_relationship_field('site_to_user', 'entity', 'id', 'site_membership_id');
     // This is here so we only grab users who have access to a site
     $users = $es->run_one();
     if (!empty($affiliations)) {
         // Construct a directory service ldap filter query to only include the possible users.
         $dir = new directory_service();
         $filter = $this->_get_ldap_filter($affiliations, $users);
         $dir->search_by_filter($filter);
         $dir_results = $dir->get_records();
         $users = $this->_get_users($users, array_keys($dir_results));
     }
     return $users;
 }
Ejemplo n.º 6
0
 function get_types_to_sites($types = 0)
 {
     if (empty($this->_user_id)) {
         trigger_error('Must set user id before requesting get_types_to_sites()');
         return array();
     }
     if (empty($this->_types_to_sites)) {
         $es = new entity_selector();
         $es->add_type(id_of('site'));
         $es->add_left_relationship_field('site_to_type', 'entity', 'id', 'types');
         $es->enable_multivalue_results();
         $es->set_order('entity.name ASC');
         $sites = $es->run_one();
         $this->_types_to_sites = array();
         foreach ($sites as $site_id => $site) {
             if ($site->get_value('types')) {
                 foreach ($site->get_value('types') as $tid) {
                     $this->_types_to_sites[$tid][$site_id] = $site;
                 }
             }
         }
     }
     if (!empty($types)) {
         if (isset($this->_types_to_sites[$types])) {
             return $this->_types_to_sites[$types];
         } else {
             return array();
         }
     } else {
         return $this->_types_to_sites;
     }
 }
Ejemplo n.º 7
0
	/**
	 * take the set of items selected, and replaces it with a set that includes the multivalue publication and category ids that
	 * match the limitations of the page
	 * @author Nathan White
	 */
	function related_post_es_additional_init_actions()
	{
		if ($this->items)
		{
			$es = new entity_selector();
			$es->add_type($this->type);
			$es->enable_multivalue_results();
			$es->add_relation('entity.id IN ('.implode(",", array_keys($this->items)).')');
			$es->add_left_relationship_field('news_to_publication', 'entity', 'id', 'publication_id', array_keys($this->related_publications));
			if ($this->related_categories)
			{
				$es->add_left_relationship_field('news_to_category', 'entity', 'id', 'cat_id', array_keys($this->related_categories));
			}
			$this->related_order_and_limit($es);
			$this->items = $es->run_one();
		}
	}
 /**
  * Search for a particular value
  * @access public
  * @param string $attr Name of the attribute to search
  * @param mixed $qstring string or array of strings to search for
  * @param array $return List of attributes to return
  * @return mixed an array of data if results, false if no results
  */
 function attr_search($attr, $qlist, $return = array())
 {
     if (is_array($qlist)) {
         if (!empty($qlist)) {
             // build a search filter for matching against multiple values.
             foreach ($qlist as $val) {
                 $filter_parts[] = $this->construct_filter('equality', $attr, $this->escape_input($val));
             }
             $filter = '(' . join(' OR ', $filter_parts) . ')';
         } else {
             // no results should be returned if empty array given as second argument
             return false;
         }
     } else {
         // build a search filter for matching against a single value.
         $filter = $this->construct_filter('equality', $attr, $this->escape_input($qlist));
     }
     $this->open_conn();
     $es = new entity_selector();
     $es->add_type(id_of('user'));
     $es->add_relation($filter);
     $es->add_relation($this->get_basic_limitation());
     if ($attr == 'ds_affiliation') {
         $es->add_left_relationship_field('user_to_audience', 'audience_integration', 'directory_service_value', 'ds_affiliation');
         $es->enable_multivalue_results();
     }
     $results_entities = $es->run_one();
     $this->close_conn();
     $results = $this->reason_entities_to_array($results_entities);
     if (!empty($results)) {
         // add in any generic attributes required
         $augmented_results = $this->add_gen_attrs_to_results($results, array_keys($this->_gen_attr_depend));
         //pray($augmented_results);
         return $augmented_results;
     } else {
         return false;
     }
 }
Ejemplo n.º 9
0
	/**
	 * Get the audiences for a given event entity
	 *
	 * Returned audience entities are sweetened with the value _link, containing an html-encoded URL
	 *
	 * @param object $e event entity
	 * @return array audience entities
	 */
	function get_event_audiences($e)
	{
		$audiences = array();
		$es = new entity_selector();
		$es->description = 'Selecting audiences for event';
		$es->limit_tables();
		$es->limit_fields();
		$es->enable_multivalue_results();
		$es->add_type( id_of('event_type'));
		$es->add_relation('entity.id = ' . $e->id());
		$es->add_left_relationship_field('event_to_audience', 'entity', 'id', 'aud_ids');
		$with_audiences = $es->run_one();
		if (!empty($with_audiences))
        {
        	$audiences = array();
        	$event = reset($with_audiences);
        	$aud_ids = $event->get_value('aud_ids');
        	$aud_ids = is_array($aud_ids) ? $aud_ids : array($aud_ids);
        	foreach( $aud_ids AS $aud_id )
        	{
        		$aud = new entity($aud_id);
        		$aud->set_value('_link', $this->construct_link(array('audience'=>$aud->id(),'no_search'=>'1'), false));
        		$audiences[$aud_id] = $aud;
        	}
        }
        return $audiences;
	}
Ejemplo n.º 10
0
	/**
	 * Build the feature set
	 */
	function _build_features()
	{
		$es1 = new entity_selector( $this->site_id );
		$es1->add_type( id_of('feature_type') );
		$es1->add_right_relationship( $this->page_id, relationship_id_of('page_to_feature'));
		$es1->add_rel_sort_field( $this->page_id, relationship_id_of('page_to_feature') );
		$es1->set_order('rel_sort_order ASC');
		if($this->params['max'] != 0)
		{
			$es1->set_num($this->params['max']);
		}
		$features = $es1->run_one();
		
		if(empty($features))
		{
			return null;
		}
	
		$es2 = new entity_selector( $this->site_id );
		$es2->add_type( id_of('image') );
		$es2->add_right_relationship_field( 'feature_to_image','entity','id','feature_id', array_keys($features) );
		$es2->enable_multivalue_results();
		$images = $es2->run_one();
		if ($images)
		{
			foreach ($images as $image_id => $image)
			{
				$features_with_image = $image->get_value('feature_id');
				$features_with_image = (!is_array($features_with_image)) ? array($features_with_image) : $features_with_image; // force to array
				foreach ($features_with_image as $feature_id)
				{
					$feature_extra[$feature_id]['image_id'][] = $image_id;
				}
			}
		}

		$es3 = new entity_selector( $this->site_id );
		$es3->add_type( id_of('av') );
		$es3->add_right_relationship_field( 'feature_to_media_work','entity','id','av_id', array_keys($features) );
		$es3->enable_multivalue_results();
		$media_works = $es3->run_one();
		if ($media_works)
		{
			foreach ($media_works as $media_work_id => $media_work)
			{
				$features_with_media_work = $media_work->get_value('av_id');
				$features_with_media_work = (!is_array($features_with_media_work)) ? array($features_with_media_work) : $features_with_media_work; // force to array
				foreach ($features_with_media_work as $feature_id)
				{
					$feature_extra[$feature_id]['av_id'][] = $media_work_id;
				}
			}
		}
		
		// augment our features with images and media works
		foreach($features as $feature_id => $feature)
		{
			if (isset($feature_extra[$feature_id]['image_id']))
			{
				$value = (count($feature_extra[$feature_id]['image_id']) == 1) ? reset($feature_extra[$feature_id]['image_id']) : $feature_extra[$feature_id]['image_id'];
				$features[$feature_id]->set_value('image_id',$value);
			}
			else $features[$feature_id]->set_value('image_id',"none");
			
			if (isset($feature_extra[$feature_id]['av_id']))
			{
				$value = (count($feature_extra[$feature_id]['av_id']) == 1) ? reset($feature_extra[$feature_id]['av_id']) : $feature_extra[$feature_id]['av_id'];
				$features[$feature_id]->set_value('av_id',$value);
			}
			else $features[$feature_id]->set_value('av_id',"none");
		}
		
		//shuffle the features if set to true
		//note that keys are preserved in the new
		//shuffled feature array
		if($this->params['shuffle']==true)
		{
			$shuffled_results=array();
			$temps=array();
			$temps=$features;
			shuffle($temps);
			foreach($temps as $temp)
			{
				$id=$temp->get_value('id');
				$shuffled_results[$id]=$temp;
			}
			$features=$shuffled_results;
		}
		//pick a random media work or image from each features list of images.
		foreach($features as $id=>$r)
		{
			$num_imgs=0;
			$num_mdia=0;
			$i=0;
			if($features[$id]->has_value('image_id'))
			{
				$img_id=$features[$id]->get_value('image_id');
				if($img_id!="none")
				{
					$num_imgs=count($img_id);
				}
			}
			else
			{
				$features[$id]->set_value('image_id','none');
			}
			if($features[$id]->has_value('av_id'))
			{
				$av_id=$features[$id]->get_value('av_id');
				if($av_id !="none")
				{
					$num_mdia=count($av_id);
				}
			}
			else
			{
				$features[$id]->set_value('av_id','none');
			}

			$num_objects=$num_imgs+$num_mdia;

			$i=rand(0, $num_objects-1 );
			if($i<$num_mdia)
			{
				$features[$id]->set_value('current_object_type','av');
				$features[$id]->set_value('current_image_index',$i);
			}
			else
			{
				$features[$id]->set_value('current_object_type','img');
				$features[$id]->set_value('current_image_index',$i-$num_mdia);
			}
		}

		//set default values for items that are not set
		foreach($features as $id=>$r)
		{
			$cp=$features[$id]->get_value('crop_style');
			if($cp==null){ $features[$id]->set_value('crop_style','fill');}
			
		}
		$this->_features=$features;
		
		//if feature id is on this page then display it
		//else redirect to same page but this feature not set
		if(isset($this->request['feature']))
		{
			$feature_id=$this->request['feature'];
			$is_a_feature_on_this_page=false;
			foreach($this->_features as $feat)
			{
				if($feature_id==$feat->get_value('id'))
				{
					$is_a_feature_on_this_page=true;
					break;
				}
			}
			if($is_a_feature_on_this_page)
			{
				$this->current_feature_id=$this->request['feature'];
			}
			else
			{
				$url=carl_make_redirect(array('feature'=>''),'');
				header("Location: ".$url);
			}
		}
		$this->_build_view_data();
	}
 function get_post_list_markup()
 {
     $markup_string = '';
     $site_id = $this->passed_vars['site']->id();
     $links = $this->passed_vars['links_to_current_publications'];
     $pub_ids = array_keys($links);
     $pub_ents = array();
     /* $category_list = array(
      *     'some_pub_id' => array(
      *         'some_cat',
      *         'another_cat'
      *     ),
      *     ...
      * );
      */
     // This is about to become a monstrous, horrendous hack.
     // Probably the least efficient, most annoying code I've
     // ever written, no joke. It is gross.
     $category_list = array();
     $flat_cat_list = array();
     $duplicate_cat_list = array();
     // For each publication scraped by this list
     foreach ($pub_ids as $pub) {
         // Get the pub entities and throw them in $pub_ents for their names later
         $pub_ents[$pub] = new entity($pub);
         // Return all news posts that belong to $pub, along with their categories
         $category_list[$pub] = array();
         $es = new entity_selector();
         $es->add_type(id_of('news'));
         $es->add_left_relationship($pub, relationship_id_of('news_to_publication'));
         $es->enable_multivalue_results();
         $es->add_left_relationship_field('news_to_category', 'entity', 'id', 'category_ids');
         //			$es->add_left_relationship_field('news_to_publication', 'entity', 'id', 'publication_ids');
         // For each news post returned
         foreach ($es->run_one() as $result) {
             // If it has multiple categories attached
             if (is_array($result->get_value('category_ids'))) {
                 // For each one
                 foreach ($result->get_value('category_ids') as $cat_id) {
                     // If this category hasn't been seen in this publication yet
                     if (!in_array($cat_id, array_keys($category_list[$pub]))) {
                         // Get its entity, and put it in an array that organizes it by pub.
                         $cat_ent = new entity($cat_id);
                         if ($cat_ent->get_value('state') == 'Live') {
                             $category_list[$pub][$cat_id] = $cat_ent;
                             // If we've seen this category name before at all
                             if (in_array($cat_ent->get_value('name'), $flat_cat_list)) {
                                 // Add it to the duplicate cat list.
                                 $duplicate_cat_list[$cat_id] = $cat_ent->get_value('name');
                             } else {
                                 // Just go ahead and add it to the flat_cat_list.
                                 $flat_cat_list[$cat_id] = $cat_ent->get_value('name');
                             }
                         }
                     }
                 }
                 // If there's only one category attached to the post, and we haven't seen it before in this publication
             } elseif (!in_array($result->get_value('category_ids'), array_keys($category_list[$pub]))) {
                 // Add it to the list!
                 $cat_ent = new entity($result->get_value('category_ids'));
                 if ($cat_ent->get_value('state') == 'Live') {
                     $category_list[$pub][$result->get_value('category_ids')] = $cat_ent;
                     // If we've seen this category name before at all
                     if (in_array($cat_ent->get_value('name'), $flat_cat_list)) {
                         // Add it to the duplicate cat list.
                         $duplicate_cat_list[$cat_end->id()] = $cat_ent->get_value('name');
                     } else {
                         // Just go ahead and add it to the flat_cat_list.
                         $flat_cat_list[$cat_ent->id()] = $cat_ent->get_value('name');
                     }
                 }
             }
         }
     }
     $markup_string .= '<h4 class="categoryHeading">More articles about...</h4>';
     $markup_string .= '<ul class="all_cats_links">';
     foreach ($pub_ids as $publication_id) {
         $publication_url = $links[$publication_id];
         foreach ($category_list[$publication_id] as $category) {
             $category_url = '?filters[1][type]=category&filters[1][id]=' . $category->id();
             $markup_string .= '<li class="' . $publication_id . '_cat"><a href="' . $publication_url . $category_url . '">' . $category->get_value('name');
             if (in_array($category->get_value('name'), $duplicate_cat_list)) {
                 $markup_string .= " (" . $pub_ents[$publication_id]->get_value("name") . ")";
             }
             $markup_string .= '</a></li>';
         }
     }
     $markup_string .= '</ul>';
     return $markup_string;
 }
Ejemplo n.º 12
0
 /**
  * Grabs a list of all publications and events attached to the site, offers them to 
  * 
  * The bulk of this form step. 
  * 
  * 
  */
 function init($args = array())
 {
     parent::init($args);
     $site_id = (int) $_REQUEST['site_id'];
     // Only do this init if we're on the step that needs it.
     if ($this->controller->get_current_step() != 'SelectIncludes') {
         return;
     }
     //////////////// PUBLICATIONS /////////////////
     // Select all publications that are attached to this site.
     $pub_factory = new PubHelperFactory();
     $es = new entity_selector($site_id);
     $es->add_type(id_of('publication_type'));
     // Add the page_id to which the pub belongs (so we can get url)
     $es->add_right_relationship_field('page_to_publication', 'entity', 'id', 'page_id');
     $es->enable_multivalue_results();
     $es->set_entity_factory($pub_factory);
     $pub_helper_entities = $es->run_one();
     if ($pub_helper_entities) {
         $this->add_element('pub_posts_header1', 'comment', array('text' => '<h2 class="region">Publications</h2>'));
         foreach ($pub_helper_entities as $ph) {
             $name = $ph->get_value('name');
             $entityID = $ph->get_value('id');
             $page_id = $ph->get_value('page_id');
             if (is_array($page_id)) {
                 $strlength = 0;
                 $page_url = '';
                 foreach ($page_id as $one_id) {
                     $page_entity = new entity($one_id);
                     if ($page_entity->get_value('state') == 'Live') {
                         $owner = $page_entity->get_owner();
                         if ($owner->get_value('state') == 'Live') {
                             $url = reason_get_page_url($one_id);
                             if (strlen($url) > $strlength) {
                                 $strlength = strlen($url);
                                 $page_url = $url;
                             }
                         }
                     }
                 }
                 $box_name = '<a target="_blank" href="' . $page_url . '">' . $name . '</a>';
                 $opts[$entityID] = $box_name;
             } else {
                 $page_entity = new entity($page_id);
                 if ($page_entity->get_value('state') == 'Live') {
                     $owner = $page_entity->get_owner();
                     if ($owner->get_value('state') == 'Live') {
                         $page_url = reason_get_page_url($page_id);
                         $box_name = '<a target="_blank" href="' . $page_url . '">' . $name . '</a>';
                         $opts[$entityID] = $box_name;
                     }
                 }
             }
         }
         $this->add_element('selected_publications', 'checkboxgroup', array('options' => $opts));
         $this->set_value('selected_publications', array_keys($opts));
         $this->set_display_name('selected_publications', 'Select the publications from which you wish to draw posts');
         $this->add_element('publication_start_date', 'textDate');
         $monthAgo = date("Y-m-d", strtotime("-1 month"));
         $today = date("Y-m-d", time());
         $this->set_value('publication_start_date', $monthAgo);
         $this->set_display_name('publication_start_date', 'From this date');
         $this->add_element('publication_end_date', 'textDate');
         $this->set_value('publication_end_date', $today);
         $this->set_display_name('publication_end_date', 'To this date');
     }
     //////////////// EVENTS ///////////////////
     // !todo: Find any page on the site $site_id which uses the module 'events', and list
     // 		  that page title as a 'calendar' (there are apparently no calendar entities,
     //		  only the events module which acts as a calendar.
     //		  The extra information should be found in the page_type def for the page containing
     //		  the events module.
     /* $eh = new reasonCalendar();
     		
     		$site = new entity($site_id);
     		$cal = new reasonCalendar(array('site'=>$site));
     		$cal->run();
     		$events = $cal->get_all_events(); */
     $es = new entity_selector($site_id);
     $es->add_type(id_of('event_type'));
     $es->set_num(1);
     $es->limit_tables();
     $es->limit_fields();
     $events = $es->run_one();
     if ($events) {
         $this->add_element('events_header1', 'comment', array('text' => '<h2 class="region">Calendars</h2>'));
         $this->add_element('events_start_date', 'textDate');
         $monthAhead = date("Y-m-d", strtotime("+1 month"));
         $today = date("Y-m-d", time());
         $this->set_value('events_start_date', $today);
         $this->set_display_name('events_start_date', 'From this date');
         $this->add_element('events_end_date', 'textDate');
         $this->set_value('events_end_date', $monthAhead);
         $this->set_display_name('events_end_date', 'To this date');
     }
     if (!$events && !$pub_helper_entities) {
         $this->add_element('sucks_to_be_you', 'comment', array('text' => '<h3>There are no publications or calendars associated with this site. Press continue if you would like to use the newsletter builder anyway.'));
     }
 }