singleReport() public static method

Can be used for pages that display only one report to avoid having to create a new template.
public static singleReport ( string $title, string $reportHtml ) : string | void
$title string The report title.
$reportHtml string The report body HTML.
return string | void The report contents if `$fetch` is true.
Example #1
0
 public function renderReportMenu(Report $report)
 {
     Piwik::checkUserHasSomeViewAccess();
     $this->checkSitePermission();
     $report->checkIsEnabled();
     $menuTitle = $report->getMenuTitle();
     if (empty($menuTitle)) {
         throw new Exception('This report is not supposed to be displayed in the menu, please define a $menuTitle in your report.');
     }
     $menuTitle = $this->translator->translate($menuTitle);
     $content = $this->renderReportWidget($report);
     return View::singleReport($menuTitle, $content);
 }
Example #2
0
 protected function indexEvent($controllerMethod)
 {
     $count = 1;
     $apiMethod = str_replace('index', 'get', $controllerMethod, $count);
     $events = new Events();
     $title = $events->getReportTitleTranslation($apiMethod);
     if (method_exists($this, $apiMethod)) {
         $content = $this->{$apiMethod}();
     } else {
         $content = $this->renderReport($apiMethod);
     }
     return View::singleReport($title, $content);
 }
Example #3
0
 public function renderReportMenu($reportModule = null, $reportAction = null)
 {
     Piwik::checkUserHasSomeViewAccess();
     $this->checkSitePermission();
     $report = Report::factory($reportModule, $reportAction);
     if (empty($report)) {
         throw new Exception(Piwik::translate('General_ExceptionReportNotFound'));
     }
     $report->checkIsEnabled();
     $menuTitle = $report->getMenuTitle();
     if (empty($menuTitle)) {
         throw new Exception('This report is not supposed to be displayed in the menu, please define a $menuTitle in your report.');
     }
     $menuTitle = Piwik::translate($menuTitle);
     $content = $this->renderReportWidget($reportModule, $reportAction);
     return View::singleReport($menuTitle, $content);
 }
Example #4
0
 public function indexCampaigns()
 {
     return View::singleReport(Piwik::translate('Referrers_Campaigns'), $this->getCampaigns(true));
 }
Example #5
0
 public function indexOutlinks()
 {
     return View::singleReport(Piwik::translate('General_Outlinks'), $this->getOutlinks(true));
 }
Example #6
0
 protected function indexEvent($controllerMethod)
 {
     $count = 1;
     $apiMethod = str_replace('index', 'get', $controllerMethod, $count);
     $events = new Events();
     $title = $events->getReportTitleTranslation($apiMethod);
     return View::singleReport($title, $this->{$apiMethod}());
 }
Example #7
0
 public function menuGetContentPieces()
 {
     $report = new GetContentPieces();
     return View::singleReport($report->getName(), $report->render());
 }
Example #8
0
 public function menuGetContentPieces()
 {
     $report = Report::factory($this->pluginName, 'getContentPieces');
     return View::singleReport($report->getName(), $report->render());
 }
Example #9
0
 public function index()
 {
     return View::singleReport(Piwik::translate('CustomVariables_CustomVariables'), $this->getCustomVariables(true));
 }