Server IP : 185.86.78.101 / Your IP : 216.73.216.108 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/widgets/ |
Upload File : |
<?php namespace app\widgets; use Yii; /** * Alert widget renders a message from session flash. All flash messages are displayed * in the sequence they were assigned using setFlash. You can set message as following: * * ```php * Yii::$app->session->setFlash('error', 'This is the message'); * Yii::$app->session->setFlash('success', 'This is the message'); * Yii::$app->session->setFlash('info', 'This is the message'); * ``` * * Multiple messages could be set as follows: * * ```php * Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); * ``` * * @author Kartik Visweswaran <kartikv2@gmail.com> * @author Alexander Makarov <sam@rmcreative.ru> */ class Alert extends \yii\bootstrap\Widget { /** * @var array the alert types configuration for the flash messages. * This array is setup as $key => $value, where: * - key: the name of the session flash variable * - value: the bootstrap alert type (i.e. danger, success, info, warning) */ public $alertTypes = [ 'error' => 'alert-danger', 'danger' => 'alert-danger', 'success' => 'alert-success', 'info' => 'alert-info', 'warning' => 'alert-warning' ]; /** * @var array the options for rendering the close button tag. * Array will be passed to [[\yii\bootstrap\Alert::closeButton]]. */ public $closeButton = []; /** * {@inheritdoc} */ public function run() { $session = Yii::$app->session; $flashes = $session->getAllFlashes(); $appendClass = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; foreach ($flashes as $type => $flash) { if (!isset($this->alertTypes[$type])) { continue; } foreach ((array) $flash as $i => $message) { echo \yii\bootstrap\Alert::widget([ 'body' => $message, 'closeButton' => $this->closeButton, 'options' => array_merge($this->options, [ 'id' => $this->getId() . '-' . $type . '-' . $i, 'class' => $this->alertTypes[$type] . $appendClass, ]), ]); } $session->removeFlash($type); } } }