<?php
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/commmicroblogging.php');
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/commmicrobloggingcont.php');
require($netsFileConfig['sysCoreRoot'].'Inc/m_Comm/Microblogging/commmicroblogging.php');
require($netsFileConfig['sysCoreRoot'].'Inc/m_Comm/Microblogging/commmicrobloggingdiscuss.php');

class PaDefault extends CustomPage {
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnBInitial(){
		$this->sMetaTitle='微博列表';
		$this->getUser('1,2,3,4,5,');
		$this->sApp=new commmicroblogging($this->sConnString);
		$this->sTemplatePath='Comm/microbloggingList_MDiscuss.php';
		
		//Parid
		$tmpAR0=$this->sControl->sDbInTemplate;
		$tmpAR0['Connection']=$this->sConnString;
		$tmpAR0['SQL']=' SELECT A.combgtID,A.combgtName,A.combgtParid,A.combgtNameStyle 
			FROM '.$this->sysTableHead.'commmicroblogginggroup AS A
			WHERE 1=1 AND A.combgtRecycle=0 AND A.combgtChecked>1 AND 
			A.combgtParid IN (SELECT combgtID FROM '.$this->sysTableHead.'commmicroblogginggroup WHERE 1=1 AND combgtRecycle=0 AND combgtChecked>1 AND combgtParid={Nets.Parid})
			ORDER BY A.combgtOrderBy DESC,A.combgtID DESC ';
		$tmpAR0['InitialString']=2;
		$tmpAR0['Parid']='combgtID';
		$tmpAR0['Text']='combgtName';
		$tmpAR0['Value']='combgtID';
		$tmpAR0['Type']=1;
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		$tmpCacheFlag='comm/comm_Microblogginggroup_list_ALL';
		$this->sControl->getOptions($tmpAR0,$tmpCacheFlag,$this->sControl->sDpReturnTemplate,$this->sParid1);
		$this->sParid2=$this->sParid1;
		$tmpAR0=$this->sControl->sDpReturnTemplate;
		$tmpAR0['Text']='所有分类';
		$tmpAR0['Value']=2;
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		array_push($this->sParid2,$tmpAR0);
		
	}
	public function OnList(){
		$tmpAR0=$this->AnalyerRequest('ID',2,0);
		$this->sMainID=$tmpAR0[0];
		//-- ------ #This group ------ --
		$tmpSQL=' SELECT A.combgtID,A.combgtName,B.combgctTemplateid_List 
			FROM {Nets.TableHead}commmicroblogginggroup AS A 
			INNER JOIN {Nets.TableHead}commmicroblogginggroupcont AS B ON B.combgctIndexID=A.combgtID
			WHERE 1=1 AND A.combgtRecycle=0 AND A.combgtChecked>1 AND A.combgtID={Nets.ID} ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$this->sMainID,$tmpSTR);
		$tmpData0=$this->sDb->Search($tmpSTR);
		if(count($tmpData0)==0){
			//Error
			return 1;
		}
		$this->sMetaTitle=$tmpData0[0]['combgtName'];
		//-- ------ #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}',$tmpData0[0]['combgctTemplateid_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.'commmicroblogginggroup','combgt');
		$this->sNavigation=$this->sDb->getParent($this->sMainID,$this->sysTableHead.'commmicroblogginggroup','combgt');
		//-- ------ #Datas ------ --
		$tmpListSTR0='DList0';
		$tmpListAR0=$this->AnalyerRequest($tmpListSTR0,'1,0,24,0',0);
		$tmpSortSTR0='DSort0';
		$tmpSortAR0=$this->AnalyerRequest($tmpSortSTR0,'combtID,2',0);
		//-- #Spell SQL --
		$tmpSQL=' SELECT A.combtID,A.combtName,A.combtParid,A.combtCreateBy,A.combtCreateTime,
			B.combctContent,B.combctSourceR00,
			B.combctCount_Views,B.combctCode_Positive,B.combctCode_Negative,B.combctCount_Discuss,
			B.combctPublisher_Name,B.combctPublisher_Email,B.combctPublisher_Source

			FROM {Nets.TableHead}commmicroblogging AS A
			INNER JOIN {Nets.TableHead}commmicrobloggingcont AS B ON B.combctIndexID=A.combtID
			WHERE 1=1 AND A.combtRecycle=0 AND A.combtChecked>1 
			AND A.combtID IN (SELECT combdtParid FROM {Nets.TableHead}commmicrobloggingdiscuss WHERE 1=1 AND combdtRecycle=0 AND combdtChecked>1 AND combdtCreateBy={Nets.CreateBy})
			ORDER BY A.combtOrderBy DESC,A.combtID DESC ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.CreateBy}',$this->sUserInfo[0]['Columns']['uitID']['Value'],$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);
		
	}
	public function getSearch($pValue,$pType){
		$tmpAR0=array($this->sMainID,);
		if($pType==0) $tmpAR0[0]=$pValue;

		//#SPICAL
		if ($pType==100) {
			/*
			$tmpAR0[8]=0;
			$tmpAR0[9]=0;
			*/
		}else if ($pType==101) {
		}
		//#SPELL
		$tmpSTR=$this->sysPage.'?ID='.$tmpAR0[0];
		return $tmpSTR;
	}
	
}
?>