2017 © Pedro Peláez
 

yii2-extension yii2-notification

Notifiaction in yii2

image

lesha724/yii2-notification

Notifiaction in yii2

  • Friday, January 5, 2018
  • by lesha724
  • Repository
  • 1 Watchers
  • 0 Stars
  • 156 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

Notifiaction in yii2

Notifiaction in yii2: bootstrap alerts, sweet alerts, noty, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist lesha724/yii2-notification "*"

or add, (*4)

"lesha724/yii2-notification": "*"

to the require section of your composer.json file., (*5)

Bootstrap Alerts

Once the extension is installed, simply use it in your code by :, (*6)

1) Set the message in your action, for example:, (*7)

<?php  
    Yii::$app->session->setFlash('bootstrap-success', 'This is the message');
?>

2) Simply add widget to your page as follows:, (*8)

<?= \lesha724\Notification\widgets\BootstrapAlert::widget([
        'alertTypes' => [
            'bootstrap-error' => [
                'class' => 'alert-danger',
                'icon' => '<i class="icon glyphicon glyphicon-ban-circle"></i>',
            ],
            'bootstrap-danger' => [
                'class' => 'alert-danger',
                'icon' => '<i class="icon glyphicon glyphicon-ban-circle"></i>',
            ],
            'bootstrap-success' => [
                'class' => 'alert-success',
                'icon' => '<i class="icon glyphicon glyphicon-ok"></i>',
            ],
            'bootstrap-info' => [
                'class' => 'alert-info',
                'icon' => '<i class="icon glyphicon glyphicon-exclamation-sign"></i>',
            ],
            'bootstrap-warning' => [
                'class' => 'alert-warning',
                'icon' => '<i class="icon glyphicon glyphicon-warning-sign"></i>',
            ],
        ],
        'closeButton'=>[],
]); ?>

SweetAlerts

Widget for flash messages, (*9)

1) Set the message in your action, for example:, (*10)

<?php  
    Yii::$app->session->setFlash('sweeat-alert-success', 'This is the message');
?>

2) Simply add widget to your page as follows:, (*11)

<?= \lesha724\Notification\widgets\SweetAlert::widget([
        'alertTypes' => [
            'sweet-alert-error' => [
                //you can use all options from http://t4t5.github.io/sweetalert/
                'type' => 'error',
                'title' => 'Error!',
                /* function use example:
                 * function(isConfirm){
                     if (isConfirm) {
                       swal("Deleted!", "Your imaginary file has been deleted.", "success");
                     } else {
                       swal("Cancelled", "Your imaginary file is safe :)", "error");
                     }
                   }
                 */

                'function' => null
            ],
            'sweet-alert-success' => [
                'type' => 'success',
                'title' => 'Success!',
                'function' => null
            ],
            'sweet-alert-info' => [
                'type' => 'info',
                'title' => 'Info!',
                'function' => null
            ],
            'sweet-alert-warning' => [
                'type' => 'warning',
                'title' => 'Warning!',
                'function' => null
            ],
        ],
]); ?>

Simple widget, (*12)

[
                    //you can use all options from http://t4t5.github.io/sweetalert/
                                    
                    'title'=> "Are you sure?",
                    'text'=> "You will not be able to recover this imaginary file!",
                    'type'=> "warning",
                    'showCancelButton'=> true,
                    'confirmButtonColor'=> "#DD6B55",
                    'confirmButtonText'=> "Yes, delete it!",
                    'cancelButtonText'=> "No, cancel plx!",
                    'closeOnConfirm'=> false,
                    'closeOnCancel'=> false,
                    'function'=>$function
                ]
        ]) ?>

The Versions

05/01 2018

dev-master

9999999-dev

Notifiaction in yii2

  Sources   Download

MIT

The Requires

 

by Avatar lesha724

extension yii2 notification widget sweet alert noty flash message

05/01 2018

v0.0.4

0.0.4.0

Notifiaction in yii2

  Sources   Download

MIT

The Requires

 

by Avatar lesha724

extension yii2 notification widget sweet alert noty flash message

26/02 2017

v0.0.3.2

0.0.3.2

Notifiaction in yii2

  Sources   Download

MIT

The Requires

 

by Avatar lesha724

extension yii2 notification widget sweet alert noty flash message

26/02 2017

v0.0.3

0.0.3.0

Notifiaction in yii2

  Sources   Download

MIT

The Requires

 

by Avatar lesha724

extension yii2 notification widget sweet alert noty flash message

26/02 2017

v0.0.3.1

0.0.3.1

Notifiaction in yii2

  Sources   Download

MIT

The Requires

 

by Avatar lesha724

extension yii2 notification widget sweet alert noty flash message

25/02 2017

v0.0.2

0.0.2.0

Notifiaction in yii2

  Sources   Download

MIT

The Requires

 

by Avatar lesha724

extension yii2 notification widget sweet alert noty flash message