本文整理汇总了PHP中Piwik\Piwik::redirectToModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::redirectToModule方法的具体用法?PHP Piwik::redirectToModule怎么用?PHP Piwik::redirectToModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Piwik
的用法示例。
在下文中一共展示了Piwik::redirectToModule方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
public function dispatch()
{
$module = Common::getRequestVar('module', '', 'string');
$action = Common::getRequestVar('action', '', 'string');
if ($module == 'CoreUpdater' || $module == 'Proxy' || $module == 'Installation' || $module == 'LanguagesManager' && $action == 'saveLanguage') {
return;
}
$updater = new PiwikCoreUpdater();
$updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
if (!empty($updates)) {
Filesystem::deleteAllCacheOnUpdate();
}
if ($updater->getComponentUpdates() !== null) {
if (FrontController::shouldRethrowException()) {
throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
} elseif ($module === 'API') {
$outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST));
$response = new ResponseBuilder($outputFormat);
$e = new Exception('Database Upgrade Required. Your Piwik database is out-of-date, and must be upgraded before you can continue.');
echo $response->getResponseException($e);
Common::sendResponseCode(503);
exit;
} else {
Piwik::redirectToModule('CoreUpdater');
}
}
}
示例2: getSparklines
public function getSparklines()
{
$idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER;
$view = new View('@Ecommerce/getSparklines');
$view->onlyConversionOverview = false;
$view->conversionsOverViewEnabled = true;
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
$goalDefinition['name'] = $this->translator->translate('Goals_Ecommerce');
$goalDefinition['allow_multiple'] = true;
} else {
$goals = GoalsApi::getInstance()->getGoals($this->idSite);
if (!isset($goals[$idGoal])) {
Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
}
$goalDefinition = $goals[$idGoal];
}
$this->setGeneralVariablesView($view);
$goal = $this->getMetricsForGoal($idGoal);
foreach ($goal as $name => $value) {
$view->{$name} = $value;
}
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
$goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART);
foreach ($goal as $name => $value) {
$name = 'cart_' . $name;
$view->{$name} = $value;
}
}
$view->idGoal = $idGoal;
$view->goalAllowMultipleConversionsPerVisit = $goalDefinition['allow_multiple'];
return $view->render();
}
示例3: dispatch
public function dispatch()
{
$module = Common::getRequestVar('module', '', 'string');
$action = Common::getRequestVar('action', '', 'string');
$updater = new PiwikCoreUpdater();
$updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
if (!empty($updates)) {
Filesystem::deleteAllCacheOnUpdate();
}
if ($updater->getComponentUpdates() !== null && $module != 'CoreUpdater' && $module != 'Proxy' && $module != 'Installation' && !($module == 'LanguagesManager' && $action == 'saveLanguage')) {
if (FrontController::shouldRethrowException()) {
throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
} else {
Piwik::redirectToModule('CoreUpdater');
}
}
}
示例4: getGoalReportView
protected function getGoalReportView($idGoal = false)
{
$view = new View('@Goals/getGoalReportView');
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
$goalDefinition['name'] = $this->translator->translate('Goals_Ecommerce');
$goalDefinition['allow_multiple'] = true;
$ecommerce = $view->ecommerce = true;
} else {
if (!isset($this->goals[$idGoal])) {
Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
}
$goalDefinition = $this->goals[$idGoal];
}
$this->setGeneralVariablesView($view);
$goal = $this->getMetricsForGoal($idGoal);
foreach ($goal as $name => $value) {
$view->{$name} = $value;
}
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
$goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART);
foreach ($goal as $name => $value) {
$name = 'cart_' . $name;
$view->{$name} = $value;
}
}
$view->showHeadline = false;
$view->idGoal = $idGoal;
$view->goalName = $goalDefinition['name'];
$view->goalAllowMultipleConversionsPerVisit = $goalDefinition['allow_multiple'];
$view->graphEvolution = $this->getEvolutionGraph(array(), $idGoal, array('nb_conversions'));
$view->nameGraphEvolution = 'Goals.getEvolutionGraph' . $idGoal;
$view->topDimensions = $this->getTopDimensions($idGoal);
$goalMetrics = Request::processRequest('Goals.get', array('idGoal' => $idGoal));
// conversion rate for new and returning visitors
$view->conversion_rate_returning = $this->formatConversionRate($goalMetrics, 'conversion_rate_returning_visit');
$view->conversion_rate_new = $this->formatConversionRate($goalMetrics, 'conversion_rate_new_visit');
$view->goalReportsByDimension = $this->getGoalReportsByDimensionTable($view->nb_conversions, isset($ecommerce), !empty($view->cart_nb_conversions));
return $view;
}
示例5: logout
/**
* Logout current user
*
* @param none
* @return void
*/
public function logout()
{
self::clearSession();
$logoutUrl = @Config::getInstance()->General['login_logout_url'];
if (empty($logoutUrl)) {
Piwik::redirectToModule('CoreHome');
} else {
Url::redirectToUrl($logoutUrl);
}
}
示例6: index
public function index()
{
$language = Common::getRequestVar('language', '');
if (!empty($language)) {
LanguagesManager::setLanguageForSession($language);
}
try {
return $this->runUpdaterAndExit();
} catch (NoUpdatesFoundException $e) {
Piwik::redirectToModule('CoreHome');
}
}
示例7: redirectToNextStep
/**
* Redirect to next step
*
* @param string $currentStep Current step
* @return void
*/
private function redirectToNextStep($currentStep, $parameters = array())
{
$steps = array_keys($this->steps);
$nextStep = $steps[1 + array_search($currentStep, $steps)];
Piwik::redirectToModule('Installation', $nextStep, $parameters);
}
示例8: setIgnoreCookie
public function setIgnoreCookie()
{
Piwik::checkUserHasSomeViewAccess();
Piwik::checkUserIsNotAnonymous();
$salt = Common::getRequestVar('ignoreSalt', false, 'string');
if ($salt !== $this->getIgnoreCookieSalt()) {
throw new Exception("Not authorized");
}
IgnoreCookie::setIgnoreCookie();
Piwik::redirectToModule('UsersManager', 'userSettings', array('token_auth' => false));
}
示例9: getGoalReportView
protected function getGoalReportView($idGoal = false)
{
$view = new View('@Goals/getGoalReportView');
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
$goalDefinition['name'] = Piwik::translate('Goals_Ecommerce');
$goalDefinition['allow_multiple'] = true;
$ecommerce = $view->ecommerce = true;
} else {
if (!isset($this->goals[$idGoal])) {
Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
}
$goalDefinition = $this->goals[$idGoal];
}
$this->setGeneralVariablesView($view);
$goal = $this->getMetricsForGoal($idGoal);
foreach ($goal as $name => $value) {
$view->{$name} = $value;
}
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
$goal = $this->getMetricsForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART);
foreach ($goal as $name => $value) {
$name = 'cart_' . $name;
$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 = 'Goals.getEvolutionGraph' . $idGoal;
$view->topDimensions = $this->getTopDimensions($idGoal);
// conversion rate for new and returning visitors
$segment = \Piwik\Plugins\VisitFrequency\API::RETURNING_VISITOR_SEGMENT;
$conversionRateReturning = API::getInstance()->getConversionRate($this->idSite, Common::getRequestVar('period'), Common::getRequestVar('date'), $segment, $idGoal);
$view->conversion_rate_returning = $this->formatConversionRate($conversionRateReturning);
$segment = 'visitorType==new';
$conversionRateNew = API::getInstance()->getConversionRate($this->idSite, Common::getRequestVar('period'), Common::getRequestVar('date'), $segment, $idGoal);
$view->conversion_rate_new = $this->formatConversionRate($conversionRateNew);
$view->goalReportsByDimension = $this->getGoalReportsByDimensionTable($view->nb_conversions, isset($ecommerce), !empty($view->cart_nb_conversions));
return $view;
}
示例10: runUpdaterAndExit
protected function runUpdaterAndExit()
{
$updater = new Updater();
$componentsWithUpdateFile = CoreUpdater::getComponentUpdates($updater);
if (empty($componentsWithUpdateFile)) {
Piwik::redirectToModule('CoreHome');
}
SettingsServer::setMaxExecutionTime(0);
$cli = Common::isPhpCliMode() ? '_cli' : '';
$welcomeTemplate = '@CoreUpdater/runUpdaterAndExit_welcome' . $cli;
$doneTemplate = '@CoreUpdater/runUpdaterAndExit_done' . $cli;
$viewWelcome = new View($welcomeTemplate);
$viewDone = new View($doneTemplate);
if (Common::isPhpCliMode()) {
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
$output = $viewWelcome->render();
if (!$this->coreError && Piwik::getModule() == 'CoreUpdater') {
$this->doExecuteUpdates($viewDone, $updater, $componentsWithUpdateFile);
$output .= $viewDone->render();
}
return $output;
} else {
if (Common::getRequestVar('updateCorePlugins', 0, 'integer') == 1) {
$this->warningMessages = array();
$this->doExecuteUpdates($viewDone, $updater, $componentsWithUpdateFile);
$this->redirectToDashboardWhenNoError($updater);
return $viewDone->render();
} else {
$viewWelcome->queries = $updater->getSqlQueriesToExecute();
$viewWelcome->isMajor = $updater->hasMajorDbUpdate();
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
return $viewWelcome->render();
}
}
exit;
}
示例11: setDateTodayIfWebsiteCreatedToday
protected function setDateTodayIfWebsiteCreatedToday()
{
$date = Common::getRequestVar('date', false);
if ($date == 'today' || Common::getRequestVar('period', false) == 'range') {
return;
}
$websiteId = Common::getRequestVar('idSite', false, 'int');
if ($websiteId) {
$website = new Site($websiteId);
$datetimeCreationDate = $website->getCreationDate()->getDatetime();
$creationDateLocalTimezone = Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d');
$todayLocalTimezone = Date::factory('now', $website->getTimezone())->toString('Y-m-d');
if ($creationDateLocalTimezone == $todayLocalTimezone) {
Piwik::redirectToModule('CoreHome', 'index', array('date' => 'today', 'idSite' => $websiteId, 'period' => Common::getRequestVar('period')));
}
}
}
示例12: setIgnoreCookie
public function setIgnoreCookie()
{
Piwik::checkUserHasSomeViewAccess();
Piwik::checkUserIsNotAnonymous();
$this->checkTokenInUrl();
IgnoreCookie::setIgnoreCookie();
Piwik::redirectToModule('UsersManager', 'userSettings', array('token_auth' => false));
}
示例13: redirectToNextStep
/**
* Redirect to next step
*
* @param string $currentStep Current step
* @return void
*/
protected function redirectToNextStep($currentStep)
{
$steps = array_keys($this->steps);
$this->session->currentStepDone = $currentStep;
$nextStep = $steps[1 + array_search($currentStep, $steps)];
Piwik::redirectToModule('Installation', $nextStep);
}
示例14: logout
/**
* Logout current user
*
* @param none
* @return void
*/
public function logout()
{
Piwik::postEvent('Login.logout', array(Piwik::getCurrentUserLogin()));
self::clearSession();
$logoutUrl = @Config::getInstance()->General['login_logout_url'];
if (empty($logoutUrl)) {
Piwik::redirectToModule('CoreHome');
} else {
Url::redirectToUrl($logoutUrl);
}
}