<?php
class PaDefault extends CustomPage {
	public $sCmsdoc=array();
	
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnBInitial(){
		$this->sMetaTitle='文档列表';
		$this->getUser('1,2,3,4,5,');
		$this->sTemplatePath='Cms/docList_Text.php';
	}
	public function OnList(){
		$tmpAR0=$this->AnalyerRequest('ID',1,0);
		$this->sMainID=$tmpAR0[0];
		//-- ------ #This group ------ --
		$tmpSQL=' SELECT A.cdgtID,A.cdgtName,B.cdgctTemplateid_List 
			FROM '.$this->sysTableHead.'cmsdocgroup AS A INNER JOIN '.$this->sysTableHead.'cmsdocgroupcont AS B ON B.cdgctIndexID=A.cdgtID
			WHERE 1=1 AND A.cdgtRecycle=0 AND A.cdgtChecked>1 AND A.cdgtID={Nets.ID} ';
		$tmpSTR=str_replace('{Nets.ID}',$this->sMainID,$tmpSQL);
		$tmpData0=$this->sDb->Search($tmpSTR);
		if(count($tmpData0)==0){
			//Error
			return 1;
		}
		$this->sMetaTitle=$tmpData0[0]['cdgtName'];
		//-- ------ #Template ------ --
		$tmpSQL=' SELECT A.stemtID,A.stemtName,B.stemctPath 
			FROM '.$this->sysTableHead.'netssystemplate AS A
			INNER JOIN '.$this->sysTableHead.'netssystemplatecont AS B ON B.stemctIndexID=A.stemtID
			WHERE 1=1 AND A.stemtRecycle=0 AND A.stemtChecked>1 AND A.stemtID={Nets.ID} ';
		$tmpSTR=str_replace('{Nets.ID}',$tmpData0[0]['cdgctTemplateid_List'],$tmpSQL);
		$tmpData0=$this->sDb->Search($tmpSTR);
		if(count($tmpData0)!=0){
			$this->sTemplatePath=$tmpData0[0]['stemctPath'];
		}
		//-- ------ #Navigation ------ --
		$tmpChildidAR0=$this->sDb->getChild($this->sMainID,$this->sysTableHead.'cmsdocgroup','cdgt');
		$this->sNavigation=$this->sDb->getParent($this->sMainID,$this->sysTableHead.'cmsdocgroup','cdgt');
		//-- ------ #Datas ------ --
		$tmpListSTR0='DList0';
		$tmpListAR0=$this->getQueryString($tmpListSTR0);
		$tmpSortSTR0='DSort0';
		$tmpSortAR0=$this->AnalyerRequest($tmpSortSTR0,'cdtID,2',0);
		//-- #Spell SQL --
		$tmpSQL=' SELECT A.cdtID,A.cdtName,A.cdtParid,A.cdtCreateTime,B.cdctFrom,B.cdctContent,B.cdctSourceR00
			FROM '.$this->sysTableHead.'cmsdoc AS A
			INNER JOIN '.$this->sysTableHead.'cmsdoccont AS B ON B.cdctIndexID=A.cdtID
			WHERE 1=1 AND A.cdtRecycle=0 AND A.cdtChecked>1 AND (1=2 {Nets.Parids})
			ORDER BY A.cdtOrderBy DESC,A.cdtID DESC ';
		$tmpSTR='';
		foreach ($tmpChildidAR0 as $Cell){
			$tmpSTR.=' OR A.cdtParid='.$Cell.' ';
		}
		$tmpSTR=str_replace('{Nets.Parids}',$tmpSTR,$tmpSQL);
		$this->sListData=$this->sDb->SearchP($tmpSTR,$tmpListAR0);
		//#Set page button
		$this->sPButton->resetTemlate('../../../Config/m_default/File/pageButton3.htm');
		$this->sPButton->sPage=$this->sysPage;
		$this->sPButton->sExtendParameter='&ID='.$this->sMainID;
		$this->sPButton->setPage($this->sDb->sysPageInfo);
	}
}
?>