ActionColumn is a column for the GridView widget that displays buttons for viewing and manipulating the items.
Since: 1.0
Author: Kartik Visweswaran (kartikv2@gmail.com)
Inheritance: extends yii\grid\ActionColumn, use trait ColumnTrait
コード例 #1
0
 public function init()
 {
     $this->registerTranslations();
     Icon::map($this->grid->getView(), Icon::FA);
     parent::init();
     // TODO: Change the autogenerated stub
 }
コード例 #2
0
 function init()
 {
     parent::init();
     if (!$this->template) {
         $this->template = "<span class='btn btn-group btn-group-sm'>{view} {update} {delete}</span>";
     } else {
         $this->template = "<span class='btn btn-group btn-group-sm'>" . $this->template . "</span>";
     }
     //Html::addCssStyle($this->headerOptions, "min-width:160px;");  TODO: Impedir que a ActionColumn quebre.
     $this->initDefaultButtons();
 }
コード例 #3
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
            value: enabled ? false : true,
            key: button.closest('tr').attr('data-key')
        },
        success: function(data){
            button.toggleClass('btn-success')
                .toggleClass('btn-danger')
                .find('i')
                .toggleClass('fa-eye')
                .toggleClass('fa-eye-slash');
        } 
    });
});
JS;
$this->registerJs($js);
echo Html::tag('div', Html::tag('div', Html::tag('div', Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), ['add'], ['class' => 'btn btn-app']), ['class' => 'row col-xs-12']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel-heading']) . Html::tag('div', GridView::widget(['dataProvider' => $ads, 'bordered' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'resizableColumns' => false, 'columns' => ['name', 'position', ['attribute' => 'createDate', 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->createDate);
}], ['attribute' => 'enableDate', 'value' => function ($model) {
    if (empty($model->enableDate)) {
        return;
    }
    return \Yii::$app->formatter->asDatetime($model->enableDate);
}], ['attribute' => 'disableDate', 'value' => function ($model) {
    if (empty($model->enableDate)) {
        return;
    }
    return \Yii::$app->formatter->asDatetime($model->disableDate);
}], ['class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{view} {enabled}', ['class' => 'btn-group btn-group-sm']), 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'width' => '90px', 'buttons' => ['view' => function ($key, $model) {
    return Html::a(FontAwesome::i('pencil'), ['edit/' . $model->id], ['class' => 'btn btn-sm btn-default']);
}, 'enabled' => function ($key, $model) {
    return Html::button(FontAwesome::i($model->state ? 'eye' : 'eye-slash'), ['class' => 'btn toggleEnabled btn-sm btn-' . ($model->state ? 'success' : 'danger')]);
}]]]]), ['class' => 'panel-body']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel panel-default']);
コード例 #4
0
ファイル: ActionColumn.php プロジェクト: EuresTools/eVote-web
 public function init()
 {
     parent::init();
     //$this->header = '';
     //$this->contentOptions = ArrayHelper::merge(['class'=>'buttonColumn', ], $this->contentOptions);
 }
コード例 #5
0
ファイル: ActionColumn.php プロジェクト: nagser/base
 public function init()
 {
     parent::init();
     //Стандартное сообщение при удалении элемента
     $this->deleteOptions['data-message'] = ArrayHelper::getValue($this->deleteOptions, 'data-message', Yii::t('yii', 'Are you sure you want to delete this item?'));
 }
