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


PHP Piwik::getPercentageSafe方法代码示例

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


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

示例1: filter

 protected function filter()
 {
     foreach ($this->table->getRows() as $key => $row) {
         $value = $row->getColumn($this->columnValueToRead);
         if (!is_null($this->totalValueUsedAsDivisor)) {
             $divisor = $this->totalValueUsedAsDivisor;
         } else {
             $divisor = $row->getColumn($this->columnNameUsedAsDivisor);
         }
         $percentage = Piwik::getPercentageSafe($value, $divisor, $this->percentagePrecision);
         $row->addColumn($this->columnNamePercentageToAdd, $percentage);
     }
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:13,代码来源:ColumnCallbackAddColumnPercentage.php

示例2: 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->urlSparklineMaxActionsReturning = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('max_actions_returning')));
     $view->urlSparklineSumVisitLengthReturning = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('sum_visit_length_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->maxActionsReturning = $dataRow->getColumn('max_actions_returning');
     $view->sumVisitLengthReturning = $dataRow->getColumn('sum_visit_length_returning');
     $nbBouncedReturningVisits = $dataRow->getColumn('bounce_count_returning');
     $view->bounceRateReturning = Piwik::getPercentageSafe($nbBouncedReturningVisits, $nbVisitsReturning);
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:17,代码来源:Controller.php

示例3: 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:neolf,项目名称:PIWIK4MOBILE,代码行数:17,代码来源:Controller.php

示例4: setSparklinesAndNumbers

 protected function setSparklinesAndNumbers($view)
 {
     $view->urlSparklineNbVisits = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_visits')));
     $view->urlSparklineNbActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions')));
     $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')));
     $dataTableVisit = self::getVisitsSummary();
     $dataRow = $dataTableVisit->getFirstRow();
     $view->urlSparklineNbUniqVisitors = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_uniq_visitors')));
     $view->nbUniqVisitors = $dataRow->getColumn('nb_uniq_visitors');
     $nbVisits = $dataRow->getColumn('nb_visits');
     $view->nbVisits = $nbVisits;
     $view->nbActions = $dataRow->getColumn('nb_actions');
     $view->averageVisitDuration = $dataRow->getColumn('avg_time_on_site');
     $nbBouncedVisits = $dataRow->getColumn('bounce_count');
     $view->bounceRate = Piwik::getPercentageSafe($nbBouncedVisits, $nbVisits);
     $view->maxActions = $dataRow->getColumn('max_actions');
     $view->nbActionsPerVisit = $dataRow->getColumn('nb_actions_per_visit');
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:21,代码来源:Controller.php

示例5: setSparklinesAndNumbers

 protected function setSparklinesAndNumbers($view)
 {
     $view->urlSparklineNbVisits = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_visits')));
     $view->urlSparklineNbActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_actions')));
     $view->urlSparklineSumVisitLength = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('sum_visit_length')));
     $view->urlSparklineMaxActions = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('max_actions')));
     $view->urlSparklineBounceRate = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('bounce_rate')));
     $dataTableVisit = self::getVisitsSummary();
     $dataRow = $dataTableVisit->getFirstRow();
     if ($view->period != 'year') {
         $view->urlSparklineNbUniqVisitors = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array('nb_uniq_visitors')));
         $view->nbUniqVisitors = $dataRow->getColumn('nb_uniq_visitors');
     }
     $nbVisits = $dataRow->getColumn('nb_visits');
     $view->nbVisits = $nbVisits;
     $view->nbActions = $dataRow->getColumn('nb_actions');
     $view->sumVisitLength = $dataRow->getColumn('sum_visit_length');
     $nbBouncedVisits = $dataRow->getColumn('bounce_count');
     $view->bounceRate = Piwik::getPercentageSafe($nbBouncedVisits, $nbVisits);
     $view->maxActions = $dataRow->getColumn('max_actions');
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:21,代码来源:Controller.php

示例6: 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')));
     $dataTableVisit = self::getVisitsSummary();
     $dataRow = $dataTableVisit->getFirstRow();
     $dataTableActions = Piwik_Actions_API::getInstance()->get(Piwik_Common::getRequestVar('idSite'), Piwik_Common::getRequestVar('period'), Piwik_Common::getRequestVar('date'), Piwik_Common::getRequestVar('segment', false));
     $dataActionsRow = $dataTableActions->getFirstRow();
     $view->nbUniqVisitors = (int) $dataRow->getColumn('nb_uniq_visitors');
     $nbVisits = (int) $dataRow->getColumn('nb_visits');
     $view->nbVisits = $nbVisits;
     $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->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');
     // 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:nnnnathann,项目名称:piwik,代码行数:37,代码来源:Controller.php

