Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #4134 renamed some more hooks and removed some not used and not …
…needed hooks
- Loading branch information
Showing
51 changed files
with
604 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* @category Piwik_Plugins | ||
* @package Piwik_LiveTab | ||
*/ | ||
|
||
namespace Piwik\Plugins\LiveTab; | ||
|
||
use Piwik\Piwik; | ||
|
||
/** | ||
* @package Piwik_LiveTab | ||
*/ | ||
class API | ||
{ | ||
/** | ||
* @var API | ||
*/ | ||
static private $instance = null; | ||
|
||
/** | ||
* @return API | ||
*/ | ||
static public function getInstance() | ||
{ | ||
if (null == self::$instance) { | ||
self::$instance = new self; | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
public function setSettings($metric, $lastMinutes, $refreshInterval) | ||
{ | ||
// TODO add login as parameter | ||
Piwik::checkUserHasSomeViewAccess(); | ||
|
||
if (!$this->isAllowedMetric($metric)) { | ||
throw new \Exception(Piwik_TranslateException('LiveTab_InvalidMetric')); | ||
} | ||
|
||
$lastMinutes = (int) $lastMinutes; | ||
$refreshInterval = (int) $refreshInterval; | ||
|
||
$login = Piwik::getCurrentUserLogin(); | ||
|
||
$model = new Model($login); | ||
$model->setSettings($metric, $lastMinutes, $refreshInterval); | ||
} | ||
|
||
public function getSettings() | ||
{ | ||
// TODO add login as parameter | ||
|
||
Piwik::checkUserHasSomeViewAccess(); | ||
|
||
$login = Piwik::getCurrentUserLogin(); | ||
|
||
$model = new Model($login); | ||
$settings = $model->getSettings(); | ||
|
||
if (empty($settings)) { | ||
return $this->getDefaultSettings(); | ||
} | ||
|
||
return array( | ||
'metric' => $settings['metric'], | ||
'lastMinutes' => $settings['last_minutes'], | ||
'refreshInterval' => $settings['refresh_interval'] | ||
); | ||
} | ||
|
||
public function getAvailableMetrics() | ||
{ | ||
return array( | ||
'visits' => Piwik_Translate('General_ColumnNbVisits'), | ||
'actions' => Piwik_Translate('General_ColumnNbActions'), | ||
'visitsConverted' => Piwik_Translate('Goals_GoalConversions'), | ||
'visitors' => Piwik_Translate('General_ColumnNbUniqVisitors') | ||
); | ||
} | ||
|
||
private function getDefaultSettings() | ||
{ | ||
return array( | ||
'metric' => LiveTab::$defaultMetricToDisplay, | ||
'lastMinutes' => LiveTab::$defaultLastMinutes, | ||
'refreshInterval' => LiveTab::$defaultRefreshInterval | ||
); | ||
} | ||
|
||
private function isAllowedMetric($metric) | ||
{ | ||
return in_array($metric, array_keys($this->getAvailableMetrics())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
* @category Piwik_Plugins | ||
* @package Piwik_LiveTab | ||
*/ | ||
|
||
namespace Piwik\Plugins\LiveTab; | ||
|
||
use Piwik\Controller\Admin; | ||
use Piwik\Piwik; | ||
use Piwik\View; | ||
|
||
/** | ||
* | ||
* @package Piwik_LiveTab | ||
*/ | ||
class Controller extends Admin | ||
{ | ||
public function index() | ||
{ | ||
Piwik::checkUserIsNotAnonymous(); | ||
|
||
$view = new View('@LiveTab/index'); | ||
|
||
$api = new API(); | ||
$settings = $api->getSettings(); | ||
|
||
$view->metricToDisplay = $settings['metric']; | ||
$view->lastMinutes = $settings['lastMinutes']; | ||
$view->refreshInterval = $settings['refreshInterval']; | ||
$view->availableMetrics = $api->getAvailableMetrics(); | ||
|
||
$this->setBasicVariablesView($view); | ||
|
||
echo $view->render(); | ||
} | ||
} |
Oops, something went wrong.
Wouldn't
Menu.Main.addItems
make more sense? Looking at the UI the menu really looks like a main menu. Admin and Top menu describe positions, where Reporting describes the type of menu.