<?php
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/shopauction.php');
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/shopauctioncont.php');
require($netsFileConfig['sysCoreRoot'].'Inc/m_Shop/Sale/shopauction.php');


class PaDefault extends CustomPage {
	public $ssetParid=2;
	
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnBInitial(){
		$this->sMetaTitle='拍卖列表';
		$this->getUser('1,2,3,4,5,');
		$this->sTemplatePath='Shop/auctionList_Normal.php';

		//-- ------ #Option ------ --
		//Parid
		$tmpAR0=$this->sControl->sDbInTemplate;
		$tmpAR0['Connection']=$this->sConnString;
		$tmpAR0['SQL']=' SELECT A.shagtID,A.shagtName,A.shagtParid FROM '.$this->sysTableHead.'shopauctiongroup AS A
			WHERE 1=1 AND A.shagtRecycle=0 AND A.shagtChecked>1 AND A.shagtParid={Nets.Parid}
			ORDER BY A.shagtOrderBy DESC,A.shagtID DESC ';
		$tmpAR0['InitialString']=$this->ssetParid;
		$tmpAR0['Parid']='shagtID';
		$tmpAR0['Text']='shagtName';
		$tmpAR0['Value']='shagtID';
		$tmpAR0['Type']=1;
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		$tmpCacheFlag='shop/shopauction_group_list';
		$this->sControl->getOptions($tmpAR0,$tmpCacheFlag,$this->sControl->sDpReturnTemplate,$this->sParid1);
		$this->sParid2=$this->sParid1;
		$tmpAR0=$this->sControl->sDpReturnTemplate;
		$tmpAR0['Text']='[所有的分类]';
		$tmpAR0['Value']='-1';
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		array_push($this->sParid2,$tmpAR0);
		//Type
		$tmpAR0=$this->sControl->sDbInTemplate;
		$tmpAR0['Connection']=$this->sConnString;
		$tmpAR0['SQL']=$this->sOptionSQL;
		$tmpAR0['InitialString']=133;
		$tmpAR0['Parid']='sotID';
		$tmpAR0['Text']='sotName';
		$tmpAR0['Value']='sotValue';
		$tmpAR0['Type']=1;
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		$tmpCacheFlag='nets/option_Shopauction_type';
		$this->sControl->getOptions($tmpAR0,$tmpCacheFlag,$this->sControl->sDpReturnTemplate,$this->sType1);
		$this->sType2=$this->sType1;
		$tmpAR0=$this->sControl->sDpReturnTemplate;
		$tmpAR0['Text']='[所有类型]';
		$tmpAR0['Value']='-1';
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		array_push($this->sType2,$tmpAR0);
		//Info_State
		$tmpAR0=$this->sControl->sDbInTemplate;
		$tmpAR0['Connection']=$this->sConnString;
		$tmpAR0['SQL']=$this->sOptionSQL;
		$tmpAR0['InitialString']=131;
		$tmpAR0['Parid']='sotID';
		$tmpAR0['Text']='sotName';
		$tmpAR0['Value']='sotValue';
		$tmpAR0['Type']=1;
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		$tmpCacheFlag='Shop/options_Auction_Info_State';
		$this->sControl->getOptions($tmpAR0,$tmpCacheFlag,$this->sControl->sDpReturnTemplate,$this->sInfo_State1);
		$this->sInfo_State2=$this->sInfo_State1;
		$tmpAR0=$this->sControl->sDpReturnTemplate;
		$tmpAR0['Text']='[所有状态]';
		$tmpAR0['Value']='-1';
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		array_push($this->sInfo_State2,$tmpAR0);
		
		//-- #sCondition_Order --
		$this->sCondition_Order=array('按价格','按销量','按上市时间',);
		
	}
	public function OnList(){
		$tmpAR0=$this->AnalyerRequest('ID',-1,0);
		$this->sMainID=$tmpAR0[0];
		$tmpAR0=$this->AnalyerRequest('DKeyword','',0);
		$this->sKeyword=$tmpAR0[0];
		$this->sSearchAR=$this->AnalyerRequest('DSearch','0,0,-1,-1',0);
		//-- ------ #This group ------ --
		$tmpSQL=' SELECT A.shagtID,A.shagtName,B.shagctTemplateid_List 
			FROM {Nets.TableHead}shopauctiongroup AS A 
			INNER JOIN {Nets.TableHead}shopauctiongroupcont AS B ON B.shagctIndexID=A.shagtID
			WHERE 1=1 AND A.shagtRecycle=0 AND A.shagtChecked>1 AND A.shagtID={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(
				'shagtID'=>0,
				'shagtName'=>'所有商品类型',
				'shagctTemplateid_List'=>0,
				),);
			//return 1;
		}
		$this->sMetaTitle=$tmpData_Group[0]['shagtName'];
		//-- ------ #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]['shagctTemplateid_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.'shopauctiongroup','shagt');
		$this->sNavigation=$this->sDb->getParent($this->sMainID,$this->sysTableHead.'shopauctiongroup','shagt');
		//-- ------ #Datas ------ --
		$tmpListSTR0='DList0';
		$tmpListAR0=$this->AnalyerRequest($tmpListSTR0,'1,0,30,0',0);
		$tmpSortSTR0='DSort0';
		$tmpSortAR0=$this->AnalyerRequest($tmpSortSTR0,'shatID,2',0);
		//-- #Spell SQL --
		$tmpSQL=' SELECT A.shatID,A.shatName,A.shatParid,A.shatNameStyle,A.shatPrice,A.shatCode,A.shatType,
			B.shactInfo_State,B.shactSourceR00,B.shactContent
			
