<?php
/*****************************************************************************
 * Alert.php
 * Defines the key template Alert.
 *
 * Kabuki CMS (C) 2013-2015, Aaron van Geffen
 *****************************************************************************/

class Alert extends Template
{
	private $_type;
	private $_message;
	private $_title;

	public function __construct($title = '', $message = '', $type = 'alert')
	{
		$this->_title = $title;
		$this->_message = $message;
		$this->_type = in_array($type, ['success', 'info', 'warning', 'danger']) ? $type : 'info';
	}

	public function html_main()
	{
		echo '
					<div class="alert', $this->_type !== 'alert' ? ' alert-' . $this->_type : '', '">'
						, !empty($this->_title) ? '<strong>' . $this->_title . '</strong><br>' : '', '
						', $this->_message,
						$this->additional_alert_content(), '
					</div>';
	}

	protected function additional_alert_content()
	{
	}
}