<?php
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/cmsdocusergroup.php');
require($netsFileConfig['sysCoreRoot_Real'].'Inc/netsFunc/Func/netsSimpleXml.php');


class PaDefault extends CustomPage {
	public $sUserinfoData0=array();
	public $sUsermessageData0=array();
	public $sUsermessageCount_All=0;
	public $sUsermessageCount_Unview=0;
	public $sUserquestionData0=array();
	public $sUserquestionCount=0;
	public $sUserquestionTomeData0=array();
	public $sUserquestionTomeCount_All=0;
	public $sUserquestionTomeCount_Unview=0;
	
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnPInitial(){
		$this->checkUser('1,2,3,4,5,');
		
	}
	public function OnBInitial(){
		$this->sMetaTitle='用户管理平台首页';
		$this->sTable=array(
			array('sttTableName'=>$this->sysTableHead.'netsuserinfo','sttColumnHead'=>'uit'),
			array('sttTableName'=>$this->sysTableHead.'netsuserinfocont','sttColumnHead'=>'uict'),);
		$this->sApp=new netsuserinfo($this->sConnString);
		
	}
	public function OnList(){
		//-- ------ #Initial ------ --
		//-- #Unit --
		$this->sApp->sDbDescriptions_Other=array(
			$this->sysDbDescriptions[$this->sysTableHead.'cmsdocusergroup'],

			);
		$tmpINT=$this->sApp->initialUnit($this->sUserInfo);
		if($tmpINT!=0){
			$this->sJscript=$this->Message('ERROR','',$this->sApp->sysLastError,'');
		}
		//-- #Userinfo --
		$tmpINT=$this->sApp->initialUser($this->sUserInfo);
		if($tmpINT!=0){
			$this->sJscript=$this->Message('ERROR','',$this->sApp->sysLastError,'');
		}

		//-- ------ #Data ------ --
		//-- #netsuserinfo --
		$tmpSQL=' SELECT A.uitID,A.uitName,A.uitNumCode,A.uitPxd,A.uitGradeid,
			B.uictCo_Name,B.uictCo_Tele,B.uictCo_Mobile,B.uictCo_Software,B.uictCo_Website,B.uictCo_ZoneChoose,B.uictCo_ZoneDetail,
			B.uictChecked_Mobile,B.uictChecked_Postcode,B.uictChecked_Bank,B.uictChecked_Email,B.uictChecked_Pay,
			C.uutName,
			D.uuctComName,D.uuctComIdCode,D.uuctComIdCodeSource,D.uuctComType,D.uuctComContact,D.uuctComContactTele,D.uuctComZoneChoose,D.uuctComZoneDetail,D.uuctComNumCode,D.uuctComContactWebsite,D.uuctComContactEmail,D.uuctComContactFax,D.uuctComPersonCount,D.uuctComYearMoney,D.uuctComRegisterFund,D.uuctComRegisterPeople,D.uuctComCreateTime,D.uuctComProduct,D.uuctComLogo,D.uuctComCustomTypes
			FROM ((({Nets.TableHead}netsuserinfo AS A
			INNER JOIN {Nets.TableHead}netsuserinfocont AS B ON B.uictIndexID=A.uitID)
			INNER JOIN {Nets.TableHead}netsuserunit AS C ON C.uutID=A.uitUnitid)
			INNER JOIN {Nets.TableHead}netsuserunitcont AS D ON D.uuctIndexID=C.uutID)
			WHERE 1=1 AND A.uitID={Nets.ID}; ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sUserInfo[0]['Columns']['uitID']['Value'],$tmpSTR);
		$this->sData_Userinfo=$this->sDb->Search($tmpSTR);
		//-- #netsusergrade --
		$tmpSQL=' SELECT A.ugratID,A.ugratName
			FROM {Nets.TableHead}netsusergrade AS A
			WHERE 1=1 AND A.ugratRecycle=0 AND A.ugratChecked>1 AND A.ugratID={Nets.ID} ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sData_Userinfo[0]['uitGradeid'],$tmpSTR);
		$this->sData_Usergrade=$this->sDb->Search($tmpSTR);
		if(count($this->sData_Usergrade)==0){
			$this->sData_Usergrade[0]['ugratName']='初级用户';
		}
		//-- #Checked --
		if (($this->sData_Userinfo[0]['uictChecked_Email']<2 && $this->sysFileConfig['userUserMailCheckAble']!=0) ||
			($this->sData_Userinfo[0]['uictChecked_Mobile']<2 && $this->sysFileConfig['userUserMobileCheckAble']!=0)) {
			//$this->sJscript.='tmpFrames.showMessage_S("mainCheckedBox",300,0);';
		}
		//cmsdoc
		$tmpSQL=' SELECT A.cdtID,A.cdtName,A.cdtCreateTime
			FROM {Nets.TableHead}cmsdoc AS A
			WHERE 1=1 AND A.cdtRecycle=0 AND A.cdtChecked>1 AND A.cdtCreateBy={Nets.ID}
			LIMIT 0,9 ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sUserInfo[0]['Columns']['uitID']['Value'],$tmpSTR);
		$this->sUsercmsdocData0=$this->sDb->Search($tmpSTR);
		
		$tmpSQL=' SELECT A.cdtID
			FROM {Nets.TableHead}cmsdoc AS A
			WHERE 1=1 AND A.cdtRecycle=0 AND A.cdtChecked>1 AND A.cdtCreateBy={Nets.ID} ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sUserInfo[0]['Columns']['uitID']['Value'],$tmpSTR);
		$tmpData0=$this->sDb->Search($tmpSTR);
		$this->sUsercmsdocCount_All=count($tmpData0);
		//oafavorite
		$tmpSQL=' SELECT A.oftID,A.oftName,A.oftCreateTime
			FROM {Nets.TableHead}oafavorite AS A
			WHERE 1=1 AND A.oftCreateBy={Nets.ID}
			LIMIT 0,9 ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sUserInfo[0]['Columns']['uitID']['Value'],$tmpSTR);
		$this->sUserfavoriteData0=$this->sDb->Search($tmpSTR);
		
		$tmpSQL=' SELECT A.oftID
			FROM {Nets.TableHead}oafavorite AS A
			WHERE 1=1 AND A.oftCreateBy={Nets.ID} ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sUserInfo[0]['Columns']['uitID']['Value'],$tmpSTR);
		$tmpData0=$this->sDb->Search($tmpSTR);
		$this->ssUserfavoriteCount_All=count($tmpData0);
		
		
		
	}
}
?>