<?php require_once 'modules/AOS_PDF_Templates/clsMsDocGenerator.php'; require_once 'modules/AOS_PDF_Templates/PDF_Lib/mpdf.php'; require_once 'modules/AOS_PDF_Templates/templateParser.php'; require_once 'modules/AOS_PDF_Templates/sendEmail.php'; require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php'; global $mod_strings; $module_type = $_REQUEST['module']; $module = new Contract(); $module_type_file = strtoupper(ltrim(rtrim($module_type, 's'), '')); $module_type_low = strtolower($module_type); $module->retrieve($_REQUEST['contractid']); $task = $_REQUEST['task']; $doc = new clsMsDocGenerator(); $contractvalue = array(); $sql = "SELECT * FROM contract_values WHERE contract_value_id ='" . $module->id . "'and deleted = 0"; $res = $module->db->query($sql); while ($row = $module->db->fetchByAssoc($res)) { $contractvalue[$row['id']] = $row['contract_value_id']; } $contract_condition = array(); $sql1 = "SELECT * FROM contract_conditions WHERE contract_condition_id ='" . $module->id . "' AND deleted = 0"; $res1 = $module->db->query($sql1); while ($row1 = $module->db->fetchByAssoc($res1)) { $contract_condition[$row1['id']] = $row1['contract_condition_id']; } $transport_contract = array(); $sql2 = "SELECT * FROM transportcontracts WHERE contract_id='" . $this->id . "' AND deleted =0"; $res2 = $module->db->query($sql2); while ($row2 = $module->db->fetchByAssoc($res2)) {
public function export() { $map['id'] = array('in', $_REQUEST['id']); $orders = $this->dao->where($map)->select(); Vendor('MsDocGenerator'); $doc = new clsMsDocGenerator(); $doc->addParagraph('网站订单', array('text-align' => '"center"', 'font-size' => '16pt', 'font-weight' => 'bold')); $i = 0; $count = count($orders); $this->assign('all_count', $count); foreach ($orders as $o) { $this->assign('i', $i); $_GET['id'] = $o['id']; $this->orders(); $doc->addParagraph($this->fetch('Orders-word')); $i++; $doc->addParagraph("<br clear=all style='page-break-before:always;' />"); } $doc->output('订单列表'); }
<?php include_once "lib/class.php"; if ($_GET['fun'] == 'creadoc') { require_once 'lib/clsMsDocGenerator.php'; require_once "lib/db_mysql.php"; $db = new db_local(); //ANNO CORRENTE //$db->query("SELECT anagrafiche.id as 'resp',nome,cognome,tel1,email,gite.*,UNIX_TIMESTAMP(dataeora) as 'data' FROM anagrafiche, gite WHERE YEAR(dataeora) = ".date("Y")." AND anagrafiche.id = gite.idresp AND approvata = 1 ORDER BY dataeora;"); //ANNO CORRENTE e FUTURI $db->query("SELECT anagrafiche.id as 'resp',nome,cognome,tel1,email,gite.*,UNIX_TIMESTAMP(dataeora) as 'data' FROM anagrafiche, gite WHERE YEAR(dataeora) >= " . date("Y") . " AND anagrafiche.id = gite.idresp AND approvata = 1 ORDER BY dataeora;"); $doc = new clsMsDocGenerator(); //$doc->addParagraph('Elenco gite approvate '.date("Y"), array('text-align' => 'center', 'font-size' => '16pt', 'font-weight' => 'bold')); $doc->addParagraph('Elenco gite approvate', array('text-align' => 'center', 'font-size' => '16pt', 'font-weight' => 'bold')); $doc->addParagraph(''); $doc->addParagraph(''); while ($db->next_record()) { $doc->startTable(array('align' => 'center', 'width' => '10cm')); //$aligns = array('center','center'); $doc->addParagraph($giorni[date("w", $db->record['data'])] . " " . substr($db->record['dataeora'], 8, 2) . " " . $mesi[date("n", $db->record['data'])] . " - " . $db->record['titolo'] . "<br><br>", array('font-weight' => 'bold', 'font-size' => '18px', 'font-family' => 'Comic Sans MS', 'width' => '10cm')); $cols = array(); $strCol = "Itinerario:<br>"; $strCol .= $db->record['itinerario'] . "<br>" . $db->record['descrizione']; $cols[] = $strCol; $strCol = "<br>"; if ($db->record['tipogita'] == 'B') { $strCol .= "Bici"; } elseif ($db->record['tipogita'] == 'BT') { $strCol .= "Bici + Treno"; } else { $strCol .= "Vedi Descrizione";
<?php require_once 'modules/AOS_PDF_Templates/clsMsDocGenerator.php'; require_once 'modules/AOS_PDF_Templates/PDF_Lib/mpdf.php'; require_once 'modules/AOS_PDF_Templates/templateParser.php'; require_once 'modules/AOS_PDF_Templates/sendEmail.php'; require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php'; global $mod_strings; $module = new Contract(); $module_type = $_REQUEST['module']; $module_type_file = strtoupper(ltrim(rtrim($module_type, 's'), '')); $module_type_low = strtolower($module_type); $module->retrieve($_REQUEST['contractid']); $task = $_REQUEST['task']; $doc = new clsMsDocGenerator(); $contractvalue = array(); $sql = "SELECT * FROM contract_values WHERE contract_value_id ='" . $module->id . "'and deleted = 0"; $res = $module->db->query($sql); while ($row = $module->db->fetchByAssoc($res)) { $contractvalue[$row['id']] = $row['contract_value_id']; } $contract_condition = array(); $sql1 = "SELECT * FROM contract_conditions WHERE contract_condition_id ='" . $module->id . "' AND deleted = 0"; $res1 = $module->db->query($sql1); while ($row1 = $module->db->fetchByAssoc($res1)) { $contract_condition[$row1['id']] = $row1['contract_condition_id']; } $transport_contract = array(); $sql2 = "SELECT * FROM transportcontracts WHERE contract_id='" . $this->id . "' AND deleted =0"; $res2 = $module->db->query($sql2); while ($row2 = $module->db->fetchByAssoc($res2)) {
/** * @author Tuan Anh * @copyright 2011 */ include 'baseClassExport.php'; require_once 'clsMsDocGenerator.php'; //var_dump($term_result); function vnstr($str) { $unicode = array('a' => 'á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ', 'd' => 'đ', 'e' => 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ', 'i' => 'í|ì|ỉ|ĩ|ị', 'o' => 'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ', 'u' => 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự', 'y' => 'ý|ỳ|ỷ|ỹ|ỵ', 'A' => 'Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ', 'D' => 'Đ', 'E' => 'É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ', 'I' => 'Í|Ì|Ỉ|Ĩ|Ị', 'O' => 'Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ', 'U' => 'Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự', 'Y' => 'Ý|Ỳ|Ỷ|Ỹ|Ỵ'); foreach ($unicode as $nonUnicode => $uni) { $str = preg_replace("/({$uni})/i", $nonUnicode, $str); } return $str; } $doc = new clsMsDocGenerator(); $format = array('text-align' => 'center', 'font-weight' => 'bold', 'font-size' => '18pt', 'color' => 'blue'); $doc->addParagraph('<img src="../file/bk_hcm.gif"/>Truong Dai hoc Bach Khoa Tp. Ho Chi Minh', $format); $format = array('text-align' => 'center', 'font-weight' => 'bold', 'font-size' => '18pt', 'color' => 'blue'); $doc->addParagraph('BANG DIEM SINH VIEN', $format); $format = array('text-align' => 'center', 'font-weight' => 'bold', 'font-size' => '20pt', 'color' => 'red'); $doc->addParagraph(vnstr($r['student_name']) . '-' . $r['student_id'], $format); foreach ($term_result as $term_result_) { $doc->newPage(); $format = array('font-weight' => 'bold', 'font-size' => '15pt', 'color' => 'grey'); $name = 'HK ' . substr($term_result_['ten_hk'], -1, 1) . ' Nam hoc ' . substr($term_result_['ten_hk'], 0, 4) . '-' . substr($term_result_['ten_hk'], 4, 4); $doc->addParagraph($name, $format); $doc->startTable(); $format = array('font-weight' => 'bold', 'font-size' => '15pt', 'color' => 'grey', 'background-color' => '#800000', 'FontFamily' => 'Times New Roman', 'width' => '200pt'); $tieude = array('Ma MH', 'Ten MH', 'So TC', 'Kiem tra', 'Thi', 'TB'); $aligns = array('center', 'center', 'center', 'center', 'center', 'center');
<?php require_once 'modules/AOS_PDF_Templates/clsMsDocGenerator.php'; require_once 'modules/AOS_PDF_Templates/PDF_Lib/mpdf.php'; require_once 'modules/AOS_PDF_Templates/templateParser.php'; require_once 'modules/AOS_PDF_Templates/sendEmail.php'; require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php'; global $mod_strings; $module = new Contract(); $module_type = $_REQUEST['module']; $module_type_file = strtoupper(ltrim(rtrim($module_type, 's'), '')); $module_type_low = strtolower($module_type); $module->retrieve($_REQUEST['contractid']); $task = $_REQUEST['task']; $doc = new clsMsDocGenerator(); $doc->setFontFamily("Time New Roman"); $template = new AOS_PDF_Templates(); // $template->retrieve($_REQUEST['templateID']); $template->retrieve('202b6fea-2574-6b18-d0b2-4e7c9f5ef960'); $object_arr = array(); $object_arr[$module_type] = $module->id; $search = array('@<script[^>]*?>.*?</script>@si', '@<[\\/\\!]*?[^<>]*?>@si', '@([\\r\\n])[\\s]+@', '@&(quot|#34);@i', '@&(amp|#38);@i', '@&(lt|#60);@i', '@&(gt|#62);@i', '@&(nbsp|#160);@i', '@&(iexcl|#161);@i', '@&#(\\d+);@e', '@<address[^>]*?>@si'); $replace = array('', '', '\\1', '"', '&', '<', '>', ' ', chr(161), 'chr(\\1)', '<br>'); $header = preg_replace($search, $replace, $template->pdfheader); $footer = preg_replace($search, $replace, $template->pdffooter); $text = preg_replace($search, $replace, $template->description); $text = preg_replace('/\\{DATE\\s+(.*?)\\}/e', "date('\\1')", $text); $text = str_replace("\$contracts", "\$" . $module_type_low, $text); $text = str_replace("\$travelguide_name", "Bui cao Học", $text); $printable = str_replace("\n", "<br />", $text); $converted = templateParser::parse_template($text, $object_arr);
function executeExportword() { global $controller, $ClassDir, $UploadDir; require_once $ClassDir . 'MsDocGenerator.class.php'; $doc = new clsMsDocGenerator(); $apf_contact = DB_DataObject::factory('ApfContact'); $apf_contact->get($apf_contact->escape($controller->getID())); $doc->setDocumentCharset("gbk"); $doc->setDocumentLang("setDocumentLang"); $doc->addParagraph($apf_contact->getName()); $apf_contact->getPhoto() ? $doc->addParagraph($doc->addImage($UploadDir . $apf_contact->getPhoto(), 80, 80)) : ""; $filename = date("Y_m_d") . $apf_contact->getName() . ".doc"; $doc->output($filename); exit; }