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


PHP Piwik::getPercentageSafe方法代码示例

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


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

示例1: setSparklinesAndNumbers

 protected function setSparklinesAndNumbers($view)
 {
     $view->urlSparklineNbVisitsReturning = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_visits_returning')));
     $view->urlSparklineNbActionsReturning = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions_returning')));
     $view->urlSparklineActionsPerVisitReturning = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions_per_visit_returning')));
     $view->urlSparklineAvgVisitDurationReturning = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('avg_time_on_site_returning')));
     $view->urlSparklineBounceRateReturning = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('bounce_rate_returning')));
     $dataTableFrequency = $this->getSummary();
     $dataRow = $dataTableFrequency->getFirstRow();
     $nbVisitsReturning = $dataRow->getColumn('nb_visits_returning');
     $view->nbVisitsReturning = $nbVisitsReturning;
     $view->nbActionsReturning = $dataRow->getColumn('nb_actions_returning');
     $view->nbActionsPerVisitReturning = $dataRow->getColumn('nb_actions_per_visit_returning');
     $view->avgVisitDurationReturning = $dataRow->getColumn('avg_time_on_site_returning');
     $nbBouncedReturningVisits = $dataRow->getColumn('bounce_count_returning');
     $view->bounceRateReturning = Piwik::getPercentageSafe($nbBouncedReturningVisits, $nbVisitsReturning);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:17,代码来源:Controller.php

示例2: formatValue

 /**
  * Formats the given value as a percentage.
  *
  * @param number $value
  * @param number $divisor
  * @return string
  */
 protected function formatValue($value, $divisor)
 {
     return Piwik::getPercentageSafe($value, $divisor, $this->quotientPrecision) . '%';
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:11,代码来源:ColumnCallbackAddColumnPercentage.php

示例3: setSparklinesAndNumbers

 protected function setSparklinesAndNumbers($view)
 {
     $view->urlSparklineNbVisits = $this->getUrlSparkline('getEvolutionGraph', array('columns' => $view->displayUniqueVisitors ? array('nb_visits', 'nb_uniq_visitors') : array('nb_visits')));
     $view->urlSparklineNbPageviews = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_pageviews', 'nb_uniq_pageviews')));
     $view->urlSparklineNbDownloads = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_downloads', 'nb_uniq_downloads')));
     $view->urlSparklineNbOutlinks = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_outlinks', 'nb_uniq_outlinks')));
     $view->urlSparklineAvgVisitDuration = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('avg_time_on_site')));
     $view->urlSparklineMaxActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('max_actions')));
     $view->urlSparklineActionsPerVisit = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions_per_visit')));
     $view->urlSparklineBounceRate = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('bounce_rate')));
     $view->urlSparklineAvgGenerationTime = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('avg_time_generation')));
     $idSite = Common::getRequestVar('idSite');
     $displaySiteSearch = Site::isSiteSearchEnabledFor($idSite);
     if ($displaySiteSearch) {
         $view->urlSparklineNbSearches = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_searches', 'nb_keywords')));
     }
     $view->displaySiteSearch = $displaySiteSearch;
     $dataTableVisit = self::getVisitsSummary();
     $dataRow = $dataTableVisit->getRowsCount() == 0 ? new Row() : $dataTableVisit->getFirstRow();
     $view->nbUniqVisitors = (int) $dataRow->getColumn('nb_uniq_visitors');
     $nbVisits = (int) $dataRow->getColumn('nb_visits');
     $view->nbVisits = $nbVisits;
     $view->averageVisitDuration = $dataRow->getColumn('avg_time_on_site');
     $nbBouncedVisits = $dataRow->getColumn('bounce_count');
     $view->bounceRate = Piwik::getPercentageSafe($nbBouncedVisits, $nbVisits);
     $view->maxActions = (int) $dataRow->getColumn('max_actions');
     $view->nbActionsPerVisit = $dataRow->getColumn('nb_actions_per_visit');
     if (Common::isActionsPluginEnabled()) {
         $view->showActionsPluginReports = true;
         $dataTableActions = APIActions::getInstance()->get($idSite, Common::getRequestVar('period'), Common::getRequestVar('date'), \Piwik\API\Request::getRawSegmentFromRequest());
         $dataActionsRow = $dataTableActions->getRowsCount() == 0 ? new Row() : $dataTableActions->getFirstRow();
         $view->nbPageviews = (int) $dataActionsRow->getColumn('nb_pageviews');
         $view->nbUniquePageviews = (int) $dataActionsRow->getColumn('nb_uniq_pageviews');
         $view->nbDownloads = (int) $dataActionsRow->getColumn('nb_downloads');
         $view->nbUniqueDownloads = (int) $dataActionsRow->getColumn('nb_uniq_downloads');
         $view->nbOutlinks = (int) $dataActionsRow->getColumn('nb_outlinks');
         $view->nbUniqueOutlinks = (int) $dataActionsRow->getColumn('nb_uniq_outlinks');
         $view->averageGenerationTime = $dataActionsRow->getColumn('avg_time_generation');
         if ($displaySiteSearch) {
             $view->nbSearches = (int) $dataActionsRow->getColumn('nb_searches');
             $view->nbKeywords = (int) $dataActionsRow->getColumn('nb_keywords');
         }
         // backward compatibility:
         // show actions if the finer metrics are not archived
         $view->showOnlyActions = false;
         if ($dataActionsRow->getColumn('nb_pageviews') + $dataActionsRow->getColumn('nb_downloads') + $dataActionsRow->getColumn('nb_outlinks') == 0 && $dataRow->getColumn('nb_actions') > 0) {
             $view->showOnlyActions = true;
             $view->nbActions = $dataRow->getColumn('nb_actions');
             $view->urlSparklineNbActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions')));
         }
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:52,代码来源:Controller.php

示例4: addFilter_percentage

 protected function addFilter_percentage()
 {
     $percentage = new Twig_SimpleFilter('percentage', function ($string, $totalValue, $precision = 1) {
         return Piwik::getPercentageSafe($string, $totalValue, $precision) . '%';
     });
     $this->twig->addFilter($percentage);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:7,代码来源:Twig.php

示例5: addFilter_percentage

 protected function addFilter_percentage()
 {
     $percentage = new Twig_SimpleFilter('percentage', function ($string, $totalValue, $precision = 1) {
         $formatter = NumberFormatter::getInstance();
         return $formatter->formatPercent(Piwik::getPercentageSafe($string, $totalValue, $precision), $precision);
     });
     $this->twig->addFilter($percentage);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:8,代码来源:Twig.php

示例6: getTotalEvolution

 private function getTotalEvolution($totalValue, $lastTotalValue)
 {
     return Piwik::getPercentageSafe($totalValue - $lastTotalValue, $lastTotalValue, 1);
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:4,代码来源:InsightReport.php


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