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