<?php
class PaDefault extends CustomPage {
	public $ssetParid=1;
	
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnPInitial(){
		$this->checkUser('1,2,3,');
		$this->sActionType='Normal';
		$this->sTable=array(
			array('sttTableName'=>$this->sysTableHead.'netsuserinfo','sttColumnHead'=>'uit'),
			array('sttTableName'=>$this->sysTableHead.'netsuserinfocont','sttColumnHead'=>'uict'),);
		$this->sUiName='Platform/my/my_myInfo1';
	}
	public function OnBInitial(){
		$this->sMetaTitle='用户';
		$this->sLimitCount=0;
		$this->sTopMessageStyle='Message';
		$this->sTopMessage='注意：用户修改密码后，必须要重新登陆。';
		$this->sApp=new netsuserinfo($this->sConnStringCore);
	}
	public function OnModify(){
		$tmpDbDescription=array();
		foreach ($this->sTable as $tableCell){
			$tmpDbDescription[]=$this->sDbDescriptions[$tableCell['sttTableName']];
		}
		//-- #uitName, --
		$tmpSTR='uitName';
		$tmpAR0=$this->AnalyerRequest($tmpSTR.'Txt','',1);
		$tmpDbDescription[0]['Columns'][$tmpSTR]['Value']=$tmpAR0[0];
		//-- #uitOldPxd, --
		$tmpSTR='uitOldPxd';
		$tmpAR0=$this->AnalyerRequest($tmpSTR.'Txt','',1);
		$tmpDbDescription[0]['Columns']['uitPxd']['Value']=$tmpAR0[0];
		//-- #uitPxd, --
		$tmpSTR='uitPxd';
		$tmpAR0=$this->AnalyerRequest($tmpSTR.'Txt','',1);
		$tmpPxd=$tmpAR0[0];
		//-- #uitNewPxd, --
		$tmpSTR='uitConfirmPxd';
		$tmpAR0=$this->AnalyerRequest($tmpSTR.'Txt','',1);
		$tmpConfirmPxd=$tmpAR0[0];
		
		$tmpINT=$this->sApp->ModifyPxd($tmpDbDescription,$tmpPxd);
		if($tmpINT!=0){
			$this->sJscript=$this->Message('ERROR','',$tmpINT,'');
			return 1;
		}
		
		$this->sJscript=$this->Message('SUCCESS','','密码修改成功',$this->sysPage);
		return 0;
	}
	public function OnNormal(){
		$tmpAR0=$this->AnalyerRequest('Normal','0,0',0);
		
		$tmpSQL=' SELECT * 
			FROM '.$this->sysTableHead.'netsuserinfo AS A 
			INNER JOIN '.$this->sysTableHead.'netsuserinfocont AS B ON B.uictIndexID=A.uitID ';
		$Coun0=2;
		foreach ($this->sTable as $Row0){
			if (count($this->sTable)>2) {
				$tmpSQL.=' INNER JOIN '.$Row0['sttTableName'].' AS '.$this->sysTableMark[$Coun0].' ON '.$this->sysTableMark[$Coun0].'.'.$Row0['sttColumnHead'].'IndexID=A.uitID ';
				$Coun0++;
			}
		}
		$tmpSQL.=' WHERE 1=1 AND A.uitID='.$this->sUserInfo[0]['Columns']['uitID']['Value'].' ';
		$tmpDataCollection0=$this->sDb->Search($tmpSQL);
		if(count($tmpDataCollection0)>0){
			$tmpRow=$tmpDataCollection0[0];
			$this->sMainID=$tmpRow[$this->sTable[0]['sttColumnHead'].'ID'];
			//-- #Get value --
			$Coun0=0;
			while (count($this->sUiDescription_Normal)>$Coun0) {
				if(isset($tmpRow[$this->sUiDescription_Normal[$Coun0]['stcotName']])){
					$this->sUiDescription_Normal[$Coun0]['Value']=$tmpRow[$this->sUiDescription_Normal[$Coun0]['stcotName']];
				}
				//Spical value set
				if($this->sUiDescription_Normal[$Coun0]['stcotName']=='uitOldPxd' ||
					$this->sUiDescription_Normal[$Coun0]['stcotName']=='uitPxd' ||
					$this->sUiDescription_Normal[$Coun0]['stcotName']=='uitConfirmPxd'){
					$this->sUiDescription_Normal[$Coun0]['Value']='';
				}
				$Coun0++;
			}
		}else {}
	}
	
