Toggle main menu visibility
新聞
下載
教材
影音
討論
其他選單
好站連結
行事曆
電子相簿
常見問題
萬用表單
即時留言簿
友站消息
社大學員
:::
登入
登入
帳號
密碼
登入
重整畫面
:::
所有書籍
「[1042] XOOPS模組開發進階」目錄
MarkDown
8-1 /header.php
1. jquery入門及連動選單
1-1 /templates/phone_book_index_b3.html
1-2 /index.php
1-3 /ajax.php
2. 表單驗證及點擊編輯
2-1 /admin/main.php
2-2 /templates/phone_book_adm_main_b3.html
2-3 /index.php
2-4 /templates/phone_book_index_b3.html
2-5 /save_phone_book.php
2-6 /get_name.php
3. 自適應表格及拉動排序
3-1 /index.php
3-2 /templates/phone_book_index_b3.html
3-3 /admin/cate.php
3-4 /templates/phone_book_adm_cate_b3.html
3-5 /admin/main.php
3-6 /templates/phone_book_adm_main_b3.html
3-7 (利用FooTable的分頁+json功能)/index.php
3-8 (利用FooTable的分頁+json功能)/templates/phone_book_index_b3.html
3-9 (利用FooTable的分頁+json功能)/columns.json
3-10 (利用FooTable的分頁+json功能)/rows.json
3-11 (舊版FooTable)/index.php
3-12 (舊版FooTable)/templates/phone_book_index_b3.html
3-13 (舊版FooTable)tadtools/FooTable.php
4. 大小月曆應用
4-1 /templates/phone_book_adm_main_b3.html
4-2 /interface_menu.php
4-3 /birthday.php
4-4 /templates/phone_book_birthday_b3.html
4-5 /xoops_version.php
4-5 /get_event.php
5. Google圖表應用及頁籤
5-1 /interface_menu.php
5-2 /chart.php
5-3 /templates/phone_book_chart_b3.html
5-4 /xoops_version.php
5-5 /ajax.php
5-6 /templates/phone_book_index_b3.html
5-7 /index.php
5-8 /templates/phone_book_adm_main_b3.html
6. 各種文字檔的匯出匯入
6-1 /interface_menu.php
6-2 /html.php
6-3 /index.php
6-4 /function.php
6-5 /csv.php
6-6 /templates/phone_book_adm_main_b3.html
6-7 /admin/main.php
6-8 /json.php
6-9 /get_json.php
6-10 資料庫語法
7. Excel的匯出與匯入
7-1 /header.php
7-2 /excel.php
7-3 /test.php
7-4 /excel_one.php
7-5 /templates/phone_book_adm_main_b3.html
7-6 /admin/main.php
7-7 /index.php
7-8 /templates/phone_book_index_b3.html
8. 產生PDF檔
8-1 /header.php
8-2 /pdf.php
8-3 /pdf.php (多檔下載版)
9. 輸出Word檔及圖片檔
9-1 /header.php
9-2 /word.php
9-3 /index.php
9-4 /templates/phone_book_index_b3.html
8-3 /pdf.php (多檔下載版)
\[1042\] XOOPS模組開發進階 ==================== ``` 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='
'; while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $sn, $cate_sn, $name, $birthday, $phone, $email, $zip, $county, $city, $addr, $note foreach ($all as $k => $v) { $$k = $v; } //過濾讀出的變數值 $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); $html.="
$name
$birthday
$phone
$email
{$zip}{$county}{$city}{$addr}
{$phone_book_cate_arr[$cate_sn]['cate_title']}
"; } $html.="
"; $pdf->writeHTML($html); } //PDF內容設定 $pdf->Output('通訊錄.pdf', 'I'); // $pdf->Output('通訊錄.pdf', 'I'); // $pdf->Output(XOOPS_ROOT_PATH.'/uploads/contact.pdf', 'F'); ```
:::
搜尋
search
進階搜尋
QR Code 區塊
快速登入
所有討論區
「PHP全端開發」線上課程討論區
XOOPS使用討論區
一般研習學員
社大學員專用
路過哈啦區
XOOPS佈景設計
XOOPS模組開發
Tad書籍區
即時留言簿
書籍目錄
展開
|
闔起
線上使用者
129
人線上 (
63
人在瀏覽
線上書籍
)
會員: 0
訪客: 129
更多…