コード例 #1
0
 function action()
 {
     $s = owa_coreAPI::entityFactory('base.site');
     $sites = owa_coreAPI::getSitesList();
     $this->set('tracked_sites', $sites);
     $this->setSubview('base.sites');
     $this->setView('base.options');
 }
コード例 #2
0
 /**
  * pre action
  *
  */
 function pre()
 {
     // site lists
     $sites = owa_coreAPI::getSitesList();
     $this->set('sites', $sites);
     // set default siteId if none exists on request
     $site_id = $this->getParam('siteId');
     if (!$site_id) {
         $site_id = $this->getParam('site_id');
     }
     if (!$site_id) {
         $site_id = $sites[0]['site_id'];
     }
     $this->setParam('siteId', $site_id);
     // pass full set of params to view
     $this->data['params'] = $this->params;
     // set default period if necessary
     if (!$this->getParam('period') && !$this->getParam('startDate')) {
         $this->set('is_default_period', true);
         $period = 'last_seven_days';
         $this->params['period'] = $period;
     } elseif (!$this->getParam('period') && $this->getParam('startDate')) {
         $period = 'date_range';
         $this->params['period'] = $period;
     } else {
         $period = $this->getParam('period');
     }
     $this->setPeriod($period);
     $this->setView('base.report');
     $this->setViewMethod('delegate');
     $this->dom_id = str_replace('.', '-', $this->getParam('do'));
     $this->data['dom_id'] = $this->dom_id;
     $this->data['do'] = $this->getParam('do');
     // setup tabs
     $siteId = $this->get('siteId');
     $gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);
     $tabs = array();
     $site_usage = array('tab_label' => 'Site Usage', 'metrics' => 'visits,pagesPerVisit,visitDuration,bounceRate,uniqueVisitors', 'sort' => 'visits-');
     $tabs['site_usage'] = $site_usage;
     // ecommerce tab
     if (owa_coreAPI::getSiteSetting($this->getParam('siteId'), 'enableEcommerceReporting')) {
         $ecommerce = array('tab_label' => 'e-commerce', 'metrics' => 'visits,transactions,transactionRevenue,revenuePerVisit,revenuePerTransaction,ecommerceConversionRate', 'sort' => 'transactionRevenue-');
         $tabs['ecommerce'] = $ecommerce;
     }
     $goal_groups = $gm->getActiveGoalGroups();
     if ($goal_groups) {
         foreach ($goal_groups as $group) {
             $goal_metrics = 'visits';
             $active_goals = $gm->getActiveGoalsByGroup($group);
             if ($active_goals) {
                 foreach ($active_goals as $goal) {
                     $goal_metrics .= sprintf(',goal%sCompletions', $goal);
                 }
             }
             $goal_metrics .= ',goalValueAll';
             $goal_group = array('tab_label' => $gm->getGoalGroupLabel($group), 'metrics' => $goal_metrics, 'sort' => 'goalValueAll-');
             $name = 'goal_group_' . $group;
             $tabs[$name] = $goal_group;
         }
     }
     $this->set('tabs', $tabs);
     $this->set('tabs_json', json_encode($tabs));
     //$this->body->set('sub_nav', owa_coreAPI::getNavigation($this->get('nav_tab'), 'sub_nav'));
     $nav = owa_coreAPI::getGroupNavigation('Reports');
     if (!owa_coreAPI::getSiteSetting($this->getParam('siteId'), 'enableEcommerceReporting')) {
         unset($nav['Ecommerce']);
     }
     $this->set('top_level_report_nav', $nav);
 }
コード例 #3
0
 /**
  * Returns array of owa_site entities where the current user has access to, taken the current controller cap into account 
  * @return array
  */
 protected function getSitesAllowedForCurrentUser()
 {
     owa_coreAPI::debug('get Sites Allowed for user');
     $currentUser = owa_coreAPI::getCurrentUser();
     if ($currentUser->isAnonymousUser() || $currentUser->isAdmin()) {
         $result = array();
         $relations = owa_coreAPI::getSitesList();
         foreach ($relations as $siteRow) {
             $site = owa_coreAPI::entityFactory('base.site');
             owa_coreAPI::debug('getSitesAllowedforuser');
             $site->load($siteRow['id']);
             $result[$siteRow['site_id']] = $site;
         }
         return $result;
     } else {
         return $currentUser->getAssignedSites();
     }
 }