diff options
Diffstat (limited to 'plugins/CoreHome/Controller.php')
-rw-r--r-- | plugins/CoreHome/Controller.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index 18eb842483..ef25ac1d1a 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -16,6 +16,7 @@ use Piwik\FrontController; use Piwik\Menu\MenuMain; use Piwik\Notification\Manager as NotificationManager; use Piwik\Piwik; +use Piwik\Plugin\Report; use Piwik\Plugins\CoreHome\DataTableRowAction\MultiRowEvolution; use Piwik\Plugins\CoreHome\DataTableRowAction\RowEvolution; use Piwik\Plugins\CorePluginsAdmin\MarketplaceApiClient; @@ -37,6 +38,42 @@ class Controller extends \Piwik\Plugin\Controller return 'redirectToCoreHomeIndex'; } + public function renderMenuReport() + { + $reportModule = Common::getRequestVar('reportModule', null, 'string'); + $reportAction = Common::getRequestVar('reportAction', null, 'string'); + + $report = Report::factory($reportModule, $reportAction); + + if (empty($report)) { + throw new Exception('This report does not exist'); + } + + if (!$report->isEnabled()) { + throw new Exception('This report is not enabled. Maybe you do not have enough permission'); + } + + return View::singleReport($report->getName(), $this->renderWidget()); + } + + public function renderWidget() + { + $reportModule = Common::getRequestVar('reportModule', null, 'string'); + $reportAction = Common::getRequestVar('reportAction', null, 'string'); + + $report = Report::factory($reportModule, $reportAction); + + if (empty($report)) { + throw new Exception('This report does not exist'); + } + + if (!$report->isEnabled()) { + throw new Exception('This report is not enabled. Maybe you do not have enough permission'); + } + + return $report->render(); + } + function redirectToCoreHomeIndex() { $defaultReport = API::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), API::PREFERENCE_DEFAULT_REPORT); |