<?php
class netssyslanguagegroup extends netsDb {
	private $sysErrorClassID='0000';
	private $sysErrorFuncID=0;
	private $sysErrorID=0;
	
	public function netssyslanguagegroup($pConnection){
		$this->netsDb($pConnection);
	}
	public function Check(&$pTableDescriptAR,$pExceptionAR1,$pExceptionAR2){
		$this->sysErrorFuncID=$this->sysErrorClassID.'02';
		
		if(count($pExceptionAR1)==0){
			$pExceptionAR1=array();
		}
		parent::Check($pTableDescriptAR,$pExceptionAR1,$pExceptionAR2);
		//
		$tmpSTR='slgtName';
		if(strlen($pTableDescriptAR[0]['Columns'][$tmpSTR]['Value'])<1 && !in_array($tmpSTR,$pExceptionAR2)){
			$this->sysLastError='提交内容错误:1.名称不能为空';
			return $this->sysErrorFuncID.'001';
		}
		return 0;
	}
	
	public function MakePackage_ID(&$pDbDescriptions){
		$this->sysErrorFuncID=$this->sysErrorClassID.'02';
		//-- ------ #Read languagegroup ------ --
		$tmpSQL=' SELECT A.slgtID,A.slgtName,A.slgtNumCode,A.slgtPath
			FROM {Nets.TableHead}netssyslanguagegroup AS A
			INNER JOIN {Nets.TableHead}netssyslanguagegroupcont AS B ON B.slgctIndexID=A.slgtID
			WHERE 1=1 AND A.slgtRecycle=0 AND A.slgtChecked>1 AND A.slgtID={Nets.ID} ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.ID}',$pDbDescriptions[0]['Columns']['slgtID']['Value'],$tmpSTR);
		$tmpData0=$this->Search($tmpSTR);
		if (count($tmpData0)!=1) {
			$this->sysLastError='对不起，您所要生成的语言包并不存在，请确认后再试或与客户人员联系。';
			$this->TransRollback();
			return $this->sysErrorFuncID.'001';
		}
		if ($tmpData0[0]['slgtPath']=='') {
			$this->sysLastError='对不起，您所要生成的语言包并不存在，请确认后再试或与客户人员联系。';
			$this->TransRollback();
			return $this->sysErrorFuncID.'001';
		}
		$tmpFilepath=$this->sysFileConfig['sysUiCoreRoot'].
			$this->sysFileConfig['sysLanguagePathRoot'].
			$this->sysFileConfig['sysLanguage'].
			$tmpData0[0]['slgtPath'];
		//-- ------ #Read language ------ --
		$tmpSQL=' SELECT A.sltID,A.sltName,A.sltNumCode,A.sltFlag,A.sltValue
			FROM {Nets.TableHead}netssyslanguage AS A
			INNER JOIN {Nets.TableHead}netssyslanguagecont AS B ON B.slctIndexID=A.sltID
			WHERE 1=1 AND A.sltRecycle=0 AND A.sltChecked>1 AND A.sltParid={Nets.Parid} ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpSTR=str_replace('{Nets.Parid}',$pDbDescriptions[0]['Columns']['slgtID']['Value'],$tmpSTR);
		$tmpData0=$this->Search($tmpSTR);
		//-- ------ #Write ------ --
		$tmpCONTENT='<?php ';
		$Coun0=0;
		foreach ($tmpData0 as $Row0){
			$tmpCONTENT.='
//'.$Row0['sltValue'].'
$netsLanguageConfig[\''.$Row0['sltFlag'].'\']=\''.$Row0['sltValue'].'\';';
			
			$Coun0++;
		}
		$tmpCONTENT.=' ?>';
		$tmpINT=$this->writeFile($tmpFilepath,$tmpCONTENT);
		
		return 0;
	}
	
}
?>