			FROM {Nets.TableHead}shopauction AS A
			INNER JOIN {Nets.TableHead}shopauctioncont AS B ON B.shactIndexID=A.shatID
			WHERE 1=1 AND A.shatRecycle=0 AND A.shatChecked>1 ';

		if ($this->sSearchAR[2]!=-1) {
			$tmpSQL.=' AND A.shatType='.$this->sSearchAR[2].' ';
		}
		if ($this->sSearchAR[3]!=-1) {
			$tmpSQL.=' AND A.shactInfo_State='.$this->sSearchAR[3].' ';
		}
		if ($this->sKeyword!='') {
			$tmpSQL.=' AND A.shatName LIKE \'%'.$this->sKeyword.'%\' ';
		}
		if ($this->sMainID!=-1) {
			$tmpSTR_0='';
			foreach ($tmpChildidAR0 as $Cell){
				$tmpSTR_0.=' OR A.shatParid='.$Cell.' ';
			}
			$tmpSQL.=' AND (1=2 '.$tmpSTR_0.') ';
		}
		$tmpSQL.=' ORDER BY A.shatOrderBy DESC,A.shatID DESC ';
		
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$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.'&DKeyword='.$this->sKeyword.'&DSearch='.$this->sSearchAR[0].$this->sysSPLIT1.$this->sSearchAR[1].$this->sysSPLIT1.$this->sSearchAR[2].$this->sysSPLIT1.$this->sSearchAR[3];
		$this->sPButton->setPage($this->sDb->sysPageInfo);
		
	}
	public function getSearch($pValue,$pType){
/*
Parid
Keyword

ListType
OrderBy
Type
State
*/
		$tmpAR0=array(
			$this->sMainID,
			$this->sKeyword,
			$this->sSearchAR[0],
			$this->sSearchAR[1],
			$this->sSearchAR[2],
			$this->sSearchAR[3],
			);
		if($pType==0) $tmpAR0[0]=$pValue;
		if($pType==1) $tmpAR0[1]=$pValue;
		if($pType==2) $tmpAR0[2]=$pValue;
		if($pType==3) $tmpAR0[3]=$pValue;
		if($pType==4) $tmpAR0[4]=$pValue;
		if($pType==5) $tmpAR0[5]=$pValue;

		//#SPICAL
		if ($pType==100) {
			/*
			$tmpAR0[8]=0;
			$tmpAR0[9]=0;
			$tmpAR0[10]=0;
			$tmpAR0[11]=0;
			$tmpAR0[12]=0;
			*/
		}else if ($pType==101) {
		}
		//#SPELL
		$tmpSTR=$this->sysPage.'?ID='.$tmpAR0[0].'&DKeyword='.$tmpAR0[1].'&DSearch='.
			$tmpAR0[2].$this->sysSPLIT1.$tmpAR0[3].$this->sysSPLIT1.$tmpAR0[4].$this->sysSPLIT1.$tmpAR0[5];
		return $tmpSTR;
	}
	
	
	
}

?>