File: D:/HostingSpaces/SBogers10/kms.komma.pro/wwwroot/lib/general/alert.class.php
<?php
/**
* alert.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 3/20/13
*/
class Alert
{
public function __construct(){ }
/*
* Show error messages
* @param mixed $msg
* @param string $type
*/
public function set($input, $type)
{
// make sure input is always an array
if ( ! is_array($input)) $input = array($input);
//
$msg = '';
if(!empty($type))
{
switch($type)
{
case 'error':
$msg .= '<div class="alert_mask">';
$msg .= '<div class="alert error">';
$msg .= '<div class="icon"></div>';
$msg .= '<div class="text_holder">';
if(count($input) > 1)
{
foreach($input as $error)
{
$msg .= $error;
}
}
else if(count($input) == 1)
{
$msg .= $input[key($input)];
}
$msg .= '</div>';
$msg .= '<div class="clear"></div>';
$msg .= '<div class="arrow"></div>';
$msg .= '</div>';
$msg .= '</div>';
break;
case 'success':
if( ! empty($input))
{
$msg .= '<div class="alert success"><span class="close">×</span>' . $input . '</div>';
}
break;
}
}
Session::set('alert',$msg);
return false;
}
/*
* Show error messages
*/
public function get()
{
if($msg = Session::get('alert'))
{
Session::destroy('alert');
return $msg;
}
return false;
}
}