mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-02 03:10:25 +02:00
Create Alert.php
This commit is contained in:
88
engine/Alert.php
Normal file
88
engine/Alert.php
Normal 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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user