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-2
/pdf.php
002
include_once
"header.php"
;
004
include_once
$GLOBALS
[
'xoops'
]->path(
'/modules/system/include/functions.php'
);
005
$def_city
= system_CleanVars(
$_REQUEST
,
'city'
,
''
,
'string'
);
006
$def_cate_sn
= system_CleanVars(
$_REQUEST
,
'cate_sn'
,
''
,
'int'
);
007
$def_county
= system_CleanVars(
$_REQUEST
,
'county'
,
''
,
'string'
);
008
$def_keyword
= system_CleanVars(
$_REQUEST
,
'keyword'
,
''
,
'string'
);
009
$sn
= system_CleanVars(
$_REQUEST
,
'sn'
,
''
,
'int'
);
012
require_once
(TADTOOLS_PATH.
'/tcpdf/tcpdf.php'
);
013
$pdf
=
new
TCPDF(
"P"
);
015
$pdf
->setPrintHeader(true);
016
$pdf
->setPrintFooter(true);
017
$pdf
->SetMargins(10, 25);
018
$pdf
->setHeaderMargin(5);
019
$pdf
->setFooterMargin(20);
021
$pdf
->setHeaderData(
'pdf_logo.png'
, 50,
'我的通訊錄'
,
'常用電話'
,
array
(0, 0, 255),
array
(150, 150, 150));
022
$pdf
->setFooterData(
array
(0, 0, 0),
array
(0, 0, 0));
023
$pdf
->setHeaderFont(
array
(
'droidsansfallback'
,
''
, 12));
024
$pdf
->setFooterFont(
array
(
'droidsansfallback'
,
''
, 12));
027
$pdf
->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
028
$pdf
->setFontSubsetting(true);
029
$pdf
->SetFont(
'droidsansfallback'
,
''
, 10,
''
, true);
034
$myts
= MyTextSanitizer::getInstance();
036
$sql
=
"select * from `"
.
$xoopsDB
->prefix(
"phone_book"
) . "`
037
where `sn` =
'{$sn}'
";
038
$result
=
$xoopsDB
->query(
$sql
)
or
web_error(
$sql
);
039
$all
=
$xoopsDB
->fetchArray(
$result
);
042
foreach
(
$all
as
$k
=>
$v
) {
050
$name
=
$myts
->htmlSpecialChars(
$name
);
051
$birthday
=
$myts
->htmlSpecialChars(
$birthday
);
052
$phone
=
$myts
->htmlSpecialChars(
$phone
);
053
$email
=
$myts
->htmlSpecialChars(
$email
);
054
$zip
=
$myts
->htmlSpecialChars(
$zip
);
055
$county
=
$myts
->htmlSpecialChars(
$county
);
056
$city
=
$myts
->htmlSpecialChars(
$city
);
057
$addr
=
$myts
->htmlSpecialChars(
$addr
);
058
$note
=
$myts
->displayTarea(
$note
, 0, 1, 0, 1, 1);
060
$pdf
->SetFont(
'droidsansfallback'
,
''
, 36,
''
, true);
062
$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
());
064
$pdf
->setTextShadow(
array
(
'enabled'
=>true,
'depth_w'
=>0.2,
'depth_h'
=>0.2,
'color'
=>
array
(196,196,196),
'opacity'
=>1,
'blend_mode'
=>
'Normal'
));
065
$pdf
->Cell(80, 80,
$name
, 1, 0,
'C'
,
''
,
''
,
''
,
''
,
''
,
'B'
);
066
$pdf
->setTextShadow(
array
(
'enabled'
=>false));
068
$pdf
->SetFont(
'droidsansfallback'
,
''
, 16,
''
, true);
070
$pdf
->Cell(30, 20,
'電話'
, 1, 0,
'C'
);
071
$pdf
->Cell(80, 20,
$phone
, 1, 1,
'C'
);
075
$pdf
->Cell(30, 20,
'信箱'
, 1, 0,
'C'
);
076
$pdf
->Cell(80, 20,
$email
, 1, 1,
'C'
);
079
$pdf
->Cell(30, 20,
'生日'
, 1, 0,
'C'
);
080
$pdf
->Cell(80, 20,
$birthday
, 1, 1,
'C'
);
083
$pdf
->Cell(30, 20,
'地址'
, 1, 0,
'C'
);
085
$pdf
->MultiCell(80, 20,
"{$zip}{$county}{$city}{$addr}"
, 1,
'L'
);
090
$and_name
=
$and_cate_sn
=
$and_city
=
""
;
091
if
(!
empty
(
$def_keyword
)){
092
$and_name
=
"and (`name` like '%{$def_keyword}%' or `city` like '%{$def_keyword}%' or `county` like '%{$def_keyword}%' or `addr` like '%{$def_keyword}%')"
;
094
$and_cate_sn
=
empty
(
$def_cate_sn
) ?
""
:
"and `cate_sn` = '{$def_cate_sn}'"
;
095
$and_county
=
empty
(
$def_county
) ?
""
:
"and `county` = '{$def_county}'"
;
096
$and_city
=
empty
(
$def_city
) ?
""
:
"and `city` = '{$def_city}'"
;
100
$phone_book_cate_arr
= get_phone_book_cate_arr();
102
$myts
= MyTextSanitizer::getInstance();
104
$sql
=
"select * from `"
.
$xoopsDB
->prefix(
"phone_book"
) .
"` where 1 $and_cate_sn $and_county $and_city $and_name limit 0,100"
;
106
$result
=
$xoopsDB
->query(
$sql
)
109
$html
=
'<table width="100%" border="1" cellpadding="4" cellspacing="0">'
;
110
while
(
$all
=
$xoopsDB
->fetchArray(
$result
)) {
112
foreach
(
$all
as
$k
=>
$v
) {
117
$name
=
$myts
->htmlSpecialChars(
$name
);
118
$birthday
=
$myts
->htmlSpecialChars(
$birthday
);
119
$phone
=
$myts
->htmlSpecialChars(
$phone
);
120
$email
=
$myts
->htmlSpecialChars(
$email
);
121
$zip
=
$myts
->htmlSpecialChars(
$zip
);
122
$county
=
$myts
->htmlSpecialChars(
$county
);
123
$city
=
$myts
->htmlSpecialChars(
$city
);
124
$addr
=
$myts
->htmlSpecialChars(
$addr
);
125
$note
=
$myts
->displayTarea(
$note
, 0, 1, 0, 1, 1);
129
<td width=\"40\" align=\"center\" bgcolor=\"yellow\">
$name
</td>
130
<td width=\"60\" align=\"center\">
$birthday
</td>
131
<td width=\"75\" align=\"center\">
$phone
</td>
132
<td width=\"120\">
$email
</td>
133
<td width=\"190\">{
$zip
}{
$county
}{
$city
}{
$addr
}</td>
134
<td width=\"55\" align=\"center\">{
$phone_book_cate_arr
[
$cate_sn
][
'cate_title'
]}</td>
141
$pdf
->writeHTML(
$html
);
147
$pdf
->Output(
'通訊錄.pdf'
,
'I'
);
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