Your IP : 216.73.217.69


Current Path : /home/semix18/public_html/optimum-wycena.pl/core/classes/
Upload File :
Current File : /home/semix18/public_html/optimum-wycena.pl/core/classes/class.error.php

<?php
/**
*	Dobi System
*
*	Terms of use and legal restrictions:
*   PLEASE READ THESE TERMS ( www.dobi.pl/doc/license/ ) CAREFULLY BEFORE USING THIS PRODUCT. 
*	USING THIS PRODUCT INDICATES THAT YOU ACCEPT THESE TERMS. 
*	IF YOU DO NOT ACCEPT THESE TERMS , DO NOT USE THIS PRODUCT.
*
*	PHP 5.1.2 and later 
*
*	@license	www.dobi.pl/doc/license/ Dobi License 1.0
*   @copyright	Copyright (c) 2005-2006 Michał 'Cube' Daniel ( http://www.dobi.pl )
* 	@link		www.dobi.pl
*	@package	Dobi Core
*	@version 	1.0, 2006/08/10 11:57
*   @author		Michał 'Cube' Daniel cube@dobi.pl		
*
*/
class error
{
	private $error_arrMessage = array();
	private $error_strFalseMessage;
	private $error_strTrueMessage;
	private $error_content = '';
//	private $error_separator = '<br />';
	private $error_redirect = true;
	private $error_redirect_time = 3;
//	private $error_class_locked = false; 	
		
	public function __construct() {}
	public function __destruct() {}	 
	 	
	public function addError( $errMsg )
	{
	  	if ($errMsg != '')
	  	{
			$this->error_arrMessage[] = $errMsg;      
		}
	}
	
	public function getErrorsAmount()
	{
		return count($this->error_arrMessage);  
	}
	
	public function errorExists()
	{
		if (count($this->error_arrMessage) > 0)
		{
			return true;	  
		} 
		return false; 
	}	
	
	public function clearErrors()
	{
		 $this->error_arrMessage = array();
		 $this->error_strFalseMessage = NULL;
		 $this->error_strTrueMessage = NULL;
		 $this->error_content = '';
	//	 $this->error_separator = '<br />';	  
	}
	
//	public function locked( $bool )
//	{
//		if (is_bool($bool)) $this->error_class_locked = $bool;
//		return NULL;
//	}
	
	public function getErrors()
	{
//		if ($this->error_class_locked) return;
		if (count($this->error_arrMessage) > 0)
		{
			echo '<p style="padding-bottom: 6px; font-weight: bold;">' . $this->error_strFalseMessage . '</p>';
			foreach ($this->error_arrMessage as $error)
			{
			//	echo $error . $this->error_separator;  
				echo '<p>' . $error . '</p>';
			} 
			echo $this->error_content; 
		}
		else
		{
			echo '<p style="padding-bottom: 6px;">' . $this->error_strTrueMessage . '</p>';
			echo $this->error_content; 		  
		}  
	}
	
	public function addAction( $action, $file = 'admin.php', $back = _WORD_BACK_ )
	{
//		if ($this->error_class_locked) return;
	    $dataRequest = Registry::getObject('dataRequest');
	    if ($this->error_redirect)
	    {
			header( 'refresh: '.$this->error_redirect_time.'; url='. str_replace('&amp;', '&', $dataRequest->getActionLink( $action, $file )) );  
		}
		$this->error_content .= '<p style="padding-top: 10px;">'._WORD_REDIRECT_.'  <a href="'. $dataRequest->getActionLink( $action, $file ) .'">'.$back.'</a></p>';    	  		
	}
	
	public function setRedirect( $boolRedirect = true)
	{
		if ($boolRedirect) $this->error_redirect = true;
		elseif (!$boolRedirect) $this->error_redirect = false;
		else return false; 
	}
	
	public function setRedirectTime( $time )
	{
		if (is_numeric($time)) 
		{
			$this->error_redirect_time = $time;  
		}
		else return false;  
	}
	
	public function addContent( $content )
	{
		$this->error_content .= $content; 
	}
/*
	public function setSeparator( $separator )
	{
		$this->error_separator =  $separator; 
	}	
*/
	public function setTrueMessage( $msg )
	{
		$this->error_strTrueMessage = $msg; 
	}
		
	public function setFalseMessage( $msg )
	{
		$this->error_strFalseMessage =  $msg; 
	}	
}

?>