當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。