コード例 #6
0
ファイル: posts.php プロジェクト: BoBRoID/plochadka
        dataType : "json",
        data: {
            'post': post
        },
        success: function (data, textStatus) {

        }
    });
};
SCRIPT;
$this->registerJs($js, 1);
?>
<h1>Посты</h1>
<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'rowOptions' => function ($model) {
    if ($model->deleted == 1) {
        return ['class' => 'danger'];
    }
    if ($model->show == 0) {
        return ['class' => 'warning'];
    }
    return [];
}, 'columns' => [['attribute' => 'id'], ['attribute' => 'title'], ['attribute' => 'category'], ['attribute' => 'premium', 'value' => function ($model) {
    return $model->premium != '0000-00-00 00:00:00' ? $model->premium : 'нет';
}], ['attribute' => 'author'], ['attribute' => 'views'], ['class' => \kartik\grid\ActionColumn::className(), 'width' => '100px;', 'buttons' => ['view' => function ($url, $model) {
    return Html::a(FA::icon('file-text-o'), \yii\helpers\Url::toRoute(['viewpost/' . $model->id]), ['class' => 'btn btn-default']);
}, 'update' => function ($url, $model) {
    return Html::a(FA::icon($model->show == 1 ? 'eye' : 'eye-slash'), '#', ['onclick' => 'moderatePost(' . $model->id . '); return false;', 'class' => 'btn btn-default']);
}, 'delete' => function ($url, $model) {
    return Html::a(FA::icon($model->show == 1 ? 'eye' : 'eye-slash'), '#', ['class' => 'btn btn-default']);
}], 'template' => '<div class="btn-group btn-group-sm">{view}{update}{delete}</div>']]]);
コード例 #7
0
ファイル: ActionColumn.php プロジェクト: pipekung/yii2-grid
 /**
  * Renders the filter cell.
  */
 public function renderFilterCell()
 {
     if ($this->grid->filterPosition === GridView::FILTER_POS_BODY && $this->mergeHeader) {
         return null;
     }
     return parent::renderFilterCell();
 }
コード例 #8
0
ファイル: index.php プロジェクト: fabristyle/yii2-user-1
echo AlertBlock::widget(['delay' => 5000, 'useSessionFlash' => TRUE]);
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => \kartik\grid\SerialColumn::className()], ['header' => '', 'value' => function ($model) {
    $avatar = Profile::findOne(['uid' => $model->id]);
    return '<div class="text-center">' . Html::img(Yii::$app->homeUrl . '/../../' . $avatar['avatar'], ['width' => 30, 'alt' => 'Profile Image']) . '</div>';
}, 'format' => 'raw'], 'username', 'email', ['attribute' => 'super_admin', 'value' => function ($model) {
    if ($model->super_admin == 1) {
        return '<div class="text-center text-success"><i class="glyphicon glyphicon-ok"></i></div>';
    } else {
        return '<div class="text-center text-danger"><i class="glyphicon glyphicon-remove"></i></div>';
    }
}, 'format' => 'raw'], ['header' => 'Status', 'value' => function ($model) {
    return $model->isStatus;
}, 'format' => 'raw'], ['class' => \kartik\grid\ActionColumn::className(), 'template' => '{confirm} {block} {update} {delete}', 'buttons' => ['confirm' => function ($url, $model) {
    if ($model->isConfirmed) {
        return Html::a('<i class="glyphicon glyphicon-ok"></i>', NULL);
    } else {
        return Html::a('<i class="glyphicon glyphicon-ok"></i>', $url, ['data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?'), 'title' => Yii::t('user', 'Confirm User')]);
    }
}, 'block' => function ($url, $model) {
    if ($model->isBlocked) {
        $title = Yii::t('user', 'Unblock User');
    } else {
        $title = Yii::t('user', 'Block User');
    }
    return Html::a('<i class="glyphicon glyphicon-lock"></i>', $url, ['data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?'), 'title' => $title]);
}, 'update' => function ($url, $model) {
    return Html::a('<i class="glyphicon glyphicon-pencil"></i>', $url, ['title' => Yii::t('user', 'Update User')]);
}, 'delete' => function ($url, $model) {
コード例 #9
0
ファイル: index.php プロジェクト: vfokov/tims2
 * @var app\modules\frontend\models\search\PoliceCase $model
 */
use yii\helpers\Html;
use yii\helpers\Url;
use kartik\grid\GridView;
use yii\widgets\Pjax;
?>

<div id="wrapper-record-print">

    <?php 
Pjax::begin(['id' => 'pjax-record-print', 'timeout' => false, 'enablePushState' => false, 'formSelector' => '#form-record-search-filter']);
?>

    <div class="row">
        <div class="col-lg-12">
            <button type="submit" class="btn btn-primary pull-right print-selected" disabled="disabled"><?php 
echo Yii::t('app', 'Print');
?>
</button>
        </div>
    </div>

    <?php 
echo GridView::widget(['id' => 'grid-record-print', 'dataProvider' => $dataProvider, 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn'], ['class' => 'yii\\grid\\SerialColumn'], 'infraction_date:datetime', 'id', 'license', 'status_id', 'elapsedTime', ['class' => \kartik\grid\ActionColumn::className(), 'template' => '{review}', 'buttons' => ['review' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', Url::to(['records/review', 'id' => $model->id]), ['title' => Yii::t('app', 'Review'), 'data-pjax' => '0']);
}]]]]);
Pjax::end();
?>

