_action = $this->getRestParam(0); if (!in_array($this->_action, $this->_actions)) { throw new Exception('Unsupported action ' . $this->_action); } $this->_callAction(); } protected function _doExport() { $tool = $this->getPdfExportTool(); $tool->setPdfFactoryCallback([$this, 'createPdf']); $tool->export(); exit; } protected function _doView() { if (false === constant('DEBUG')) { $this->_do404(); } $id = $this->getRestParam(1); $this->createPdf($id, 'view.pdf', true); exit; } /** * @return Tool */ abstract protected function getPdfExportTool(); abstract public function createPdf($id, $file, $output = false); public static function getExportUrl() { return self::getPage('url') . '/' . self::ACTION_EXPORT; } public static function getViewUrl() { return self::getPage('url') . '/' . self::ACTION_VIEW; } }