<?php
class PaDefault extends CustomPage {
	public $ssetParid=1;
	
	public function PaDefault(){
		$this->ComPage();
	}
	public function OnPInitial(){
		$this->checkUser('1,2,3,4,5,');
		$this->sActionType='Normal';
		$this->sTable=array(
			array('sttTableName'=>$this->sysTableHead.'netsuserunit','sttColumnHead'=>'uut'),
			array('sttTableName'=>$this->sysTableHead.'netsuserunitcont','sttColumnHead'=>'uuct'),);
		$this->sUiName='User/nets/my_userunit0';
	}
	public function OnBInitial(){
		$this->sMetaTitle='单位';
		$this->sLimitCount=0;
		$this->sApp=new netsuserunit($this->sConnString);
	}
	public function OnModify(){
		parent::OnModify();
		$this->sUserInfo[0]['Columns']['uitTypeid']['Value']='1,2,3,4,5,';
		$tmpINT=$this->sApp->Relogin($this->sUserInfo);
	}
	public function OnNormal(){
		$tmpSQL=' SELECT 
			* 
			FROM '.$this->sysTableHead.'netsuserunit AS A 
			INNER JOIN '.$this->sysTableHead.'netsuserunitcont AS B ON B.uuctIndexID=A.uutID
			INNER JOIN '.$this->sysTableHead.'netsuserinfo AS C ON C.uitUnitid=A.uutID
			WHERE 1=1 AND C.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){
		if($pColumn['stcotName']=='Quick'){
			$pColumn['ControlStyle']='width:50px;';
		}else if($pColumn['stcotName']=='uutChecked' && $pFlag=='Search'){
			$pColumn['Option']=$this->sChecked2;
		}else if($pColumn['stcotName']=='uutParid' && $pFlag=='Search'){
			$pColumn['Option']=$this->sParid2;
		}else if($pColumn['stcotName']=='uuctCoSex' && $pFlag=='Normal'){
			$pColumn['Option']=$this->sSex1;
		}
		return $pColumn;
	}
	public function DefUiButton($pFlag,$Exception){
		parent::DefUiButton($pFlag,array('List','Normal','ListChildLink','NormalChildLink',));
		if($pFlag=='Normal'){ ?>
<li class="ButBut"><input type="submit" value="保存单位信息" class="Control2" onclick="setActionType('Normal','DModify','','');" /></li>
<?php
		}
	}
}
?>