</div>
コード例 #10
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
<?php

use kartik\grid\GridView;
use rmrevin\yii\fontawesome\FA;
use yii\helpers\Html;
$this->title = 'Менеджер меню';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FA::i('plus') . Html::tag('small', 'Добавить'), ['add'], ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $menus, 'summary' => false, 'bordered' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'columns' => [['attribute' => 'name'], 'alias', ['class' => \kartik\grid\ActionColumn::className(), 'width' => '110px', 'buttons' => ['view' => function ($key, $model) {
    return Html::a(FA::i('eye'), '/menu/view/' . $model->id, ['class' => 'btn btn-default']);
}, 'edit' => function ($key, $model) {
    return Html::a(FA::i('pencil'), '/menu/edit/' . $model->id, ['class' => 'btn btn-default']);
}], 'template' => Html::tag('div', '{edit}{view}', ['class' => 'btn-group'])]], 'resizableColumns' => false]);
?>
    </div>
</div>
コード例 #11
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
echo Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), Url::toRoute(['/news/new']), ['class' => 'btn btn-app']), Html::button(FontAwesome::i('eye') . Html::tag('small', 'Опубликовать'), ['class' => 'btn publishChecked btn-app']), Html::button(FontAwesome::i('eye-slash') . Html::tag('small', 'Скрыть'), ['class' => 'btn unpublishChecked btn-app']), Html::button(FontAwesome::i('trash') . Html::tag('small', 'Удалить'), ['class' => 'btn deleteChecked btn-app']), Html::button(FontAwesome::i('trash-o') . Html::tag('small', 'Восстановить'), ['class' => 'btn restoreChecked btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $newsDataProvider, 'bordered' => false, 'export' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'resizableColumns' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'id' => 'newsGrid', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'tableOptions' => ['class' => 'gridWithLongText'], 'columns' => [['class' => \yii\grid\CheckboxColumn::className(), 'options' => ['style' => 'width: 30px'], 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'title', 'format' => 'html', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::a($model->title, ['/news/show/' . $model->id], ['class' => 'longText']);
}], ['attribute' => 'categoryID', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '180px', 'value' => function ($model) {
    if (empty($model)) {
        return '';
    }
    return $model->category->title;
}], ['attribute' => 'publishDate', 'label' => 'Опубликовано', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '120px', 'value' => function ($model) {
    return \Yii::$app->formatter->asDate($model->publishDate);
}], ['attribute' => 'hits', 'width' => '90px', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    $views = $model->hits;
    if ($todayViews = $model->todayViews) {
        $views .= Html::tag('span', " (+{$todayViews->views})", ['class' => 'text-success', 'data-toggle' => 'tooltip', 'title' => 'Просмотры за сегодня']);
    }
    return $views;
}], ['class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{edit}{published}{deleted}', ['class' => 'btn-group btn-group-sm']), 'width' => '120px', 'buttons' => ['edit' => function ($key, $model) {
    return Html::a(\rmrevin\yii\fontawesome\FA::i('pencil'), ['/news/show/' . $model->id, 'act' => 'edit'], ['class' => 'btn btn-default']);
}, 'published' => function ($key, $model) {
    return Html::button(\rmrevin\yii\fontawesome\FA::i('eye' . ($model->published ? '' : '-slash')), ['class' => 'btn togglePublished btn-' . ($model->published ? 'success' : 'danger')]);
}, 'deleted' => function ($key, $model) {
    return Html::button(\rmrevin\yii\fontawesome\FA::i('trash' . ($model->deleted ? '' : '-o')), ['class' => 'btn toggleDeleted btn-' . ($model->deleted ? 'danger' : 'success')]);
}]]]]);
?>
    </div>
    <div class="clearfix"></div>
