HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers68/resortouddorpduin.nl/wwwroot/kms/lib/ui/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)
    {
        $msg = '';
        if(!empty($type))
        {
            switch($type)
            {
                case 'error':
                    if(count($input) > 1)
                    {
                        $msg .= '<span class="alert error">';
                        $msg .= '<span class="close">&times;</span>';
                        $msg .= '<span class="title">Er zijn een aantal<br />fouten opgetreden:</span><ul>';
                        foreach($input as $error)
                        {
                            $msg .= '<li>' . $error . '</li>';
                        }
                        $msg .= '</ul>';
                        $msg .= '</span>';
                    }
                    else if(count($input) == 1)
                    {
                        $msg .= '<span class="alert error">';
                        $msg .= '<span class="close">&times;</span>';
                        $msg .= '<span class="title">Er is een<br />fout opgetreden:</span><ul>';
                        $msg .= '<li>' . $input[key($input)] . '</li>';
                        $msg .= '</ul>';
                        $msg .= '</span>';
                    }
                    break;
                case 'success':
                    if( ! empty($input))
                    {
                        $msg .= '<div class="alert success"><span class="close">&times;</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;
    }
}