示例7: formatValue

	protected function formatValue($value, $divisor)
	{
		return Piwik::getPercentageSafe($value, $divisor, $this->quotientPrecision) . '%';
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:4,代码来源:ColumnCallbackAddColumnPercentage.php

示例8: getConversionRateNewVisitors

	public function getConversionRateNewVisitors( $idSite, $period, $date, $idGoal = false )
	{
		// new visits converted for all goals = nb visits converted - nb visits converted for returning
		if($idGoal == false)
		{
			$request = new Piwik_API_Request("method=VisitsSummary.getVisitsConverted&idSite=$idSite&period=$period&date=$date&format=original");
			$convertedVisits = $request->process();
			$request = new Piwik_API_Request("method=VisitFrequency.getConvertedVisitsReturning&idSite=$idSite&period=$period&date=$date&format=original");
			$convertedReturningVisits = $request->process();
			$convertedNewVisits = $convertedVisits - $convertedReturningVisits;
		}
		// new visits converted for a given goal = nb conversion for this goal for new visits
		else
		{
			$convertedNewVisits = $this->getNumeric($idSite, $period, $date, Piwik_Goals::getRecordName('nb_conversions', $idGoal, 0));
		}
		// all new visits = all visits - all returning visits 
		$request = new Piwik_API_Request("method=VisitFrequency.getVisitsReturning&idSite=$idSite&period=$period&date=$date&format=original");
		$nbVisitsReturning = $request->process();
		$request = new Piwik_API_Request("method=VisitsSummary.getVisits&idSite=$idSite&period=$period&date=$date&format=original");
		$nbVisits = $request->process();
		$newVisits = $nbVisits - $nbVisitsReturning;
		return Piwik::getPercentageSafe($convertedNewVisits, $newVisits, Piwik_Goals::ROUNDING_PRECISION);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:24,代码来源:API.php

示例9: getPlugin

	public function getPlugin( $idSite, $period, $date, $segment = false )
	{
		// fetch all archive data required
		$dataTable = $this->getDataTable('UserSettings_plugin', $idSite, $period, $date, $segment);
		$browserTypes	= $this->getDataTable('UserSettings_browserType', $idSite, $period, $date, $segment);
		$archive		= Piwik_Archive::build($idSite, $period, $date, $segment);
		$visitsSums		= $archive->getNumeric('nb_visits');

		// check whether given tables are arrays
		if($dataTable instanceof Piwik_DataTable_Array) {
			$tableArray			= $dataTable->getArray();
			$browserTypesArray	= $browserTypes->getArray();
			$visitSumsArray		= $visitsSums->getArray();
		} else {
			$tableArray 		= Array($dataTable);
			$browserTypesArray 	= Array($browserTypes);
			$visitSumsArray 	= Array($visitsSums);
		}
		
		// walk through the results and calculate the percentage
		foreach($tableArray as $key => $table) {
			
			// get according browserType table
			foreach($browserTypesArray AS $k => $browsers) {
				if($k == $key) {
					$browserType = $browsers;
				}
			}
			
			// get according visitsSum
			foreach($visitSumsArray AS $k => $visits) {
				if($k == $key) {
					if(is_object($visits)) {
						$visitsSumTotal = (float)$visits->getFirstRow()->getColumn(0);
					} else {
						$visitsSumTotal = (float)$visits;
					}
				}
			}
			
			$ieStats		= $browserType->getRowFromLabel('ie');

			$ieVisits 	= 0;
			if($ieStats !== false)
			{
				$ieVisits = $ieStats->getColumn(Piwik_Archive::INDEX_NB_VISITS);
			}
			$visitsSum		= $visitsSumTotal - $ieVisits;
		
			// Calculate percentage, but ignore IE users cause plugin detection doesn't work on IE
			// The filter must be applied now so that the new column can 
			// be sorted by the generic filters (applied right after this function exits)
			$table->filter('ColumnCallbackAddColumnPercentage', array('nb_visits_percentage', Piwik_Archive::INDEX_NB_VISITS, $visitsSum, 1));
		
			// correct the cookie and java value (as detection works in IE, too)
			$row = $table->getRowFromLabel('cookie');
			if($row) {
				$percentage = Piwik::getPercentageSafe($row->getColumn(Piwik_Archive::INDEX_NB_VISITS), $visitsSumTotal, 1) . '%';
				$row->setColumn('nb_visits_percentage', $percentage);
			}
			$row = $table->getRowFromLabel('java');
			if($row) {
				$percentage = Piwik::getPercentageSafe($row->getColumn(Piwik_Archive::INDEX_NB_VISITS), $visitsSumTotal, 1) . '%';
				$row->setColumn('nb_visits_percentage', $percentage);
			}
			
		}
		
		$dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getPluginsLogo'));
		$dataTable->queueFilter('ColumnCallbackReplace', array('label', 'ucfirst'));
		
		return $dataTable;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:73,代码来源:API.php

示例10: getConversionRateNewVisitors

 private function getConversionRateNewVisitors($idSite, $period, $date, $idGoal = false)
 {
     // new visits converted for all goals = nb visits converted - nb visits converted for returning
     if ($idGoal == false) {
         $request = new Piwik_API_Request("method=VisitsSummary.getVisitsConverted&idSite={$idSite}&period={$period}&date={$date}&format=original");
         $convertedVisits = $request->process();
         $request = new Piwik_API_Request("method=VisitFrequency.getConvertedVisitsReturning&idSite={$idSite}&period={$period}&date={$date}&format=original");
         $convertedReturningVisits = $request->process();
         $convertedNewVisits = $convertedVisits - $convertedReturningVisits;
     } else {
         $convertedNewVisits = Piwik_Goals_API::getInstance()->getConversions($idSite, $period, $date, $segment = false, $idGoal);
     }
     // all new visits = all visits - all returning visits
     $request = new Piwik_API_Request("method=VisitFrequency.getVisitsReturning&idSite={$idSite}&period={$period}&date={$date}&format=original");
     $nbVisitsReturning = $request->process();
     $request = new Piwik_API_Request("method=VisitsSummary.getVisits&idSite={$idSite}&period={$period}&date={$date}&format=original");
     $nbVisits = $request->process();
     $newVisits = $nbVisits - $nbVisitsReturning;
     return Piwik::getPercentageSafe($convertedNewVisits, $newVisits, Piwik_Goals::ROUNDING_PRECISION);
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:20,代码来源:Controller.php


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