本文整理汇总了PHP中entity_selector::limit_tables方法的典型用法代码示例。如果您正苦于以下问题:PHP entity_selector::limit_tables方法的具体用法?PHP entity_selector::limit_tables怎么用?PHP entity_selector::limit_tables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity_selector
的用法示例。
在下文中一共展示了entity_selector::limit_tables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 & 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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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];
}
示例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);
}
示例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();
}
示例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;
}
示例13: foreach
<input type="submit" name="do_it" value="Run the script" />
</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>';
示例14:
function further_checks_on_entity( $entity )
{
if($this->params['limit_to_current_page'])
{
$es = new entity_selector();
$es->add_type(id_of('av'));
$es->add_relation('`entity`.`id` = "'.addslashes($entity->id()).'"');
$es->add_right_relationship( $this->page_id, relationship_id_of('minisite_page_to_av') );
$es->set_num(1);
$es->limit_tables();
$es->limit_fields();
$results = $es->run_one();
return (!empty($results));
}
return true;
}
示例15: implode
function get_allowable_relationships_with_missing_types()
{
$es = new entity_selector();
$es->limit_tables();
$es->limit_fields(array('id', 'name'));
$es->add_type(id_of('type'));
$valid_types = $es->run_one('', 'All'); // look at all entities of all state
$valid_type_ids = implode(',', array_keys($valid_types));
$q = 'SELECT id from allowable_relationship WHERE ((relationship_a NOT IN ('.$valid_type_ids.')) OR
(relationship_b NOT IN ('.$valid_type_ids.')))';
$results = db_query($q);
while ($result = mysql_fetch_assoc($results))
{
$ids[] = $result['id'];
}
return (isset($ids)) ? $ids : array();
}