public function getsettingsAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper("layout")->disableLayout();
     $aJson = null;
     $oModelVOrderJournal = new User_Model_VOrderJournal();
     if ($this->_request->isPost()) {
         $aPostData = $this->_request->getPost();
         $nOrderId = (int) $aPostData["order_id"];
         if (is_numeric($nOrderId) && $nOrderId > 0) {
             $aRow = $oModelVOrderJournal->getOne($nOrderId)->toArray();
             $aJson = array("success" => true, "row" => $aRow);
         }
     }
     header("Content-type: application/json");
     echo Zend_Json::encode($aJson);
     exit;
 }
 public function printAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper("layout")->disableLayout();
     require_once "../library/zkk/AppCms2/tcpdf/tcpdf.php";
     $nOrderId = (int) $this->_getParam("no");
     if (is_numeric($nOrderId) && $nOrderId > 0 && in_array($this->_sRoleName, array("librarian", "administrator", "superadministrator"))) {
         $oModelOrderJournal = new User_Model_VOrderJournal();
         $oModelOrderChangeLog = new User_Model_OrderChangeLog();
         $oModelOrderJournalOrderChangeLog = new User_Model_OrderJournalOrderChangeLog();
         $oOrderJournal = $oModelOrderJournal->getOne($nOrderId);
         $oPdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, "UTF-8", false);
         $oPdf->setFont("freesans");
         $oPdf->setPrintHeader(false);
         $oPdf->addPage();
         $oPdf->SetFontSize(12);
         $oPdf->writeHTMLCell(60, 10, "", 5, "<strong>{$oOrderJournal->call_id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(120, 10, "", "", "ZAKŁADKA ZAMÓWIENIA KOPII", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numer zamówienia: <strong>{$oOrderJournal->id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(75, 5, "", "", "Sygnatura: <strong>{$oOrderJournal->call_id}</strong><br />Sygnatura lokalna: <strong>{$oOrderJournal->csa_call_id}</strong><br />Kolekcja: <strong>{$oOrderJournal->collection}</strong>", 0, 1, false, true, "R", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 30, "", "", "Tytuł książki / czasopisma:<br /><strong>{$oOrderJournal->journal_title}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Rocznik: <strong>{$oOrderJournal->journal_year_publication}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numeracja: <strong>{$oOrderJournal->journal_number}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Strony od: <strong>{$oOrderJournal->page_from}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Strony do: <strong>{$oOrderJournal->page_until}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Autor: <strong>{$oOrderJournal->article_author}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 30, "", "", "Nazwa rozdziału / artykułu:<br /><strong>{$oOrderJournal->article_title}</strong>", 1, 1, false, true, "L", true);
         $sCurrTime = date("Y-m-d H:i:s", time());
         $sHtml1 = "\n        Data zamówienia: <strong>{$sCurrTime}</strong><br /><br />\n        Zamówione dla: <br /><strong>{$oOrderJournal->user_first_name} {$oOrderJournal->user_last_name}</strong><br /><br />\n        Przekazać do: <br /><strong></strong>\n      ";
         $oPdf->writeHTMLCell(95, 5, 110, 75, $sHtml1, 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(60, 10, "", 150, "<strong>{$oOrderJournal->call_id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(120, 10, "", "", "ZAKŁADKA ZAMÓWIENIA KOPII", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numer zamówienia: <strong>{$oOrderJournal->id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(75, 5, "", "", "Sygnatura: <strong>{$oOrderJournal->call_id}</strong><br />Sygnatura lokalna: <strong>{$oOrderJournal->csa_call_id}</strong><br />Kolekcja: <strong>{$oOrderJournal->collection}</strong>", 0, 1, false, true, "R", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 30, "", "", "Tytuł książki / czasopisma:<br /><strong>{$oOrderJournal->journal_title}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Rocznik: <strong>{$oOrderJournal->journal_year_publication}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numeracja: <strong>{$oOrderJournal->journal_number}</strong>", 1, 1, false, true, "L", true);
         $sHtml2 = "\n        Data zamówienia: <strong>{$sCurrTime}</strong><br /><br />\n        Zamówione dla: <br /><strong></strong>\n      ";
         $oPdf->writeHTMLCell(95, 5, 110, 190, $sHtml2, 0, 1, false, true, "L", true);
         $oPdf->Output($nOrderId . ".pdf", "I");
         $nOrderChangeLogId = $oModelOrderChangeLog->addRow(array("order_change_type_id" => 3, "user_id" => $this->_oAuth->getStorage()->read()->user_id, "date" => time()));
         $oModelOrderJournalOrderChangeLog->addRow(array("order_journal_id" => $nOrderId, "order_change_log_id" => $nOrderChangeLogId));
     }
     exit;
 }