diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-08-02 17:59:33 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-08-02 17:59:33 +0400 |
commit | a96ec40e983a8b64f4c25def541a519ff3670e6a (patch) | |
tree | bef2a5f7b1e9532dc96161334e23a553cdff7ea1 /plugins/Dashboard | |
parent | 61997f45e4c39360000e815c9e0853ae04e2f56f (diff) |
Refs #4059 Converting dozens of plugins/* classes to use Namespaces, \Piwik\Plugins\*
Added namespaces to functions.php files in the five plugins that had one
Work in progress
Diffstat (limited to 'plugins/Dashboard')
-rw-r--r-- | plugins/Dashboard/API.php | 22 | ||||
-rw-r--r-- | plugins/Dashboard/Controller.php | 28 | ||||
-rw-r--r-- | plugins/Dashboard/Dashboard.php | 11 |
3 files changed, 32 insertions, 29 deletions
diff --git a/plugins/Dashboard/API.php b/plugins/Dashboard/API.php index dd87979739..1330eacef6 100644 --- a/plugins/Dashboard/API.php +++ b/plugins/Dashboard/API.php @@ -5,21 +5,22 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * @category Piwik_Plugins - * @package Piwik_Dashboard + * @package Dashboard */ +namespace Piwik\Plugins\Dashboard; + use Piwik\Piwik; use Piwik\WidgetsList; - /** * This API is the <a href='http://piwik.org/docs/analytics-api/reference/' target='_blank'>Dashboard API</a>: it gives information about dashboards. * * @package Piwik_API */ -class Piwik_Dashboard_API +class API { /** - * @var Piwik_Dashboard_API + * @var \Piwik\Plugins\Dashboard\API */ static private $instance = null; @@ -27,11 +28,11 @@ class Piwik_Dashboard_API public function __construct() { - $this->dashboard = new Piwik_Dashboard(); + $this->dashboard = new Dashboard(); } /** - * @return Piwik_Dashboard_API + * @return \Piwik\Plugins\Dashboard\API */ static public function getInstance() { @@ -83,7 +84,7 @@ class Piwik_Dashboard_API */ private function getUserDashboards() { - $userLogin = Piwik::getCurrentUserLogin(); + $userLogin = Piwik::getCurrentUserLogin(); $userDashboards = $this->dashboard->getAllDashboards($userLogin); $dashboards = array(); @@ -91,10 +92,9 @@ class Piwik_Dashboard_API foreach ($userDashboards as $userDashboard) { if ($this->hasDashboardColumns($userDashboard)) { - $widgets = $this->getExistingWidgetsWithinDashboard($userDashboard); + $widgets = $this->getExistingWidgetsWithinDashboard($userDashboard); $dashboards[] = $this->buildDashboard($userDashboard, $widgets); } - } return $dashboards; @@ -111,8 +111,8 @@ class Piwik_Dashboard_API foreach ($column as $widget) { if ($this->widgetIsNotHidden($widget) && $this->widgetExists($widget)) { - $module = $widget->parameters->module; - $action = $widget->parameters->action; + $module = $widget->parameters->module; + $action = $widget->parameters->action; $widgets[] = array('module' => $module, 'action' => $action); } diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php index 7ffe0dc79e..bded95b33e 100644 --- a/plugins/Dashboard/Controller.php +++ b/plugins/Dashboard/Controller.php @@ -5,12 +5,14 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * @category Piwik_Plugins - * @package Piwik_Dashboard + * @package Dashboard */ +namespace Piwik\Plugins\Dashboard; + use Piwik\DataTable\Renderer\Json; use Piwik\Piwik; use Piwik\Common; -use Piwik\Controller; +use Piwik\Plugins\Dashboard\Dashboard; use Piwik\Session\SessionNamespace; use Piwik\View; use Piwik\Db; @@ -19,12 +21,12 @@ use Piwik\WidgetsList; /** * Dashboard Controller * - * @package Piwik_Dashboard + * @package Dashboard */ -class Piwik_Dashboard_Controller extends Controller +class Controller extends \Piwik\Controller { /** - * @var Piwik_Dashboard + * @var Dashboard */ private $dashboard; @@ -32,7 +34,7 @@ class Piwik_Dashboard_Controller extends Controller { parent::init(); - $this->dashboard = new Piwik_Dashboard(); + $this->dashboard = new Dashboard(); } protected function _getDashboardView($template) @@ -96,7 +98,7 @@ class Piwik_Dashboard_Controller extends Controller $layout = $this->dashboard->getDefaultLayout(); $idDashboard = Common::getRequestVar('idDashboard', 1, 'int'); if (Piwik::isUserIsAnonymous()) { - $session = new SessionNamespace("Piwik_Dashboard"); + $session = new SessionNamespace("Dashboard"); $session->dashboardLayout = $layout; $session->setExpirationSeconds(1800); } else { @@ -161,15 +163,15 @@ class Piwik_Dashboard_Controller extends Controller public function getAllDashboards() { $this->checkTokenInUrl(); - + if (Piwik::isUserIsAnonymous()) { Json::sendHeaderJSON(); echo '[]'; - + return; } - $login = Piwik::getCurrentUserLogin(); + $login = Piwik::getCurrentUserLogin(); $dashboards = $this->dashboard->getAllDashboards($login); Json::sendHeaderJSON(); @@ -260,7 +262,7 @@ class Piwik_Dashboard_Controller extends Controller $idDashboard = Common::getRequestVar('idDashboard', 1, 'int'); $name = Common::getRequestVar('name', '', 'string'); if (Piwik::isUserIsAnonymous()) { - $session = new SessionNamespace("Piwik_Dashboard"); + $session = new SessionNamespace("Dashboard"); $session->dashboardLayout = $layout; $session->setExpirationSeconds(1800); } else { @@ -298,14 +300,13 @@ class Piwik_Dashboard_Controller extends Controller { if (Piwik::isUserIsAnonymous()) { - $session = new SessionNamespace("Piwik_Dashboard"); + $session = new SessionNamespace("Dashboard"); if (!isset($session->dashboardLayout)) { return $this->dashboard->getDefaultLayout(); } $layout = $session->dashboardLayout; - } else { $layout = $this->dashboard->getLayoutForUser(Piwik::getCurrentUserLogin(), $idDashboard); } @@ -335,7 +336,6 @@ class Piwik_Dashboard_Controller extends Controller array(25, 25, 25, 25) ); } - } diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php index 13d25ee9cb..58618e05b4 100644 --- a/plugins/Dashboard/Dashboard.php +++ b/plugins/Dashboard/Dashboard.php @@ -6,19 +6,22 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * * @category Piwik_Plugins - * @package Piwik_Dashboard + * @package Dashboard */ +namespace Piwik\Plugins\Dashboard; + +use Exception; use Piwik\Piwik; use Piwik\Common; -use Piwik\Plugin; use Piwik\Site; use Piwik\Db; use Piwik\WidgetsList; +use Zend_Registry; /** - * @package Piwik_Dashboard + * @package Dashboard */ -class Piwik_Dashboard extends Plugin +class Dashboard extends \Piwik\Plugin { /** * @see Piwik_Plugin::getListHooksRegistered |