<?php
require($netsFileConfig['sysCoreRoot'].'Inc/m_Gsnavigation/gsnavigation/gsnavigationactive.php');

class PaDefault extends CustomPage {
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnBInitial(){
		$this->sMetaTitle='团购首页';
		$this->getUser('1,2,3,4,5,');
		$this->sTemplatePath='Gsnavigation/gsnavigationHome.php';
		//-- #Share link --
		$this->sData_LinkShare=array();
		$tmpCacheFlag='nets/options_LinkShare_Groupsale';
		$tmpAR_Cache=$this->sDb->readCache($tmpCacheFlag);
		if(count($tmpAR_Cache)==0){
			$tmpParid=20;
			$tmpSQL=' SELECT A.cltID,A.cltName,A.cltURL,A.cltTarget,B.clctSourceR00
				FROM {Nets.TableHead}cmslink AS A
				INNER JOIN {Nets.TableHead}cmslinkcont AS B ON B.clctIndexID=A.cltID
				WHERE 1=1 AND A.cltRecycle=0 AND A.cltChecked>1 AND A.cltParid={Nets.Parid}
				ORDER BY A.cltOrderBy DESC,A.cltID DESC ';
			$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
			$tmpSTR=str_replace('{Nets.Parid}',$tmpParid,$tmpSTR);
			$this->sData_LinkShare=$this->sDb->Search($tmpSTR);
			
			if($this->sysFileConfig['CacheDbAble']==1){
				$this->sDb->writeCache($tmpCacheFlag,$this->sData_LinkShare);
			}
		}else {
			$this->sData_LinkShare=$tmpAR_Cache;
		}
		
	}
	public function OnList(){
		$tmpApp=new gsnavigationactive($this->sConnString);
		$tmpApp->setAllState();
		
		
		/*
		$tmpSQL=' SELECT A.gsnatID,A.gsnatName,B.gsnactRemark
			FROM {Nets.TableHead}gsnavigationactive AS A
			INNER JOIN {Nets.TableHead}gsnavigationactivecont AS B ON B.gsnactIndexID=A.gsnatID
			WHERE 1=1 ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpData0=$this->sDb->Search($tmpSTR);
		
		foreach ($tmpData0 as $Row0) {
			$tmpAR0=explode('---',$Row0['gsnactRemark']);
			if (count($tmpAR0)==2) {
				$tmpAR0[0]=str_replace('【','',$tmpAR0[0]);
				$tmpAR0[0]=str_replace('】','',$tmpAR0[0]);
				
				$tmpSQL=' UPDATE {Nets.TableHead}gsnavigationactive AS A SET 
					A.gsnatUnitid=(SELECT B.gsnutID FROM {Nets.TableHead}gsnavigationunit AS B
						WHERE B.gsnutName LIKE \'{Nets.UnitName}\' LIMIT 0,1),
					A.gsnatZoneid=(SELECT C.sztID FROM {Nets.TableHead}netssyszone AS C
						WHERE C.sztName LIKE \'{Nets.ZoneName}\' LIMIT 0,1)
					
					WHERE 1=1 AND A.gsnatID={Nets.ID} ';
				$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
				$tmpSTR=str_replace('{Nets.ZoneName}',$tmpAR0[0],$tmpSTR);
				$tmpSTR=str_replace('{Nets.UnitName}',$tmpAR0[1],$tmpSTR);
				$tmpSTR=str_replace('{Nets.ID}',$Row0['gsnatID'],$tmpSTR);

				$tmpINT=$this->sDb->Execute($tmpSTR);
				
			}
			
			
			
			
		}
		*/
		
	}
	
}

?>