class_mcMessageReport.inc.php 978 Bytes
<?php
/** 
 * @copyright (c) 2014, netz.coop eG
 */
class mcMessageReport {
	private static $Messages = array();
	public static function addMessage($param_subject, $param_Message='') {
		mcMessageReport::$Messages[] = array('subject' => $param_subject, 'text' => $param_Message);
	}

	public static function printMessages() {
		echo '<p class="message">';
		foreach(mcMessageReport::$Messages as $message) {
			echo '<br />' . $message['subject'].': '.$message['text'];
		}
		echo '</p>';
		mcMessageReport::$Messages = array();
	}


	private static $Errors = array();
	public static function addError($param_subject, $param_Message='') {
		mcMessageReport::$Errors[] = array('subject' => $param_subject, 'text' => $param_Message);
	}

	public static function printErrors() {
		echo '<p class="meld">';
		foreach(mcMessageReport::$Errors as $error) {
			echo '<br />' . $error['subject'].' ('.$error['text'].')';
		}
		echo '</p>';
		mcMessageReport::$Errors = array();
	}
}
?>