%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace adminlte\widgets;
use \yii\bootstrap\Alert as BootstrapAlert;
use \yii\bootstrap\Widget;
/**
* Alert widget renders a message from session flash for AdminLTE alerts. All flash messages are displayed
* in the sequence they were assigned using setFlash. You can set message as following:
*
* ```php
* \Yii::$app->getSession()->setFlash('error', '<b>Alert!</b> Danger alert preview. This alert is dismissable.');
* ```
*
* Multiple messages could be set as follows:
*
* ```php
* \Yii::$app->getSession()->setFlash('error', ['Error 1', 'Error 2']);
* ```
*
* @author Evgeniy Tkachenko <et.coder@gmail.com>
*/
class Alert extends Widget
{
/**
* @var array the alert types configuration for the flash messages.
* This array is setup as $key => $value, where:
* - $key is the name of the session flash variable
* - $value is the array:
* - class of alert type (i.e. danger, success, info, warning)
* - icon for alert AdminLTE
*/
public $alertTypes = [
'error' => [
'class' => 'alert-danger',
'icon' => '<i class="icon fa fa-ban"></i>',
],
'danger' => [
'class' => 'alert-danger',
'icon' => '<i class="icon fa fa-ban"></i>',
],
'success' => [
'class' => 'alert-success',
'icon' => '<i class="icon fa fa-check"></i>',
],
'info' => [
'class' => 'alert-info',
'icon' => '<i class="icon fa fa-info"></i>',
],
'warning' => [
'class' => 'alert-warning',
'icon' => '<i class="icon fa fa-warning"></i>',
],
];
/**
* @var array the options for rendering the close button tag.
*/
public $closeButton = [];
/**
* Initializes the widget.
* This method will register the bootstrap asset bundle. If you override this method,
* make sure you call the parent implementation first.
*/
public function init()
{
parent::init();
$session = \Yii::$app->getSession();
$flashes = $session->getAllFlashes();
$appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : '';
foreach ($flashes as $type => $data) {
if (isset($this->alertTypes[$type])) {
$data = (array) $data;
foreach ($data as $message) {
$this->options['class'] = $this->alertTypes[$type]['class'] . $appendCss;
$this->options['id'] = $this->getId() . '-' . $type;
echo BootstrapAlert::widget([
'body' => $this->alertTypes[$type]['icon'] . $message,
'closeButton' => $this->closeButton,
'options' => $this->options,
]);
}
$session->removeFlash($type);
}
}
}
}