本文整理汇总了PHP中entity_selector::get_one_count方法的典型用法代码示例。如果您正苦于以下问题:PHP entity_selector::get_one_count方法的具体用法?PHP entity_selector::get_one_count怎么用?PHP entity_selector::get_one_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity_selector
的用法示例。
在下文中一共展示了entity_selector::get_one_count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
function get_links()
{
$links = parent::get_links();
$es = new entity_selector($this->admin_page->site_id);
$es->add_type(id_of('event_type'));
$es->set_order('dated.datetime DESC');
$values = $es->run_one();
//should adjust so that can't rearrange slots for events that have only one or no registration slots.
//also, probably not for past events either.
if ($values) {
foreach ($values as $event_id => $event) {
$es2 = new entity_selector($this->admin_page->site_id);
$es2->add_type(id_of('registration_slot_type'));
$es2->add_right_relationship($event_id, relationship_id_of('event_type_to_registration_slot_type'));
$numSlots = $es2->get_one_count();
if ($numSlots > 1) {
$date = $event->get_value('datetime');
$name = 'Sort slots for ' . $event->get_value('name') . ' - ' . prettify_mysql_datetime($date);
$link = $this->admin_page->make_link(array('event_id' => $event->id(), 'default_sort' => false), true);
$links[$name] = $link;
}
}
$this->links = $links;
return $this->links;
}
}
示例2: 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);
}
示例3: init
/**
* Standard Module init function
*
* Sets up the entity selectors and grabs the site lists
*
* @return void
*/
function init()
{
parent::init();
$this->site = new entity($this->admin_page->site_id);
$this->admin_page->title = 'Site Listing';
$lm = new entity_selector();
$lm->add_type(id_of('site'));
$lm->set_order('entity.name');
$lm->add_relation('site.site_state = "Live"');
$this->ls_count = $lm->get_one_count();
$this->live_sites_list = $lm->run_one();
if (reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
$nm = new entity_selector();
$nm->add_type(id_of('site'));
$nm->set_order('entity.name');
$nm->add_relation('site.site_state != "Live"');
$this->nls_count = $nm->get_one_count();
$this->not_live_site_list = $nm->run_one();
}
}
示例4:
/**
* Returns the number of comments associated with a news item.
* @param entity news item
* @return int number of comments associated with news item
*/
function count_comments($item)
{
$es = new entity_selector( $this->site_id );
$es->description = 'Counting comments for this news item';
$es->add_type( id_of('comment_type') );
$es->add_relation('show_hide.show_hide = "show"');
$es->add_right_relationship( $item->id(), relationship_id_of('news_to_comment') );
return $es->get_one_count();
}
示例5:
function show_live()
{
$es = new entity_selector($this->admin_page->site_id);
$es->add_type($this->admin_page->type_id);
// I was moving over the new_entity stuff and saw this hadn't been updated. I thought we were really looking to get this up, and I remember that it worked correctly on webdev, so I just moved these two lines over as well. If something is going wrong, it might be because of this. --Footie
$es->set_sharing('owns');
$es->limit_tables();
$es->limit_fields();
//die( 'turned sharing to "owns"' );
$c = $es->get_one_count('Live');
$this->live_item_count = $c;
if (empty($this->admin_page->request['state']) || $this->admin_page->request['state'] == 'live') {
echo '<strong>Current Items <span class="count">(' . $c . ')</span></strong><br />';
} else {
echo '<a href="' . $this->admin_page->make_link(array('state' => 'live')) . '">Current Items <span class="count">(' . $c . ')</span></a><br />';
}
}
示例6: filter_pages
private function filter_pages($pages)
{
$filtered = array();
foreach ($pages as $page) {
$es = new entity_selector();
$es->add_type(id_of('av'));
$es->add_right_relationship($page->id(), relationship_id_of('minisite_page_to_av'));
if ($es->get_one_count() > 1) {
$filtered[] = $page;
}
}
return $filtered;
}