path('/modules/system/include/functions.php'); $def_city = system_CleanVars($_REQUEST, 'city', '', 'string'); $def_cate_sn = system_CleanVars($_REQUEST, 'cate_sn', '', 'int'); $def_county = system_CleanVars($_REQUEST, 'county', '', 'string'); $def_keyword = system_CleanVars($_REQUEST, 'keyword', '', 'string'); $sn = system_CleanVars($_REQUEST, 'sn', '', 'int'); require_once(TADTOOLS_PATH.'/tcpdf/tcpdf.php'); $pdf = new TCPDF("P"); $pdf->setPrintHeader(true); //不要頁首 $pdf->setPrintFooter(true); //不要頁尾 $pdf->SetMargins(10, 25); $pdf->setHeaderMargin(5); //頁首上方與頁面頂端的距離 $pdf->setFooterMargin(20); //頁尾上方與頁面尾端的距離 $pdf->setHeaderData('pdf_logo.png', 50, '我的通訊錄', '常用電話', array(0, 0, 255), array(150, 150, 150)); $pdf->setFooterData(array(0, 0, 0), array(0, 0, 0)); $pdf->setHeaderFont(array('droidsansfallback', '', 12)); $pdf->setFooterFont(array('droidsansfallback', '', 12)); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //設定自動分頁 $pdf->setFontSubsetting(true); //產生字型子集(有用到的字才放到文件中) $pdf->SetFont('droidsansfallback', '', 10, '', true); //設定字型 $pdf->AddPage(); //新增頁面 if($sn){ $myts = MyTextSanitizer::getInstance(); $sql = "select * from `" . $xoopsDB->prefix("phone_book") . "` where `sn` = '{$sn}' "; $result = $xoopsDB->query($sql) or web_error($sql); $all = $xoopsDB->fetchArray($result); //以下會產生這些變數: $sn, $cate_sn, $name, $birthday, $phone, $email, $zip, $county, $city, $addr, $note foreach ($all as $k => $v) { $$k = $v; } //取得分類資料(phone_book_cate) //$phone_book_cate_arr = get_phone_book_cate($cate_sn); //過濾讀出的變數值 $name = $myts->htmlSpecialChars($name); $birthday = $myts->htmlSpecialChars($birthday); $phone = $myts->htmlSpecialChars($phone); $email = $myts->htmlSpecialChars($email); $zip = $myts->htmlSpecialChars($zip); $county = $myts->htmlSpecialChars($county); $city = $myts->htmlSpecialChars($city); $addr = $myts->htmlSpecialChars($addr); $note = $myts->displayTarea($note, 0, 1, 0, 1, 1); $pdf->SetFont('droidsansfallback', '', 36, '', true); //設定字型 $pdf->Image(XOOPS_ROOT_PATH.'/uploads/photo.jpg', $x='', $y='', 80, 80, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()); $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); $pdf->Cell(80, 80, $name, 1, 0, 'C','','','','','','B'); $pdf->setTextShadow(array('enabled'=>false)); $pdf->SetFont('droidsansfallback', '', 16, '', true); //設定字型 $pdf->Cell(30, 20, '電話', 1, 0, 'C'); $pdf->Cell(80, 20, $phone, 1, 1, 'C'); //$pdf->Cell(80, 80, '', 0, 0, 'C'); $pdf->SetX(90); $pdf->Cell(30, 20, '信箱', 1, 0, 'C'); $pdf->Cell(80, 20, $email, 1, 1, 'C'); $pdf->SetX(90); $pdf->Cell(30, 20, '生日', 1, 0, 'C'); $pdf->Cell(80, 20, $birthday, 1, 1, 'C'); $pdf->SetX(90); $pdf->Cell(30, 20, '地址', 1, 0, 'C'); //$pdf->Cell(80, 20, "{$zip}{$county}{$city}{$addr}", 1, 1, 'C','','',1); $pdf->MultiCell(80, 20, "{$zip}{$county}{$city}{$addr}", 1, 'L'); }else{ $and_name=$and_cate_sn=$and_city=""; if(!empty($def_keyword)){ $and_name="and (`name` like '%{$def_keyword}%' or `city` like '%{$def_keyword}%' or `county` like '%{$def_keyword}%' or `addr` like '%{$def_keyword}%')"; }else{ $and_cate_sn = empty($def_cate_sn) ? "" : "and `cate_sn` = '{$def_cate_sn}'"; $and_county = empty($def_county) ? "" : "and `county` = '{$def_county}'"; $and_city = empty($def_city) ? "" : "and `city` = '{$def_city}'"; } //取得分類資料 $phone_book_cate_arr = get_phone_book_cate_arr(); $myts = MyTextSanitizer::getInstance(); $sql = "select * from `" . $xoopsDB->prefix("phone_book") . "` where 1 $and_cate_sn $and_county $and_city $and_name limit 0,100"; $result = $xoopsDB->query($sql) or web_error($sql); $html='
進階搜尋
56人線上 (19人在瀏覽線上書籍)
會員: 0
訪客: 56