<?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 {Nets.TableHead}cmsdocgroup AS A 
			INNER JOIN {Nets.TableHead}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.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sMainID,$tmpSTR);
		$tmpData_Group=$this->sDb->Search($tmpSTR);
		if(count($tmpData_Group)==0){
			//Error
			$tmpData_Group=array(array(
				'cdgtID'=>0,
				'cdgtName'=>'所有分类',
				'cdgctTemplateid_List'=>0,
				));
		}
		$this->sMetaTitle=$tmpData_Group[0]['cdgtName'];
		//-- ------ #Template ------ --
		$tmpSQL=' SELECT A.stemtID,A.stemtName,B.stemctPath 
			FROM {Nets.TableHead}netssystemplate AS A
			INNER JOIN {Nets.TableHead}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.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$tmpData_Group[0]['cdgctTemplateid_List'],$tmpSTR);
		$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 {Nets.TableHead}cmsdoc AS A
			INNER JOIN {Nets.TableHead}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_0='';
		if ($this->sMainID==-1) {
			$tmpSTR_0=' OR A.cdtParid!=-1 ';
		}else {
			foreach ($tmpChildidAR0 as $Cell){
				$tmpSTR_0.=' OR A.cdtParid='.$Cell.' ';
			}
		}
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.Parids}',$tmpSTR_0,$tmpSTR);
		$this->sListData=$this->sDb->SearchP($tmpSTR,$tmpListAR0);
		$this->sRecordCount=$this->sDb->sysPageInfo[3];
		//#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);
		
	}
	
}
?>