/**
  * Write record about Job to LogBook
  */
 function writelogbookAction()
 {
     $jobid = intval($this->_request->getParam('jobid'));
     $name_job = trim($this->_request->getParam('name_job'));
     $endtime = trim($this->_request->getParam('endtime'));
     $joberrors = intval($this->_request->getParam('joberrors', 0));
     $this->view->title = $this->view->translate->_("Logbook: add new record");
     $this->view->wblogbook = new Wblogbook();
     $this->view->amessages = array();
     // setup new record
     // get data from table
     Zend_Loader::loadClass('Wbjobdesc');
     $table = new wbJobDesc();
     $select = $table->select()->where('name_job = ?', $name_job);
     $row = $table->fetchRow($select);
     if ($row) {
         $this->view->wblogbook->logTxt = $row->description . "\n" . $row->retention_period . "\n\n" . "{$name_job} {$endtime}\n\n" . "BACULA_JOBID={$jobid}\n";
     } else {
         $this->view->wblogbook->logTxt = "{$name_job}\n{$endtime}\n" . "BACULA_JOBID={$jobid}\n";
     }
     if ($joberrors > 0) {
         $this->view->wblogbook->logTypeId = 255;
         // Error
         $this->view->wblogbook->logTxt .= "\nJob Errors : " . $joberrors . "\n";
     } else {
         $this->view->wblogbook->logTypeId = 20;
     }
     // OK
     // get data from wbLogType
     Zend_Loader::loadClass('Wblogtype');
     $typs = new Wblogtype();
     $this->view->typs = $typs->fetchAll();
     // common fileds
     $this->view->wblogbook->logDateLast = null;
     $this->view->wblogbook->logId = null;
     $this->view->wblogbook->logDateCreate = date('Y-m-d H:i:s', time());
     $this->view->hiddenNew = 1;
     $this->view->aAllowedTags = $this->aAllowedTags;
     $this->view->joberrors = $joberrors;
     $this->view->jobid = $jobid;
     echo $this->renderScript('/wblogbook/add.phtml');
 }
 public function deleteAction()
 {
     $desc_id = intval($this->_request->getParam('desc_id'));
     $table = new wbJobDesc();
     $where = $table->getAdapter()->quoteInto('desc_id = ?', $desc_id);
     $table->delete($where);
     $this->_helper->redirector('index');
 }