</div>
コード例 #12
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
$customerModal = new \bobroid\remodal\Remodal(['addRandomToID' => false, 'id' => 'addUser', 'confirmButton' => false, 'cancelButton' => false]);
echo $customerModal->renderModal($this->render('_new_user', ['model' => new \backend\models\SiteuserForm()]));
?>

<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FA::i('plus') . Html::tag('small', 'Добавить'), '#addUser', ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $siteusersDataProvider, 'summary' => false, 'bordered' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'columns' => [['vAlign' => GridView::ALIGN_MIDDLE, 'class' => SerialColumn::className()], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '200px', 'attribute' => 'username'], ['vAlign' => GridView::ALIGN_MIDDLE, 'attribute' => 'email'], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '100px', 'attribute' => 'status', 'value' => function ($model) {
    if ($model->status == $model::STATUS_ACTIVE) {
        return 'Активен';
    }
    return 'Не активен';
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '160px', 'attribute' => 'created_at', 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->created_at);
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '150px', 'attribute' => 'last_visit', 'value' => function ($model) {
    return \Yii::$app->formatter->asRelativeTime($model->last_visit);
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '100px', 'class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{edit}{status}', ['class' => 'btn-group']), 'buttons' => ['edit' => function () {
    return Html::button(FA::i('pencil'), ['class' => 'btn btn-default editUser', 'title' => 'Редактировать']);
}, 'status' => function ($key, $model) {
    $active = $model->status == $model::STATUS_ACTIVE;
    return Html::button(FA::i($active ? 'unlock' : 'lock'), ['class' => 'btn changeStatus btn-' . ($active ? 'success' : 'danger')]);
}]]]]);
?>

    </div>
</div>
コード例 #13
0
ファイル: ActionColumn.php プロジェクト: ailingsen/betterdebt
 public function init()
 {
     parent::init();
     $this->template = '<div class="btn-group" role="group" aria-label="...">' . $this->template . '</div>';
 }
