<?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_myInfo0';
	}
	public function OnBInitial(){
		$this->sMetaTitle='用户';
		$this->sLimitCount=0;
		$this->sApp=new netsuserinfo($this->sConnStringCore);
		//Sex
		$tmpAR0=$this->sControl->sDbInTemplate;
		$tmpAR0['Connection']=$this->sConnStringCore;
		$tmpAR0['SQL']=$this->sOptionSQL;
		$tmpAR0['InitialString']=45;
		$tmpAR0['Parid']='sotID';
		$tmpAR0['Text']='sotName';
		$tmpAR0['Value']='sotValue';
		$tmpAR0['Type']=1;
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		$this->sSex1=$this->sSex2=$this->sControl->bindDropdown($tmpAR0);
		$tmpAR0=$this->sControl->sDpReturnTemplate;
		$tmpAR0['Text']='[所有审核状态]';
		$tmpAR0['Value']='-1';
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		array_push($this->sSex2,$tmpAR0);
	}
	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']];
				}
				$Coun0++;
			}
		}else {}
	}
	
	public function DefUiPanel(&$pColumn,$pFlag){
		parent::DefUiPanel($pColumn,$pFlag);
		if($pColumn['stcotName']=='uitParid' && $pFlag=='Search'){
			$pColumn['Option']=$this->sParid2;
		}else if($pColumn['stcotName']=='uictCoSex' && $pFlag=='Normal'){
			$pColumn['Option']=$this->sSex1;
		}else if($pColumn['stcotName']=='uitApikey' && $pFlag=='Normal'){
			$pColumn['Value']=$this->sApp->MakeApikey($this->sUserInfo);
			
		}
		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
		}
	}
}
?>