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


PHP Piwik::redirectToModule方法代码示例

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


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

示例1: getGoalReportView

 protected function getGoalReportView()
 {
     $idGoal = Piwik_Common::getRequestVar('idGoal', null, 'int');
     if (!isset($this->goals[$idGoal])) {
         Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
     }
     $goalDefinition = $this->goals[$idGoal];
     $view = Piwik_View::factory('single_goal');
     $this->setGeneralVariablesView($view);
     $goal = $this->getMetricsForGoal($idGoal);
     foreach ($goal as $name => $value) {
         $view->{$name} = $value;
     }
     $view->idGoal = $idGoal;
     $view->goalName = $goalDefinition['name'];
     $view->goalAllowMultipleConversionsPerVisit = $goalDefinition['allow_multiple'];
     $view->graphEvolution = $this->getEvolutionGraph(true, array('nb_conversions'), $idGoal);
     $view->nameGraphEvolution = 'GoalsgetEvolutionGraph' . $idGoal;
     $view->topDimensions = $this->getTopDimensions($idGoal);
     // conversion rate for new and returning visitors
     $conversionRateReturning = $this->getConversionRateReturningVisitors($this->idSite, Piwik_Common::getRequestVar('period'), Piwik_Common::getRequestVar('date'), $idGoal);
     $view->conversion_rate_returning = $this->formatConversionRate($conversionRateReturning);
     $conversionRateNew = $this->getConversionRateNewVisitors($this->idSite, Piwik_Common::getRequestVar('period'), Piwik_Common::getRequestVar('date'), $idGoal);
     $view->conversion_rate_new = $this->formatConversionRate($conversionRateNew);
     return $view;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:26,代码来源:Controller.php

示例2: setDateTodayIfWebsiteCreatedToday

	protected function setDateTodayIfWebsiteCreatedToday()
	{
		$date = Piwik_Common::getRequestVar('date', false);
		if($date == 'today'
			|| Piwik_Common::getRequestVar('period', false) == 'range') 
		{
			return;
		} 
		$websiteId = Piwik_Common::getRequestVar('idSite', false, 'int');
		if ($websiteId) 
		{
			$website = new Piwik_Site($websiteId);
			$datetimeCreationDate = $this->site->getCreationDate()->getDatetime();
			$creationDateLocalTimezone = Piwik_Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d');
			$todayLocalTimezone = Piwik_Date::factory('now', $website->getTimezone())->toString('Y-m-d');
			if( $creationDateLocalTimezone == $todayLocalTimezone ) 
			{
				Piwik::redirectToModule( 'CoreHome', 'index', 
										array(	'date' => 'today', 
												'idSite' => $websiteId, 
												'period' => Piwik_Common::getRequestVar('period')) 
				);
			}
		}
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:Controller.php

示例3: goalReport

 function goalReport()
 {
     $idGoal = Piwik_Common::getRequestVar('idGoal', null, 'int');
     if (!isset($this->goals[$idGoal])) {
         Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
     }
     $goalDefinition = $this->goals[$idGoal];
     $view = Piwik_View::factory('single_goal');
     $view->currency = Piwik::getCurrency();
     $goal = $this->getMetricsForGoal($idGoal);
     foreach ($goal as $name => $value) {
         $view->{$name} = $value;
     }
     $view->name = $goalDefinition['name'];
     $view->title = $goalDefinition['name'] . ' - Conversions';
     $view->graphEvolution = $this->getEvolutionGraph(true, array(Piwik_Goals::getRecordName('nb_conversions', $idGoal)), $idGoal);
     $view->nameGraphEvolution = 'GoalsgetEvolutionGraph';
     $view->topSegments = $this->getTopSegments($idGoal);
     // conversion rate for new and returning visitors
     $request = new Piwik_API_Request("method=Goals.getConversionRateReturningVisitors&format=original");
     $view->conversion_rate_returning = round($request->process(), self::CONVERSION_RATE_PRECISION);
     $request = new Piwik_API_Request("method=Goals.getConversionRateNewVisitors&format=original");
     $view->conversion_rate_new = round($request->process(), self::CONVERSION_RATE_PRECISION);
     $verticalSlider = array();
     // string label
     // array parameters to ajax call on click (module, action)
     // specific order
     // (intermediate labels)
     // automatically load the first from the list, highlights it
     $view->tableByConversion = Piwik_FrontController::getInstance()->fetchDispatch('Referers', 'getKeywords', array(false, 'tableGoals'));
     echo $view->render();
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:32,代码来源:Controller.php

示例4: dispatch

 function dispatch()
 {
     $module = Piwik_Common::getRequestVar('module', '', 'string');
     $updater = new Piwik_Updater();
     if (self::getComponentUpdates($updater) !== null && $module != 'CoreUpdater') {
         Piwik::redirectToModule('CoreUpdater');
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:8,代码来源:CoreUpdater.php

示例5: funnelReport

 function funnelReport()
 {
     $idFunnel = Piwik_Common::getRequestVar('idFunnel', null, 'int');
     if (!isset($this->funnels[$idFunnel])) {
         Piwik::redirectToModule('Funnels', 'index', array('idFunnel' => null));
     }
     // Set up the view
     $view = Piwik_View::factory('single_funnel');
     $this->setGeneralVariablesView($view);
     // Get the funnel and related goal data
     $funnelDefinition = $this->funnels[$idFunnel];
     $idGoal = $funnelDefinition['idgoal'];
     $goal_request = new Piwik_API_Request("method=Goals.get&format=original&idGoal={$idGoal}");
     $datatable = $goal_request->process();
     $dataRow = $datatable->getFirstRow();
     $view->goal_conversions = $dataRow->getColumn('nb_conversions');
     $view->name = $funnelDefinition['goal_name'];
     // Get the data on each funnel step
     $funnel_data = $this->getMetricsForFunnel($idFunnel);
     foreach ($funnelDefinition['steps'] as &$step) {
         $recordName = Piwik_Funnels::getRecordName('nb_actions', $idFunnel, $step['idstep']);
         $step['nb_actions'] = $funnel_data->getColumn($recordName);
         $recordName = Piwik_Funnels::getRecordName('nb_next_step_actions', $idFunnel, $step['idstep']);
         $step['nb_next_step_actions'] = $funnel_data->getColumn($recordName);
         $recordName = Piwik_Funnels::getRecordName('percent_next_step_actions', $idFunnel, $step['idstep']);
         $step['percent_next_step_actions'] = round($funnel_data->getColumn($recordName), self::ROUNDING_PRECISION);
         $recordName = Piwik_Funnels::getRecordName('nb_entry', $idFunnel, $step['idstep']);
         $step['nb_entry'] = $funnel_data->getColumn($recordName);
         $step['referring_actions'] = array();
         $refUrls = $this->getRefUrls($idFunnel, $step['idstep']);
         $refUrls->filter('Sort', array('value', 'desc'));
         $refUrls->filter('Limit', array(0, self::NUM_URLS_TO_DISPLAY));
         foreach ($refUrls->getRows() as $row) {
             $label = $this->labelOrDefault($row->getColumn('label'), '(entrance)');
             $step['referring_actions'][] = array('label' => $label, 'value' => $row->getColumn('value'));
         }
         $recordName = Piwik_Funnels::getRecordName('nb_exit', $idFunnel, $step['idstep']);
         $step['nb_exit'] = $funnel_data->getColumn($recordName);
         $step['next_actions'] = array();
         $nextUrls = $this->getNextUrls($idFunnel, $step['idstep']);
         $nextUrls->filter('Sort', array('value', 'desc'));
         $nextUrls->filter('Limit', array(0, self::NUM_URLS_TO_DISPLAY));
         foreach ($nextUrls->getRows() as $row) {
             $label = $this->labelOrDefault($row->getColumn('label'), '(exit)');
             $step['next_actions'][] = array('label' => $label, 'value' => $row->getColumn('value'));
         }
     }
     // What percent of people who visited the first funnel step converted at the end of the funnel?
     $recordName = Piwik_Funnels::getRecordName('conversion_rate', $idFunnel, false);
     $view->conversion_rate = round($funnel_data->getColumn($recordName), self::ROUNDING_PRECISION);
     // Let the view access the funnel steps
     $view->steps = $funnelDefinition['steps'];
     echo $view->render();
 }
开发者ID:ep123,项目名称:funnels,代码行数:54,代码来源:Controller.php

示例6: generate

	public function generate() 
	{
		Piwik::checkUserIsSuperUser();
		$nonce = Piwik_Common::getRequestVar('form_nonce', '', 'string', $_POST);
		if(Piwik_Common::getRequestVar('choice', 'no') != 'yes' ||
				!Piwik_Nonce::verifyNonce('Piwik_VisitorGenerator.generate', $nonce))
		{
			Piwik::redirectToModule('VisitorGenerator', 'index');
		}
		Piwik_Nonce::discardNonce('Piwik_VisitorGenerator.generate');

		$daysToCompute = Piwik_Common::getRequestVar('daysToCompute', 1, 'int');

		// get idSite from POST with fallback to GET
		$idSite = Piwik_Common::getRequestVar('idSite', false, 'int', $_GET);
		$idSite = Piwik_Common::getRequestVar('idSite', $idSite, 'int', $_POST);

		Piwik::setMaxExecutionTime(0);

		$timer = new Piwik_Timer;
		$time = time() - ($daysToCompute-1)*86400;
		
		// Update site.ts_created if we generate visits on days before the website was created
		$site = new Piwik_Site($idSite);
		$minGeneratedDate = Piwik_Date::factory($time);
		if($minGeneratedDate->isEarlier($site->getCreationDate()))
		{
			// direct access to the website table (bad practise but this is a debug / dev plugin)
    		Zend_Registry::get('db')->update(Piwik_Common::prefixTable("site"), 
    							array('ts_created' =>  $minGeneratedDate->getDatetime()),
    							"idsite = $idSite");
		}
		
		$nbActionsTotal = 0;
		while($time <= time()) 
		{
			$nbActionsTotalThisDay = $this->generateVisits($time, $idSite);
			$time += 86400;
			$nbActionsTotal += $nbActionsTotalThisDay;
		}

		// Init view
		$view = Piwik_View::factory('generate');
		$this->setBasicVariablesView($view);
		$view->menu = Piwik_GetAdminMenu();
		$view->assign('timer', $timer);
		$view->assign('days', $daysToCompute);
		$view->assign('nbActionsTotal', $nbActionsTotal);
		$view->assign('nbRequestsPerSec', round($nbActionsTotal / $timer->getTime(),0));
		echo $view->render();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:51,代码来源:Controller.php

示例7: setDateTodayIfWebsiteCreatedToday

 protected function setDateTodayIfWebsiteCreatedToday()
 {
     $date = Piwik_Common::getRequestVar('date', false);
     $date = Piwik_Date::factory($date);
     if ($date->isToday()) {
         return;
     }
     $websiteId = Piwik_Common::getRequestVar('idSite', false);
     if ($websiteId) {
         $website = new Piwik_Site($websiteId);
         if ($website->getCreationDate()->isToday()) {
             Piwik::redirectToModule('CoreHome', 'index', array('date' => 'today', 'idSite' => $websiteId, 'period' => Piwik_Common::getRequestVar('period')));
         }
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:15,代码来源:Controller.php

示例8: dispatch

 function dispatch()
 {
     $module = Piwik_Common::getRequestVar('module', '', 'string');
     $updater = new Piwik_Updater();
     $updater->addComponentToCheck('core', Piwik_Version::VERSION);
     $updates = $updater->getComponentsWithNewVersion();
     if (!empty($updates)) {
         Piwik::deleteAllCacheOnUpdate();
     }
     if (self::getComponentUpdates($updater) !== null && $module != 'CoreUpdater' && $module != 'Proxy') {
         if (Piwik_FrontController::shouldRethrowException()) {
             throw new Exception("Piwik and/or some plugins have been upgraded to a new version. Please run the update process first. See documentation: http://piwik.org/docs/update/");
         } else {
             Piwik::redirectToModule('CoreUpdater');
         }
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:CoreUpdater.php

示例9: dispatch

	function dispatch()
	{
		$module = Piwik_Common::getRequestVar('module', '', 'string');
		$updater = new Piwik_Updater();
		$updater->addComponentToCheck('core', Piwik_Version::VERSION);
		$updates = $updater->getComponentsWithNewVersion();
		if(!empty($updates))
		{
			Piwik::deleteAllCacheOnUpdate();
		}
		if(self::getComponentUpdates($updater) !== null 
			&& $module != 'CoreUpdater'
			// Proxy module is used to redirect users to piwik.org, should still work when Piwik must be updated
			&& $module != 'Proxy')
		{
			Piwik::redirectToModule('CoreUpdater');
		}
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:18,代码来源:CoreUpdater.php

示例10: redirectToNextStep

 protected function redirectToNextStep($currentStep)
 {
     $_SESSION['currentStepDone'] = $currentStep;
     $nextStep = $this->steps[1 + array_search($currentStep, $this->steps)];
     Piwik::redirectToModule('Installation', $nextStep);
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:6,代码来源:Controller.php

示例11: redirectToNextStep

	/**
	 * Redirect to next step
	 *
	 * @param string Current step
	 * @return none
	 */
	protected function redirectToNextStep($currentStep)
	{
		$steps = array_keys($this->steps);
		$this->session->currentStepDone = $currentStep;
		$nextStep = $steps[1 + array_search($currentStep, $steps)];
		Piwik::redirectToModule('Installation' , $nextStep);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:13,代码来源:Controller.php

示例12: redirectToNextStep

 protected function redirectToNextStep($currentStep)
 {
     $session = new Zend_Session_Namespace("Installation");
     $session->currentStepDone = $currentStep;
     $nextStep = $this->steps[1 + array_search($currentStep, $this->steps)];
     Piwik::redirectToModule('Installation', $nextStep);
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:7,代码来源:Controller.php

示例13: generate

 public function generate()
 {
     // Only admin is allowed to do this!
     Piwik::checkUserIsSuperUser();
     $GET = $_GET;
     $POST = $_POST;
     $COOKIE = $_COOKIE;
     $REQUEST = $_REQUEST;
     $nonce = Piwik_Common::getRequestVar('form_nonce', '', 'string', $_POST);
     if (Piwik_Common::getRequestVar('choice', 'no') != 'yes' || !Piwik_Nonce::verifyNonce('Piwik_VisitorGenerator.generate', $nonce)) {
         Piwik::redirectToModule('VisitorGenerator', 'index');
     }
     Piwik_Nonce::discardNonce('Piwik_VisitorGenerator.generate');
     $minVisitors = Piwik_Common::getRequestVar('minVisitors', 20, 'int');
     $maxVisitors = Piwik_Common::getRequestVar('maxVisitors', 100, 'int');
     $nbActions = Piwik_Common::getRequestVar('nbActions', 10, 'int');
     $daysToCompute = Piwik_Common::getRequestVar('daysToCompute', 1, 'int');
     // get idSite from POST with fallback to GET
     $idSite = Piwik_Common::getRequestVar('idSite', false, 'int', $_GET);
     $idSite = Piwik_Common::getRequestVar('idSite', $idSite, 'int', $_POST);
     Piwik::setMaxExecutionTime(0);
     $loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
     $loadedPlugins = array_keys($loadedPlugins);
     // we have to unload the Provider plugin otherwise it tries to lookup the IP for a hostname, and there is no dns server here
     if (Piwik_PluginsManager::getInstance()->isPluginActivated('Provider')) {
         Piwik_PluginsManager::getInstance()->unloadPlugin('Provider');
     }
     // we set the DO NOT load plugins so that the Tracker generator doesn't load the plugins we've just disabled.
     // if for some reasons you want to load the plugins, comment this line, and disable the plugin Provider in the plugins interface
     Piwik_PluginsManager::getInstance()->doNotLoadPlugins();
     $generator = new Piwik_VisitorGenerator_Generator();
     $generator->setMaximumUrlDepth(3);
     //$generator->disableProfiler();
     $generator->setIdSite($idSite);
     $nbActionsTotal = 0;
     //$generator->emptyAllLogTables();
     $generator->init();
     $timer = new Piwik_Timer();
     $startTime = time() - ($daysToCompute - 1) * 86400;
     // Update site.ts_created if we generate visits on days before the website was created
     $site = new Piwik_Site($idSite);
     $minGeneratedDate = Piwik_Date::factory($startTime);
     if ($minGeneratedDate->isEarlier($site->getCreationDate())) {
         // direct access to the website table (bad practise but this is a debug / dev plugin)
         Zend_Registry::get('db')->update(Piwik_Common::prefixTable("site"), array('ts_created' => $minGeneratedDate->getDatetime()), "idsite = {$idSite}");
     }
     $dates = array();
     while ($startTime <= time()) {
         $visitors = rand($minVisitors, $maxVisitors);
         $actions = $nbActions;
         $generator->setTimestampToUse($startTime);
         $nbActionsTotalThisDay = $generator->generate($visitors, $actions);
         $actionsPerVisit = round($nbActionsTotalThisDay / $visitors);
         $date = array();
         $date['visitors'] = $visitors;
         $date['actionsPerVisit'] = $actionsPerVisit;
         $date['startTime'] = $startTime;
         $dates[] = $date;
         $startTime += 86400;
         $nbActionsTotal += $nbActionsTotalThisDay;
         //sleep(1);
     }
     $generator->end();
     // Recover all super globals
     $_GET = $GET;
     $_POST = $POST;
     $_COOKIE = $COOKIE;
     $_REQUEST = $REQUEST;
     // Reload plugins
     Piwik_PluginsManager::getInstance()->loadPlugins($loadedPlugins);
     // Init view
     $view = Piwik_View::factory('generate');
     $this->setBasicVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     $view->assign('dates', $dates);
     $view->assign('timer', $timer);
     $view->assign('nbActionsTotal', $nbActionsTotal);
     $view->assign('nbRequestsPerSec', round($nbActionsTotal / $timer->getTime(), 0));
     echo $view->render();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:80,代码来源:Controller.php

示例14: runUpdaterAndExit

 protected function runUpdaterAndExit()
 {
     $updater = new Piwik_Updater();
     $componentsWithUpdateFile = Piwik_CoreUpdater::getComponentUpdates($updater);
     if (empty($componentsWithUpdateFile)) {
         Piwik::redirectToModule('CoreHome');
     }
     Piwik::setMaxExecutionTime(0);
     $sqlQueries = $updater->getSqlQueriesToExecute();
     if (Piwik_Common::isPhpCliMode()) {
         $view = Piwik_View::factory('update_welcome');
         $this->doWelcomeUpdates($view, $componentsWithUpdateFile);
         if (!$this->coreError) {
             $view = Piwik_View::factory('update_database_done');
             $this->doExecuteUpdates($view, $updater, $componentsWithUpdateFile);
         }
     } else {
         if (Piwik_Common::getRequestVar('updateCorePlugins', 0, 'integer') == 1 || count($sqlQueries) == 1) {
             $this->warningMessages = array();
             $view = Piwik_View::factory('update_database_done');
             $this->doExecuteUpdates($view, $updater, $componentsWithUpdateFile);
         } else {
             $view = Piwik_View::factory('update_welcome');
             $view->queries = $sqlQueries;
             $this->doWelcomeUpdates($view, $componentsWithUpdateFile);
         }
     }
     exit;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:29,代码来源:Controller.php

示例15: logout

 /**
  * Logout current user
  *
  * @param none
  * @return void
  */
 public function logout()
 {
     self::clearSession();
     Piwik::redirectToModule('CoreHome');
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:11,代码来源:Controller.php


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