Subversion Repositories php-qbpwcf

Rev

Blame | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2014~2026 MIN ZHI, CHEN

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/

#使用命名空間qbpwcf
namespace qbpwcf;

#assets dir
$assetsDir="assets of table::divAjax_20251110";

#函式說明:
#建立div表格,並具備翻頁功能,從ajax取得新資料.
#回傳結果:
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
#$result["error"],錯誤訊息.
#$result["function"],當前執行的函數名稱.
#$result["content"],表格的html內容.
#$result["argu"],使用的參數.
#$result["argued"],參數檢查後使用的參數.
#必填參數:
#$conf["dataUrl"],字串,取得資料的url.
$conf["dataUrl"]="assets of table::divAjax_20251110/index.php";
#可省略參數:
#$conf["defaulBorderStyleName"],字串,預設的表格框線css類別樣式名稱,預設為"__qbpwcf_border",樣式為{border:1px solid;}
#$conf["defaulBorderStyleName"]="__qbpwcf_border";
#$conf["id.table"],字串,table的id.
#$conf["id.table"]="tableId";
#$conf["class.table"],陣列,最外層div要套用的css類別樣式
#$conf["class.table"]=array();
#$conf["class.table.head"],陣列,表格標題最外層div要套用的css類別樣式
#$conf["class.table.head"]=array();
#$conf["class.table.head.th"],陣列,<th>要套用的css類別樣式
#$conf["class.table.head.th"]=array();
#$conf["class.table.head.th.td"],陣列,標題欄位內容標籤<td>要套用的css類別樣式
#$conf["class.table.head.th.td"]=array();
#$conf["class.table.body"],陣列,表格內容最外圍div要套用的css類別樣式
#$conf["class.table.body"]=array();
#$conf["class.table.body.tr"],陣列,<tr>要套用的css類別樣式
#$conf["class.table.body.tr"]=array();
#$conf["class.table.body.tr.odd"],陣列,奇數<tr>要套用的css類別樣式.
#$conf["class.table.body.tr.odd"]=array();
#$conf["class.table.body.tr.even"],陣列,偶數<tr>要套用的css類別樣式.
#$conf["class.table.body.tr.even"]=array();
#$conf["class.table.body.tr.td"],陣列,內容欄位標籤<td>要套用的css類別樣式
#$conf["class.table.body.tr.td"]=array();
#$conf["titleRow"],字串陣列,表格內個欄位的標題內容.
#$conf["titleRow"]=array();
#$conf["titleId"],字串,抬頭的id.
#$conf["titleId"]="titleId";
#參考資料:
#https://www.w3.org/Style/css2-updates/css2/tables.html
#備註:
#無.
$divAjax=table::divAjax($conf);
unset($conf);

#如果異常
if($divAjax["status"]==="false"){

        #函式說明:
        #撰寫log
        #回傳結果:
        #$result["status"],狀態,"true"或"false".
        #$result["error"],錯誤訊息陣列.
        #$result["function"],當前函式的名稱.
        #$result["argu"],使用的參數.
        #必填參數:
        #$conf["path"],字串,log檔案的路徑與名稱.
        $conf["path"]=$logFile;
        #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
        $conf["content"]=$divAjax;
        #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
        $conf["fileArgu"]=__FILE__;
        #可省略參數:
        #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
        #$conf["rewrite"]="false";
        #參考資料:
        #無.
        #備註:
        #無.
        $record=logs::record($conf);
        unset($conf);

        #如果寫log失敗
        if($record["status"]==="false"){

                #印出結果
                var_dump($record);

                }#if end

        #結束執行,回傳錯誤代碼1
        exit(1);

        }#if end

#印出 html 語法
echo $divAjax["content"];

?>