Subversion Repositories php-qbpwcf

Rev

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

Rev 200 Rev 207
Line 2929... Line 2929...
2929
 
2929
 
2930
		}#function div end
2930
		}#function div end
2931
 
2931
 
2932
	/*
2932
	/*
2933
	#函式說明:
2933
	#函式說明:
2934
	#建立div表格,並具備翻頁功能,從ajax取得新資料.
2934
	#建立div表格,並具備翻頁功能,從ajax取得新資料,傳遞的參數為post變數的pageNumber,代表要檢閱第幾頁的資料.
2935
	#回傳結果:
2935
	#回傳結果:
2936
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2936
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
2937
	#$result["error"],錯誤訊息.
2937
	#$result["error"],錯誤訊息.
2938
	#$result["function"],當前執行的函數名稱.
2938
	#$result["function"],當前執行的函數名稱.
2939
	#$result["content"],表格的html內容.
2939
	#$result["content"],表格的html內容.
Line 3226... Line 3226...
3226
			#反之
3226
			#反之
3227
			else{
3227
			else{
3228
				#設置預設的樣式
3228
				#設置預設的樣式
3229
				$table_head="class='__qbpwcf_border'";
3229
				$table_head="class='__qbpwcf_border'";
3230
			
3230
			
3231
				}#else		
3231
				}#else end
3232
 
3232
 
3233
			#初始化要套用的<th>類別樣式
3233
			#初始化要套用的<th>類別樣式
3234
			$table_th="";
3234
			$table_th="";
3235
 
3235
 
3236
			#如果有設置 $conf["class.table.head.th"]
3236
			#如果有設置 $conf["class.table.head.th"]
Line 3281... Line 3281...
3281
 
3281
 
3282
				}#if end
3282
				}#if end
3283
 
3283
 
3284
			#反之
3284
			#反之
3285
			else{
3285
			else{
-
 
3286
			
3286
				#設置預設的樣式
3287
				#設置預設的樣式
3287
				$table_th_td="class='__qbpwcf_border'";
3288
				$table_th_td="class='__qbpwcf_border'";
3288
			
3289
			
3289
				}#else	
3290
				}#else	
3290
 
3291
 
Line 3296... Line 3297...
3296
	
3297
	
3297
				}#if end
3298
				}#if end
3298
			
3299
			
3299
			#反之	
3300
			#反之	
3300
			else{
3301
			else{
-
 
3302
				
3301
				#預設的ID為資料表id+"_title"
3303
				#預設的ID為資料表id+"_title"
3302
				$conf["titleId"]="id=\"".$result["argued"]["id.table"]."_title\"";
3304
				$conf["titleId"]="id=\"".$result["argued"]["id.table"]."_title\"";
3303
				
3305
				
3304
				}#else end
3306
				}#else end
3305
 
3307
 
Line 3341... Line 3343...
3341
 
3343
 
3342
			}#if end
3344
			}#if end
3343
			
3345
			
3344
		#反之
3346
		#反之
3345
		else{
3347
		else{
-
 
3348
			
3346
			#設置預設的樣式
3349
			#設置預設的樣式
3347
			$table_body="class=\"__qbpwcf_border\"";
3350
			$table_body="class=\"__qbpwcf_border\"";
3348
		
3351
		
3349
			}#else	
3352
			}#else	
3350
 
3353
 
Line 3370... Line 3373...
3370
 
3373
 
3371
			}#if end
3374
			}#if end
3372
			
3375
			
3373
		#反之
3376
		#反之
3374
		else{
3377
		else{
-
 
3378
			
3375
			#設置預設的樣式
3379
			#設置預設的樣式
3376
			$table_body_tr="class=\"__qbpwcf_border\"";
3380
			$table_body_tr="class=\"__qbpwcf_border\"";
3377
		
3381
			
3378
			}#else	
3382
			}#else	
3379
			
3383
			
3380
		#初始化要套用的<tbody>中奇數<tr>的css類別樣式
3384
		#初始化要套用的<tbody>中奇數<tr>的css類別樣式
3381
		$table_body_tr_odd="";
3385
		$table_body_tr_odd="";
3382
 
3386
 
Line 3434... Line 3438...
3434
 
3438
 
3435
			}#if end
3439
			}#if end
3436
			
3440
			
3437
		#反之
3441
		#反之
3438
		else{
3442
		else{
-
 
3443
		
3439
			#設置預設的樣式
3444
			#設置預設的樣式
3440
			$table_body_tr_td="class=\"__qbpwcf_border\"";
3445
			$table_body_tr_td="class=\"__qbpwcf_border\"";
3441
		
3446
		
3442
			}#else	
3447
			}#else	
3443
 
3448
 
Line 3496... Line 3501...
3496
		params.resType='json';
3501
		params.resType='json';
3497
		params.preAc=function(){
3502
		params.preAc=function(){
3498
			
3503
			
3499
			//取得 tbody
3504
			//取得 tbody
3500
			var tbody=params.table.querySelector('div[qbpwcfAttr=tbody]');
3505
			var tbody=params.table.querySelector('div[qbpwcfAttr=tbody]');
3501
						
3506
			
3502
			//清空表單內容
3507
			//清空表單內容
3503
			tbody.innerHTML='';
3508
			tbody.innerHTML='';
3504
			
3509
			
3505
			//建立處理中的div
3510
			//建立處理中的div
3506
			var div=document.createElement('div');
3511
			var div=document.createElement('div');
Line 3511... Line 3516...
3511
			tbody.appendChild(div);
3516
			tbody.appendChild(div);
3512
			
3517
			
3513
			}
3518
			}
3514
		params.aftAc=function(res){
3519
		params.aftAc=function(res){
3515
			
3520
			
3516
			//如果沒有資料
3521
			//如果沒有meta資料
-
 
3522
			if(res===null){
-
 
3523
			
-
 
3524
				//提示錯誤訊息
-
 
3525
				console.error('no response data');
-
 
3526
				
-
 
3527
				//結束執行
-
 
3528
				return false;
-
 
3529
			
-
 
3530
				}//if end
-
 
3531
			
-
 
3532
			//如果沒有meta資料
3517
			if(res.meta===undefined){
3533
			if(res.meta===null){
3518
			
3534
			
3519
				//提示錯誤訊息
3535
				//提示錯誤訊息
3520
				console.error('lost meta data');
3536
				console.error('lost meta data');
3521
				
3537
				
3522
				//結束執行
3538
				//結束執行
Line 3686... Line 3702...
3686
				
3702
				
3687
				});
3703
				});
3688
			nextPageDiv.appendChild(nextPageA);
3704
			nextPageDiv.appendChild(nextPageA);
3689
			
3705
			
3690
			//放置上一頁與下一頁的link
3706
			//放置上一頁與下一頁的link
3691
			changePageDiv.appendChild(prePageDiv);			
3707
			changePageDiv.appendChild(prePageDiv);
3692
			changePageDiv.appendChild(nextPageDiv);
3708
			changePageDiv.appendChild(nextPageDiv);
3693
			
3709
			
3694
			//放置資料描述
3710
			//放置資料描述
3695
			rootBottomDiv.appendChild(descDiv);
3711
			rootBottomDiv.appendChild(descDiv);
3696
			
3712
			
Line 3742... Line 3758...
3742
	
3758
	
3743
		}#function divAjax end
3759
		}#function divAjax end
3744
 
3760
 
3745
	/*
3761
	/*
3746
	#函式說明:
3762
	#函式說明:
-
 
3763
	#接收 funciton divAjax 的 ajax 要求,轉換成SQL語法.
-
 
3764
	#回傳結果:
-
 
3765
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
3766
	#$result["error"],錯誤訊息.
-
 
3767
	#$result["function"],當前執行的函數名稱.
-
 
3768
	#$result["content"],json for table::divAjax.
-
 
3769
	#$result["argu"],使用的參數.
-
 
3770
	#必填參數:
-
 
3771
	#$conf["mainTable"],字串,主資料表名稱.
-
 
3772
	$conf["mainTable"]="";
-
 
3773
	#$conf["columnYouWant"],字串陣列,為想要的資料表欄位,格式為 "dbName.dtName.colName".
-
 
3774
	$conf["columnYouWant"]=array($dbName.".".$conf["mainTable"]."."."id");
-
 
3775
	#可省略參數:
-
 
3776
	#$conf["dbAddress"],字串,爲mysql-Server的位置,預設為$dbAddress.
-
 
3777
	#$conf["dbAddress"]=$dbAddress;
-
 
3778
	#$conf["dbAccount"],字串,爲用於連入mysql-Server時要使用的帳號,預設為$dbAccount.
-
 
3779
	#$conf["dbAccount"]=$dbAccount;
-
 
3780
	#$conf["dbName"],字串,爲要連的資料庫名稱,預設為$dbName.
-
 
3781
	#$conf["dbName"]=$dbName;
-
 
3782
	#$conf["dbPassword"],字串,爲連線到mysql-Server時要使用的密碼,可省略,若省略則代表不使用密碼,預設為$dbPassword.
-
 
3783
	#$conf["dbPassword"]=$dbPassword;
-
 
3784
	#$conf["dbPort"],字串,為連線到mysql-Server時對應的port,可省略,預設為$dbPort.
-
 
3785
	#$conf["dbPort"]=$dbPort;
-
 
3786
	#$conf["numberPerPage"],每頁的資料上限,設為"30",
-
 
3787
	#$conf["numberPerPage"]="30";
-
 
3788
	#$conf["mainDtWhereColName"],字串陣列,用於主表判斷語句的欄位項目陣列.
-
 
3789
	#$conf["mainDtWhereColName"]=array("");
-
 
3790
	
-
 
3791
	#$conf["mainDtWhereColVal"]=,字串陣列,用於主表判斷語句的欄位項目數值陣列,若與LIKE搭配,則可以在關鍵自字串的左右名加上「%」符號,這樣就可以搜尋具有該字串的內容.
-
 
3792
	#$conf["mainDtWhereColVal"]=array("");
-
 
3793
	
-
 
3794
	#$conf["mainDtWhereColCombine"],字串陣列,用於主表判斷語句當中需要()起來的判斷式,須爲陣列值,"s"代表「(」,"e"代表「)」 ,若無則須設爲""。
-
 
3795
	#$conf["mainDtWhereColCombine"]=array("");
-
 
3796
	#$conf["mainWhereColumnOperator"],字串陣列,用於判斷語句的比較符號陣列,可以用的符號有「"="、">"、"<"、"LIKE"、"NOT LIKE"」,預設都爲「=」。
-
 
3797
	#$conf["mainWhereColumnOperator"]=array("");
-
 
3798
	#$conf["mainWhereColumnAndOr"],字串陣列,用於判斷語句條件之間成立的條件是AND還是OR,須爲陣列值。其數量應爲要判斷的欄位數量減一。
-
 
3799
	#$conf["mainWhereColumnAndOr"]=array("");
-
 
3800
	#$conf["mainWhereIn"],字串陣列,為每個in語句的內容,特定欄位數值等於陣列元素之一。array(array("colName",array("a","b","c")));代表欄位colName的值為a,b,c三者之一.
-
 
3801
	#$conf["mainWhereIn"]=array(array("colName",array("a","b","c")));
-
 
3802
	#$conf["mainWhereNotIn"],字串陣列,為每個not in語句的內容,array(array("colName",array("a","b","c")));代表欄位colName的值不為a,b,c三者之一.
-
 
3803
	#$conf["mainWhereNotIn"]=array(array("colName",array("a","b","c")));
-
 
3804
	#$conf["mainGroupBy"],字串陣列,爲要以哪幾個欄爲作爲分羣的依據(欄位相同的數值僅會取出一筆)。
-
 
3805
	#$conf["mainGroupBy"]=array();
-
 
3806
	#$conf["mainOrderItem"],字串,組好的資料的排序項目依據
-
 
3807
	#$conf["mainOrderItem"]="";
-
 
3808
	#$conf["mainAscORdesc"],字串,組好的資料要低增還是遞減排序,asc爲遞增;desc爲遞減,預設不做處理.
-
 
3809
	#$conf["mainAscORdesc"]="";
-
 
3810
	
-
 
3811
	#參考資料:
-
 
3812
	#https://www.w3.org/Style/css2-updates/css2/tables.html
-
 
3813
	#備註:
-
 
3814
	#無.
-
 
3815
	*/
