<?php
class ComPage extends netsPage {
	public $sMainData='';
	public $sErrorPath='';
	public $sInterface_UserInfo=array();
	
	public $sSpicalValue=array(); #Define spical value user by Add or Modify
	
	public function ComPage(){
		$this->netsPage();
	}
	public function OnInitial(){
		//-- ------ ### ------ --
		$this->sDb=new netsDb($this->sConnString);
		$this->sDbCore=new netsDb($this->sConnStringCore);
		$this->sCode=new netsCode();
		
		parent::OnInitial();
	}
	public function checkURL($pType){
		$tmpDescription=array();
		$tmpDescription[0]=$this->sysDbDescriptions[$this->sysTableHead.'netsuserinfo'];
		$tmpDescription[1]=$this->sysDbDescriptions[$this->sysTableHead.'netsuserinfocont'];
		$tmpDescription[2]=$this->sysDbDescriptions[$this->sysTableHead.'netsuserunit'];
		$tmpDescription[3]=$this->sysDbDescriptions[$this->sysTableHead.'netsuserunitcont'];
		$tmpDescription[4]=$this->sysDbDescriptions[$this->sysTableHead.'netsusertype'];
		$tmpDescription[5]=$this->sysDbDescriptions[$this->sysTableHead.'netsusertypecont'];
		$tmpDescription[6]=$this->sysDbDescriptions[$this->sysTableHead.'netsuserdepartment'];
		$tmpDescription[7]=$this->sysDbDescriptions[$this->sysTableHead.'netsuserdepartmentcont'];
		$tmpDescription[8]=$this->sysDbDescriptions[$this->sysTableHead.'netsusergroup'];
		$tmpDescription[9]=$this->sysDbDescriptions[$this->sysTableHead.'netsusergrade'];
		$tmpUserApp=new netsuserinfo($this->sConnString);
		$tmpSTR='uttType';
		$tmpDescription[4]['Columns'][$tmpSTR]['Value']=$pType;
		//-- ------ #Check ------ --
		//#Initial
		$tmpErrorFlag_0=0;
		$tmpErrorFlag_1=0;
		//#GET
		$tmpAR0=$this->AnalyerRequest('UCODE',',,',0);
		if($tmpAR0[0]=='' || $tmpAR0[1]=='' || $tmpAR0[2]==''){
			$tmpErrorFlag_1=1;
		}else {
			$tmpINT=$tmpUserApp->ReadUserinfo_Interface($tmpDescription,$tmpAR0[0].$this->sysSPLIT1.$tmpAR0[1].$this->sysSPLIT1.$tmpAR0[2],'');
			if($tmpINT!=0){
				$tmpErrorFlag_1=1;
			}
		}
		//#POST
		$tmpAR0=$this->AnalyerRequest('UCODE','',1);
		$tmpAR0=explode($this->sysSPLIT1,$tmpAR0[0]);
		if(count($tmpAR0)!=3){
			$tmpAR0=array('','','',);
		}
		if($tmpAR0[0]=='' || $tmpAR0[1]=='' || $tmpAR0[2]==''){
			$tmpErrorFlag_1=1;
		}else {
			$tmpINT=$tmpUserApp->ReadUserinfo_Interface($tmpDescription,$tmpAR0[0].$this->sysSPLIT1.$tmpAR0[1].$this->sysSPLIT1.$tmpAR0[2],'');
			if($tmpINT!=0){
				$tmpErrorFlag_1=1;
			}
		}
		if ($tmpErrorFlag_0==1 && $tmpErrorFlag_1==1){
			$this->makeError('NoPower_User','没有权限');
			return 1;
		}
		$this->sInterface_UserInfo=$tmpDescription;
		//-- ------ #Make path ------ --
		$this->sErrorPath=$this->sysFileConfig['sysCoreRoot'].$this->sysFileConfig['sysUnitCachePath'].
			$this->sInterface_UserInfo[2]['Columns']['uutNumCode']['Value'].'/'.
			$this->sInterface_UserInfo[0]['Columns']['uitNumCode']['Value'].'/';

		return 0;
	}
	public function makeError($pCode,$pMessage){
		$tmpXml=new netsXml();
		$tmpData0=array(
			array('HEAD',0,$pCode,$pMessage,),
			);
		$this->sMainData=$tmpXml->makeNETSXML($tmpData0);
		return 0;
	}
	public function makeData($pData,$pData_ADD){
		$tmpXml=new netsXml();
		$tmpCONTENT=array();
		$tmpCONTENT[]=array('HEAD',0,'SUCCESS','数据获取成功',);
		$tmpAR0=array();
		$Coun0=0;
		foreach ($pData as $Row0){
			while ($Column=each($Row0)){
				$tmpAR0[$Coun0][$Column['key']]=$Column['value'];
			}
			$Coun0++;
		}
		$tmpCONTENT[]=array('DATA',1,$tmpAR0,'数据内容',);
		foreach ($pData_ADD as $Row0){
			$tmpCONTENT[]=array($Row0[0],$Row0[1],$Row0[2],$Row0[3],);
		}
		$this->sMainData=$tmpXml->makeNETSXML($tmpCONTENT);
		
		return 0;
	}
}
?>