Exemplo n.º 1
0
    public function Header()
    {
        $pdf = $this;
        $pdf->SetFont('freeserif', '', 7);
        $pdf->SetMargins(5, 5, 5);
        $i = $pdf->getPage();
        $companyName = App_Env::getCompanyName();
        $userFullName = App_Env::getUserFullName();
        $curentDate = App_Env::getCurrentDate();
        $caption = $this->caption;
        if ($pdf->CurOrientation == 'L') {
            $width = '80%';
        } else {
            $width = '70%';
        }
        $html = <<<HTML
<table   style="width: 100%;" width="100%" >
<tr><td style="width:{$width};border: none;text-align:left; ">{$companyName}</td>
    <td style="width: 50px;border: none;text-align: right;">Print Date:</td>
    <td style="width: 150px;border: none;text-align: right; ">{$curentDate}</td></tr>
<tr><td style="border: none;">{$caption}</td>
    <td style="width: 50px;border: none;text-align: right;">Print by:</td>
    <td style="width: 150px;border: none;text-align: right;">{$userFullName}</td></tr>
</table>
HTML;
        $pdf->writeHTML($html, true, true, false, false, '');
    }
Exemplo n.º 2
0
 function init()
 {
     parent::init();
     $fileid = $this->_fileName;
     $this->SetFont('freeserif', '', 14);
     $this->AddPage();
     $name = App_Env::getUserFullName();
     $wartermark = 'ผู้พิมพ์รายงาน ' . $name . ' ' . date('d/m/Y h i s') . 'เลขที่เอกสาร ' . $fileid . '  www.thaidxc.org ';
     $this->SetKeywords($wartermark);
     $this->StartTransform();
     $this->SetAlpha(0.1, 'Screen');
     $this->Rotate(45, 0, 200);
     for ($i = 0; $i <= 10; $i++) {
         $this->Text(-$i * 10, 88 + $i * 20, $wartermark . $wartermark);
         //. $wartermark . $wartermark
     }
     $this->StopTransform();
 }
Exemplo n.º 3
0
 /**
  * This method is used to render the page footer. 
  * It is automatically called by AddPage() and could be overwritten in your own inherited class.
  */
 public function Footer()
 {
     $cur_y = $this->GetY();
     $ormargins = $this->getOriginalMargins();
     $this->SetTextColor(0, 0, 0);
     //set style for cell border
     $line_width = 0.85 / $this->getScaleFactor();
     $this->SetLineStyle(array('width' => $line_width, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     //print document barcode
     $barcode = $this->getBarcode();
     if (!empty($barcode)) {
         $this->Ln($line_width);
         $barcode_width = round(($this->getPageWidth() - $ormargins['left'] - $ormargins['right']) / 3);
         $this->write1DBarcode($barcode, 'C128B', $this->GetX(), $cur_y + $line_width, $barcode_width, $this->getFooterMargin() / 3 - $line_width, 0.3, '', '');
         $this->Text($this->GetX(), $cur_y + $line_width + 10, $barcode);
         $this->StartTransform();
         $this->SetFont('freeserif', '', 12);
         $name = App_Env::getUserFullName();
         $date = date('d/m/Y');
         $time = date('H:i');
         $this->Text($this->GetX(), $cur_y + $line_width + 16, "ผู้พิมพ์   {$name} วันที่  {$date} เวลา {$time}น.");
         $this->StopTransform();
     }
     if (empty($this->pagegroups)) {
         $pagenumtxt = $this->l['w_page'] . ' ' . $this->getAliasNumPage() . ' / ' . $this->getAliasNbPages();
     } else {
         $pagenumtxt = $this->l['w_page'] . ' ' . $this->getPageNumGroupAlias() . ' / ' . $this->getPageGroupAlias();
     }
     $this->SetY($cur_y);
     //Print page number
     if ($this->getRTL()) {
         $this->SetX($ormargins['right']);
         $this->Cell(0, 0, $pagenumtxt, 'T', 0, 'L');
     } else {
         $this->SetX($ormargins['left']);
         $this->Cell(0, 0, $pagenumtxt, 'T', 0, 'R');
     }
 }
Exemplo n.º 4
0
 public function update($data, $where = null)
 {
     $cols = $this->getCols();
     if (in_array("modified", $cols)) {
         $newdate = new DateTime();
         $newdatestr = $newdate->format($this->_datetime_format);
         $data['modified'] = $newdatestr;
     }
     if (in_array("modifier_id", $this->_cols)) {
         $data['modifier_id'] = App_Env::getUserId();
     }
     if (in_array("modify_by", $this->_cols)) {
         $data['modify_by'] = App_Env::getUserId() . ":" . App_Env::getUserFullName();
     }
     $this->getDbTable()->update($data, $where);
 }
Exemplo n.º 5
0
 public function getBodyContent()
 {
     try {
         $this->setIsNullParam('COMPANY_INFO', $this->_info());
         $this->setIsNullParam('COMPANY_NAME_TH', $this->_info(false));
         $this->setIsNullParam('CUSTOMER_NAME', App_Env::getUserFullName());
         if (count($this->_to) == 0) {
             $this->addTo(App_Env::getUserEmail());
         }
         if (count($this->_bcc) == 0) {
             $this->addBcc(App_Env::getSystemEmail());
         }
         // $mail = new Zend_Mail('utf-8');
         //$mail->setHeaderEncoding();
         ob_start();
         // ดึง layout ออกมา
         if ($this->_templete_id != '') {
             $templtet = new Sys_Model_Template();
             $templtet->find($this->_templete_id);
             $this->_subject = $templtet->name;
             //หา ค่า posible value
             $possibleAttributes = $templtet->possibleAttributes;
             $possibleAttributes_tmp1 = str_replace(array("<ul>", '</ul>', '<li>', '</li>'), ' ', $possibleAttributes);
             $possibleAttributes_tmp1 = preg_replace(array('/\\s\\s+/'), " ", $possibleAttributes_tmp1);
             $possibleAttributes_tmp2 = explode(" ", $possibleAttributes_tmp1);
             $data_key = array();
             $data_value = array();
             foreach ($possibleAttributes_tmp2 as $attr) {
                 $attr = trim($attr);
                 if ($attr != '') {
                     $value = trim($this->_templete_params[$attr]);
                     if ($value == '') {
                         $value = 'N/A';
                     }
                     $data_value[] = $value;
                     $data_key[] = $attr;
                 }
             }
             //print_r($data_key);
             //print_r($data_value);
             echo str_replace($data_key, $data_value, $templtet->getContent());
         } else {
             // กำหนดค่าโดยตรง
             echo $content = $this->_content;
             echo $footer = $this->_footer;
         }
         $html = ob_get_clean();
         $html = str_replace("http://www.dev2.scimaxthailand.com", WEB_DOMAIN, $html);
         return $html;
         //  exit();
     } catch (Exception $e) {
         //	$this->view->stat = 'error';
         //	$this->view->msg = $e->getMessage ();
         echo $e->getMessage();
         // throw new Exception($e->getMessage());
     }
 }