getRestParams(); if (empty($params)) { $this->_addTopLinks(); } elseif (1 == count($params) && in_array($params[0], array('html', 'tcpdf'))) { $method = '_' . $params[0]; $this->{$method}(); } else { $this->_do404(); } return $this; } protected function _addTopLinks() { $baseUrl = \Qs_Request::getFinalBaseUrl(); $this->_addLinksItem( array( array('title' => 'HTML', 'url' => $baseUrl . '/html'), array('title' => 'HTML2PDF', 'url' => $baseUrl . '/tcpdf'), ) ); return $this; } protected function _getHtml() { $item = array('tpl' => $this->getTemplate('view.tpl')); $this->_addItem($item); return $this->_doc->fetchTemplate($item['tpl']); } protected function _html() { $this->_doc->setTemplatePath(array('SpeedyDoc', 'Doc')); echo $this->_getHtml(); exit; } protected function _tcpdf() { $pdf = \Qs_Pdf::factory(); $pdf->setHtml($this->_getHtml()); $pdf->inline(uniqid() . '.pdf'); exit; } }