1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 02:10:37 +02:00

Create Alert.php

This commit is contained in:
Sergey Romanenko
2013-01-08 03:13:10 -08:00
parent 60af4afaa3
commit ef76f8befc

88
engine/Alert.php Normal file
View File

@@ -0,0 +1,88 @@
<?php
/**
* Gelato Library
*
* This source file is part of the Gelato Library. More information,
* documentation and tutorials can be found at http://gelato.monstra.org
*
* @package Gelato
*
* @author Romanenko Sergey / Awilum
* @copyright (c) 2013 Romanenko Sergey / Awilum
* @since 1.0.0
*/
class Alert
{
/**
* Protected constructor since this is a static class.
*
* @access protected
*/
protected function __construct()
{
// Nothing here
}
/**
* Show success message
*
* <code>
* Alert::success('Message here...');
* </code>
*
* @param string $message Message
* @param integer $time Time
*/
public static function success($message, $time = 3000)
{
// Redefine vars
$message = (string) $message;
$time = (int) $time;
echo '<div class="alert alert-info">'.$message.'</div>
<script type="text/javascript">setTimeout(\'$(".alert").slideUp("slow")\', '.$time.'); </script>';
}
/**
* Show warning message
*
* <code>
* Alert::warning('Message here...');
* </code>
*
* @param string $message Message
* @param integer $time Time
*/
public static function warning($message, $time = 3000)
{
// Redefine vars
$message = (string) $message;
$time = (int) $time;
echo '<div class="alert alert-warning">'.$message.'</div>
<script type="text/javascript">setTimeout(\'$(".alert").slideUp("slow")\', '.$time.'); </script>';
}
/**
* Show error message
*
* <code>
* Alert::error('Message here...');
* </code>
*
* @param string $message Message
* @param integer $time Time
*/
public static function error($message, $time = 3000)
{
// Redefine vars
$message = (string) $message;
$time = (int) $time;
echo '<div class="alert alert-error">'.$message.'</div>
<script type="text/javascript">setTimeout(\'$(".alert").slideUp("slow")\', '.$time.'); </script>';
}
}