	public function DefUiPanel(&$pColumn,$pFlag){
		if($pColumn['stcotName']=='Quick'){
			$pColumn['ControlStyle']='width:50px;';
		}else if($pColumn['stcotName']=='uitChecked' && $pFlag=='Search'){
			$pColumn['Option']=$this->sChecked2;
		}else if($pColumn['stcotName']=='uitParid' && $pFlag=='Search'){
			$pColumn['Option']=$this->sParid2;
		}
		return $pColumn;
	}
	public function DefUiButton($pFlag,$Exception){
		parent::DefUiButton($pFlag,array('List','Normal','Normal_Head','ListChildLink','NormalChildLink',));
		if($pFlag=='Normal'){ ?>
<li class="ButBut"><input type="submit" value="保存我的信息" class="Control2" onclick="tmpCommon.setActionType('Normal','DModify','','');" /></li>
<?php
		}else if ($pFlag=='Normal_Head' && !in_array($pFlag,$Exception)) { ?>
<li class="Tab_Option_Button">
	<div class="Tab_Option_ButtonCell"><img src="<?php echo($this->sysFileConfig['sysUiCoreRoot']); ?>Ui/Common/Img/Common/icon_head_4.jpg" /></div>
	<div class="Tab_Option_ButtonCell"><a href="#Here" class="Link1 FBlue2" onclick="tmpCommon.setActionType('Normal','DModify','',''); tmpCommon.netsSubmit();">保存我的信息</a></div></li>

<?php
		}
	}
	public function DefUiJscript($pFlag){
?>
function jsDCheck(pPara){
	var tmpControl="";
	var tmpError="";
	var tmpChecker=new netsChecker();
	var tmpActionWithOut=document.getElementById("ActionWithOut");
	var Coun0=0;
	//-- ------ #ActionWithOut ------ --
	if(tmpActionWithOut==undefined){
		return true;
	}
	if(tmpActionWithOut.value=="1"){
		return true;
	}else if(tmpActionWithOut.value=="2"){
		return false;
	}
	//-- ------ #Check ------ --
	//#uitName
	tmpCheckCont=document.getElementById("uitNameTxt");
	tmpCheckCont.value=tmpChecker.Filter(tmpCheckCont.value,0);
	if(!tmpChecker.CheckLen(tmpCheckCont.value,5,32)){
		Coun0++;
		tmpError+=Coun0+".用户名必须大于5位"+sysSPLIT8;
	}
	//#uitOldPxd
	tmpCheckCont=document.getElementById("uitOldPxdTxt");
	tmpCheckCont.value=tmpChecker.Filter(tmpCheckCont.value,0);
	if(!tmpChecker.CheckLen(tmpCheckCont.value,5,32)){
		Coun0++;
		tmpError+=Coun0+".请输入多于5位的旧密码"+sysSPLIT8;
	}
	//#uitPxd
	tmpCheckCont=document.getElementById("uitPxdTxt");
	tmpCheckCont.value=tmpChecker.Filter(tmpCheckCont.value,0);
	if(!tmpChecker.CheckLen(tmpCheckCont.value,5,32)){
		Coun0++;
		tmpError+=Coun0+".请输入多于5位的新密码"+sysSPLIT8;
	}
	//#uitConfirmPxd
	tmpCheckCont0=document.getElementById("uitPxdTxt");
	tmpCheckCont1=document.getElementById("uitConfirmPxdTxt");
	tmpCheckCont0.value=tmpChecker.Filter(tmpCheckCont0.value,0);
	tmpCheckCont1.value=tmpChecker.Filter(tmpCheckCont1.value,0);
	if(tmpCheckCont0.value!=tmpCheckCont1.value){
		Coun0++;
		tmpError+=Coun0+".您两次输入的新密码必须一致"+sysSPLIT8;
	}
	//-- ------ #Result ------ --
	if(Coun0>0){
		tmpSTR="对不起，您提交的内容存在以下错误:"+sysSPLIT8+tmpError;
		showMessage("系统消息 - unionNets.com",tmpSTR,"","0");
		return false;
	}else{
		return true;
	}
}
<?php
	}
}
?>