Subversion Repositories php-qbpwcf

Rev

Rev 81 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2014~2025 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 form::inputText_xxxxxxxx";

#函式說明:
#可以輸入文字的表單
#回傳結果:
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
#$result["function"],當前執行的函數.
#$result["error"],錯誤訊息陣列.
#$result["content"],按鈕語法.
#必填參數:
#$conf["name"],字串,爲該文字輸入框的名稱,用於讓接收頁面讀取的名稱。
$conf["name"]="resource";
#$conf["readOnly"],字串,爲該文字框是否可以填寫資料,若要只能觀看不能填寫,那麼就必須將其值設爲"true",反之要設爲"false".
$conf["readOnly"]="false";
#可省略參數:
#$conf["width"],字串,爲文字框的外觀長度,預設為"100%".
#$conf["width"]="";
#$conf["maxInputLength"],字串,爲可輸入的最大位元長度,預設不限制.
#$conf["maxInputLength"]="";
#$conf["autoFocus"],字串,是否為將填寫的指標移到該表單,"true"代表要,預設為"false".
#$conf["autoFocus"]="";
#$conf["value"],字串,爲該文字框預設要顯示的文字,預設爲"".
#$conf["value"]="";
#$conf["class"],字串,爲要套用的css樣式,若省略,則會套用預設的 "__qbpwcf_inputTextCssStyle" 樣式,其屬性爲 "width:100%","font-size:30px"
#$conf["class"]="";
#$conf["classList"],字串陣列,為要使用的多個css class樣式,若有使用,則會取代"class"參數的設定.
$conf["classList"]=array("a","b","c");
#$conf["jsActivitor"],字串,爲觸發js的條件,可以是"onChange"(已改變內容時)、"onClick"(按下按鈕時)、"onkeyup"(當鍵盤按下放開後)、"onmouseover"(當滑鼠移過去的時候)...,須搭配$conf["jsSubmitActionTarget"]參數。
#$conf["jsActivitor"]="";
#$conf["jsAction"],字串,爲該js是要做什麼,可以是"document.testForm.submit()"(傳送名爲testForm的表單內容)...,須搭配$conf["jsActivitor"]參數。
#$conf["jsAction"]="";
#$conf["trStart"],字串,爲是否要以<tr>開頭,"true"表示"是"。也可以看作新的一列開始,預設為"false".
#$conf["trStart"]="";
#$conf["tdStart"],字串,爲是否要以<td>開頭,"true"表示"是"。也可以看成列裏面的元素開始,預設為"false".
#$conf["tdStart"]="";
#$conf["formStart"],字串,爲是否要以<form>開頭,"true"表示"是",也可以看成表單的開始,預設為"false".
#$conf["formStart"]="";
#$conf["formAction"],字串,表單遞交的目的地,若$conf["formStart"]為"true",則該參數不能省略.
#$conf["formAction"]="";
#$conf["formName"],字串,爲該表單的名稱
#$conf["formName"]="";
#$conf["formMethod"],字串,爲傳輸的方法,若沒設定則預設爲post,其他可用的參數爲get。
#$conf["formMethod"]="";
#$conf["formTarget"],字串,為顯示的方式,若沒設定則預設爲"_self",其他可用的參數爲 "_blank"、"_parent"、"_top",也可以是iframe的名稱。
#$conf["formTarget"]="";
#$conf["tableStart"],字串,爲該表單是否要以<table>開始。"true"爲是,預設為"false".
#$conf["tableStart"]="";
#$conf["tableClass"],字串,表格要套用的css樣式,若爲"__withoutBorder"的話則套用無框線的預設樣式;若爲"__withBorder"的話,則爲有框線的預設樣式,預設為"__withoutBorder".
#$conf["tableClass"]="";
#$conf["formEnd"],字串,爲是否要以<form>結尾,"true"表示"是",也可以看成表單的結束,預設為"false".
#$conf["formEnd"]="true";
#$conf["tdEnd"],字串,爲是否要以</td>結尾,"true"表示"是"。也可以看成列裏面的元素結束,預設為"false".
#$conf["tdEnd"]="true";
#$conf["trEnd"],字串,爲是否要以</tr>結尾,"true"表示"是"。也可以看作該列結束,預設為"false".
#$conf["trEnd"]="true";
#$conf["tableEnd"],字串,爲該表單是否要以</table>結尾,"true"爲是,預設為"false".
#$conf["tableEnd"]="true";
#$conf["autocomplete"],字串,是否依據使用者過往輸入的記錄來提示可能要的輸入內容,"on"為啟用,"off"為停用,預設為"on".
#$conf["autocomplete"]="off";
#$conf["required"],字串,該欄位是否必填,"true"為必填,"false"為可留空,預設為"false".
#$conf["required"]="true";
#$conf["comment"],字串,輸入方框上面要放哪些註解文字,亦即用label來呈現,同時指定"for"屬性的數值為當前"input"標籤的id,意即參數"name"的內容.
$conf["comment"]="文字輸入的表單";
#$conf["placeholder"],字串,當沒有內容時要顯示的內容.
$conf["placeholder"]="測試 classList 參數";
#$conf["br"],字串,"true"代表最後要換行,預設為"false".
#$conf["br"]="true";
#$conf["p"],字串,"true"代表最後要空一行,預設為"false".
#$conf["p"]="true";
#$conf["id"],字串,該元素的id,預設不使用.
#$conf["id"]="";
#$conf["dataFormId"],字串,提供用於識別哪一張表單的data屬性名稱.
#$conf["dataFormId"]="";
#參考資料:
#input=>http://www.w3schools.com/tags/tag_input.asp
#備註:
#無.
$inputText=form::inputText($conf);
unset($conf);

#debug
#var_dump($inputText);exit;

#如果執行失敗
if($inputText["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"]=$inputText;
        #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
        $conf["fileArgu"]=__FILE__;
        #可省略參數:
        #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
        #$conf["rewrite"]="false";
        #參考資料:
        #無.
        #備註:
        #無.
        $record=logs::record($conf);
        unset($conf);

        #結束執行
        exit(1);

        }#if end

#印出結果
echo $inputText["content"];