当前位置: 首页>>代码示例>>PHP>>正文


PHP entity_selector::add_left_relationship_field方法代码示例

本文整理汇总了PHP中entity_selector::add_left_relationship_field方法的典型用法代码示例。如果您正苦于以下问题:PHP entity_selector::add_left_relationship_field方法的具体用法?PHP entity_selector::add_left_relationship_field怎么用?PHP entity_selector::add_left_relationship_field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entity_selector的用法示例。


在下文中一共展示了entity_selector::add_left_relationship_field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

 /**
  * 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:65,代码来源:feature.php

示例2: foreach

 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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:blurb_page_type_change.php

示例3:

 /**
  * @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;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:13,代码来源:feature_helper.php

示例4: unset

	/**
	 * 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;
	}
开发者ID:natepixel,项目名称:reason_package,代码行数:55,代码来源:other_publication_news.php

示例5: array

 function show_site($site)
 {
     $link = $site->get_value('base_url');
     echo '<li>' . "\n";
     echo '<h4><a href="' . $link . '">' . $site->get_value('name') . '</a></h4>' . "\n";
     $es = new entity_selector($site->id());
     $es->description = 'Getting pages for child site';
     $es->add_type(id_of('minisite_page'));
     $es->add_left_relationship_field('minisite_page_parent', 'entity', 'id', 'parent_id');
     $es->add_relation('page_node.nav_display = "Yes"');
     $es->set_order('sortable.sort_order');
     $pages = $es->run_one();
     $parents = array();
     foreach ($pages as $page) {
         if ($page->id() == $page->get_value('parent_id')) {
             $root_page_id = $page->id();
         } else {
             $parents[$page->get_value('parent_id')][$page->id()] = $page;
         }
     }
     $this->display_pages($link, $parents, $root_page_id);
     echo '</li>' . "\n";
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:23,代码来源:child_sites_top_pages.php

示例6: add_editor_user_role

function add_editor_user_role($test_mode = true)
{
    echo '<h3>Adding editor user role</h3>';
    $editor_user_role_id = id_of('editor_user_role');
    echo '<ul>';
    if (!empty($editor_user_role_id)) {
        echo '<li>Editor user role already exists; no need to create it</li>';
    } else {
        if ($test_mode) {
            echo '<li>Would have created editor user role</li>';
        } else {
            $editor_user_role_id = reason_create_entity(id_of('master_admin'), id_of('user_role'), $GLOBALS['__cur_user_id_hack__'], 'Editor', array('new' => '0', 'unique_name' => 'editor_user_role'));
            if ($editor_user_role_id) {
                echo '<li>Created editor user role (ID: ' . $editor_user_role_id . ')</li>';
            } else {
                echo '<li>Unable to create editor user role! Aborting this step.</li></ul>';
                return false;
            }
        }
    }
    // get users with their user roles
    $es = new entity_selector();
    $es->add_type(id_of('user'));
    $es->add_left_relationship_field('user_to_user_role', 'entity', 'id', 'user_role_id', false);
    $users = $es->run_one();
    if ($test_mode) {
        echo '<li>Would have added editor user role to these users currently without a role:';
    } else {
        echo '<li>Adding editor user role to users currently without a role:';
    }
    echo '<ol>';
    $count = 0;
    foreach ($users as $user) {
        if (!$user->get_value('user_role_id')) {
            $count++;
            if ($test_mode) {
                echo '<li>' . $user->get_value('name') . '</li>';
            } else {
                if (create_relationship($user->id(), $editor_user_role_id, relationship_id_of('user_to_user_role'))) {
                    echo '<li>' . $user->get_value('name') . '</li>';
                } else {
                    echo '<li><strong>Eeep!</strong> Problem assigning editor user role to ' . $user->get_value('name') . '</li>';
                }
            }
        }
    }
    echo '</ol>';
    if (!$count) {
        echo '<strong>No users needed to be updated; all users have roles.</strong>';
    }
    echo '</li>';
    echo '</ul>';
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:53,代码来源:misc_updates.php

示例7: IN

 function init_from_categories(&$already_selected)
 {
     if ($this->page_category_mode) {
         $cat_es = new entity_selector($this->site_id);
         $cat_es->add_type(id_of('category_type'));
         $cat_es->limit_tables();
         $cat_es->limit_fields();
         $cat_es->add_right_relationship($this->page_id, relationship_id_of('page_to_category'));
         $cat_result = $cat_es->run_one();
         if (!empty($cat_result)) {
             $es = new entity_selector($this->site_id);
             $es->add_type(id_of('quote_type'));
             $es->set_env('site', $this->site_id);
             $es->add_left_relationship_field('quote_to_category', 'entity', 'id', 'cat_id', array_keys($cat_result));
             if (!empty($already_selected)) {
                 $es->add_relation('entity.id NOT IN (' . implode(array_keys($already_selected)) . ')');
             }
             $result = $es->run_one();
         }
     }
     return !empty($result) ? $result : array();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:22,代码来源:quote_helper.php

示例8: foreach

<?php 
} else {
    $report = '';
    // first find all sites
    $es = new entity_selector();
    $es->add_type(id_of('site'));
    $es->limit_tables();
    $es->limit_fields();
    $result = $es->run_one();
    $site_ids = array_keys($result);
    foreach ($site_ids as $site_id) {
        $es = new entity_selector($site_id);
        $es->add_type(id_of('minisite_page'));
        $es->limit_tables();
        $es->limit_fields();
        $meta = $es->add_left_relationship_field('minisite_page_parent', 'entity', 'id', 'parent_id');
        $str = $meta['parent_id']['table'] . "." . $meta['parent_id']['field'];
        $es->add_relation('entity.id = ' . $str);
        $result = $es->run_one();
        $count = count($result);
        if ($count > 1) {
            $site = new entity($site_id);
            $report .= '<h3>The site "' . $site->get_value('name') . '" has ' . $count . ' root pages.</h3>';
            $report .= '<ul>';
            foreach ($result as $page) {
                $last_mod = $page->get_value('last_modified');
                $page_name = $page->get_value('name');
                $page_name = !empty($page_name) ? $page_name : '<em>Untitled</em>';
                $report .= '<li>' . $page_name . ' (id is ' . $page->id() . ', last modified ' . prettify_mysql_datetime($last_mod) . ')</li>';
            }
            $report .= '</ul>';
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:find_extra_root_pages.php

示例9: array

 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;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:32,代码来源:orphan_manager.php

示例10: array

		/**
		 * Grab featured items from related publications and populate $featured_items[$pub_id]
		 *
		 * - We optimize and sort differently depending on how many related publications we are picking from.
		 * - If just one, we use relationship_sort_order, otherwise we do datetime DESC.
		 */
		function get_related_featured_items()
		{
			$featured_items = array();
			$related_pub_ids = implode(",", array_keys($this->related_publications));
			if ($this->show_featured_items && !empty($related_pub_ids))
			{
				if (count($this->related_publications) > 1) // we use dated.datetime DESC for sort order
				{
					$es = new entity_selector( $this->site_id );
					$es->description = 'Selecting featured news items from related publications';
					$es->add_type( id_of('news') );
					$es->set_env('site', $this->site_id);
					$alias['rel_pub_id'] = current($es->add_right_relationship_field( 'publication_to_featured_post', 'entity', 'id', 'related_publication_id' ));
					$alias['pub_id'] = current($es->add_left_relationship_field( 'news_to_publication', 'entity', 'id', 'publication_id' ));
					$es->add_relation($alias['rel_pub_id']['table'] . '.id IN ('.$related_pub_ids.')');
					$es->add_relation($alias['rel_pub_id']['table'] . '.id = '.$alias['pub_id']['table'] . '.id');
					$es->add_relation('status.status = "published"');
					$es->set_order('dated.datetime DESC');
					$fi = $es->run_one();
					if (!empty($fi))
					{
						foreach($fi as $k=>$v)
						{
							$featured_items[$k] = $v;
						}
					}
				}
				else // lets use relationship sort order since we have only 1 related publication.
				{
					$related_pub_id = $related_pub_ids;
					$es = new entity_selector( $this->site_id );
					$es->description = 'Selecting featured news items from a single related publication';
					$es->add_type( id_of('news') );
					$es->set_env('site', $this->site_id);
					$es->add_right_relationship( $related_pub_id, relationship_id_of('publication_to_featured_post') );
					$es->add_left_relationship( $related_pub_id, relationship_id_of('news_to_publication') );
					$es->add_rel_sort_field($related_pub_id, relationship_id_of('publication_to_featured_post'), 'featured_sort_order');
					$es->set_order('featured_sort_order ASC');
					
					$fi = $es->run_one();
					if (!empty($fi))
					{
						foreach($fi as $k=>$v)
						{
							$featured_items[$k] = $v;
							$featured_items[$k]->set_value('publication_id', $related_pub_id);
							$featured_items[$k]->set_value('related_publication_id', $related_pub_id);
						}
					}
				}
			}
			return $featured_items;
		}
