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; } }
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); }
/** * 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(); } }
/** * 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(); }
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 />'; } }
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; }