本文整理汇总了PHP中entity_selector::add_relation方法的典型用法代码示例。如果您正苦于以下问题:PHP entity_selector::add_relation方法的具体用法?PHP entity_selector::add_relation怎么用?PHP entity_selector::add_relation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity_selector
的用法示例。
在下文中一共展示了entity_selector::add_relation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function _get_events()
{
if(!isset($this->events))
{
$es = new entity_selector($this->site_id);
$es->add_type(id_of('event_type'));
if(!in_array('archived',$this->params['show']))
{
$es->add_relation('`last_occurence` >= "'.addslashes(date('Y-m-d')).'"');
}
if(!in_array('upcoming',$this->params['show']))
{
$es->add_relation('`datetime` < "'.addslashes(date('Y-m-d',time() + (60*60*24))).'"');
}
if(!in_array('current',$this->params['show']))
{
$es->add_relation('(`last_occurence` < "'.addslashes(date('Y-m-d')).'" OR `datetime` >= "'.addslashes(date('Y-m-d',time() + (60*60*24))).'")');
}
$es->add_relation('`show_hide` = "show"');
$es->set_order($this->params['order']);
$this->_modify_events_es($es);
$events = $es->run_one();
$class = $this->get_model_class($this->params['model']);
foreach($events as $id => $event)
{
$this->events[$id] = new $class($event);
}
if(empty($this->events))
$this->events = array();
}
return $this->events;
}
示例2: entered
function run_error_checks()
{
parent::run_error_checks();
$es = new entity_selector();
$es->add_relation('audience_integration.directory_service_value = "' . reason_sql_string_escape($this->get_value('directory_service_value')) . '"');
$es->add_relation('entity.id != ' . $this->get_value('id'));
$es->set_num(1);
$conflicts = $es->run_one(id_of('audience_type'));
if (!empty($conflicts)) {
$this->set_error('directory_service_value', 'The Directory Service Value you entered ("' . $this->get_value('directory_service_value') . '") is already in use. Each audience must have a unique directory service value.');
}
}
示例3:
function alter_values()
{
$parent = new entity_selector();
$parent->add_field('entity2', 'id', 'parent_id');
$parent->add_table('allowable_relationship2', 'allowable_relationship');
$parent->add_table('relationship2', 'relationship');
$parent->add_table('entity2', 'entity');
$parent->add_relation('entity2.id = relationship2.entity_b');
$parent->add_relation('entity.id = relationship2.entity_a');
$parent->add_relation('relationship2.type = allowable_relationship2.id');
$parent->add_relation('allowable_relationship2.name LIKE "%parent%"');
$parent->set_order('sortable.sort_order');
$this->es->swallow($parent);
$this->remove_column('id');
}
示例4: addslashes
function image_may_be_shown($id)
{
if ($this->params['alternate_source_page_id']) {
$page_id = $this->params['alternate_source_page_id'];
if (!($site_id = get_owner_site_id($page_id))) {
$site_id = $this->site_id;
}
} else {
$page_id = $this->cur_page->id();
$site_id = $this->site_id;
}
$es = new entity_selector();
$es->add_type(id_of('image'));
$es->set_env('site', $site_id);
$es->add_right_relationship($page_id, relationship_id_of('minisite_page_to_image'));
$es->add_relation('entity.id = ' . addslashes($id));
$result = $es->run_one();
//echo 'given id='.$id;
if (!empty($result)) {
//echo 'returning true';
return true;
} else {
//echo 'returning false';
return false;
}
}
示例5: 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;
}
示例6: 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;
}
示例7: IN
function get_pages($page_types)
{
$es = new entity_selector();
$es->add_type(id_of('minisite_page'));
$es->add_relation('custom_page IN ("' . implode('","', $page_types) . '")');
return $es->run_one();
}
示例8: name_es
function name_es($name)
{
$es = new entity_selector();
$es->add_type(id_of('content_table'));
$es->add_relation('entity.name = "' . $name . '"');
$results = $es->run_one();
return $results;
}
示例9: get_loki_1_entity
/**
* @return object loki 1 entity if it exists
*/
protected function get_loki_1_entity()
{
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('html_editor_type'));
$es->add_relation('entity.name = "Loki 1"');
$es->set_num(1);
$result = $es->run_one();
return !empty($result) ? reset($result) : FALSE;
}
示例10: date
function init_list()
{
if ($this->site_specific) {
$es = new entity_selector($this->parent->site_id);
$es->description = "Getting the jobs on this site";
} else {
$es = new entity_selector();
$es->description = "Getting all jobs -- not just on this site";
}
$es->add_type(id_of('job'));
$es->add_relation('show_hide.show_hide = "show"');
$es->add_relation('job.posting_start <= "' . date('Y-m-d') . '"');
$es->add_relation('adddate( job.posting_start, interval duration.duration day ) >= "' . date('Y-m-d') . '"');
$this->jobs = $es->run_one();
if (!empty($this->request['job_id']) && !empty($this->jobs[$this->request['job_id']])) {
$this->_add_crumb($this->jobs[$this->request['job_id']]->get_value('name'));
}
}
示例11: _link_in_db
protected function _link_in_db()
{
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('admin_link'));
$es->add_relation('`url` = "?cur_module=AdminTools"');
$es->set_num(1);
$results = $es->run_one();
return !empty($results);
}
示例12: entity
/**
* Quick and dirty helper function that gets the sites with available associations with that type.
*
* This function just checks for all sites that are currently set to share objects of the given type.
* If the current site is live, it only selects those other sites which are also live. It does
* not check the sites to see if the site is actually sharing anything.
* @return array An array of entities of the available sites in alphabetical order
*/
function get_sites_with_available_associations()
{
$cur_site = new entity($this->page->site_id);
$es = new entity_selector();
$es->add_type(id_of('site'));
if ($cur_site->get_value('site_state') == 'Live') {
$es->add_relation('site.site_state = "Live"');
}
$es->add_relation('entity.id != ' . $this->page->site_id);
$es->add_left_relationship($this->page->type_id, relationship_id_of('site_shares_type'));
$es->set_order('name ASC');
$results = $es->run_one();
$return_array = array();
foreach ($results as $e) {
$return_array[$e->id()] = $e->get_value('name');
}
return $return_array;
}
示例13:
/**
* @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;
}
示例14: init
function init($args = array())
{
parent::init($args);
$s = new entity_selector();
$s->add_type(id_of('site'));
$s->set_order('entity.name');
$s->add_relation('site.site_state = "Live"');
$this->site_count = $s->get_one_count();
$this->sites = $s->run_one();
//pray($this->sites);
}
示例15: array
function get_available_image_galleries($site_id)
{
$page_types = $this->get_image_related_page_types();
$pages = array();
if (!empty($page_types)) {
$es = new entity_selector($site_id);
$es->add_type(id_of('minisite_page'));
$es->add_relation('page_node.custom_page IN (\'' . implode('\', \'', $page_types) . '\')');
$pages = $es->run_one();
}
return $pages;
}