コード例 #14
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
    $.ajax({
        url: '/rss/toggle',
        method: 'post',
        data: {
            attribute: 'published',
            value: enabled ? false : true,
            key: button.closest('tr').attr('data-key')
        },
        success: function(data){
            button.toggleClass('btn-success')
                .toggleClass('btn-danger')
                .find('i')
                .toggleClass('fa-eye')
                .toggleClass('fa-eye-slash');
        } 
    });
});
JS;
$this->registerJs($js);
$this->title = 'Менеджер RSS';
echo Html::tag('div', Html::tag('div', Html::tag('div', Html::a(FA::i('plus') . Html::tag('small', 'Добавить'), ['/rss/add'], ['class' => 'btn btn-app']), ['class' => 'row col-xs-12']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel-heading']) . Html::tag('div', GridView::widget(['dataProvider' => $feeds, 'summary' => false, 'bordered' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'resizableColumns' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'tableOptions' => ['class' => 'gridWithLongText'], 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'columns' => [['attribute' => 'name', 'format' => 'raw', 'width' => '180px', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'description', 'format' => 'raw', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::tag('span', $model->description, ['class' => 'longText']);
}], ['attribute' => 'created', 'width' => '110px', 'contentOptions' => ['style' => 'white-space: normal'], 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->created);
}], ['class' => \kartik\grid\ActionColumn::className(), 'width' => '120px', 'buttons' => ['published' => function ($key, $model) {
    return Html::button(FA::i($model->published ? 'eye' : 'eye-slash'), ['class' => 'btn togglePublished btn-' . ($model->published ? 'success' : 'danger')]);
}, 'view' => function ($key, $model) {
    return Html::a(FA::i('globe'), \Yii::$app->params['frontend'] . '/rss/' . $model->fullLink, ['class' => 'btn btn-default', 'title' => 'Просмотреть на сайте']);
}, 'edit' => function () {
    return Html::button(FA::i('pencil'), ['class' => 'btn btn-default editRssFeed', 'title' => 'Редактировать']);
}], 'template' => Html::tag('div', '{edit}{view}{published}', ['class' => 'btn-group btn-group-sm'])]]]), ['class' => 'panel-body']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel panel-default']) . $this->render('edit', ['model' => new \backend\modules\rss\models\NewsFeedForm()]);
コード例 #15
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
                            <button type="button" class="btn btn-default btn-sm checkUnpublish"><i class="fa fa-eye-slash"></i></button>
                        </div>
                        <button type="button" class="btn btn-default btn-sm checkSeed"><i class="fa fa-check"></i></button>', 'footer' => '<div class="btn-group">
                            <button type="button" class="btn btn-default btn-sm checkDeleted"><i class="fa fa-trash-o"></i></button>
                            <button type="button" class="btn btn-default btn-sm checkPublish"><i class="fa fa-eye"></i></button>
                            <button type="button" class="btn btn-default btn-sm checkUnpublish"><i class="fa fa-eye-slash"></i></button>
                        </div>
                        <button type="button" class="btn btn-default btn-sm checkSeed"><i class="fa fa-check"></i></button>'], 'panelTemplate' => '<div class="panel {type}">{panelHeading}{items}{panelFooter}<div class="text-center">{pager}</div></div>', 'panelFooterTemplate' => '{footer}<div class="clearfix"></div>', 'dataProvider' => $comments, 'bordered' => false, 'summary' => false, 'hover' => true, 'id' => 'commentsGrid', 'pjax' => true, 'pjaxSettings' => ['linkSelector' => '#commentsGrid .pagination a'], 'striped' => false, 'layout' => '{items}', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'resizableColumns' => false, 'columns' => [['class' => \kartik\grid\CheckboxColumn::className()], ['format' => 'raw', 'attribute' => 'author', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::tag('span', $model->author, ['title' => "IP: {$model->ip} email: {$model->email}", 'data-toggle' => 'tooltip']);
}], ['label' => 'Статья', 'format' => 'raw', 'value' => function ($model) {
    if (empty($model->news)) {
        return 'отсутствует';
    }
    return Html::a($model->news->title, '/news/show/' . $model->news->id, ['class' => 'longLink newsTitle']);
}], ['attribute' => 'text', 'format' => 'html', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::tag('span', $model->text, ['class' => 'longLink commentText']);
}], ['attribute' => 'date', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return \Yii::$app->formatter->asRelativeTime($model->date);
}], ['header' => ' ', 'width' => '100px', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'class' => \kartik\grid\ActionColumn::className(), 'buttons' => ['view' => function ($key, $model) {
    return Html::button(FA::i($model->published == 1 ? 'eye' : 'eye-slash'), ['class' => 'publishComment btn btn-sm btn-default']);
}, 'update' => function ($model) {
    return Html::button(FA::i('pencil'), ['class' => 'editComment btn btn-sm btn-default']);
}], 'template' => Html::tag('div', '{view}{update}', ['class' => 'btn-group btn-group-sm'])]]]);
?>
            </div>
        </div>
    </div>
