function action() { // Load the core API $api =& owa_coreAPI::singleton($this->params); if ($this->params['site_id']) { //get site labels $s = owa_coreAPI::entityFactory('base.site'); $s->getByColumn('site_id', $this->getParam('site_id')); $this->set('site_name', $s->get('name')); $this->set('site_description', $s->get('description')); } else { $this->set('site_name', 'All Sites'); $this->set('site_description', 'All Sites Tracked by OWA'); } //setup Metrics $m = owa_coreApi::metricFactory('base.latestVisits'); $m->setConstraint('site_id', $this->getParam('site_id')); $m->setPeriod($this->getPeriod()); $m->setOrder(OWA_SQL_DESCENDING); $m->setLimit(15); $results = $m->generate(); $this->set('latest_visits', $results); $this->setView('base.kmlVisitsGeolocation'); return; }
function action() { $userManager = owa_coreApi::supportClassFactory('base', 'userManager'); // add check here to ensure that this is not the default user.... $userManager->deleteUser($this->getParam('user_id')); $this->setRedirectAction('base.users'); $this->set('status_code', 3004); }
function action() { $userManager = owa_coreApi::supportClassFactory('base', 'userManager'); $user_params = array('user_id' => trim($this->params['user_id']), 'real_name' => $this->params['real_name'], 'role' => $this->params['role'], 'email_address' => trim($this->params['email_address'])); $temp_passkey = $userManager->createNewUser($user_params); // log account creation event to event queue $ed = owa_coreAPI::getEventDispatch(); $ed->log(array('user_id' => $this->params['user_id'], 'real_name' => $this->params['real_name'], 'role' => $this->params['role'], 'email_address' => $this->params['email_address'], 'temp_passkey' => $temp_passkey), 'base.new_user_account'); $this->setRedirectAction('base.users'); $this->set('status_code', 3000); }
function action() { $site_id = $this->getParam('site_id'); if ($site_id) { //get site labels $s = owa_coreAPI::entityFactory('base.site'); $s->getByColumn('site_id', $site_id); $this->set('site_name', $s->get('name')); $this->set('site_description', $s->get('description')); } else { $this->set('site_name', 'All Sites'); $this->set('site_description', 'All Sites Tracked by OWA'); } //setup Metrics $m = owa_coreApi::metricFactory('base.latestVisits'); $m->setConstraint('site_id', $this->getParam('site_id')); //$period = $this->makeTimePeriod('all_time'); $m->setPeriod($this->getPeriod()); $m->setLimit(100); $m->setOrder('DESC'); $this->set('latest_visits', $m->generate()); $this->setView('base.xmlVisitsGeolocation'); return; }
private function setAllowedSitesList($site_ids) { $list = array(); if (!empty($site_ids)) { foreach ($site_ids as $row) { $siteEntity = owa_coreApi::entityFactory('base.site'); $siteEntity->load($row['site_id']); $list[$siteEntity->get('site_id')] = $siteEntity; } } $this->assignedSites = $list; $this->isAssignedSitesListLoaded = true; }
/** * Returns collection of owa_user entities that are allowed for current user * @return owa_user[] */ public function getAssignedUsers() { if (!$this->get('id')) { throw new Exception('no site data loaded!'); } if (!isset(self::$cachedAssignedUsers[$this->get('id')])) { $db = owa_coreAPI::dbSingleton(); $db->selectFrom('owa_site_user'); $db->selectColumn('*'); $db->where('site_id', $this->get('id')); $relations = $db->getAllRows(); $result = array(); if (is_array($relations)) { foreach ($relations as $row) { $userEntity = owa_coreApi::entityFactory('base.user'); $userEntity->load($row['user_id']); $result[] = $userEntity; } } self::$cachedAssignedUsers[$this->get('id')] = $result; } return self::$cachedAssignedUsers[$this->get('id')]; }
function __construct() { //parent::__construct(); $this->user = owa_coreApi::entityFactory('base.user'); }