/**
  * Get an specific report by its Id
  */
 public function getAction()
 {
     $output = $this->getRequest()->getParam('output', 'json');
     $type = $this->getRequest()->getParam('id');
     // Custom download report name
     if ($type !== ReportModel::KPI_MONTHLY) {
         throw new InvalidArgumentException("Only Report KPI/ARPU available.");
     }
     // Check report permissions by type
     $dumpReport = new ReportModel();
     $dumpReport->setType($type);
     $this->_helper->allowed('read', $dumpReport);
     if ($output !== 'json') {
         throw new InvalidArgumentException("Only JSON output available.");
     }
     $helper = $this->_helper->output('Stream_Json');
     // Load report
     $params = $this->getRequest()->getParams();
     $params['type'] = $type;
     $this->view->data = \Application\Service\ReportService::getInstance()->load($type, $params);
     if (is_null($this->view->data)) {
         throw new \Application\Exceptions\NotFoundException("Report not available");
     }
     if (isset($params['requiredFields'])) {
         $requiredFields = explode(':', $params['requiredFields']);
         $this->view->setAllowedFields($requiredFields);
     }
     if (isset($params['skipEmptyItems']) && $params['skipEmptyItems']) {
         $this->view->setSkipEmptyItems(true);
     }
     $helper->addHeaders();
     $this->getResponse()->sendHeaders();
     $this->view->render('');
     $this->_helper->forceExit();
 }
 public function setUp()
 {
     $this->_reportService = ReportService::getInstance();
     self::initAuthUser(self::PROVIDER_COMMERCIAL_USER_ID);
 }
 public function init()
 {
     $this->_downloadTokenSrv = Download\Service\DownloadTokenService::getInstance();
     $this->_reportSrv = ReportService::getInstance();
 }
 public function init()
 {
     $this->_reportSrv = \Application\Service\ReportService::getInstance();
 }