Toggle main menu visibility
新聞
下載
教材
影音
討論
其他選單
好站連結
行事曆
電子相簿
常見問題
萬用表單
即時留言簿
友站消息
社大學員
:::
登入
登入
帳號
密碼
登入
重整畫面
:::
所有書籍
「[1042] XOOPS模組開發進階」目錄
MarkDown
9-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
9-3 /index.php
\[1042\] XOOPS模組開發進階 ==================== ``` setDefaultFontName('微軟正黑體'); //設定預設字型 $PHPWord->setDefaultFontSize(10); //設定預設字型大小 $sectionStyle = array('orientation' => null, 'marginLeft' => 900, 'marginRight' => 900); //頁面設定 $section = $PHPWord->createSection($sectionStyle); //建立一個頁面 //內容設定 $fontStyle1 = array('name'=>'標楷體', 'color'=>'0000ff', 'size'=>24); //文字樣式設定 $fontStyle2 = array('color'=>'ff0000', 'size'=>18, 'bold'=>true, 'bold'=>true, 'underline'=>PHPWord_Style_Font::UNDERLINE_DASH , 'fgColor'=>PHPWord_Style_Font::FGCOLOR_YELLOW ,'strikethrough'=>true); //文字樣式設定 //段落設定 $paragraphStyle=array('align' => 'center', 'spaceAfter'=>300); $PHPWord->addTitleStyle( 1, $fontStyle1, $paragraphStyle); //設定標題樣式 $PHPWord->addTitleStyle( 2, $fontStyle2); //設定標題樣式 $section->addTitle( '通訊錄', 1 ); //新增標題 /*內容部份*/ // $TextfontStyle = array('name'=>'標楷體', 'color'=>'000000', 'size'=>12); //文字樣式設定 // $TextparagraphStyle=array('align' => 'left', 'spaceAfter'=>576); // $content1="頂新案一審判無罪,台北市長柯文哲今天表示,這是總統大選迄今為止,「最大的催票行為」。 // 柯文哲昨晚到社子島進行Homestay,今天一早還到當地地藏禪寺和地皎法師、台北市議員吳思瑤及徐世勳、當地居民和里長一同吃素齋早餐祈福。 // 媒體餐後聯訪詢問頂新製油公司前董事長魏應充被判無罪,怎看?"; // $content2="柯文哲表示,這是總統大選迄今為止,這是最大的催票行為,用膝蓋想也知道。 // 記者追問是否把挺綠的票催出來?柯文哲笑著反問「妳認為哩?」。 // 彰化地方法院昨天判決頂新製油案無罪。法官根據專業鑑定,認為酸價不是作為油品最終衛生認定基礎;法院採完整的檢驗,總極性化合物也未如檢方所稱達危害程度。"; // $section->addText( $content1, $TextfontStyle ,$TextparagraphStyle); //新增內容 // $section->addText( $content2, $TextfontStyle ,$TextparagraphStyle); //新增內容 /*表格部份*/ $styleTable=array('borderColor' => '000000', 'borderSize' => 4, 'cellMargin' => 30); //表格樣式 $styleFirstRow = array('bgColor' => '66BBFF'); //首行樣式 $PHPWord->addTableStyle('myTable', $styleTable, $styleFirstRow); //建立表格樣式 $cellStyle = array('bgColor' => 'ffffff'); //儲存格樣式 $table = $section->addTable('myTable'); //建立表格 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); $table->addRow(); //新增一列 $table->addCell(1800, array('gridSpan' => '3', 'bgColor' => 'ffffff'))->addText($name.'聯絡方式'); //新增一格 $table->addRow(); //新增一列 $table->addCell(1800, array('vMerge' => 'restart', 'bgColor' => 'ffffff'))->addText('相片'); //新增一格 $table->addCell(1800, $cellStyle)->addText('姓名'); //新增一格 $table->addCell(3000, $cellStyle)->addText($name); //新增一格 $table->addRow(); //新增一列 $table->addCell(1800, array('vMerge' => 'fusion')); //新增一格 $table->addCell(1800, $cellStyle)->addText('生日'); //新增一格 $table->addCell(3000, $cellStyle)->addText($birthday); //新增一格 $table->addRow(); //新增一列 $table->addCell(1800, array('vMerge' => 'fusion')); //新增一格 $table->addCell(1800, $cellStyle)->addText('電話'); //新增一格 $table->addCell(3000, $cellStyle)->addText($phone); //新增一格 $table->addRow(); //新增一列 $table->addCell(1800, array('vMerge' => 'fusion')); //新增一格 $table->addCell(1800, $cellStyle)->addText('信箱'); //新增一格 $table->addCell(3000, $cellStyle)->addText($email); //新增一格 $table->addRow(); //新增一列 $table->addCell(1800, array('vMerge' => 'fusion')); //新增一格 $table->addCell(1800, $cellStyle)->addText('地址'); //新增一格 $table->addCell(3000, $cellStyle)->addText($zip.$county.$city.$addr); //新增一格 }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); 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); $table->addRow(); //新增一列 $table->addCell(1800, $cellStyle)->addText($name); //新增一格 $table->addCell(2500, $cellStyle)->addText($birthday); //新增一格 $table->addCell(2000, $cellStyle)->addText($phone); //新增一格 $table->addCell(2000, $cellStyle)->addText($email); //新增一格 $table->addCell(8000, $cellStyle)->addText($zip.$county.$city.$addr); //新增一格 } } header('Content-Type: application/vnd.ms-word'); header('Content-Disposition: attachment;filename=通訊錄.docx'); header('Cache-Control: max-age=0'); $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); $objWriter->save('php://output'); ```
:::
搜尋
search
進階搜尋
QR Code 區塊
快速登入
所有討論區
「PHP全端開發」線上課程討論區
XOOPS使用討論區
一般研習學員
社大學員專用
路過哈啦區
XOOPS佈景設計
XOOPS模組開發
Tad書籍區
即時留言簿
書籍目錄
展開
|
闔起
線上使用者
112
人線上 (
74
人在瀏覽
線上書籍
)
會員: 0
訪客: 112
更多…