</div>
<?php 
\yii\widgets\Pjax::end();
echo $this->render('editModal', ['model' => new \backend\modules\comments\models\CommentForm()]);
コード例 #16
0
ファイル: index.php プロジェクト: cinghie/yii2-user-extended
use yii\helpers\Url;
$this->title = Yii::t('userextended', 'Manage roles');
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
if (Yii::$app->getModule('userextended')->showTitles) {
    ?>
    <h1><?php 
    echo Yii::t('userextended', 'Manage roles');
    ?>
</h1>
<?php 
}
?>

<?php 
$this->beginContent('@dektrium/rbac/views/layout.php');
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'layout' => "{items}\n{pager}", 'columns' => [['attribute' => 'name', 'format' => 'html', 'hAlign' => 'center', 'header' => Yii::t('rbac', 'Name'), 'value' => function ($model) {
    $url = Url::to(['/rbac/role/update', 'name' => $model['name']]);
    return Html::a($model['name'], $url);
}], ['attribute' => 'description', 'hAlign' => 'center', 'header' => Yii::t('rbac', 'Description')], ['attribute' => 'rule_name', 'hAlign' => 'center', 'header' => Yii::t('rbac', 'Rule name')], ['class' => ActionColumn::className(), 'template' => '{update} {delete}', 'urlCreator' => function ($action, $model) {
    return Url::to(['/rbac/role/' . $action, 'name' => $model['name']]);
}]], 'responsive' => true, 'hover' => true, 'panel' => ['before' => '<span style="margin-right: 5px;">' . Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('userextended', 'New'), ['create'], ['class' => 'btn btn-new btn-success']) . '</span>', 'heading' => '<h3 class="panel-title"><i class="fa fa-users"></i></h3>', 'type' => 'success', 'showFooter' => false]]);
?>

<?php 
$this->endContent();
コード例 #17
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
                .toggleClass('fa-eye-slash');
        } 
    });
});
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), ['/quiz/default/add'], ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body" style="padding: 0">
        <?php 
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'bordered' => false, 'resizableColumns' => false, 'export' => false, 'summary' => false, 'tableOptions' => ['class' => 'gridWithLongText'], 'columns' => [['attribute' => 'name', 'format' => 'raw', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::a($model->name, '/quiz/view/' . $model->id, ['class' => 'longText', 'title' => $model->name]);
}], ['width' => '60px', 'label' => 'Голосов', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'hAlign' => \kartik\grid\GridView::ALIGN_CENTER, 'value' => function ($model) {
    return count($model->votes);
}], ['attribute' => 'dateStart', 'contentOptions' => ['style' => 'white-space: normal'], 'width' => '120px', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'hAlign' => \kartik\grid\GridView::ALIGN_CENTER, 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->dateStart);
}], ['attribute' => 'dateEnd', 'contentOptions' => ['style' => 'white-space: normal'], 'width' => '120px', 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'hAlign' => \kartik\grid\GridView::ALIGN_CENTER, 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->dateEnd);
}], ['class' => \kartik\grid\ActionColumn::className(), 'vAlign' => \kartik\grid\GridView::ALIGN_MIDDLE, 'buttons' => ['edit' => function ($key, $model) {
    return Html::a(FontAwesome::i('pencil'), ['edit/' . $model->id], ['class' => 'btn btn-sm btn-default']);
}, 'published' => function ($key, $model) {
    return Html::button(FontAwesome::i($model->published ? 'eye' : 'eye-slash'), ['class' => 'btn togglePublished btn-sm btn-' . ($model->published ? 'success' : 'danger')]);
}], 'width' => '90px', 'template' => Html::tag('div', '{edit} {published}', ['class' => 'btn-group btn-group-sm'])]]]);
?>
    </div>
</div>
コード例 #18
-1
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     $this->buttons['custom'] = function ($url, $model) {
         $event = new CustomActionEvent(['module' => \Yii::$app->controller->getUniqueId(), 'model' => $model]);
         Event::trigger($this, self::EVENT_CUSTOM_ACTION, $event);
         return implode(' ', $event->buttons);
     };
 }