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


PHP entity_selector::limit_fields方法代码示例

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


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

示例1: 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

示例2: addslashes

 function _produce_borrowing_nav()
 {
     $ret = '';
     $nes = new entity_selector();
     $nes->add_type(id_of('type'));
     $nes->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_cannot_edit_type'));
     $nes->add_relation('`entity`.`id` = "' . addslashes($this->admin_page->type_id) . '"');
     $nes->set_num(1);
     $nes->limit_tables();
     $nes->limit_fields();
     $ns = $nes->run_one();
     $show_edit = reason_user_has_privs($this->admin_page->user_id, 'edit') && !$this->admin_page->is_second_level() && empty($ns) ? true : false;
     /* $type = new entity($this->admin_page->type_id);
     			$name = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
     			if(function_exists('mb_strtolower'))
     				$name = mb_strtolower($name);
     			else
     				$name = strtolower($name); */
     $ret .= '<div class="borrowNav">' . "\n";
     $ret .= '<ul>';
     if ($show_edit) {
         $ret .= '<li><a href="' . $this->admin_page->get_owned_list_link($this->admin_page->type_id) . '"><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/bullet_edit.png" alt="" /> Add &amp; edit</a></li>';
     }
     $ret .= '<li class="current"><strong><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/car.png" alt="" /> Borrow</strong></li>';
     $ret .= '</ul>' . "\n";
     $ret .= '</div>' . "\n";
     // if(reason_user_has_privs($this->admin_page->user_id,'edit'))
     return $ret;
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:29,代码来源:sharing.php

示例3: build

 /**
  * Make sure that the model is configured with a valid URL.
  *
  * @return string json
  */
 function build()
 {
     if ($site_id = $this->config('site_id')) {
         $s = get_microtime();
         $es = new entity_selector();
         $es->add_type(id_of('social_account_type'));
         $es->add_right_relationship($site_id, relationship_id_of('site_to_social_account'));
         $es->add_rel_sort_field($site_id, relationship_id_of('site_to_social_account'));
         $es->set_order('rel_sort_order ASC');
         $es->limit_tables();
         $es->limit_fields();
         if ($results = $es->run_one()) {
             $result_keys = array_keys($results);
             $sih = reason_get_social_integration_helper();
             foreach ($result_keys as $id) {
                 // get the integrator if it supports the SocialAccountProfileLinks interface
                 if ($integrator = $sih->get_social_account_integrator($id, 'SocialAccountProfileLinks')) {
                     $profile_links[$id]['icon'] = $integrator->get_profile_link_icon($id);
                     $profile_links[$id]['text'] = $integrator->get_profile_link_text($id);
                     $profile_links[$id]['href'] = $integrator->get_profile_link_href($id);
                 }
             }
             if (!empty($profile_links)) {
                 return $profile_links;
             }
         }
         return false;
     } else {
         trigger_error('The ReasonSocialProfileLinksModel must be provided with the configuration parameter site_id.', FATAL);
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:36,代码来源:profile_links.php

示例4:

 function get_last_modified_item_selector()
 {
     $es = new entity_selector($this->site_id());
     $es->add_type($this->type());
     $es->limit_tables();
     $es->limit_fields('last_modified');
     $es->set_num(1);
     $es->set_order('last_modified DESC');
     return $es;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:10,代码来源:reason_json.php

示例5: init

 /**
  * Initialize the module
  * grabs all the blurbs associated with the current site
  * @param $args array
  */
 function init($args = array())
 {
     parent::init($args);
     $master_admin_id = id_of('master_admin');
     $es = new entity_selector($master_admin_id);
     $es->limit_tables();
     $es->limit_fields();
     $es->add_type(id_of('text_blurb'));
     $es->add_right_relationship($this->site_id, relationship_id_of('site_to_announcement_blurb'));
     $es->set_env('site', $master_admin_id);
     $this->blurbs = $es->run_one();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:17,代码来源:announcements.php

示例6: foreach

 function get_orphans($max = NULL, $refresh_cache = false)
 {
     if ($refresh_cache || !$this->_orphans_grabbed) {
         $e = new entity_selector();
         $e->limit_tables();
         $e->limit_fields();
         if (empty($this->_types)) {
             $types = $e->run_one(id_of('type'));
         } else {
             $types = $this->_types;
         }
         $sites = $e->run_one(id_of('site'), 'All');
         foreach ($types as $type_id => $type) {
             $e = new entity_selector();
             $e->add_type($type_id);
             $e->limit_tables();
             $e->limit_fields();
             $alias = $e->add_right_relationship_field('owns', 'entity', 'id', 'site_id');
             $field = $alias['site_id']['table'] . '.' . $alias['site_id']['field'];
             $e->add_relation($field . ' IN ("' . implode('","', array_keys($sites)) . '")');
             $non_orphans = $e->run_one('', 'All');
             $e = new entity_selector();
             $e->add_type($type_id);
             $e->limit_tables(array('entity'));
             $e->limit_fields();
             if (!empty($non_orphans)) {
                 $e->add_relation('entity.id NOT IN ("' . implode('","', array_keys($non_orphans)) . '")');
             }
             $orphans = $e->run_one('', 'All');
             if (!empty($orphans)) {
                 $this->_orphans[$type_id] = $orphans;
                 if (!empty($max)) {
                     $total = count($this->_orphans[$type_id]);
                     $max = $max - $total;
                     if ($max < 1) {
                         $length = count($this->_orphans[$type_id]) + $max;
                         $this->_orphans[$type_id] = array_slice($this->_orphans[$type_id], 0, $length, true);
                         $this->maxed_type = array('type' => $type_id, 'total' => $total);
                         break;
                     }
                 }
             }
         }
     }
     return $this->_orphans;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:46,代码来源:orphan_manager.php

示例7: init

 function init($args = array())
 {
     $es = new entity_selector($this->site_id);
     $es->description = 'Selecting publications for this page';
     $es->add_type(id_of('publication_type'));
     $es->add_right_relationship($this->page_id, relationship_id_of('page_to_publication'));
     $es->set_num(1);
     $publications = $es->run_one();
     if (!empty($publications)) {
         $this->publication = current($publications);
         if ($this->publication->get_value('has_sections') == 'yes') {
             $es = new entity_selector($this->site_id);
             $es->description = 'Selecting news sections for this publication';
             $es->add_type(id_of('news_section_type'));
             $es->add_left_relationship($this->publication->id(), relationship_id_of('news_section_to_publication'));
             $es->set_order('sortable.sort_order ASC');
             $this->sections = $es->run_one();
         }
     }
     if (!empty($this->sections) && !empty($this->publication) && $this->publication->get_value('has_issues')) {
         if (!empty($this->request['issue_id'])) {
             $iss = new entity($this->request['issue_id']);
             if ($iss->get_values() && $iss->get_value('type') == id_of('issue_type')) {
                 $this->issue = $iss;
             }
         } else {
             $es = new entity_selector($this->site_id);
             $es->description = 'Selecting issues for this publication';
             $es->add_type(id_of('issue_type'));
             $es->limit_tables(array('dated', 'show_hide'));
             $es->limit_fields('dated.datetime');
             $es->set_order('dated.datetime DESC');
             $es->add_relation('show_hide.show_hide = "show"');
             $es->add_left_relationship($this->publication->id(), relationship_id_of('issue_to_publication'));
             $es->set_num(1);
             $issues = $es->run_one();
             if (!empty($issues)) {
                 $this->issue = current($issues);
             }
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:42,代码来源:sections.php

示例8: publicationHelper

 /**
  * If the current site has the publication type, find the feed url for the oldest publication and redirect
  */
 function publication_check($site)
 {
     $es = new entity_selector($site->id());
     $es->add_type(id_of('publication_type'));
     $es->add_right_relationship_field('news_to_publication', 'entity', 'id', 'news_id');
     $es->limit_tables('entity');
     $es->limit_fields('entity.creation_date');
     $es->set_num(1);
     $es->set_order('entity.creation_date ASC');
     $result = $es->run_one();
     if ($result) {
         $id_array = array_keys($result);
         $ph = new publicationHelper(reset($id_array));
         // should I bother with the helper or just do it here?
         $feed_url = $ph->get_feed_url($site->id());
         if ($feed_url) {
             header("Location: " . $feed_url, true, 301);
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:23,代码来源:news.php

示例9: array

 /**
  * Get the groups that apply to a given page
  * @param integer $page_id
  * @return array of group objects
  */
 function get_groups($page_id)
 {
     if (!isset($this->_pages_to_groups[$page_id])) {
         $alrel_id = relationship_id_of('page_to_access_group');
         if (!$alrel_id) {
             trigger_error('page_to_access_group needs to be added. Please upgrade your database at ' . REASON_HTTP_BASE_PATH . 'scripts/upgrade/4.0b6_to_4.0b7/');
             return array();
         }
         $chain = $this->_page_tree->get_id_chain($page_id);
         if (empty($chain)) {
             trigger_error('Page ' . $page_id . 'does not appear to be in site.');
             $this->_pages_to_groups[$page_id] = array();
         } else {
             $es = new entity_selector();
             $es->add_type(id_of('group_type'));
             $es->limit_tables();
             $es->limit_fields();
             $es->add_right_relationship($chain, $alrel_id);
             $es->set_num(count($chain));
             $this->_pages_to_groups[$page_id] = $es->run_one();
         }
     }
     return $this->_pages_to_groups[$page_id];
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:page_access.php

示例10: build_entities

function build_entities($e, $t, $last_edited_by, &$entities)
{
    global $a_ids;
    $cb_new = '';
    if ($rel_id = isset($a_ids[$t]) ? $a_ids[$t] : false) {
        $es = new entity_selector();
        $es->add_type($t);
        $es->add_right_relationship($e, $rel_id);
        $es->limit_fields(array('entity.last_edited_by'));
        $es->limit_tables(array('entity'));
        $es->set_order('last_modified ASC, entity.id ASC');
        $archived = $es->run_one(false, 'Archived');
        foreach ($archived as $k => $v) {
            if (empty($cb_new)) {
                $result = true;
                $cb_new = $v->get_value('last_edited_by');
                $entities[$e] = $cb_new;
            }
            $entities[$k] = $cb_new;
        }
    }
    return isset($result);
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:23,代码来源:create_created_by.php

示例11: 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

示例12: get_assets_needing_fixing

 /**
  * Find all files with one of these extensions .pptx, .docx, or xlsx where mime type is not application/vnd.openxmlformats
  *
  * @todo implement me
  */
 protected function get_assets_needing_fixing()
 {
     $es = new entity_selector();
     $es->limit_tables(array('entity', 'asset'));
     $es->limit_fields(array('mime_type', 'file_type', 'last_edited_by', 'last_modified'));
     $es->add_type(id_of('asset'));
     $es->add_relation('`file_type` IN ("' . implode('","', $this->seek_file_extensions) . '")');
     $es->add_relation('`mime_type` IN ("' . implode('","', $this->seek_mime_types) . '")');
     $result = $es->run_one();
     return !empty($result) ? $result : FALSE;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:16,代码来源:office_2007_fix.php

示例13: foreach

</form>
<?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>';
            }
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:find_extra_root_pages.php

示例14: implode

	function _validate_thor_tables($all_tables)
	{
		// create string of ids
		$form_ids = array_keys($all_tables);
		$form_id_string = implode(",",$form_ids);
		
		// select all form entities with ids in $all_tables - ones that are not selected do not correspond to a reason entity
		$es = new entity_selector();
		$es->add_type(id_of('form'));
		$es->limit_tables();
		$es->limit_fields();
		$es->add_relation('entity.id IN ('.$form_id_string.')');
		$result = $es->run_one();
		$form_ids_in_reason = array_keys($result);
		$invalid_ids = (array_diff($form_ids, $form_ids_in_reason));
		foreach ($invalid_ids as $id)
		{
			unset($all_tables[$id]);
		}
		return $all_tables;
	}
开发者ID:natepixel,项目名称:reason_package,代码行数:21,代码来源:thor_db_structure_fix.php

示例15: array

 function update_es()
 {
     // lets find the sites that share the type (except the current site) and limit our query to those sites
     $prep_es = new entity_selector();
     $prep_es->add_type(id_of('site'));
     $prep_es->add_left_relationship($this->admin_page->type_id, relationship_id_of('site_shares_type'));
     if ($this->site_is_live()) {
         $prep_es->limit_tables('site');
         $prep_es->limit_fields('site.site_state');
         $prep_es->add_relation('site.site_state = "Live"');
         $prep_es->add_relation('entity.id != "' . $this->admin_page->site_id . '"');
     } else {
         $prep_es->limit_tables();
         $prep_es->limit_fields();
     }
     $this->sites_that_borrow_type = $prep_es->run_one();
     $es = new entity_selector();
     $es->add_type($this->admin_page->type_id);
     $limiter = !empty($this->admin_page->request['search_site']) ? $this->admin_page->request['search_site'] : array_keys($this->sites_that_borrow_type);
     if (empty($limiter)) {
         $limiter = array("-1");
     }
     // no sites share type lets limit to site_id = -1, which will be no sites - this avoids a crash.
     $es->add_right_relationship_field('owns', 'entity', 'id', 'site_id', $limiter);
     $es->add_right_relationship_field('owns', 'entity', 'name', 'site');
     $this->apply_order_and_limits($es);
     $es->add_relation('(entity.no_share IS NULL OR entity.no_share = 0)');
     // entity is shared
     $this->es = $es;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:sharing.php


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