Piwik\Plugin\Report::render PHP Method

render() public method

Renders a report depending on the configured ViewDataTable see {@link configureView()} and {@link getDefaultTypeViewDataTable()}. If you want to customize the render process or just render any custom view you can overwrite this method.
public render ( ) : string
return string
    public function render()
    {
        $viewDataTable = Common::getRequestVar('viewDataTable', false, 'string');
        $fixed = Common::getRequestVar('forceView', 0, 'int');
        $module = $this->getModule();
        $action = $this->getAction();
        $apiProxy = Proxy::getInstance();
        if (!$apiProxy->isExistingApiAction($module, $action)) {
            throw new Exception("Invalid action name '{$module}' for '{$action}' plugin.");
        }
        $apiAction = $apiProxy->buildApiActionName($module, $action);
        $view = ViewDataTableFactory::build($viewDataTable, $apiAction, $module . '.' . $action, $fixed);
        return $view->render();
    }

Usage Example

コード例 #1
0
ファイル: Controller.php プロジェクト: bossrabbit/piwik
 public function renderReportWidget(Report $report)
 {
     Piwik::checkUserHasSomeViewAccess();
     $this->checkSitePermission();
     $report->checkIsEnabled();
     return $report->render();
 }