当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik_Site::getMainUrlFor方法代码示例

本文整理汇总了PHP中Piwik_Site::getMainUrlFor方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Site::getMainUrlFor方法的具体用法?PHP Piwik_Site::getMainUrlFor怎么用?PHP Piwik_Site::getMainUrlFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik_Site的用法示例。


在下文中一共展示了Piwik_Site::getMainUrlFor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSitesInfo

 public function getSitesInfo($view)
 {
     Piwik::checkUserHasSomeViewAccess();
     $displayRevenueColumn = Piwik_Common::isGoalPluginEnabled();
     // overwrites the default Date set in the parent controller
     // Instead of the default current website's local date,
     // we set "today" or "yesterday" based on the default Piwik timezone
     $piwikDefaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
     $dateRequest = Piwik_Common::getRequestVar('date', 'today');
     $period = Piwik_Common::getRequestVar('period', 'day');
     $date = $dateRequest;
     if ($period != 'range') {
         $date = $this->getDateParameterInTimezone($dateRequest, $piwikDefaultTimezone);
         $date = $date->toString();
     }
     $siteIds = Piwik_SitesManager_API::getInstance()->getSitesIdWithAtLeastViewAccess();
     $dataTable = Piwik_MultiSites_API::getInstance()->getAll($period, $date, $segment = false);
     list($minDate, $maxDate) = $this->getMinMaxDateAcrossWebsites($siteIds);
     $totalVisits = $totalActions = $totalRevenue = 0;
     // put data into a form the template will understand better
     $digestableData = array();
     foreach ($siteIds as $idSite) {
         $isEcommerceEnabled = Piwik_Site::isEcommerceEnabledFor($idSite);
         $digestableData[$idSite] = array('idsite' => $idSite, 'main_url' => Piwik_Site::getMainUrlFor($idSite), 'name' => Piwik_Site::getNameFor($idSite), 'visits' => 0, 'actions' => 0);
         if ($period != 'range') {
             $digestableData[$idSite]['visits_evolution'] = 0;
             $digestableData[$idSite]['actions_evolution'] = 0;
         }
         if ($displayRevenueColumn) {
             $revenueDefault = $isEcommerceEnabled ? 0 : "'-'";
             if ($period != 'range') {
                 $digestableData[$idSite]['revenue_evolution'] = $revenueDefault;
             }
         }
     }
     foreach ($dataTable->getRows() as $row) {
         $idsite = (int) $row->getMetadata('idsite');
         $site =& $digestableData[$idsite];
         $site['visits'] = (int) $row->getColumn('nb_visits');
         $totalVisits += $site['visits'];
         $site['actions'] = (int) $row->getColumn('nb_actions');
         $totalActions += $site['actions'];
         if ($displayRevenueColumn) {
             if ($row->getColumn('revenue') !== false) {
                 $site['revenue'] = $row->getColumn('revenue');
                 $totalRevenue += $site['revenue'];
             }
         }
         if ($period != 'range') {
             $site['visits_evolution'] = $row->getColumn('visits_evolution');
             $site['actions_evolution'] = $row->getColumn('actions_evolution');
             if ($displayRevenueColumn) {
                 $site['revenue_evolution'] = $row->getColumn('revenue_evolution');
             }
         }
     }
     $this->applyPrettyMoney($digestableData);
     $view->sitesData = array_values($digestableData);
     $view->evolutionBy = $this->evolutionBy;
     $view->period = $period;
     $view->dateRequest = $dateRequest;
     $view->page = $this->page;
     $view->limit = $this->limit;
     $view->orderBy = $this->orderBy;
     $view->order = $this->order;
     $view->totalVisits = $totalVisits;
     $view->totalRevenue = $totalRevenue;
     $view->displayRevenueColumn = $displayRevenueColumn;
     $view->totalActions = $totalActions;
     $params = $this->getGraphParamsModified();
     $view->dateSparkline = $period == 'range' ? $dateRequest : $params['date'];
     $view->autoRefreshTodayReport = false;
     // if the current date is today, or yesterday,
     // in case the website is set to UTC-12), or today in UTC+14, we refresh the page every 5min
     if (in_array($date, array('today', date('Y-m-d'), 'yesterday', Piwik_Date::factory('yesterday')->toString('Y-m-d'), Piwik_Date::factory('now', 'UTC+14')->toString('Y-m-d')))) {
         $view->autoRefreshTodayReport = Piwik_Config::getInstance()->General['multisites_refresh_after_seconds'];
     }
     $this->setGeneralVariablesView($view);
     $this->setMinDateView($minDate, $view);
     $this->setMaxDateView($maxDate, $view);
     $view->show_sparklines = Piwik_Config::getInstance()->General['show_multisites_sparklines'];
     echo $view->render();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:83,代码来源:Controller.php


注:本文中的Piwik_Site::getMainUrlFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。