-
 
3816
	public static function divAjaxRes(&$conf){
-
 
3817
	
-
 
3818
		#初始化要回傳的變數
-
 
3819
		$result=array();
-
 
3820
 
-
 
3821
		#記錄當前執行的函數名稱
-
 
3822
		$result["function"]=__FUNCTION__;
-
 
3823
 
-
 
3824
		#初始化表格的html語法
-
 
3825
		$result["content"]="";
-
 
3826
 
-
 
3827
		#如果 $conf 不為陣列
-
 
3828
		if(gettype($conf)!="array"){
-
 
3829
 
-
 
3830
			#設置執行失敗
-
 
3831
			$result["status"]="false";
-
 
3832
 
-
 
3833
			#設置執行錯誤訊息
-
 
3834
			$result["error"][]="\$conf變數須為陣列形態";
-
 
3835
 
-
 
3836
			#如果傳入的參數為 null
-
 
3837
			if($conf==null){
-
 
3838
 
-
 
3839
				#設置執行錯誤訊息
-
 
3840
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
-
 
3841
 
-
 
3842
				}#if end
-
 
3843
 
-
 
3844
			#回傳結果
-
 
3845
			return $result;
-
 
3846
 
-
 
3847
			}#if end
-
 
3848
		
-
 
3849
		#取得使用的參數
-
 
3850
		$result["argu"]=$conf;
-
 
3851
		
-
 
3852
		#檢查參數
-
 
3853
		#函式說明:
-
 
3854
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
-
 
3855
		#回傳結果:
-
 
3856
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
3857
		#$result["error"],執行不正常結束的錯訊息陣列.
-
 
3858
		#$result["simpleError"],簡單表示的錯誤訊息.
-
 
3859
		#$result["function"],當前執行的函式名稱.
-
 
3860
		#$result["argu"],設置給予的參數.
-
 
3861
		#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
-
 
3862
		#$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
-
 
3863
		#$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
-
 
3864
		#$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
-
 
3865
		#$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
-
 
3866
		#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
-
 
3867
		#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
-
 
3868
		#$result["notNeedVar"],字串陣列,多餘的參數名稱.
-
 
3869
		#必填參數:
-
 
3870
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
-
 
3871
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
-
 
3872
		#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
-
 
3873
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
-
 
3874
		#可省略參數:
-
 
3875
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
-
 
3876
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("mainTable","columnYouWant");
-
 
3877
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null、any代表不指定變數形態.其中 resource也包含"resource (closed)".
-
 
3878
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
-
 
3879
		#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
-
 
3880
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
-
 
3881
		#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
-
 
3882
		#$conf["variableCheck::checkArguments"]["canNotBeEmpty"]=array("numberPerPage");
-
 
3883
		#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
-
 
3884
		#$conf["canBeEmpty"]=array();
-
 
3885
		#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
-
 
3886
		$conf["variableCheck::checkArguments"]["skipableVariableCanNotBeEmpty"]=array("numberPerPage","dbAddress","dbAccount","dbName","dbPassword","dbPort");
-
 
3887
		#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
-
 
3888
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("numberPerPage","dbAddress","dbAccount","dbName","dbPassword","dbPort","mainDtWhereColName","mainDtWhereColVal","mainDtWhereColCombine","mainWhereColumnOperator","mainWhereColumnAndOr","mainWhereIn","mainWhereNotIn","mainNumberStart","mainNumLimit","mainGroupBy","mainOrderItem","mainAscORdesc");
-
 
3889
		#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
-
 
3890
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string","string","string","string","array","array","array","array","array","array","array","array","array","array","array","array");
-
 
3891
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
-
 
3892
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("30",$dbAddress,$dbAccount,$dbName,$dbPassword,$dbPort,null,null,null,null,null,null,null,null,null,null,null,null);
-
 
3893
		#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
-
 
3894
		#$conf["disallowAllSkipableVarIsEmpty"]="";
-
 
3895
		#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
-
 
3896
		#$conf["disallowAllSkipableVarIsEmptyArray"]="";
-
 
3897
		#$conf["disallowAllSkipableVarNotExist"],字串,是否不允許每個可省略參數都不存在,預設為"false"代表允許,反之為"true".
-
 
3898
		#$conf["disallowAllSkipableVarNotExist"]="";
-
 
3899
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
-
 
3900
		#$conf["arrayCountEqualCheck"][]=array();
-
 
3901
		#參考資料:
-
 
3902
		#array_keys=>http://php.net/manual/en/function.array-keys.php
-
 
3903
		#備註:
-
 
3904
		#無.
-
 
3905
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
-
 
3906
		unset($conf["variableCheck::checkArguments"]);
-
 
3907
		
-
 
3908
		#如果檢查失敗
-
 
3909
		if($checkArguments["status"]=="false"){
-
 
3910
 
-
 
3911
			#設置執行不正常
-
 
3912
			$result["status"]="false";
-
 
3913
 
-
 
3914
			#設置錯誤訊息
-
 
3915
			$result["error"]=$checkArguments;
-
 
3916
 
-
 
3917
			#回傳結果
-
 
3918
			return $result;
-
 
3919
 
-
 
3920
			}#if end
-
 
3921
 
-
 
3922
		#如果檢查不通過
-
 
3923
		if($checkArguments["passed"]=="false"){
-
 
3924
 
-
 
3925
			#設置執行不正常
-
 
3926
			$result["status"]="false";
-
 
3927
 
-
 
3928
			#設置錯誤訊息
-
 
3929
			$result["error"]=$checkArguments;
-
 
3930
 
-
 
3931
			#回傳結果
-
 
3932
			return $result;
-
 
3933
 
-
 
3934
			}#if end
-
 
3935
	
-
 
3936
		#函式說明:
-
 
3937
		#可以處理多個透過GET、POST而來的資訊,儲存成變數,同時限定傳送的方法、來源,來增加安全性,檢查有沒有皆收到必須要接收到的變數,沒有接收到的變數可以指定從session變數中取得.
-
 
3938
		#回傳結果:
-
 
3939
		#$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
-
 
3940
		#$result["error"],錯誤訊息陣列.
-
 
3941
		#$resutl["function"],當前執行的函式名稱.
-
 
3942
		#$result["warning"],警告訊息陣列.
-
 
3943
		#$result["passed"],是否有皆收到全部該接收到的變數,若有設定$conf["checkedVarName"]的話,執行正常後會回傳該結果。
-
 
3944
		#$result["lostVarName"],沒有皆收到的變數名稱陣列
-
 
3945
		#$result["inputDataContent"],所接收的參數陣列.
-
 
3946
		#$result["inputDataContent"]["變數名稱"],所接收變數的內容.
-
 
3947
		#$result["inputDataCount"],從表單總共接收到幾個元素.
-
 
3948
		#$result["HTTP_REFERER"],前一頁的網址,null代表不存在.
-
 
3949
		#必填參數:
-
 
3950
		#$conf["method"],字串,傳送過來的資料是用"post/POST"還是"get/GET"?
-
 
3951
		$conf["form::responseMultiInputDataSecurityEnhance"]["method"]="post";
-
 
3952
		#可省略參數:
-
 
3953
		#$conf["allowGet"],字串,是否要允許 get 傳值,"true",代表允許;"false" ,代表不允許,預設爲不允許.
-
 
3954
		#$conf["allowGet"]="true";
-
 
3955
		#$conf["limitPrePage"],字串陣列,是否要限定前一頁的網址為哪些,才能接收內容,不符合則轉址.
-
 
3956
		$conf["form::responseMultiInputDataSecurityEnhance"]["limitPrePage"]=array("table::divAjax.php");
-
 
3957
		#$conf["transferLocation"],字串,遇到get傳值,或前一個頁面不符合要求時要轉址到的頁面,預設爲資安素養網"https://isafe.moe.edu.tw/"
-
 
3958
		#$conf["transferLocation"]="";
-
 
3959
		#$conf["ignore"]=字串陣列,如果要接收的變數名稱與該陣列其一元素一樣,則不放進要回傳的變數裏面.
-
 
3960
		#$conf["ignore"]=array();
-
 
3961
		#$conf["correctCharacter"]=,字串,如果爲"false",則不處理可能導致網頁出問題的字串,預設爲要進行處理.
-
 
3962
		#$conf["correctCharacter"]="false";
-
 
3963
		#$conf["checkedVarName"],字串陣列,為檢查是否有接收到哪些變數.
-
 
3964
		$conf["form::responseMultiInputDataSecurityEnhance"]["checkedVarName"]=array("pageNumber");
-
 
3965
		#$conf["canBeEmptyString"],字串,用$conf["checkedVarName"]指定接收的變數名稱陣列,若接收到的內容為空字串是否算有接收到內容,預設為"false","true"代表接收到的內容可以為空字串,"false"代表接收到的內容不可以為空字串.
-
 
3966
		#$conf["canBeEmptyString"]="false";
-
 
3967
		#$conf["sessionNameArray"],陣列,若存在則代表若沒有從表單取得變數,則從session變數中取得內容,每個元素代表每個表單變數對應的session名稱,若不是要改用session方式取得變數內容的變數,請輸入null,數量請跟$conf["checkedVarName"]參數一致.
-
 
3968
		#$conf["sessionNameArray"]=array();
-
 
3969
		#$conf["unsetSessionArray"],陣列,與$conf["sessionNameArray"]對應的元素,是否要接收到變數後就卸除,"true"代表要卸除,預設為"false"代表不要卸除.
-
 
3970
		#$conf["unsetSessionArray"]=array();
-
 
3971
		#參考資料:
-
 
3972
		#foreach 的用法 -> http://php.net/manual/en/control-structures.foreach.php
-
 
3973
		#伺服器端的變數 -> http://php.net/manual/en/reserved.variables.server.php
-
 
3974
		#備註:
-
 
3975
		#表單變數的名稱若含有「.」,則會變成「-」。
-
 
3976
		$responseMultiInputDataSecurityEnhance=form::responseMultiInputDataSecurityEnhance($conf["form::responseMultiInputDataSecurityEnhance"]);
-
 
3977
		unset($conf["form::responseMultiInputDataSecurityEnhance"]);
-
 
3978
		
-
 
3979
		#如果執行異常
-
 
3980
		if($responseMultiInputDataSecurityEnhance["status"]==="false"){
-
 
3981
		
-
 
3982
			#設置執行異常識別
-
 
3983
			$result["status"]="false";
-
 
3984
			
-
 
3985
			#設置執行錯誤 
-
 
3986
			$result["error"]=$responseMultiInputDataSecurityEnhance;
-
 
3987
		
-
 
3988
			#回傳結果
-
 
3989
			return $result;
-
 
3990
		
-
 
3991
			}#if end
-
 
3992
			
-
 
3993
		#如果檢查不通過
-
 
3994
		if($responseMultiInputDataSecurityEnhance["passed"]==="false"){
-
 
3995
		
-
 
3996
			#設置執行異常識別
-
 
3997
			$result["status"]="false";
-
 
3998
			
-
 
3999
			#設置執行錯誤 
-
 
4000
			$result["error"]=$responseMultiInputDataSecurityEnhance;
-
 
4001
		
-
 
4002
			#回傳結果
-
 
4003
			return $result;
-
 
4004
		
-
 
4005
			}#if end
-
 
4006
		
-
 
4007
		#取得當前頁面
-
 
4008
		$pageNumber=$responseMultiInputDataSecurityEnhance["inputDataContent"]["pageNumber"];
-
 
4009
			
-
 
4010
		#函式說明:
-
 
4011
		#透過php來join多張資料表資料,提供各個欄位的包含資料庫、資料表、的資訊,會產生sql inner join的效果,資料會越來越多.
-
 
4012
		#回傳結果:
-
 
4013
		#$result["status"],執行結果"true"為成功;"false"為執行失敗。
-
 
4014
		#$result["error"],錯誤訊息陣列。
-
 
4015
		#$reuslt["function"],當前執行的函數
-
 
4016
		#$result["content"],爲合併了子資料表欄位的父資料表的內容。
-
 
4017
		#$result["content"][$conf["WhereColumnName"][$i]][$dataSetNum]
-
 
4018
			#$dataSetNum 爲第$dataSetNum+1筆資料
-
 
4019
			#$conf["WhereColumnName"][$i] 爲第 $i+1 個欄位的名稱
-
 
4020
		#$result["parentTable"]["dataCount"],爲取得的資料筆數。
-
 
4021
		#必填參數:
-
 
4022
		#$conf["dbInfo"]["資料庫名稱"],字串陣列,爲要存取的"資料庫名稱"的連線資訊.
-
 
4023
		#$conf["dbIfno"]["資料庫名稱"]["dbAddr"],字串,dbServer的位置.
-
 
4024
		$conf["db::joinByPHP"]["dbInfo"][$conf["dbName"]]["dbAddr"]=$conf["dbAddress"];
-
 
4025
		#$conf["dbIfno"]["資料庫名稱"]["dbAcct"],字串,dbServer的連線帳號.
-
 
4026
		$conf["db::joinByPHP"]["dbInfo"][$conf["dbName"]]["dbAcct"]=$conf["dbAccount"];
-
 
4027
		#$conf["mainTable"],字串,為 主資料庫.資料表 的名稱,例如 "dbA.dtA".
-
 
4028
		$conf["db::joinByPHP"]["mainTable"]=$conf["mainTable"];
-
 
4029
		#可省略參數:
-
 
4030
		#$conf["linkColumnName"],二字串陣列,為資料表間相連結的欄位名稱,格式為 array("mergedDb.mergedDt.mergedCol","linkDb.linkDt.linkCol") 就代表當前組好的欄位 mergedDb.mergedDt.mergedCol 跟資料庫 linkDB 表 linkDt 欄位 linkCol 進行資料的配對。
-
 
4031
		#$conf["linkColumnName"]=array(array(""));
-
 
4032
		#$conf["dbInfo"]["資料庫名稱"]["dbPass"],字串,dbServer的連線密碼.
-
 
4033
		$conf["db::joinByPHP"]["dbInfo"][$conf["dbName"]]["dbPass"]=$dbPassword;
-
 
4034
		#$conf["dbInfo"]["資料庫名稱"]["dbPort"],字串,db連線用的port.
-
 
4035
		$conf["db::joinByPHP"]["dbInfo"][$conf["dbName"]]["dbPort"]=$dbPort;
-
 
4036
		#$conf["columnYouWant"],字串陣列,為想要的資料表欄位,格式為 "dbName.dtName.colName".
-
 
4037
		$conf["db::joinByPHP"]["columnYouWant"]=$conf["columnYouWant"];
-
 
4038
		
-
 
4039
		#如果有參數 $conf["mainDtWhereColName"]
-
 
4040
		if(isset($conf["mainDtWhereColName"])){
-
 
4041
		
-
 
4042
			#$conf["mainDtWhereColName"],字串陣列,用於主表判斷語句的欄位項目陣列.
-
 
4043
			$conf["db::joinByPHP"]["mainDtWhereColName"]=$conf["mainDtWhereColName"];
-
 
4044
		
-
 
4045
			}#if end
-
 
4046
		
-
 
4047
		#如果有參數 $conf["mainDtWhereColName"]
-
 
4048
		if(isset($conf["mainDtWhereColName"])){
-
 
4049
		
-
 
4050
			#$conf["mainDtWhereColVal"]=,字串陣列,用於主表判斷語句的欄位項目數值陣列,若與LIKE搭配,則可以在關鍵自字串的左右名加上「%」符號,這樣就可以搜尋具有該字串的內容.
-
 
4051
			$conf["db::joinByPHP"]["mainDtWhereColVal"]=$conf["mainDtWhereColName"];
-
 
4052
		
-
 
4053
			}#if end
-
 
4054
		
-
 
4055
		#如果有參數 $conf["mainDtWhereColCombine"]
-
 
4056
		if(isset($conf["mainDtWhereColCombine"])){
-
 
4057
		
-
 
4058
			#$conf["mainDtWhereColCombine"],字串陣列,用於主表判斷語句當中需要()起來的判斷式,須爲陣列值,"s"代表「(」,"e"代表「)」 ,若無則須設爲""。
-
 
4059
			$conf["db::joinByPHP"]["mainDtWhereColCombine"]=$conf["mainDtWhereColCombine"];
-
 
4060
		
-
 
4061
			}#if end
-
 
4062
		
-
 
4063
		#如果有參數 $conf["mainWhereColumnOperator"]
-
 
4064
		if(isset($conf["mainWhereColumnOperator"])){
-
 
4065
		
-
 
4066
			#$conf["mainWhereColumnOperator"],字串陣列,用於判斷語句的比較符號陣列,可以用的符號有「"="、">"、"<"、"LIKE"、"NOT LIKE"」,預設都爲「=」。
-
 
4067
			$conf["db::joinByPHP"]["mainWhereColumnOperator"]=$conf["mainWhereColumnOperator"];
-
 
4068
		
-
 
4069
			}#if end
-
 
4070
		
-
 
4071
		#如果有參數 $conf["mainWhereColumnAndOr"]
-
 
4072
		if(isset($conf["mainWhereColumnAndOr"])){
-
 
4073
		
-
 
4074
			#$conf["mainWhereColumnAndOr"],字串陣列,用於判斷語句條件之間成立的條件是AND還是OR,須爲陣列值。其數量應爲要判斷的欄位數量減一。
-
 
4075
			$conf["db::joinByPHP"]["mainWhereColumnAndOr"]=$conf["mainWhereColumnAndOr"];
-
 
4076
		
-
 
4077
			}#if end
-
 
4078
		
-
 
4079
		
-
 
4080
		#如果有參數 $conf["mainWhereIn"]
-
 
4081
		if(isset($conf["mainWhereIn"])){
-
 
4082
		
-
 
4083
			#$conf["mainWhereIn"],字串陣列,為每個in語句的內容,特定欄位數值等於陣列元素之一。array(array("colName",array("a","b","c")));代表欄位colName的值為a,b,c三者之一.
-
 
4084
			$conf["db::joinByPHP"]["mainWhereIn"]=$conf["mainWhereIn"];
-
 
4085
		
-
 
4086
			}#if end
-
 
4087
		
-
 
4088
		#如果有參數 $conf["mainWhereNotIn"]
-
 
4089
		if(isset($conf["mainWhereNotIn"])){
-
 
4090
		
-
 
4091
			#$conf["mainWhereNotIn"],字串陣列,為每個not in語句的內容,array(array("colName",array("a","b","c")));代表欄位colName的值不為a,b,c三者之一.
-
 
4092
			$conf["db::joinByPHP"]["mainWhereNotIn"]=$conf["mainWhereNotIn"];
-
 
4093
		
-
 
4094
			}#if end
-
 
4095
			
-
 
4096
		#$conf["mainNumberStart"],字串,從第幾筆開始讀取,預設為"0",代筆第一筆.
-
 
4097
		$conf["db::joinByPHP"]["mainNumberStart"]="".(30*$pageNumber-1);
-
 
4098
		#$conf["mainNumLimit"],字串,要取幾筆資料,可以省略,省略則表示不限制數目.
-
 
4099
		$conf["db::joinByPHP"]["mainNumLimit"]=$conf["numberPerPage"];
-
 
4100
		
-
 
4101
		#如果有參數 $conf["mainGroupBy"]
-
 
4102
		if(isset($conf["mainGroupBy"])){
-
 
4103
		
-
 
4104
			#$conf["mainGroupBy"],字串陣列,爲要以哪幾個欄爲作爲分羣的依據(欄位相同的數值僅會取出一筆)。
-
 
4105
			$conf["db::joinByPHP"]["mainGroupBy"]=$conf["mainGroupBy"];
-
 
4106
			
-
 
4107
			}#if end
-
 
4108
			
-
 
4109
		#如果有參數 $conf["mainOrderItem"]
-
 
4110
		if(isset($conf["mainOrderItem"])){
-
 
4111
		
-
 
4112
			#$conf["mainOrderItem"],字串,組好的資料的排序項目依據
-
 
4113
			$conf["db::joinByPHP"]["mainOrderItem"]=$conf["mainOrderItem"];
-
 
4114
			
-
 
4115
			}#if end
-
 
4116
		
-
 
4117
		#如果有參數 $conf["mainAscORdesc"]
-
 
4118
		if(isset($conf["mainAscORdesc"])){
-
 
4119
		
-
 
4120
			#$conf["mainAscORdesc"],字串,組好的資料要低增還是遞減排序,asc爲遞增;desc爲遞減,預設不做處理.
-
 
4121
			$conf["db::joinByPHP"]["mainOrderItem"]=$conf["mainAscORdesc"];
-
 
4122
			
-
 
4123
			}#if end
-
 
4124
		
-
 
4125
		#參考資料:
-
 
4126
		#無.
-
 
4127
		#備註:
-
 
4128
		#無.
-
 
4129
		$joinByPHP=db::joinByPHP($conf["db::joinByPHP"]);
-
 
4130
		unset($conf["db::joinByPHP"]);
-
 
4131
	
-
 
4132
		#如果執行異常
-
 
4133
		if($joinByPHP["status"]==="false"){
-
 
4134
		
-
 
4135
			#設置執行異常識別
-
 
4136
			$result["status"]="false";
-
 
4137
			
-
 
4138
			#設置執行錯誤 
-
 
4139
			$result["error"]=$joinByPHP;
-
 
4140
		
-
 
4141
			#回傳結果
-
 
4142
			return $result;
-
 
4143
		
-
 
4144
			}#if end
-
 
4145
	
-
 
4146
		#初始化要回給 divAjax 的 json 內容
-
 
4147
		$ajaxDivRes=array();
-
 
4148
	
-
 
4149
		#meta for divAjax
-
 
4150
		$ajaxDivRes["meta"]=array();
-
 
4151
		
-
 
4152
		#設置當前是第幾頁
-
 
4153
		$ajaxDivRes["meta"]["pageNumber"]=$conf["pageNumber"];
-
 
4154
		
-
 
4155
		#設置一頁的資料上限
-
 
4156
		$ajaxDivRes["meta"]["numberPerPage"]=$conf["numberPerPage"];
-
 
4157
		
-
 
4158
		#設置當前頁面的資料筆數
-
 
4159
		$ajaxDivRes["meta"]["currentNumber"]=$conf["currentNumber"];
-
 
4160
		
-
 
4161
		#設置總共的資料筆數
-
 
4162
		$ajaxDivRes["meta"]["total"]=$conf["total"];
-
 
4163
		
-
 
4164
		#設置每列資料的每個欄位內容
-
 
4165
		$ajaxDivRes["data"]=$conf["data"];
-
 
4166
		
-
 
4167
		#json encode res for divAjax
-
 
4168
		$result["content"]=json_encode($ajaxDivRes);
-
 
4169
	
-
 
4170
		#回傳結果
-
 
4171
		return $result;
-
 
4172
	
-
 
4173
		}#function divAjaxRes end
-
 
4174
 
-
 
4175
	/*
-
 
4176
	#函式說明:
3747
	#建立<thead></thead>標籤,裡面放置表格的標題.
4177
	#建立<thead></thead>標籤,裡面放置表格的標題.
3748
	#回傳結果:
4178
	#回傳結果:
3749
	#$result["status"],執行是否正常,"true"代表正常;"false"代表不正常.
4179
	#$result["status"],執行是否正常,"true"代表正常;"false"代表不正常.
3750
	#$result["error"],涵式錯誤訊息陣列.
4180
	#$result["error"],涵式錯誤訊息陣列.
3751
	#$result["content"],thead的語法.
4181
	#$result["content"],thead的語法.