Subversion Repositories php-qbpwcf

Rev

Rev 3 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2024 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 20... Line 20...
20
    You should have received a copy of the GNU General Public License
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
 
22
 
23
*/
23
*/
24
namespace qbpwcf;
24
namespace qbpwcf;
25
	
25
 
26
/*
26
/*
27
類別說明:
27
類別說明:
28
tab應用相關的類別.
28
tab應用相關的類別.
29
備註:
29
備註:
30
無.
30
無.
31
*/
31
*/
32
class tab{
32
class tab{
33
	
33
 
34
	/*
34
	/*
35
	#函式說明:
35
	#函式說明:
36
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
36
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
37
	#回傳結果:
37
	#回傳結果:
38
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
38
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 43... Line 43...
43
	#$arguments,陣列,為呼叫方法時所用的參數.
43
	#$arguments,陣列,為呼叫方法時所用的參數.
44
	#參考資料:
44
	#參考資料:
45
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
45
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
46
	*/
46
	*/
47
	public function __call($method,$arguments){
47
	public function __call($method,$arguments){
48
		
48
 
49
		#取得當前執行的函式
49
		#取得當前執行的函式
50
		$result["function"]=__FUNCTION__;
50
		$result["function"]=__FUNCTION__;
51
		
51
 
52
		#設置執行不正常
52
		#設置執行不正常
53
		$result["status"]="false";
53
		$result["status"]="false";
54
		
54
 
55
		#設置執行錯誤
55
		#設置執行錯誤
56
		$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
56
		$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
57
		
57
 
58
		#設置所丟入的參數
58
		#設置所丟入的參數
59
		$result["error"][]=$arguments;
59
		$result["error"][]=$arguments;
60
		
60
 
61
		#回傳結果
61
		#回傳結果
62
		return $result;
62
		return $result;
63
		
63
 
64
		}#function __call end
64
		}#function __call end
65
		
65
 
66
	/*
66
	/*
67
	#函式說明:
67
	#函式說明:
68
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
68
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
69
	#回傳結果:
69
	#回傳結果:
70
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
70
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 75... Line 75...
75
	#$arguments,陣列,為呼叫方法時所用的參數.
75
	#$arguments,陣列,為呼叫方法時所用的參數.
76
	#參考資料:
76
	#參考資料:
77
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
77
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
78
	*/
78
	*/
79
	public static function __callStatic($method,$arguments){
79
	public static function __callStatic($method,$arguments){
80
		
80
 
81
		#取得當前執行的函式
81
		#取得當前執行的函式
82
		$result["function"]=__FUNCTION__;
82
		$result["function"]=__FUNCTION__;
83
		
83
 
84
		#設置執行不正常
84
		#設置執行不正常
85
		$result["status"]="false";
85
		$result["status"]="false";
86
		
86
 
87
		#設置執行錯誤
87
		#設置執行錯誤
88
		$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
88
		$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
89
		
89
 
90
		#設置所丟入的參數
90
		#設置所丟入的參數
91
		$result["error"][]=$arguments;
91
		$result["error"][]=$arguments;
92
		
92
 
93
		#回傳結果
93
		#回傳結果
94
		return $result;
94
		return $result;
95
		
95
 
96
		}#function __callStatic end
96
		}#function __callStatic end
97
	
97
 
98
	/*
98
	/*
99
	#涵式說明:
99
	#涵式說明:
100
	#建立給行動版頁面使用的分頁功能
100
	#建立給行動版頁面使用的分頁功能
101
	#回傳結果:
101
	#回傳結果:
102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
103
	#$result["error"],錯誤訊息陣列.
103
	#$result["error"],錯誤訊息陣列.
104
	#$result["function"],當前執行的函數名稱
104
	#$result["function"],當前執行的函數名稱
105
	#$result["content"],建立bootstrap樣式分頁的語法
105
	#$result["content"],建立bootstrap樣式分頁的語法
106
	#必填參數:
106
	#必填參數:
107
	#$conf["liName"],字串陣列,每個分頁標籤的名稱.		
107
	#$conf["liName"],字串陣列,每個分頁標籤的名稱.
108
	$conf["liName"]=array();
108
	$conf["liName"]=array();
109
	#$conf["liContent"],字串陣列,每個分頁底下的內容為什麼.
109
	#$conf["liContent"],字串陣列,每個分頁底下的內容為什麼.
110
	$conf["liContent"]=array();
110
	$conf["liContent"]=array();
111
	#可省略參數:
111
	#可省略參數:
112
	#$conf["liIdHeadStr"],字串,每個分頁的id開頭字串,預設為"mobileTab",若在一分html文件裡面使用多個mobile()則會導致衝突,請務必個別指派不同的數值.
112
	#$conf["liIdHeadStr"],字串,每個分頁的id開頭字串,預設為"mobileTab",若在一分html文件裡面使用多個mobile()則會導致衝突,請務必個別指派不同的數值.
113
	#$conf["liIdHeadStr"]="";
113
	#$conf["liIdHeadStr"]="";
114
	*/
114
	*/
115
	function mobile(&$conf){
115
	function mobile(&$conf){
116
		
116
 
117
		#初始化要回傳的結果
117
		#初始化要回傳的結果
118
		$result=array();
118
		$result=array();
119
 
119
 
120
		#初始化語法
120
		#初始化語法
121
		$result["content"]="";
121
		$result["content"]="";
Line 123... Line 123...
123
		#取得當前執行的函數名稱
123
		#取得當前執行的函數名稱
124
		$result["function"]=__FUNCTION__;
124
		$result["function"]=__FUNCTION__;
125
 
125
 
126
		#如果沒有參數
126
		#如果沒有參數
127
		if(func_num_args()==0){
127
		if(func_num_args()==0){
128
			
128
 
129
			#設置執行失敗
129
			#設置執行失敗
130
			$result["status"]="false";
130
			$result["status"]="false";
131
			
131
 
132
			#設置執行錯誤訊息
132
			#設置執行錯誤訊息
133
			$result["error"]="函數".$result["function"]."需要參數";
133
			$result["error"]="函數".$result["function"]."需要參數";
134
			
134
 
135
			#回傳結果
135
			#回傳結果
136
			return $result;
136
			return $result;
137
			
137
 
138
			}#if end
138
			}#if end
139
			
139
 
140
		#取得參數
140
		#取得參數
141
		$result["argu"]=$conf;
141
		$result["argu"]=$conf;
142
 
142
 
143
		#如果 $conf 不為陣列
143
		#如果 $conf 不為陣列
144
		if(gettype($conf)!="array"){
144
		if(gettype($conf)!="array"){
145
			
145
 
146
			#設置執行失敗
146
			#設置執行失敗
147
			$result["status"]="false";
147
			$result["status"]="false";
148
			
148
 
149
			#設置執行錯誤訊息
149
			#設置執行錯誤訊息
150
			$result["error"][]="\$conf變數須為陣列形態";
150
			$result["error"][]="\$conf變數須為陣列形態";
151
			
151
 
152
			#如果傳入的參數為 null
152
			#如果傳入的參數為 null
153
			if($conf==null){
153
			if($conf==null){
154
				
154
 
155
				#設置執行錯誤訊息
155
				#設置執行錯誤訊息
156
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
156
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
157
				
157
 
158
				}#if end
158
				}#if end
159
 
159
 
160
			#回傳結果
160
			#回傳結果
161
			return $result;
161
			return $result;
162
			
162
 
163
			}#if end
163
			}#if end
164
		
164
 
165
		#檢查參數
165
		#檢查參數
166
		#函式說明:
166
		#函式說明:
167
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
167
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
168
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
168
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
169
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
169
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 194... Line 194...
194
		#$conf["canBeEmpty"]=array();
194
		#$conf["canBeEmpty"]=array();
195
		#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
195
		#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
196
		#$conf["skipableVariableCanNotBeEmpty"]=array();
196
		#$conf["skipableVariableCanNotBeEmpty"]=array();
197
		#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
197
		#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
198
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("liIdHeadStr");
198
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("liIdHeadStr");
199
		#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
199
		#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
200
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
200
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
201
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
201
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
202
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("mobileTab");
202
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("mobileTab");
203
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
203
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
204
		$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array("liName","liContnet");
204
		$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array("liName","liContnet");
205
		#參考資料來源:
205
		#參考資料來源:
206
		#array_keys=>http://php.net/manual/en/function.array-keys.php
206
		#array_keys=>http://php.net/manual/en/function.array-keys.php
207
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
207
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
208
		unset($conf["variableCheck::checkArguments"]);
208
		unset($conf["variableCheck::checkArguments"]);
209
		
209
 
210
		#如果檢查參數失敗
210
		#如果檢查參數失敗
211
		if($checkArguments["status"]=="false"){
211
		if($checkArguments["status"]=="false"){
212
			
212
 
213
			#設置執行失敗
213
			#設置執行失敗
214
			$result["status"]="false";
214
			$result["status"]="false";
215
			
215
 
216
			#設置執行錯誤訊息
216
			#設置執行錯誤訊息
217
			$result["error"]=$checkArguments;
217
			$result["error"]=$checkArguments;
218
			
218
 
219
			#回傳結果
219
			#回傳結果
220
			return $result;
220
			return $result;
221
			
221
 
222
			}#if end
222
			}#if end
223
			
223
 
224
		#如果檢查參數不通過
224
		#如果檢查參數不通過
225
		if($checkArguments["passed"]=="false"){
225
		if($checkArguments["passed"]=="false"){
226
			
226
 
227
			#設置執行失敗
227
			#設置執行失敗
228
			$result["status"]="false";
228
			$result["status"]="false";
229
			
229
 
230
			#設置執行錯誤訊息
230
			#設置執行錯誤訊息
231
			$result["error"]=$checkArguments;
231
			$result["error"]=$checkArguments;
232
			
232
 
233
			#回傳結果
233
			#回傳結果
234
			return $result;
234
			return $result;
235
			
235
 
236
			}#if end
236
			}#if end
237
		
237
 
238
		#涵式說明: 
238
		#涵式說明:
239
		#建立給與html標籤使用的style屬性字串.
239
		#建立給與html標籤使用的style屬性字串.
240
		#回傳的結果:
240
		#回傳的結果:
241
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.		
241
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
242
		#$result["function"],當前執行的函數
242
		#$result["function"],當前執行的函數
243
		#$result["error"],錯誤訊息陣列
243
		#$result["error"],錯誤訊息陣列
244
		#$result["content"],css設定內容
244
		#$result["content"],css設定內容
245
		#必填的參數:
245
		#必填的參數:
246
		$conf["css::styleStr"]["styleName"]=array("font-size","display","padding-left","padding-right","padding-top","padding-bottom");#為屬性名稱,須為陣列值
246
		$conf["css::styleStr"]["styleName"]=array("font-size","display","padding-left","padding-right","padding-top","padding-bottom");#為屬性名稱,須為陣列值
247
		$conf["css::styleStr"]["styleValue"]=array("26px","inline","15px","15px","10px","10px");#為屬性值,須為陣列值
247
		$conf["css::styleStr"]["styleValue"]=array("26px","inline","15px","15px","10px","10px");#為屬性值,須為陣列值
248
		$styleStr=css::styleStr($conf["css::styleStr"]);
248
		$styleStr=css::styleStr($conf["css::styleStr"]);
249
		unset($conf["css::styleStr"]);
249
		unset($conf["css::styleStr"]);
250
		
250
 
251
		#如果建立 style 屬性字串失敗
251
		#如果建立 style 屬性字串失敗
252
		if($styleStr["status"]=="false"){
252
		if($styleStr["status"]=="false"){
253
			
253
 
254
			#設置執行失敗
254
			#設置執行失敗
255
			$result["status"]="false";
255
			$result["status"]="false";
256
			
256
 
257
			#設置執行錯誤訊息
257
			#設置執行錯誤訊息
258
			$result["error"]=$styleStr;
258
			$result["error"]=$styleStr;
259
			
259
 
260
			#回傳結果
260
			#回傳結果
261
			return $result;
261
			return $result;
262
			
262
 
263
			}#if end
263
			}#if end
264
		
264
 
265
		#tag標題開始
265
		#tag標題開始
266
		$result["content"]=$result["content"]."<div>";
266
		$result["content"]=$result["content"]."<div>";
267
		
267
 
268
		#上一頁的元素id
268
		#上一頁的元素id
269
		$prePageId=$conf["liIdHeadStr"]."_prePage";
269
		$prePageId=$conf["liIdHeadStr"]."_prePage";
270
		
270
 
271
		#上一頁的標籤
271
		#上一頁的標籤
272
		$result["content"]=$result["content"]."<span ".$styleStr["content"]." >";
272
		$result["content"]=$result["content"]."<span ".$styleStr["content"]." >";
273
		$result["content"]=$result["content"]."<span id=\"".$prePageId."\" class=\"btn btn-default\" >上一頁</span>";
273
		$result["content"]=$result["content"]."<span id=\"".$prePageId."\" class=\"btn btn-default\" >上一頁</span>";
274
		$result["content"]=$result["content"]."</span>";
274
		$result["content"]=$result["content"]."</span>";
275
		
275
 
276
		#當前標題的標籤
276
		#當前標題的標籤
277
		$result["content"]=$result["content"]."<span ".$styleStr["content"]." >";
277
		$result["content"]=$result["content"]."<span ".$styleStr["content"]." >";
278
		$result["content"]=$result["content"]."<span></span>";
278
		$result["content"]=$result["content"]."<span></span>";
279
		$result["content"]=$result["content"]."</span>";
279
		$result["content"]=$result["content"]."</span>";
280
		
280
 
281
		#下一頁的元素id
281
		#下一頁的元素id
282
		$nextPageId=$conf["liIdHeadStr"]."_nextPage";
282
		$nextPageId=$conf["liIdHeadStr"]."_nextPage";
283
		
283
 
284
		#下一頁的標籤
284
		#下一頁的標籤
285
		$result["content"]=$result["content"]."<span ".$styleStr["content"]." >";
285
		$result["content"]=$result["content"]."<span ".$styleStr["content"]." >";
286
		$result["content"]=$result["content"]."<span id=\"".$nextPageId."\" class=\"btn btn-default\" >下一頁</span>";
286
		$result["content"]=$result["content"]."<span id=\"".$nextPageId."\" class=\"btn btn-default\" >下一頁</span>";
287
		$result["content"]=$result["content"]."</span>";
287
		$result["content"]=$result["content"]."</span>";
288
		
288
 
289
		#tag標題結束
289
		#tag標題結束
290
		$result["content"]=$result["content"]."</div>";
290
		$result["content"]=$result["content"]."</div>";
291
		
291
 
292
		#設置隱藏樣式的css類別名稱
292
		#設置隱藏樣式的css類別名稱
293
		$hideClass=$conf["liIdHeadStr"]."_hide";
293
		$hideClass=$conf["liIdHeadStr"]."_hide";
294
		
294
 
295
		#建立 $tabIdHeadStr.hide 類別
295
		#建立 $tabIdHeadStr.hide 類別
296
		#涵式說明: 
296
		#涵式說明:
297
		#創建 css 樣式,前面會自動加上「.」.
297
		#創建 css 樣式,前面會自動加上「.」.
298
		#回傳的結果:
298
		#回傳的結果:
299
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
299
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
300
		#$result["css"],css設定內容
300
		#$result["css"],css設定內容
301
		#$result["function"],當前執行的函數
301
		#$result["function"],當前執行的函數
302
		#$result["error"],涵式錯誤訊息,若爲""則表示沒有錯誤 
302
		#$result["error"],涵式錯誤訊息,若爲""則表示沒有錯誤
303
		#必填的參數:
303
		#必填的參數:
304
		$conf["css::createCssStyle"]["cssStyleName"]=$hideClass;#為該 css 樣式的名稱,不能以數字開頭,限定id的css樣式名稱為「樣式名稱.元素名稱」.
304
		$conf["css::createCssStyle"]["cssStyleName"]=$hideClass;#為該 css 樣式的名稱,不能以數字開頭,限定id的css樣式名稱為「樣式名稱.元素名稱」.
305
		$conf["css::createCssStyle"]["attributes"]=array("display");#為屬性名稱,須為陣列值
305
		$conf["css::createCssStyle"]["attributes"]=array("display");#為屬性名稱,須為陣列值
306
		$conf["css::createCssStyle"]["content"]=array("none");#為屬性值,須為陣列值
306
		$conf["css::createCssStyle"]["content"]=array("none");#為屬性值,須為陣列值
307
		$createCssStyle=css::createCssStyle($conf["css::createCssStyle"]);
307
		$createCssStyle=css::createCssStyle($conf["css::createCssStyle"]);
308
		unset($conf["css::createCssStyle"]);
308
		unset($conf["css::createCssStyle"]);
309
		
309
 
310
		#如果建立 css 樣式失敗
310
		#如果建立 css 樣式失敗
311
		if($createCssStyle["status"]=="false"){
311
		if($createCssStyle["status"]=="false"){
312
			
312
 
313
			$result["status"]="false";
313
			$result["status"]="false";
314
				
314
 
315
			#設置執行錯誤訊息
315
			#設置執行錯誤訊息
316
			$result["error"]=$createCssStyle;
316
			$result["error"]=$createCssStyle;
317
			
317
 
318
			#回傳結果
318
			#回傳結果
319
			return $result;
319
			return $result;
320
			
320
 
321
			}#if end
321
			}#if end
322
		
322
 
323
		#串接 css 樣式			
323
		#串接 css 樣式
324
		$result["content"]=$result["content"].$createCssStyle["css"];
324
		$result["content"]=$result["content"].$createCssStyle["css"];
325
		
325
 
326
		#儲存總共有幾個tab
326
		#儲存總共有幾個tab
327
		$tabCount=count($conf["liContent"]);
327
		$tabCount=count($conf["liContent"]);
328
					
328
 
329
		#$conf["liContent"]有幾個元素就執行幾次
329
		#$conf["liContent"]有幾個元素就執行幾次
330
		for($i=0;$i<$tabCount;$i++){
330
		for($i=0;$i<$tabCount;$i++){
331
		
331
 
332
			#設置div區塊
332
			#設置div區塊
333
			#涵式說明:
333
			#涵式說明:
334
			#<div>區塊,裡面可以指定css的class樣式,可以指定提示文字.
334
			#<div>區塊,裡面可以指定css的class樣式,可以指定提示文字.
335
			#$result["status"],字串,執行否正常,"true"代表正常,"false"代表不正常.
335
			#$result["status"],字串,執行否正常,"true"代表正常,"false"代表不正常.
336
			#$result["functin"],字串,當前函數的名稱.
336
			#$result["functin"],字串,當前函數的名稱.
Line 346... Line 346...
346
			$conf["css::divSection"]["class"]=$hideClass;
346
			$conf["css::divSection"]["class"]=$hideClass;
347
			#$conf["title"],陣列,滑鼠移到上面時要顯示的內容,每個元素代表一列內容
347
			#$conf["title"],陣列,滑鼠移到上面時要顯示的內容,每個元素代表一列內容
348
			#$conf["title"]=array();
348
			#$conf["title"]=array();
349
			$divSection=css::divSection($conf["css::divSection"]);
349
			$divSection=css::divSection($conf["css::divSection"]);
350
			unset($conf["css::divSection"]);
350
			unset($conf["css::divSection"]);
351
		
351
 
352
			#如果建立div區塊失敗
352
			#如果建立div區塊失敗
353
			if($divSection["status"]=="false"){
353
			if($divSection["status"]=="false"){
354
				
354
 
355
				#設置執行失敗
355
				#設置執行失敗
356
				$result["status"]="false";
356
				$result["status"]="false";
357
				
357
 
358
				#設置執行錯誤訊息
358
				#設置執行錯誤訊息
359
				$result["error"]=$divSection;
359
				$result["error"]=$divSection;
360
				
360
 
361
				#回傳結果
361
				#回傳結果
362
				return $result;
362
				return $result;
363
				
363
 
364
				}#if end
364
				}#if end
365
				
365
 
366
			#串接div的內容
366
			#串接div的內容
367
			$result["content"]=$result["content"].$divSection["content"];
367
			$result["content"]=$result["content"].$divSection["content"];
368
		
368
 
369
			}#for end
369
			}#for end
370
		
370
 
371
		#儲存tab名稱變數
371
		#儲存tab名稱變數
372
		$jsonArray["tabList"]=$conf["liName"];
372
		$jsonArray["tabList"]=$conf["liName"];
373
			
373
 
374
		#預設要顯示的tab index
374
		#預設要顯示的tab index
375
		$jsonArray["tabToShow"]=0;					
375
		$jsonArray["tabToShow"]=0;
376
		
376
 
377
		#轉換成json變數
377
		#轉換成json變數
378
		$jsonData=json_encode($jsonArray);
378
		$jsonData=json_encode($jsonArray);
379
		
379
 
380
		#設置暫存新分頁資訊的webstorage名稱
380
		#設置暫存新分頁資訊的webstorage名稱
381
		$tempWebStorage=$conf["liIdHeadStr"]."_tempWebStorage";
381
		$tempWebStorage=$conf["liIdHeadStr"]."_tempWebStorage";
382
		
382
 
383
		#設置儲存哪個分頁要顯示以及每個分頁標題的webSorage變數.
383
		#設置儲存哪個分頁要顯示以及每個分頁標題的webSorage變數.
384
		#涵式說明:
384
		#涵式說明:
385
		#儲存變數到local storage
385
		#儲存變數到local storage
386
		#回傳結果:
386
		#回傳結果:
387
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
387
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
Line 395... Line 395...
395
		$conf["javaScript::saveToLocalStorage"]["val"]=$jsonData;
395
		$conf["javaScript::saveToLocalStorage"]["val"]=$jsonData;
396
		#$conf["noScriptTag"],字串,是否不要<script></script>,"true"代表不要,"false"代表不用,預設為"false".
396
		#$conf["noScriptTag"],字串,是否不要<script></script>,"true"代表不要,"false"代表不用,預設為"false".
397
		#$conf["javaScript::saveToLocalStorage"]["noScriptTag"]="false";
397
		#$conf["javaScript::saveToLocalStorage"]["noScriptTag"]="false";
398
		$saveToLocalStorage=javaScript::saveToLocalStorage($conf["javaScript::saveToLocalStorage"]);
398
		$saveToLocalStorage=javaScript::saveToLocalStorage($conf["javaScript::saveToLocalStorage"]);
399
		unset($conf["javaScript::saveToLocalStorage"]);
399
		unset($conf["javaScript::saveToLocalStorage"]);
400
		
400
 
401
		#如果建立local storage失敗
401
		#如果建立local storage失敗
402
		if($saveToLocalStorage["status"]==="false"){
402
		if($saveToLocalStorage["status"]==="false"){
403
			
403
 
404
			#設置執行失敗
404
			#設置執行失敗
405
			$result["status"]="false";
405
			$result["status"]="false";
406
			
406
 
407
			#設置執行錯誤訊息
407
			#設置執行錯誤訊息
408
			$result["error"]=$saveToLocalStorage;
408
			$result["error"]=$saveToLocalStorage;
409
			
409
 
410
			#回傳結果
410
			#回傳結果
411
			return $result;
411
			return $result;
412
			
412
 
413
			}#if end
413
			}#if end
414
			
414
 
415
		#串接內容
415
		#串接內容
416
		$result["content"]=$result["content"].$saveToLocalStorage["content"];
416
		$result["content"]=$result["content"].$saveToLocalStorage["content"];
417
		
417
 
418
		#設置儲存既有分頁資訊的webstorage名稱
418
		#設置儲存既有分頁資訊的webstorage名稱
419
		$webStorage=$conf["liIdHeadStr"]."_webStorage";
419
		$webStorage=$conf["liIdHeadStr"]."_webStorage";
420
		
420
 
421
		#設置儲存既有分頁資訊的js變數名稱
421
		#設置儲存既有分頁資訊的js變數名稱
422
		$currentTabInfo=$conf["liIdHeadStr"]."currentTabInfo";
422
		$currentTabInfo=$conf["liIdHeadStr"]."currentTabInfo";
423
		
423
 
424
		#檢查是否存在既有分頁資訊的 local storage 變數.
424
		#檢查是否存在既有分頁資訊的 local storage 變數.
425
		#涵式說明:
425
		#涵式說明:
426
		#取得儲存在local storage的變數
426
		#取得儲存在local storage的變數
427
		#回傳結果:
427
		#回傳結果:
428
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
428
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
Line 439... Line 439...
439
		$conf["javaScript::getLocalStorage"]["noScriptTag"]="true";
439
		$conf["javaScript::getLocalStorage"]["noScriptTag"]="true";
440
		#$conf["json"],字串要取出的資料是否json,"true"代表是,"false"代表不是,預設為"false".
440
		#$conf["json"],字串要取出的資料是否json,"true"代表是,"false"代表不是,預設為"false".
441
		$conf["javaScript::getLocalStorage"]["json"]="true";
441
		$conf["javaScript::getLocalStorage"]["json"]="true";
442
		$getLocalStorage=javaScript::getLocalStorage($conf["javaScript::getLocalStorage"]);
442
		$getLocalStorage=javaScript::getLocalStorage($conf["javaScript::getLocalStorage"]);
443
		unset($conf["javaScript::getLocalStorage"]);
443
		unset($conf["javaScript::getLocalStorage"]);
444
		
444
 
445
		#如果建立語法失敗
445
		#如果建立語法失敗
446
		if($getLocalStorage["status"]==="false"){
446
		if($getLocalStorage["status"]==="false"){
447
					
447
 
448
			#設置執行失敗
448
			#設置執行失敗
449
			$result["status"]="false";
449
			$result["status"]="false";
450
			
450
 
451
			#設置執行錯誤訊息
451
			#設置執行錯誤訊息
452
			$result["error"]=$getLocalStorage;
452
			$result["error"]=$getLocalStorage;
453
			
453
 
454
			#回傳結果
454
			#回傳結果
455
			return $result;
455
			return $result;
456
			
456
 
457
			}#if end
457
			}#if end
458
		
458
 
459
		#取得儲存在 local storage 中既有的分頁資料
459
		#取得儲存在 local storage 中既有的分頁資料
460
		$script=$getLocalStorage["content"];
460
		$script=$getLocalStorage["content"];
461
		
461
 
462
		#設置儲存哪個分頁要顯示以及每個分頁標題的webSorage變數.
462
		#設置儲存哪個分頁要顯示以及每個分頁標題的webSorage變數.
463
		#涵式說明:
463
		#涵式說明:
464
		#儲存變數到local storage
464
		#儲存變數到local storage
465
		#回傳結果:
465
		#回傳結果:
466
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
466
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
Line 475... Line 475...
475
		#可省略參數:
475
		#可省略參數:
476
		#$conf["noScriptTag"],字串,是否不要用script tag包住回傳的內容($result["content"]),"true"代表不要用,"false"代表要用,預設為"false".
476
		#$conf["noScriptTag"],字串,是否不要用script tag包住回傳的內容($result["content"]),"true"代表不要用,"false"代表要用,預設為"false".
477
		$conf["javaScript::saveToLocalStorage"]["noScriptTag"]="true";
477
		$conf["javaScript::saveToLocalStorage"]["noScriptTag"]="true";
478
		$saveToLocalStorage=javaScript::saveToLocalStorage($conf["javaScript::saveToLocalStorage"]);
478
		$saveToLocalStorage=javaScript::saveToLocalStorage($conf["javaScript::saveToLocalStorage"]);
479
		unset($conf["javaScript::saveToLocalStorage"]);
479
		unset($conf["javaScript::saveToLocalStorage"]);
480
		
480
 
481
		#如果建立local storage失敗
481
		#如果建立local storage失敗
482
		if($saveToLocalStorage["status"]==="false"){
482
		if($saveToLocalStorage["status"]==="false"){
483
			
483
 
484
			#設置執行失敗
484
			#設置執行失敗
485
			$result["status"]="false";
485
			$result["status"]="false";
486
			
486
 
487
			#設置執行錯誤訊息
487
			#設置執行錯誤訊息
488
			$result["error"]=$saveToLocalStorage;
488
			$result["error"]=$saveToLocalStorage;
489
			
489
 
490
			#回傳結果
490
			#回傳結果
491
			return $result;
491
			return $result;
492
			
492
 
493
			}#if end
493
			}#if end
494
			
494
 
495
		#涵式說明:
495
		#涵式說明:
496
		#移除儲存在local storage的變數
496
		#移除儲存在local storage的變數
497
		#回傳結果:
497
		#回傳結果:
498
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
498
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
499
		#$result["error"],錯誤訊息陣列
499
		#$result["error"],錯誤訊息陣列
Line 505... Line 505...
505
		#可省略參數:
505
		#可省略參數:
506
		#$conf["noScriptTag"],字串,是否不要用script tag包住回傳的內容($result["content"]),"true"代表不要用,"false"代表要用,預設為"false".
506
		#$conf["noScriptTag"],字串,是否不要用script tag包住回傳的內容($result["content"]),"true"代表不要用,"false"代表要用,預設為"false".
507
		$conf["javaScript::rmLocalStorage"]["noScriptTag"]="true";
507
		$conf["javaScript::rmLocalStorage"]["noScriptTag"]="true";
508
		$rmLocalStorage=javaScript::rmLocalStorage($conf["javaScript::rmLocalStorage"]);
508
		$rmLocalStorage=javaScript::rmLocalStorage($conf["javaScript::rmLocalStorage"]);
509
		unset($conf["javaScript::rmLocalStorage"]);
509
		unset($conf["javaScript::rmLocalStorage"]);
510
		
510
 
511
		#如果建立移除暫存 local storage 變數的語法失敗
511
		#如果建立移除暫存 local storage 變數的語法失敗
512
		if($rmLocalStorage["status"]=="false"){
512
		if($rmLocalStorage["status"]=="false"){
513
			
513
 
514
			#設置執行失敗
514
			#設置執行失敗
515
			$result["status"]="false";
515
			$result["status"]="false";
516
			
516
 
517
			#設置執行錯誤訊息
517
			#設置執行錯誤訊息
518
			$result["error"]=$rmLocalStorage;
518
			$result["error"]=$rmLocalStorage;
519
			
519
 
520
			#回傳結果
520
			#回傳結果
521
			return $result;
521
			return $result;
522
			
522
 
523
			}#if end
523
			}#if end
524
		
524
 
525
		#建立 prePage 的事件
525
		#建立 prePage 的事件
526
		#涵式說明:
526
		#涵式說明:
527
		#建立特定元素的jquery on click事件
527
		#建立特定元素的jquery on click事件
528
		#回傳結果:
528
		#回傳結果:
529
		#$result["status"],執行正確與否,"true"代表執行正確,"false"代表執行失敗.
529
		#$result["status"],執行正確與否,"true"代表執行正確,"false"代表執行失敗.
Line 536... Line 536...
536
		$conf["jquery::onClick"]["trigger"]="#".$prePageId;
536
		$conf["jquery::onClick"]["trigger"]="#".$prePageId;
537
		#$conf["content"],字串,click事件觸發後,要做的事情.
537
		#$conf["content"],字串,click事件觸發後,要做的事情.
538
		$conf["jquery::onClick"]["content"]=$getLocalStorage["content"]."
538
		$conf["jquery::onClick"]["content"]=$getLocalStorage["content"]."
539
			//取得當前分頁的索引
539
			//取得當前分頁的索引
540
			index=".$currentTabInfo.".tabToShow;
540
			index=".$currentTabInfo.".tabToShow;
541
			
541
 
542
			//如果是第一個分頁
542
			//如果是第一個分頁
543
			if(index==0)
543
			if(index==0)
544
			{					
544
			{
545
				return false;
545
				return false;
546
			}
546
			}
547
			//反之
547
			//反之
548
			else
548
			else
549
			{
549
			{
550
				//隱藏切換前的分頁內容
550
				//隱藏切換前的分頁內容
551
				$('#".$conf["liIdHeadStr"]."'+index).addClass('".$hideClass."');
551
				$('#".$conf["liIdHeadStr"]."'+index).addClass('".$hideClass."');
552
				
552
 
553
				//恢復下一頁的功能
553
				//恢復下一頁的功能
554
				$('#".$nextPageId."').attr('disabled',false);
554
				$('#".$nextPageId."').attr('disabled',false);
555
									
555
 
556
				//分頁索引-1
556
				//分頁索引-1
557
				".$currentTabInfo.".tabToShow=index-1;
557
				".$currentTabInfo.".tabToShow=index-1;
558
				
558
 
559
				//如果是一個分頁
559
				//如果是一個分頁
560
				if(".$currentTabInfo.".tabToShow==0)
560
				if(".$currentTabInfo.".tabToShow==0)
561
				{
561
				{
562
					//停止上一頁的功能
562
					//停止上一頁的功能
563
					$('#".$prePageId."').attr('disabled',true);
563
					$('#".$prePageId."').attr('disabled',true);
564
				}
564
				}
565
				
565
 
566
				//更新儲存到localStorage的變數(目前看的分頁)
566
				//更新儲存到localStorage的變數(目前看的分頁)
567
				localStorage.".$webStorage."=JSON.stringify(".$currentTabInfo.");
567
				localStorage.".$webStorage."=JSON.stringify(".$currentTabInfo.");
568
				
568
 
569
				//更新分頁標題
569
				//更新分頁標題
570
				$('#".$prePageId."').parent().next().html('<span>'+".$currentTabInfo.".tabList[".$currentTabInfo.".tabToShow]+'</span>');				
570
				$('#".$prePageId."').parent().next().html('<span>'+".$currentTabInfo.".tabList[".$currentTabInfo.".tabToShow]+'</span>');
571
			
571
 
572
				//顯示分頁內容
572
				//顯示分頁內容
573
				$('#".$conf["liIdHeadStr"]."'+".$currentTabInfo.".tabToShow).removeClass('".$hideClass."');
573
				$('#".$conf["liIdHeadStr"]."'+".$currentTabInfo.".tabToShow).removeClass('".$hideClass."');
574
			}			
574
			}
575
			";	
575
			";
576
		#可省略參數:
576
		#可省略參數:
577
		#$conf["jqueryPath"],字串,jquery的位置,預設不指定.
577
		#$conf["jqueryPath"],字串,jquery的位置,預設不指定.
578
		#$conf["jqueryPath"]="";
578
		#$conf["jqueryPath"]="";
579
		#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jqueryPath"一起設置,預設為當前檔案的位置.
579
		#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jqueryPath"一起設置,預設為當前檔案的位置.
580
		#$conf["fileArgu"]=__FILE__;
580
		#$conf["fileArgu"]=__FILE__;
Line 582... Line 582...
582
		$conf["jquery::onClick"]["noScriptTag"]="true";
582
		$conf["jquery::onClick"]["noScriptTag"]="true";
583
		#參考資料:
583
		#參考資料:
584
		#selector=>https://api.jquery.com/category/selectors/
584
		#selector=>https://api.jquery.com/category/selectors/
585
		$prePageClickEvent=jquery::onClick($conf["jquery::onClick"]);
585
		$prePageClickEvent=jquery::onClick($conf["jquery::onClick"]);
586
		unset($conf["jquery::onClick"]);
586
		unset($conf["jquery::onClick"]);
587
		
587
 
588
		#如果建立 on click 事件失敗
588
		#如果建立 on click 事件失敗
589
		if($prePageClickEvent["status"]=="false"){
589
		if($prePageClickEvent["status"]=="false"){
590
			
590
 
591
			#設置執行失敗
591
			#設置執行失敗
592
			$result["status"]="false";
592
			$result["status"]="false";
593
			
593
 
594
			#設置執行錯誤訊息
594
			#設置執行錯誤訊息
595
			$result["error"]=$prePageClickEvent;
595
			$result["error"]=$prePageClickEvent;
596
			
596
 
597
			#回傳結果
597
			#回傳結果
598
			return $result;
598
			return $result;
599
			
599
 
600
			}#if end
600
			}#if end
601
		
601
 
602
		#建立 nextPage 的事件
602
		#建立 nextPage 的事件
603
		#涵式說明:
603
		#涵式說明:
604
		#建立特定元素的jquery on click事件
604
		#建立特定元素的jquery on click事件
605
		#回傳結果:
605
		#回傳結果:
606
		#$result["status"],執行正確與否,"true"代表執行正確,"false"代表執行失敗.
606
		#$result["status"],執行正確與否,"true"代表執行正確,"false"代表執行失敗.
Line 613... Line 613...
613
		$conf["jquery::onClick"]["trigger"]="#".$nextPageId;
613
		$conf["jquery::onClick"]["trigger"]="#".$nextPageId;
614
		#$conf["content"],字串,click事件觸發後,要做的事情.
614
		#$conf["content"],字串,click事件觸發後,要做的事情.
615
		$conf["jquery::onClick"]["content"]=$getLocalStorage["content"]."
615
		$conf["jquery::onClick"]["content"]=$getLocalStorage["content"]."
616
			//取得當前分頁的索引
616
			//取得當前分頁的索引
617
			index=".$currentTabInfo.".tabToShow;
617
			index=".$currentTabInfo.".tabToShow;
618
			
618
 
619
			//如果是最後一個分頁
619
			//如果是最後一個分頁
620
			if(index==".$currentTabInfo.".tabList.length-1)
620
			if(index==".$currentTabInfo.".tabList.length-1)
621
			{
621
			{
622
				return false;
622
				return false;
623
			}
623
			}
624
			//反之
624
			//反之
625
			else
625
			else
626
			{
626
			{
627
				//隱藏切換前的分頁內容
627
				//隱藏切換前的分頁內容
628
				$('#".$conf["liIdHeadStr"]."'+index).addClass('".$hideClass."');
628
				$('#".$conf["liIdHeadStr"]."'+index).addClass('".$hideClass."');
629
			
629
 
630
				//恢復上一頁的功能
630
				//恢復上一頁的功能
631
				$('#".$prePageId."').attr('disabled',false);
631
				$('#".$prePageId."').attr('disabled',false);
632
			
632
 
633
				//分頁索引+1
633
				//分頁索引+1
634
				".$currentTabInfo.".tabToShow=index+1;
634
				".$currentTabInfo.".tabToShow=index+1;
635
				
635
 
636
				//如果是最後一個分頁
636
				//如果是最後一個分頁
637
				if(".$currentTabInfo.".tabToShow==".$currentTabInfo.".tabList.length-1)
637
				if(".$currentTabInfo.".tabToShow==".$currentTabInfo.".tabList.length-1)
638
				{
638
				{
639
					//停止下一頁的功能
639
					//停止下一頁的功能
640
					$('#".$nextPageId."').attr('disabled',true);
640
					$('#".$nextPageId."').attr('disabled',true);
641
				}
641
				}
642
				
642
 
643
				//更新儲存到localStorage的變數(目前看的分頁)
643
				//更新儲存到localStorage的變數(目前看的分頁)
644
				localStorage.".$webStorage."=JSON.stringify(".$currentTabInfo.");
644
				localStorage.".$webStorage."=JSON.stringify(".$currentTabInfo.");
645
				
645
 
646
				//更新分頁標題
646
				//更新分頁標題
647
				$('#".$nextPageId."').parent().prev().html('<span>'+".$currentTabInfo.".tabList[".$currentTabInfo.".tabToShow]+'</span>');										
647
				$('#".$nextPageId."').parent().prev().html('<span>'+".$currentTabInfo.".tabList[".$currentTabInfo.".tabToShow]+'</span>');
648
				
648
 
649
				//顯示分頁內容
649
				//顯示分頁內容
650
				$('#".$conf["liIdHeadStr"]."'+".$currentTabInfo.".tabToShow).removeClass('".$hideClass."');
650
				$('#".$conf["liIdHeadStr"]."'+".$currentTabInfo.".tabToShow).removeClass('".$hideClass."');
651
			}			
651
			}
652
			";		
652
			";
653
		#可省略參數:
653
		#可省略參數:
654
		#$conf["jqueryPath"],字串,jquery的位置,預設不指定.
654
		#$conf["jqueryPath"],字串,jquery的位置,預設不指定.
655
		#$conf["jqueryPath"]="";
655
		#$conf["jqueryPath"]="";
656
		#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jqueryPath"一起設置,預設為當前檔案的位置.
656
		#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jqueryPath"一起設置,預設為當前檔案的位置.
657
		#$conf["fileArgu"]=__FILE__;
657
		#$conf["fileArgu"]=__FILE__;
Line 659... Line 659...
659
		$conf["jquery::onClick"]["noScriptTag"]="true";
659
		$conf["jquery::onClick"]["noScriptTag"]="true";
660
		#參考資料:
660
		#參考資料:
661
		#selector=>https://api.jquery.com/category/selectors/
661
		#selector=>https://api.jquery.com/category/selectors/
662
		$nextPageClickEvent=jquery::onClick($conf["jquery::onClick"]);
662
		$nextPageClickEvent=jquery::onClick($conf["jquery::onClick"]);
663
		unset($conf["jquery::onClick"]);
663
		unset($conf["jquery::onClick"]);
664
		
664
 
665
		#如果建立 on click 事件失敗
665
		#如果建立 on click 事件失敗
666
		if($nextPageClickEvent["status"]=="false"){
666
		if($nextPageClickEvent["status"]=="false"){
667
			
667
 
668
			#設置執行失敗
668
			#設置執行失敗
669
			$result["status"]="false";
669
			$result["status"]="false";
670
			
670
 
671
			#設置執行錯誤訊息
671
			#設置執行錯誤訊息
672
			$result["error"]=$nextPageClickEvent;
672
			$result["error"]=$nextPageClickEvent;
673
			
673
 
674
			#回傳結果
674
			#回傳結果
675
			return $result;
675
			return $result;
676
			
676
 
677
			}#if end
677
			}#if end
678
		
678
 
679
		#建立初始化當前瀏覽頁面的功能
679
		#建立初始化當前瀏覽頁面的功能
680
		$initialTabViewScript="
680
		$initialTabViewScript="
681
		
681
 
682
			//取得分頁資訊的變數
682
			//取得分頁資訊的變數
683
			".$getLocalStorage["content"]."
683
			".$getLocalStorage["content"]."
684
			
684
 
685
			//初始化分頁標題
685
			//初始化分頁標題
686
			$('#".$nextPageId."').parent().prev().html('<span>'+".$currentTabInfo.".tabList[".$currentTabInfo.".tabToShow]+'</span>');
686
			$('#".$nextPageId."').parent().prev().html('<span>'+".$currentTabInfo.".tabList[".$currentTabInfo.".tabToShow]+'</span>');
687
			
687
 
688
			//初始化要顯示的分頁內容
688
			//初始化要顯示的分頁內容
689
			$('#".$conf["liIdHeadStr"]."'+".$currentTabInfo.".tabToShow).removeClass('".$hideClass."');
689
			$('#".$conf["liIdHeadStr"]."'+".$currentTabInfo.".tabToShow).removeClass('".$hideClass."');
690
			
690
 
691
			//如果是第一個分頁
691
			//如果是第一個分頁
692
			if(".$currentTabInfo.".tabToShow==0)
692
			if(".$currentTabInfo.".tabToShow==0)
693
			{
693
			{
694
				//停止上一頁的功能
694
				//停止上一頁的功能
695
				$('#".$prePageId."').attr('disabled',true);
695
				$('#".$prePageId."').attr('disabled',true);
696
			}
696
			}
697
			
697
 
698
			//如果是最後一個分頁
698
			//如果是最後一個分頁
699
			if(".$currentTabInfo.".tabToShow==".$currentTabInfo.".tabList.length-1)
699
			if(".$currentTabInfo.".tabToShow==".$currentTabInfo.".tabList.length-1)
700
			{
700
			{
701
				//停止下一頁的功能
701
				//停止下一頁的功能
702
				$('#".$nextPageId."').attr('disabled',true);
702
				$('#".$nextPageId."').attr('disabled',true);
703
			}
703
			}
704
			";			
704
			";
705
		
705
 
706
		#建立檢查分頁資訊是否存在且結構正確,再決定使用既有的分頁資訊還是建立新的分頁資訊.
706
		#建立檢查分頁資訊是否存在且結構正確,再決定使用既有的分頁資訊還是建立新的分頁資訊.
707
		$script=$script."
707
		$script=$script."
708
			
708
 
709
			//如果沒有分頁資訊存在
709
			//如果沒有分頁資訊存在
710
			if(window.".$currentTabInfo."==undefined)
710
			if(window.".$currentTabInfo."==undefined)
711
			{
711
			{
712
				//建立新的 tab 資訊
712
				//建立新的 tab 資訊
713
				".$saveToLocalStorage["content"]."				
713
				".$saveToLocalStorage["content"]."
714
									
714
 
715
				//將暫存的tab資訊移除
715
				//將暫存的tab資訊移除
716
				".$rmLocalStorage["content"]."
716
				".$rmLocalStorage["content"]."
717
				
717
 
718
				//設定上一頁按鈕的事件
718
				//設定上一頁按鈕的事件
719
				".$prePageClickEvent["content"]."
719
				".$prePageClickEvent["content"]."
720
				
720
 
721
				//設定下一頁按鈕的事件
721
				//設定下一頁按鈕的事件
722
				".$nextPageClickEvent["content"]."
722
				".$nextPageClickEvent["content"]."
723
				
723
 
724
				//初始化要呈現的tab頁面
724
				//初始化要呈現的tab頁面
725
				".$initialTabViewScript."
725
				".$initialTabViewScript."
726
				
726
 
727
			}//if end
727
			}//if end
728
			
728
 
729
			//反之檢查既有的tab資訊結構是否正確
729
			//反之檢查既有的tab資訊結構是否正確
730
			else
730
			else
731
			{
731
			{
732
				//初始化設置結構檢查不通過
732
				//初始化設置結構檢查不通過
733
				passed='false';
733
				passed='false';
734
			
734
 
735
				//檢查有無 tabToShow 與 tabList 兩個元素
735
				//檢查有無 tabToShow 與 tabList 兩個元素
736
				if(".$currentTabInfo.".tabToShow!='undefinded' & ".$currentTabInfo.".tabList!='undefinded')
736
				if(".$currentTabInfo.".tabToShow!='undefinded' & ".$currentTabInfo.".tabList!='undefinded')
737
				{
737
				{
738
					//檢查 tabToShow 的數值是否正確 與 tabList 的數量是否正確
738
					//檢查 tabToShow 的數值是否正確 與 tabList 的數量是否正確
739
					if(".$currentTabInfo.".tabToShow<".$tabCount." & ".$currentTabInfo.".tabList.length==.".$tabCount.")
739
					if(".$currentTabInfo.".tabToShow<".$tabCount." & ".$currentTabInfo.".tabList.length==.".$tabCount.")
740
					{						
740
					{
741
						//設置結構檢查通過
741
						//設置結構檢查通過
742
						passed='true';
742
						passed='true';
743
					
743
 
744
					}//if end
744
					}//if end
745
				
745
 
746
				}//if end
746
				}//if end
747
				
747
 
748
				//結構資訊正常
748
				//結構資訊正常
749
				if(passed)
749
				if(passed)
750
				{
750
				{
751
					//將暫存的tab資訊移除
751
					//將暫存的tab資訊移除
752
					".$rmLocalStorage["content"]."	
752
					".$rmLocalStorage["content"]."
753
					
753
 
754
					//設定上一頁按鈕的事件
754
					//設定上一頁按鈕的事件
755
					".$prePageClickEvent["content"]."
755
					".$prePageClickEvent["content"]."
756
					
756
 
757
					//設定下一頁按鈕的事件
757
					//設定下一頁按鈕的事件
758
					".$nextPageClickEvent["content"]."
758
					".$nextPageClickEvent["content"]."
759
					
759
 
760
					//初始化要呈現的tab頁面
760
					//初始化要呈現的tab頁面
761
					".$initialTabViewScript."	
761
					".$initialTabViewScript."
762
								
762
 
763
				}//if end
763
				}//if end
764
				
764
 
765
				//結構資訊不正常
765
				//結構資訊不正常
766
				else
766
				else
767
				{
767
				{
768
					//建立新的 tab 資訊
768
					//建立新的 tab 資訊
769
					".$saveToLocalStorage["content"]."				
769
					".$saveToLocalStorage["content"]."
770
									
770
 
771
					//將暫存的tab資訊移除
771
					//將暫存的tab資訊移除
772
					".$rmLocalStorage["content"]."
772
					".$rmLocalStorage["content"]."
773
					
773
 
774
				}//else end
774
				}//else end
775
				
775
 
776
			}//else end
776
			}//else end
777
			";			
777
			";
778
		
778
 
779
		#將 建立檢查分頁資訊是否存在且結構正確,再決定使用既有的分頁資訊還是建立新的分頁資訊 的script語法用<script></script>包起來.
779
		#將 建立檢查分頁資訊是否存在且結構正確,再決定使用既有的分頁資訊還是建立新的分頁資訊 的script語法用<script></script>包起來.
780
		#涵式說明:
780
		#涵式說明:
781
		#將要執行的script語法透過該函式執行
781
		#將要執行的script語法透過該函式執行
782
		#回傳結果:
782
		#回傳結果:
783
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
783
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
Line 787... Line 787...
787
		#必填的參數:
787
		#必填的參數:
788
		#$conf["script"],字串,要執行的javaScript語法,標籤「<script></script>」會自動補上.
788
		#$conf["script"],字串,要執行的javaScript語法,標籤「<script></script>」會自動補上.
789
		$conf["javaScript::toScript"]["script"]=$script;
789
		$conf["javaScript::toScript"]["script"]=$script;
790
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
790
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
791
		unset($conf["javaScript::toScript"]);
791
		unset($conf["javaScript::toScript"]);
792
		
792
 
793
		#如果建立
793
		#如果建立
794
		if($toScript["status"]=="false"){
794
		if($toScript["status"]=="false"){
795
			
795
 
796
			#設置執行失敗
796
			#設置執行失敗
797
			$result["status"]="false";
797
			$result["status"]="false";
798
			
798
 
799
			#設置執行錯誤訊息
799
			#設置執行錯誤訊息
800
			$result["error"]=$toScript;
800
			$result["error"]=$toScript;
801
			
801
 
802
			#回傳結果
802
			#回傳結果
803
			return $result;
803
			return $result;
804
			
804
 
805
			}#if end
805
			}#if end
806
			
806
 
807
		#串接 script 語法
807
		#串接 script 語法
808
		$result["content"]=$result["content"].$toScript["content"];
808
		$result["content"]=$result["content"].$toScript["content"];
809
		
809
 
810
		#用<div></div>包起來
810
		#用<div></div>包起來
811
		$result["content"]="<div>".$result["content"]."</div>";
811
		$result["content"]="<div>".$result["content"]."</div>";
812
									
812
 
813
		#設置執行正常
813
		#設置執行正常
814
		$result["status"]="true";		
814
		$result["status"]="true";
815
		
815
 
816
		#回傳結果
816
		#回傳結果
817
		return $result;
817
		return $result;
818
		
818
 
819
		}#function mobile end
819
		}#function mobile end
820
		
820
 
821
	/*
821
	/*
822
	#函數說明:
822
	#函數說明:
823
	#使用bootstrap樣式建立的分頁功能  
823
	#使用bootstrap樣式建立的分頁功能
824
	#回傳結果:
824
	#回傳結果:
825
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
825
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
826
	#$result["error"],錯誤訊息陣列.
826
	#$result["error"],錯誤訊息陣列.
827
	#$result["function"],當前執行的函數名稱
827
	#$result["function"],當前執行的函數名稱
828
	#$result["content"],建立bootstrap樣式分頁的語法
828
	#$result["content"],建立bootstrap樣式分頁的語法
Line 834... Line 834...
834
	#可省略參數:
834
	#可省略參數:
835
	#$conf["liId"],陣列,$conf["liContent"]中每個元素的id,用來給$conf["liName"]呼叫要顯示的頁面,預設為$conf["liName"].
835
	#$conf["liId"],陣列,$conf["liContent"]中每個元素的id,用來給$conf["liName"]呼叫要顯示的頁面,預設為$conf["liName"].
836
	#$conf["liId"]=array();
836
	#$conf["liId"]=array();
837
	#參考資料:
837
	#參考資料:
838
	#http://www.w3schools.com/bootstrap/bootstrap_tabs_pills.asp
838
	#http://www.w3schools.com/bootstrap/bootstrap_tabs_pills.asp
839
	*/ 
839
	*/
840
	function bootstrap(&$conf){
840
	function bootstrap(&$conf){
841
		
841
 
842
		#初始化要回傳的結果
842
		#初始化要回傳的結果
843
		$result=array();
843
		$result=array();
844
 
844
 
845
		#取得當前執行的函數名稱
845
		#取得當前執行的函數名稱
846
		$result["function"]=__FUNCTION__;
846
		$result["function"]=__FUNCTION__;
847
 
847
 
848
		#如果沒有參數
848
		#如果沒有參數
849
		if(func_num_args()==0){
849
		if(func_num_args()==0){
850
			
850
 
851
			#設置執行失敗
851
			#設置執行失敗
852
			$result["status"]="false";
852
			$result["status"]="false";
853
			
853
 
854
			#設置執行錯誤訊息
854
			#設置執行錯誤訊息
855
			$result["error"]="函數".$result["function"]."需要參數";
855
			$result["error"]="函數".$result["function"]."需要參數";
856
			
856
 
857
			#回傳結果
857
			#回傳結果
858
			return $result;
858
			return $result;
859
			
859
 
860
			}#if end
860
			}#if end
861
			
861
 
862
		#取得參數
862
		#取得參數
863
		$result["argu"]=$conf;
863
		$result["argu"]=$conf;
864
 
864
 
865
		#如果 $conf 不為陣列
865
		#如果 $conf 不為陣列
866
		if(gettype($conf)!="array"){
866
		if(gettype($conf)!="array"){
867
			
867
 
868
			#設置執行失敗
868
			#設置執行失敗
869
			$result["status"]="false";
869
			$result["status"]="false";
870
			
870
 
871
			#設置執行錯誤訊息
871
			#設置執行錯誤訊息
872
			$result["error"][]="\$conf變數須為陣列形態";
872
			$result["error"][]="\$conf變數須為陣列形態";
873
			
873
 
874
			#如果傳入的參數為 null
874
			#如果傳入的參數為 null
875
			if($conf==null){
875
			if($conf==null){
876
				
876
 
877
				#設置執行錯誤訊息
877
				#設置執行錯誤訊息
878
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
878
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
879
				
879
 
880
				}#if end
880
				}#if end
881
 
881
 
882
			#回傳結果
882
			#回傳結果
883
			return $result;
883
			return $result;
884
			
884
 
885
			}#if end
885
			}#if end
886
			
886
 
887
		#檢查參數
887
		#檢查參數
888
		#函式說明:
888
		#函式說明:
889
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
889
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
890
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
890
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
891
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
891
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 916... Line 916...
916
		#$conf["canBeEmpty"]=array();
916
		#$conf["canBeEmpty"]=array();
917
		#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
917
		#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
918
		#$conf["skipableVariableCanNotBeEmpty"]=array();
918
		#$conf["skipableVariableCanNotBeEmpty"]=array();
919
		#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
919
		#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
920
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("liId");
920
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("liId");
921
		#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
921
		#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
922
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("array");
922
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("array");
923
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
923
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
924
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("\$conf[\"liName\"]");
924
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("\$conf[\"liName\"]");
925
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
925
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
926
		$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array("liName","liContnet","liId");
926
		$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array("liName","liContnet","liId");
927
		#參考資料來源:
927
		#參考資料來源:
928
		#array_keys=>http://php.net/manual/en/function.array-keys.php
928
		#array_keys=>http://php.net/manual/en/function.array-keys.php
929
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
929
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
930
		unset($conf["variableCheck::checkArguments"]);
930
		unset($conf["variableCheck::checkArguments"]);
931
		
931
 
932
		#如果檢查參數失敗
932
		#如果檢查參數失敗
933
		if($checkArguments["status"]=="false"){
933
		if($checkArguments["status"]=="false"){
934
			
934
 
935
			#設置執行失敗
935
			#設置執行失敗
936
			$result["status"]="false";
936
			$result["status"]="false";
937
			
937
 
938
			#設置執行錯誤訊息
938
			#設置執行錯誤訊息
939
			$result["error"]=$checkArguments;
939
			$result["error"]=$checkArguments;
940
			
940
 
941
			#回傳結果
941
			#回傳結果
942
			return $result;
942
			return $result;
943
			
943
 
944
			}#if end
944
			}#if end
945
			
945
 
946
		#如果檢查參數不通過
946
		#如果檢查參數不通過
947
		if($checkArguments["passed"]=="false"){
947
		if($checkArguments["passed"]=="false"){
948
			
948
 
949
			#設置執行失敗
949
			#設置執行失敗
950
			$result["status"]="false";
950
			$result["status"]="false";
951
			
951
 
952
			#設置執行錯誤訊息
952
			#設置執行錯誤訊息
953
			$result["error"]=$checkArguments;
953
			$result["error"]=$checkArguments;
954
			
954
 
955
			#回傳結果
955
			#回傳結果
956
			return $result;
956
			return $result;
957
			
957
 
958
			}#if end
958
			}#if end
959
		
959
 
960
		#ul開始
960
		#ul開始
961
		$ul="<ul class=\"nav nav-tabs\">";
961
		$ul="<ul class=\"nav nav-tabs\">";
962
		
962
 
963
		#初始化tab的內容
963
		#初始化tab的內容
964
		$tab="<div class=\"tab-content\">";
964
		$tab="<div class=\"tab-content\">";
965
		
965
 
966
		#$conf["liName"] 有幾個就執行幾次
966
		#$conf["liName"] 有幾個就執行幾次
967
		for($i=0;$i<count($conf["liName"]);$i++){
967
		for($i=0;$i<count($conf["liName"]);$i++){
968
			
968
 
969
			#串接 li
969
			#串接 li
970
			$ul=$ul."<li>";
970
			$ul=$ul."<li>";
971
			$ul=$ul."<a data-toggle=\"tab\" href=\"#".$conf["liId"][$i]."\" >".$conf["liName"][$i]."</a>";
971
			$ul=$ul."<a data-toggle=\"tab\" href=\"#".$conf["liId"][$i]."\" >".$conf["liName"][$i]."</a>";
972
			$ul=$ul."</li>";
972
			$ul=$ul."</li>";
973
			
973
 
974
			#如果是第一筆
974
			#如果是第一筆
975
			if($i===0){
975
			if($i===0){
976
				
976
 
977
				#串接 tab 的內容
977
				#串接 tab 的內容
978
				$tab=$tab."<div class=\"tab-pane fade in active \" id=\"".$conf["liId"][$i]."\">".$conf["liContent"][$i]."</div>";	
978
				$tab=$tab."<div class=\"tab-pane fade in active \" id=\"".$conf["liId"][$i]."\">".$conf["liContent"][$i]."</div>";
979
									
979
 
980
				}#if end
980
				}#if end
981
			
981
 
982
			#反之不是第一筆
982
			#反之不是第一筆
983
			else{
983
			else{
984
				
984
 
985
				#串接 tab 的內容
985
				#串接 tab 的內容
986
				$tab=$tab."<div class=\"tab-pane fade\" id=\"".$conf["liId"][$i]."\">".$conf["liContent"][$i]."</div>";	
986
				$tab=$tab."<div class=\"tab-pane fade\" id=\"".$conf["liId"][$i]."\">".$conf["liContent"][$i]."</div>";
987
				
987
 
988
				}#else end
988
				}#else end
989
			
989
 
990
			}#for end
990
			}#for end
991
				
991
 
992
		#ul結束
992
		#ul結束
993
		$ul=$ul."</ul>";
993
		$ul=$ul."</ul>";
994
		
994
 
995
		#tab content 結束
995
		#tab content 結束
996
		$tab=$tab."</div>";
996
		$tab=$tab."</div>";
997
					
997
 
998
		#取得分頁的內容
998
		#取得分頁的內容
999
		$result["content"]=$ul.$tab;
999
		$result["content"]=$ul.$tab;
1000
		
1000
 
1001
		#設置執行正常
1001
		#設置執行正常
1002
		$result["status"]="true";
1002
		$result["status"]="true";
1003
		
1003
 
1004
		#回傳結果
1004
		#回傳結果
1005
		return $result;
1005
		return $result;
1006
		
1006
 
1007
		}#function botostrap
1007
		}#function botostrap
1008
	
1008
 
1009
	}#class tab end
1009
	}#class tab end
1010
 
1010
 
1011
?>
1011
?>