protected function initDefaultButtons()
    {
        $controller = $this->getCompatibilityId();
        if(\Yii::$app->user->checkAccess('read::' . $controller)) {
            if (!isset($this->buttons['view'])) {
                $this->buttons['view'] = function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [
                        'title' => Yii::t('yii', 'View'),
                        'class' => 'btn btn-xs btn-primary hidden-xs button-status-deactivate',
                        'data-pjax' => '0',
                    ]);
                };
            }
        }
        if(\Yii::$app->user->checkAccess('update::' . $controller)) {
            if (!isset($this->buttons['status'])) {
                $this->buttons['status'] = function ($url, $model) {
                    if($model->status == 'active') 
                        return Html::a('<span class="glyphicon glyphicon-remove"></span>', $url,  [
                            'title' => Yii::t('yii', 'Deactivate'),
                            'onclick' => 'javascript: if(confirm("Are you sure you want to deactivate this item?")) myGrid.status($(this)); return false;',
                            'class' => 'btn btn-xs btn-warning hidden-xs button-status-deactivate',
                            'data-pjax' => '0',
                        ]);
                    else 
                        return Html::a('<span class="glyphicon glyphicon-ok"></span>', $url,  [
                            'title' => Yii::t('yii', 'Activate'),
                            'onclick' => 'javascript: if(confirm("Are you sure you want to activate this item?")) myGrid.status($(this)); return false;',
                            'class' => 'btn btn-xs btn-success hidden-xs button-status-activate',
                            'data-pjax' => '0',
                        ]);
                };
            }        
            if (!isset($this->buttons['update'])) {
                $this->buttons['update'] = function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
                        'title' => Yii::t('yii', 'Update'),
                        'class' => 'btn btn-xs btn-default',
                        'data-pjax' => '0',
                    ]);
                };
            }
        }
        if(\Yii::$app->user->checkAccess('delete::' . $controller)) {
            if (!isset($this->buttons['delete'])) {
                $this->buttons['delete'] = function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
                        'title' => Yii::t('yii', 'Delete'),
                        'onclick' => 'javascript: if(confirm("Are you sure you want to delete this item?")) myGrid.status($(this)); return false;',
                        'class' => 'btn btn-xs btn-danger button-delete',
                        'data-pjax' => '0',
                    ]);
                };
            }
        }
    }
protected function initDefaultButtons()
    {
        $controller = $this->getCompatibilityId();
        if(\Yii::$app->user->checkAccess('read::' . $controller)) {
            if (!isset($this->buttons['view'])) {
                $this->buttons['view'] = function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [
                        'title' => Yii::t('yii', 'View'),
                        'class' => 'btn btn-xs btn-primary hidden-xs button-status-deactivate',
                        'data-pjax' => '0',
                    ]);
                };
            }
        }
        if(\Yii::$app->user->checkAccess('update::' . $controller)) {
            if (!isset($this->buttons['status'])) {
                $this->buttons['status'] = function ($url, $model) {
                    if($model->status == 'active') 
                        return Html::a('<span class="glyphicon glyphicon-remove"></span>', $url,  [
                            'title' => Yii::t('yii', 'Deactivate'),
                            'onclick' => 'javascript: if(confirm("Are you sure you want to deactivate this item?")) myGrid.status($(this)); return false;',
                            'class' => 'btn btn-xs btn-warning hidden-xs button-status-deactivate',
                            'data-pjax' => '0',
                        ]);
                    else 
                        return Html::a('<span class="glyphicon glyphicon-ok"></span>', $url,  [
                            'title' => Yii::t('yii', 'Activate'),
                            'onclick' => 'javascript: if(confirm("Are you sure you want to activate this item?")) myGrid.status($(this)); return false;',
                            'class' => 'btn btn-xs btn-success hidden-xs button-status-activate',
                            'data-pjax' => '0',
                        ]);
                };
            }        
            if (!isset($this->buttons['update'])) {
                $this->buttons['update'] = function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
                        'title' => Yii::t('yii', 'Update'),
                        'class' => 'btn btn-xs btn-default',
                        'data-pjax' => '0',
                    ]);
                };
            }
        }
        if(\Yii::$app->user->checkAccess('delete::' . $controller)) {
            if (!isset($this->buttons['delete'])) {
                $this->buttons['delete'] = function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
                        'title' => Yii::t('yii', 'Delete'),
                        'onclick' => 'javascript: if(confirm("Are you sure you want to delete this item?")) myGrid.status($(this)); return false;',
                        'class' => 'btn btn-xs btn-danger button-delete',
                        'data-pjax' => '0',
                    ]);
                };
            }
        }
    }
protected function initDefaultButtons ( ) { $ controller = $ this -> getCompatibilityId ( ) ; if ( \ Yii :: $ app -> user -> checkAccess ( 'read::' . $ controller ) ) { if ( ! isset ( $ this -> buttons [ 'view' ] ) ) { $ this -> buttons [ 'view' ] = function ( $ url , $ model ) { return Html :: a ( '<span class="glyphicon glyphicon-eye-open"></span>' , $ url , [ 'title' => Yii :: t ( 'yii' , 'View' ) , 'class' => 'btn btn-xs btn-primary hidden-xs button-status-deactivate' , 'data-pjax' => '0' , ] ) ; } ; } } if ( \ Yii :: $ app -> user -> checkAccess ( 'update::' . $ controller ) ) { if ( ! isset ( $ this -> buttons [ 'status' ] ) ) { $ this -> buttons [ 'status' ] = function ( $ url , $ model ) { if ( $ model -> status == 'active' ) return Html :: a ( '<span class="glyphicon glyphicon-remove"></span>' , $ url , [ 'title' => Yii :: t ( 'yii' , 'Deactivate' ) , 'onclick' => 'javascript: if(confirm("Are you sure you want to deactivate this item?")) myGrid.status($(this)); return false;' , 'class' => 'btn btn-xs btn-warning hidden-xs button-status-deactivate' , 'data-pjax' => '0' , ] ) ; else return Html :: a ( '<span class="glyphicon glyphicon-ok"></span>' , $ url , [ 'title' => Yii :: t ( 'yii' , 'Activate' ) , 'onclick' => 'javascript: if(confirm("Are you sure you want to activate this item?")) myGrid.status($(this)); return false;' , 'class' => 'btn btn-xs btn-success hidden-xs button-status-activate' , 'data-pjax' => '0' , ] ) ; } ; } if ( ! isset ( $ this -> buttons [ 'update' ] ) ) { $ this -> buttons [ 'update' ] = function ( $ url , $ model ) { return Html :: a ( '<span class="glyphicon glyphicon-pencil"></span>' , $ url , [ 'title' => Yii :: t ( 'yii' , 'Update' ) , 'class' => 'btn btn-xs btn-default' , 'data-pjax' => '0' , ] ) ; } ; } } if ( \ Yii :: $ app -> user -> checkAccess ( 'delete::' . $ controller ) ) { if ( ! isset ( $ this -> buttons [ 'delete' ] ) ) { $ this -> buttons [ 'delete' ] = function ( $ url , $ model ) { return Html :: a ( '<span class="glyphicon glyphicon-trash"></span>' , $ url , [ 'title' => Yii :: t ( 'yii' , 'Delete' ) , 'onclick' => 'javascript: if(confirm("Are you sure you want to delete this item?")) myGrid.status($(this)); return false;' , 'class' => 'btn btn-xs btn-danger button-delete' , 'data-pjax' => '0' , ] ) ; } ; } } }
Initializes the default button rendering callbacks
Initializes the default button rendering callbacks