开发者ID:natepixel,项目名称:reason_package,代码行数:59,代码来源:module.php

示例11: switch

 /**
  * Create a valid search filter, taking into account generic attribute requirements 
  * @access public
  * @param string $type Type of comparison (equality, inequality, like)
  * @param string $attr Name of attribute
  * @param string $value Value to compare against
  * @return string
  */
 function construct_filter($type, $attr, $value)
 {
     $negative = false;
     switch ($type) {
         case 'equality':
         case '=':
             $type = 'equality';
             $not_flag = '';
             $compare = '=';
             break;
         case 'inequality':
         case '!=':
             $type = 'inequality';
             $not_flag = '';
             $compare = '!=';
             $negative = true;
             break;
         case 'like':
         case 'LIKE':
         case '~=':
             $type = 'like';
             $not_flag = '';
             $compare = 'LIKE';
             $value = '%' . $value . '%';
             break;
         default:
             $not_flag = '';
             $compare = $type;
             break;
             break;
     }
     // If the filter contains wildcards, force a LIKE with appropriate syntax.
     if (strpos($value, '*') !== false) {
         $value = str_replace('*', '%', $value);
         if ($type == 'inequality') {
             $compare = 'NOT LIKE';
         } else {
             $compare = 'LIKE';
             $negative = true;
         }
         $type = 'like';
     }
     // Provide special actions for generic attributes.  This
     // will need to be modified for your own particular situation.
     // If you just need to replace one attribute with another, redefine
     // $attr; otherwise, define $filter to be the full filter to return.
     if (isset($this->_gen_attr_depend[$attr])) {
         switch ($attr) {
             case 'ds_fullname':
                 $filter = sprintf('%s (CONCAT(user_given_name," ",user_surname) %s "%s")', $not_flag, $compare, $this->escape_input($value));
                 break;
             case 'ds_affiliation':
                 $es = new entity_selector();
                 //echo current($this->_gen_attr_depend[$attr]).' '.$compare.' '.$value;
                 $es->add_relation(current($this->_gen_attr_depend[$attr]) . ' ' . $compare . ' "' . $this->escape_input($value) . '"');
                 $this->open_conn();
                 $es->add_left_relationship_field('user_to_audience', 'audience_integration', 'directory_service_value', 'ds_affiliation');
                 $users = $es->run_one(id_of('user'));
                 $this->close_conn();
                 if (!empty($users)) {
                     $filter = 'entity.id ' . $not_flag . ' IN (' . implode(',', array_keys($users)) . ')';
                 } else {
                     $filter = '1 = 2';
                 }
                 break;
             default:
                 if (count($this->_gen_attr_depend[$attr]) == 1) {
                     $attr = reset($this->_gen_attr_depend[$attr]);
                 }
         }
     }
     if (!isset($filter)) {
         $ok = $this->get_ok_fieldnames();
         // since SQL behaves differently from LDAP when unknown attributes/columns are asked for,
         // we need to replace unknown selectors with an elegant failure equivalent, e.g. 1=2.
         if (!in_array($attr, $ok)) {
             //trigger_error($attr.' is not a recognized attribute');
             return '( 1 = 2 )';
         }
         $filter = empty($not_flag) ? sprintf('%s %s "%s"', $attr, $compare, $this->escape_input($value)) : sprintf('%s (%s %s "%s")', $not_flag, $attr, $compare, $this->escape_input($value));
     }
     return $filter;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:91,代码来源:reason_directory_service.php

示例12: ReasonObjectCache

 /**
  * We'll get our site URLs using the url_builder to save some time.
  *
  * We also will cache the urls for url_cache_lifespan so that only the first load has the overhead of URL building.
  */
 function get_site_urls()
 {
     $roc = new ReasonObjectCache($this->admin_page->site_id . '_google_analytics_site_url_info', $this->url_cache_lifespan);
     $urls = $roc->fetch();
     if (!$urls) {
         $es = new entity_selector($this->admin_page->site_id);
         $es->limit_fields(array('url', 'url_fragment'));
         $es->add_type(id_of('minisite_page'));
         $es->add_left_relationship_field('minisite_page_parent', 'entity', 'id', 'parent_id');
         $es->add_relation('(entity.name != "") AND ((url.url = "") OR (url.url IS NULL))');
         // only pages, not custom urls
         $this->pages = $es->run_one();
         $url_builder = new reasonPageURL();
         $url_builder->provide_page_entities($pages);
         foreach ($this->pages as $id => $page) {
             $url_builder->set_id($id);
             $url = $url_builder->get_relative_url();
             $urls[$id] = $url;
         }
         $roc->set($urls);
     }
     return $urls;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:analytics.php

示例13: fputs

 function _update_blog_feeds()
 {
     $this->debug('updating blog feeds');
     fputs($this->_fp, "\n# blog feed rewrites\n\n") or trigger_error('Unable to write to htaccess', HIGH);
     // get all assets for this site
     $ms =& reason_get_module_sets();
     $modules = $ms->get('publication_item_display');
     $page_types = array();
     foreach ($modules as $module) {
         $pts = page_types_that_use_module($module);
         if (!empty($pts)) {
             $page_types = array_merge($page_types, $pts);
         }
     }
     array_unique($page_types);
     array_walk($page_types, 'db_prep_walk');
     if (empty($page_types)) {
         return;
     }
     // there are no publication page types in this instance of Reason
     $es = new entity_selector($this->site_id);
     $es->add_type(id_of('minisite_page'));
     $es->add_left_relationship_field('page_to_publication', 'entity', 'id', 'publication_id');
     $es->add_relation('`entity`.`state` = "Live"');
     $es->add_relation('`custom_page` IN (' . implode(',', $page_types) . ')');
     $es->set_sharing('owns');
     $blog_pages = $es->run_one();
     $blog_type_entity = new entity(id_of('publication_type'));
     $news_type_entity = new entity(id_of('news'));
     foreach ($blog_pages as $blog_page) {
         $blog = new entity($blog_page->get_value('publication_id'));
         fputs($this->_fp, 'RewriteRule ^' . MINISITE_FEED_DIRECTORY_NAME . '/' . $blog_type_entity->get_value('feed_url_string') . '/' . $blog->get_value('blog_feed_string') . '$ ' . FEED_GENERATOR_STUB_PATH . '?type_id=' . $news_type_entity->id() . '&site_id=' . $this->site->id() . '&blog_id=' . $blog->id() . '&feed=blog_posts' . "\n") or trigger_error('Unable to write to htaccess file', HIGH);
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:34,代码来源:url_manager.php

示例14: array

 /**
  * Return published items - published items are defined as:
  *
  * 1. the news item is marked as published
  * 2. if the publication is issued, the news item must be related to at least one published issue
  * @param limit_num int set a max number of items to return from the publicaiton
  * @param force_refresh force a new query
  *
  * @return array news/post entities that are published
  */
 function &get_published_items($limit_num = false, $force_refresh = false)
 {
     if ($limit_num != $this->limit) {
         $this->limit_changed = true;
     }
     if (!isset($this->published_items) || $this->date_changed || $this->limit_changed || $force_refresh) {
         $issued = $this->get_value('has_issues') == 'yes';
         $issues = $issued ? $this->get_published_issues() : false;
         if ($issued && !$issues) {
             $this->published_items = array();
         } else {
             $es = new entity_selector();
             $es->description = 'Selecting published news items for this publication';
             $es->add_type(id_of('news'));
             $es->limit_tables(array('dated', 'show_hide', 'status'));
             $es->limit_fields(array('dated.datetime', 'status.status', 'show_hide.show_hide'));
             $es->add_left_relationship($this->id(), relationship_id_of('news_to_publication'));
             $es->set_order('dated.datetime DESC');
             if ($this->get_start_date()) {
                 $es->add_relation('dated.datetime >= "' . $this->get_start_date() . '"');
             }
             if ($this->get_end_date()) {
                 $es->add_relation('dated.datetime <= "' . $this->get_end_date() . '"');
             }
             if ($limit_num) {
                 $es->set_num($limit_num);
             }
             $es->add_relation("status.status != 'pending'");
             if ($issues) {
                 $es->add_left_relationship_field('news_to_issue', 'entity', 'id', 'issue_id', array_keys($issues));
             }
             $this->published_items = $es->run_one();
         }
         $this->date_changed = false;
         $this->limit_changed = false;
         $this->limit = $limit_num;
     }
     return $this->published_items;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:49,代码来源:publication_helper.php

示例15: array

	/**
	 * 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;
	}
开发者ID:natepixel,项目名称:reason_package,代码行数:35,代码来源:events.php


注:本文中的entity_selector::add_left_relationship_field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。