| <?php |
|
|
| |
| |
| |
| |
| |
| |
|
|
| namespace Piwik\Plugins\ImageGraph; |
|
|
| use Piwik\Common; |
| use Piwik\Piwik; |
| use Piwik\Plugins\API\API as APIPlugins; |
| use Piwik\SettingsPiwik; |
| use Piwik\View; |
|
|
| class Controller extends \Piwik\Plugin\Controller |
| { |
| |
| |
| |
| |
| public function index() |
| { |
| Piwik::checkUserHasSomeAdminAccess(); |
| $idSite = $this->idSite ?: 1; |
| $period = Common::getRequestVar('period', 'day', 'string'); |
| $date = Common::getRequestVar('date', 'today', 'string'); |
| $_GET['token_auth'] = Piwik::getCurrentUserTokenAuth(); |
| $reports = APIPlugins::getInstance()->getReportMetadata($idSite, $period, $date); |
| $plot = array(); |
| foreach ($reports as $report) { |
| if (!empty($report['imageGraphUrl'])) { |
| $plot[] = array( |
| |
| $report['category'] . ' › ' . $report['name'], |
| |
| SettingsPiwik::getPiwikUrl() . $report['imageGraphUrl'], |
| ); |
| } |
| } |
| $view = new View('@ImageGraph/index'); |
| $view->titleAndUrls = $plot; |
| return $view->render(); |
| } |
|
|
| |
| public function testAllSizes() |
| { |
| Piwik::checkUserHasSuperUserAccess(); |
|
|
| $view = new View('@ImageGraph/testAllSizes'); |
| $this->setGeneralVariablesView($view); |
|
|
| $period = Common::getRequestVar('period', 'day', 'string'); |
| $date = Common::getRequestVar('date', 'today', 'string'); |
|
|
| $_GET['token_auth'] = Piwik::getCurrentUserTokenAuth(); |
| $availableReports = APIPlugins::getInstance()->getReportMetadata($this->idSite, $period, $date); |
| $view->availableReports = $availableReports; |
| $view->graphTypes = array( |
| '', |
| |
| |
| |
| |
| |
| ); |
| $view->graphSizes = array( |
| array(null, null), |
| array(460, 150), |
| array(300, 150), |
| array(240, 150), |
| array(800, 150), |
| array(600, 300, $fontSize = 18, 300, 150), |
| ); |
| return $view->render(); |
| } |
| } |
|
|