本文整理汇总了PHP中owa_coreAPI::getSitesList方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::getSitesList方法的具体用法?PHP owa_coreAPI::getSitesList怎么用?PHP owa_coreAPI::getSitesList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::getSitesList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
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: pre
/**
* 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: getSitesAllowedForCurrentUser
/**
* 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();
}
}