<?php
class CErrorMSG
	{
	var $oSystem;
	var $msURL=false;
	function CErrorMSG(&$oSystem)
		{
		$this->oSystem=&$oSystem;
		}
	function gsGenerateFinalError($sError)
		{
return  $sError;
		$oTPL=$this->oSystem->goGetTPLParser(PATHQS."error/final/err.".$sError.".tpl");
		
		$oTPL->gbSetValue("LOGINURL", "http://".$this->oSystem->oControl->gsGetHostName()."/".$this->oSystem->oControl->gsGetCurrentPathName()."/login/showscreen");
		echo $oTPL->gsParse();
		exit;
		}
	function gsGenerateError($oError,$TPL="simple")
		{

		if($oError->msURL===false)
			$oTPL=$this->oSystem->goGetTPLParser(PATHQS."error/nonfinal/error.".$TPL.".simple.tpl");
		else
			{

			$oTPL=$this->oSystem->goGetTPLParser(PATHQS."error/nonfinal/err.".$TPL.".go.tpl");#
			}
		$oTPL->gbSetValue("errorText",$oError->gsGetErrorText());
		$oTPL->gbSetValue("GoOnURL",$oError->gsGetURL());
		$oTPL->gbSetValue("GoOnText",$oError->gbGetGoOnText());
		return $oTPL->gsParse();
		}
	function gsGenerateWarning($oError)
		{
		}
	}
class CError
	{
	var $mlErrorCode=false;
	var $msErrorText=false;
	var $msURL=false;
	var $msGoOnText=false;
	function CError($lErrorCode,$asAdditional=false)
		{
		global $oSystem;
		$this->oSystem=&$oSystem;
		$this->mlErrorCode=$lErrorCode;
		$sErrorText=$this->oSystem->oDB->gsGetFieldValue("tdErrorMSG","Text","ErrorPK=".$lErrorCode);
		if($asAdditional!==false)
			{
			$oTPL=$this->oSystem->goGetTPLParser($sErrorText,$asAdditional);
			$oTPL->gbSetValArray($asAdditional);
			$this->msErrorText=$oTPL->gsParse();
			}
		else
			$this->msErrorText=$sErrorText;
		$this->oSystem->oDB->goUpdateArray("tdErrorMSG",array("LastOccur"=>"now()","UserPK"=>$this->oSystem->oUser->oUserData->UserPK),"ErrorPK=".$lErrorCode);
		
		}
	function gsGetErrorCode()
		{
		return $this->mlErrorCode;
		}
	function gsGetErrorText()
		{
		return $this->msErrorText;
		}
	function gbGetGoOnText()
		{
		return $this->msGoOnText;
		}
	function gbSetGoOnText($sText)
		{
		if($this->msGoOnText===false)
			$this->msGoOnText=$sText;
		}
	function gsGetURL()
		{
		return $this->msURL=""?"false":$this->msURL;
		}
	function gbSetURL($sURL)
		{
		$this->msURL=$sURL;
		}
	}