作者:anl
项目:yii2-rba
/**
* @return string $template
* @return mixed
*/
public function actions($template = '{update} {delete}')
{
$this->columns = array_merge($this->columns, [['class' => ActionColumn::className(), 'controller' => SELF::CONTROLLER, 'template' => $template, 'buttons' => ['update' => function ($url, $model, $key) {
return Html::a('<i class="fa fa-pencil"></i>', false, ['value' => Url::to([SELF::CONTROLLER . '/update', 'id' => $model->id]), 'title' => 'Update', 'class' => 'showModalButton']);
}], 'contentOptions' => ['class' => 'text-right']]]);
return $this;
}
作者:anl
项目:yii2-auth
/**
* @param string $template
* @param mixed $params
* @return mixed
*/
public function actions($template = '{update} {delete}', $params = '')
{
$this->columns = array_merge($this->columns, [['class' => ActionColumn::className(), 'controller' => SELF::CONTROLLER, 'template' => $template, 'buttons' => ['update-role-to-user' => function ($url, $model, $key) use($params) {
return Html::a('<i class="fa fa-check"></i>', [SELF::CONTROLLER . '/update-role', 'userId' => $model['user_id'], 'tenantId' => $params, 'role' => 'user'], ['title' => 'Update to User', 'data-toggle' => 'tooltip']);
}, 'update-role-to-admin' => function ($url, $model, $key) use($params) {
return Html::a('<i class="fa fa-check-circle"></i>', [SELF::CONTROLLER . '/update-role', 'userId' => $model['user_id'], 'tenantId' => $params, 'role' => 'admin'], ['title' => 'Update to Admin', 'data-toggle' => 'tooltip']);
}, 'remove-tenant' => function ($url, $model, $key) {
return Html::a('<i class="fa fa-times"></i>', [SELF::CONTROLLER . '/remove-tenant', 'userId' => $model['user_id']], ['title' => 'Remove', 'data-toggle' => 'tooltip']);
}], 'contentOptions' => ['class' => 'text-right']]]);
return $this;
}
作者:anl
项目:yii2-helpe
/**
* @return string $template
* @return mixed
*/
public function actions($template = '{update} {delete}')
{
$this->columns = array_merge($this->columns, [['class' => ActionColumn::className(), 'controller' => $this->controller, 'template' => $template, 'buttons' => ['ajax-update' => function ($url, $model) {
return Html::a(Html::tag('i', '', ['class' => 'glyphicon glyphicon-pencil']), false, ['value' => Url::to(["{$this->controller}/ajax-update", 'id' => $model->id, 'pjaxId' => 'list-pjax']), 'data-toggle' => 'tooltip', 'title' => 'Update', 'class' => 'showModalButton', 'name' => "update-{$this->controller}-button"]);
}, 'ajax-delete' => function ($url, $model) {
AjaxDeleteAsset::register(Yii::$app->controller->view);
return Html::a('<span class="glyphicon glyphicon-trash"></span>', false, ['class' => 'ajaxDelete', 'delete-url' => Url::to(["{$this->controller}/ajax-delete", 'id' => $model->id]), 'pjax-container' => 'list-pjax', 'name' => "delete-{$this->controller}-button"]);
}, 'ajax-copy' => function ($url, $model) {
return Html::a(Html::tag('i', '', ['class' => 'glyphicon glyphicon-copy']), false, ['value' => Url::to(["{$this->controller}/ajax-copy", 'id' => $model->id, 'pjaxId' => 'list-pjax']), 'data-toggle' => 'tooltip', 'title' => 'Copy', 'class' => 'showModalButton', 'name' => "copy-{$this->controller}-button"]);
}], 'contentOptions' => ['class' => 'text-right']]]);
return $this;
}
作者:dawei10
项目:yii2-admin-modul
/**
* List of grid actions
* @return array
*/
public function actions()
{
$entity = \Yii::$app->getRequest()->getQueryParam('entity', null);
$primaryKey = $this->entity->primaryKey();
return [['class' => ActionColumn::className(), 'buttons' => ['view' => function ($url, $model, $key) use($entity, $primaryKey) {
return Html::a(Yii::t('admin', 'View'), ['manage/view', 'entity' => $entity, 'id' => $model->{$primaryKey}], ['class' => 'btn btn-primary']);
}, 'update' => function ($url, $model, $key) use($entity, $primaryKey) {
return Html::a(Yii::t('admin', 'Edit'), ['manage/update', 'entity' => $entity, 'id' => $model->{$primaryKey}], ['class' => 'btn btn-warning']);
}, 'delete' => function ($url, $model, $key) use($entity, $primaryKey) {
return Html::a(Yii::t('admin', 'Delete'), ['manage/delete', 'entity' => $entity, 'id' => $model->{$primaryKey}], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('admin', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
}]]];
}
作者:anl
项目:yii2-rba
/**
* @return string $template
* @return mixed
*/
public function actions($template = '{update} {delete}')
{
$this->columns = array_merge($this->columns, [['class' => ActionColumn::className(), 'controller' => SELF::CONTROLLER, 'template' => $template, 'buttons' => ['update-user-role' => function ($url, $model, $key) {
if ($model->getUserRole()->exists()) {
return Html::a('<i class="fa fa-pencil"></i>', false, ['value' => Url::to([SELF::CONTROLLER . '/update', 'id' => $model->userRole->id]), 'title' => 'Update', 'class' => 'showModalButton']);
}
return Html::a('<i class="fa fa-plus"></i>', false, ['value' => Url::to([SELF::CONTROLLER . '/create', 'user_id' => $model->id]), 'title' => 'Create', 'class' => 'showModalButton']);
}, 'delete-user-role' => function ($url, $model, $key) {
if ($model->getUserRole()->exists()) {
return Html::a('<i class="fa fa-trash"></i>', Url::to(['user-role/delete', 'id' => $model->userRole->id]), ['data-confirm' => 'Are you sure you want to delete this item?', 'data-method' => 'post', 'data-pjax' => '0']);
}
return '';
}], 'contentOptions' => ['class' => 'text-right']]]);
return $this;
}
作者:eiben
项目:raptorap
/* @var $this yii\web\View */
/* @var $searchModel app\models\search\RaptorSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Raptors';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="raptor-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<p>
<?php
echo Html::a('Create Raptor', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
Pjax::begin(['timeout' => Yii::$app->constants->pjaxTimeout]);
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'columns' => [['class' => ActionColumn::className(), 'template' => '{update}{view}', 'headerOptions' => ['style' => 'width: 100px;'], 'buttonOptions' => ['style' => 'padding: 5px;'], 'contentOptions' => ['style' => 'text-align: center;']], 'species_short', 'species_long']]);
?>
<?php
Pjax::end();
?>
</div>
作者:sieulo
项目:yii2-car
<!-- Table row -->
<div class="row">
<div class="col-xs-12 table-responsive">
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'layout' => "{items}\n{pager}", 'columns' => [['attribute' => 'no', 'label' => '#', 'value' => function ($model) {
static $no;
return ++$no;
}, 'headerOptions' => ['width' => '4%', 'style' => 'text-align: center'], 'contentOptions' => ['style' => 'text-align: center; vertical-align: middle;']], ['attribute' => 'name', 'format' => 'raw', 'label' => ' ' . Yii::t('cart', 'Description'), 'contentOptions' => ['style' => 'vertical-align: middle'], 'value' => function ($model) {
return $model->icon . ' ' . $model->name . ' ' . Html::tag('span', $model->description, ['class' => 'text-muted']);
}], ['attribute' => 'quantity', 'value' => function ($model, $key, $index, $column) {
return QuantityCell::widget(['model' => $model]);
//, 'type' => 'number'
}, 'format' => 'raw'], ['attribute' => 'price', 'contentOptions' => ['style' => 'vertical-align: middle;white-space: nowrap;'], 'value' => function ($model) use($cart) {
return $cart->formatCurrency($model->cost);
}], 'actions' => ['class' => ActionColumn::className(), 'template' => '{remove}', 'headerOptions' => ['width' => '4%'], 'contentOptions' => ['style' => 'text-align: center; vertical-align: middle;'], 'buttons' => ['remove' => function ($url, $model, $key) {
return Html::a('<i class="fa fa-times text-danger"></i>', ['remove', 'id' => $model->id]);
}]]]]);
?>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<!-- accepted payments column -->
<div class="col-xs-6">
<p class="lead">Payment Methods:</p>
<img src="https://almsaeedstudio.com/themes/AdminLTE/dist/img/credit/visa.png" alt="Visa">
<img src="https://almsaeedstudio.com/themes/AdminLTE/dist/img/credit/mastercard.png" alt="Mastercard">
<img src="https://almsaeedstudio.com/themes/AdminLTE/dist/img/credit/american-express.png"
作者:TF0
项目:yii2-advanced-de
echo Alert::widget();
?>
<div class="accounts-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<p>
<?php
echo Html::a('Новый счет', ['new'], ['class' => 'btn btn-success']);
?>
<?php
echo Html::a('Новый перевод', Yii::$app->urlManager->createUrl(['transaction/transfer']), ['class' => 'btn btn-info']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'showOnEmpty' => false, 'layout' => "{items}\n{pager}", 'filterModel' => $searchModel, 'columns' => ['name', 'amount', ['attribute' => 'currencyId', 'headerOptions' => ['width' => '100'], 'filter' => false, 'content' => function ($data) {
/** @var $data \frontend\models\Accounts */
if ($data->currency) {
return $data->currency->title;
}
return false;
}], ['class' => ActionColumn::className(), 'template' => '{update}']]]);
?>
</div>
作者:cubicla
项目:store-cub
$this->title = Yii::t('storecube', 'PAGE_PRODUCTS');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
$gridId = 'products-grid';
$panelButtons = $actions = [];
if (Yii::$app->user->can('ACPProductsCreate')) {
$panelButtons[] = '{create}';
}
if (Yii::$app->user->can('ACPProductsUpdate')) {
$actions[] = '{update}';
}
if (Yii::$app->user->can('ACPProductsDelete')) {
$panelButtons[] = '{mass-delete}';
$actions[] = '{delete}';
}
if (Yii::$app->user->can('ACPProductsView')) {
$actions[] = '{view}';
}
$gridActionsColumn = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)];
$panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null;
?>
<?php
Panel::begin(['title' => $this->title, 'buttonsTemplate' => $panelButtons, 'grid' => $gridId]);
?>
<?php
echo GridView::widget(['id' => $gridId, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'article', 'name', 'short_desc:ntext', $gridActionsColumn], 'pager' => ['firstPageLabel' => 'First', 'lastPageLabel' => 'Last']]);
Panel::end();
作者:HeavyDot
项目:heavyCM
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\ActionColumn;
use dmstr\widgets\Alert;
$this->title = Yii::t('app', 'Blog Categories');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
echo $this->render('_content-header');
?>
<?php
echo Alert::widget();
?>
<p class="pull-left">
<?php
echo Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('app', 'Add New Blog Category'), 'create', ['class' => 'btn btn-primary']);
?>
</p>
<div class="clearfix"></div>
<?php
echo GridView::widget(['dataProvider' => $blogCategoryProvider, 'filterModel' => $blogCategorySearch, 'id' => 'content-grid', 'tableOptions' => ['class' => 'table table-striped table-bordered box box-primary'], 'columns' => [['attribute' => 'name', 'format' => 'raw', 'value' => function ($blogCategory) {
return Html::a($blogCategory->name, ['update', 'id' => $blogCategory->id]);
}], 'created_at:datetime', 'updated_at:datetime', ['class' => ActionColumn::className(), 'template' => '{update}']]]);
作者:wsdsl
项目:yii2-rba
<?php
/**
* @var yii\web\View $this
* @var \yii\data\ActiveDataProvider $dataProvider
* @var \ws\rbac\Module $module
*/
use yii\grid\ActionColumn;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
$this->title = Yii::$app->request->isPjax ? null : Yii::t('app', 'Assign');
$this->params['breadcrumbs'][] = $this->title;
$module = Yii::$app->controller->module;
?>
<div class="user-index">
<?php
Pjax::begin(['options' => ['id' => 'pjax']]);
?>
<?php
echo GridView::widget(['layout' => "{items}\n{summary}\n{pager}", 'dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', $module->usernameField, ['class' => ActionColumn::className(), 'template' => '{assign}', 'buttons' => ['assign' => function ($url, $model, $key) {
$options = ['title' => Yii::t('yii', 'Assign'), 'aria-label' => Yii::t('yii', 'Assign'), 'data-pjax' => '0'];
return Html::a('<span class="glyphicon glyphicon-user"></span>', ['assign', 'uid' => $model->id], $options);
}]]]]);
?>
<?php
Pjax::end();
?>
</div>
作者:zhaoyan15856
项目:galax
/*
* This file is part of the Dektrium project.
*
* (c) Dektrium project <http://github.com/dektrium>
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
/**
* @var $dataProvider array
* @var $filterModel dektrium\rbac\models\Search
* @var $this yii\web\View
*/
use yii\grid\ActionColumn;
use kartik\grid\GridView;
use yii\helpers\Url;
$this->title = Yii::t('rbac', 'Roles');
$this->params['breadcrumbs'][] = $this->title;
$this->params['title'] = $this->title;
$this->params['menu']['auth'] = true;
$this->params['sub-menu']['list-role'] = true;
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'layout' => "{items}\n{pager}", 'columns' => [['attribute' => 'name', 'header' => Yii::t('rbac', 'Name'), 'options' => ['style' => 'width: 20%']], ['attribute' => 'description', 'header' => Yii::t('rbac', 'Description'), 'options' => ['style' => 'width: 55%']], ['attribute' => 'rule_name', 'header' => Yii::t('rbac', 'Rule name'), 'options' => ['style' => 'width: 20%']], ['class' => ActionColumn::className(), 'template' => '{update} {delete}', 'urlCreator' => function ($action, $model) {
return Url::to(['/auth/auth/' . $action, 'name' => $model['name']]);
}, 'options' => ['style' => 'width: 5%']]], 'export' => false, 'responsive' => true, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-globe"></i> ' . Yii::t('rbac', 'Roles') . '</h3>', 'type' => 'success', 'before' => false, 'footer' => false, 'after' => false]]);
?>
作者:shubnikoff
项目:telepor
?>
<div class="row">
<div class="col-md-8">
<?php
echo $form->field($model, 'searchKey')->textInput(['placeholder' => 'Введите текст заявки'])->label(false);
?>
</div>
<div class="col-md-4" style="vertical-align: bottom">
<?php
echo Html::submitButton('<span class="glyphicon glyphicon-search"></span> Найти', ['class' => 'btn btn-primary']);
?>
</div>
</div>
<?php
ActiveForm::end();
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'topic', 'content' => function ($model) {
return Html::a($model->topic, ['vks-request/view', 'id' => (string) $model->primaryKey]);
}, 'contentOptions' => ['style' => 'width: 62%']], ['attribute' => 'status', 'value' => function ($model) {
return Request::statusName($model->status);
}, 'contentOptions' => ['style' => 'width: 13%']], ['attribute' => 'date', 'content' => function ($model) {
return Yii::$app->formatter->asDate($model->date->sec) . " c {$model->beginTimeString} по {$model->endTimeString}";
}, 'contentOptions' => ['style' => 'width: 20%']], ['class' => \yii\grid\ActionColumn::className(), 'controller' => 'vks-request', 'template' => '{delete}', 'visible' => Yii::$app->user->can(SystemPermission::DELETE_REQUEST)]]]);
?>
</div>
作者:huasxi
项目:lulucms
public function init()
{
parent::init();
$this->headerOptions['width'] = '120px';
$this->template = '{update} {delete}';
}
作者:caron
项目:yii2-component
public function createUrl($action, $model, $key, $index)
{
if (method_exists($model, 'getUrl') && ($url = $model->getUrl($action)) && !$this->urlCreator) {
return $url;
} else {
return parent::createUrl($action, $model, $key, $index);
}
}
作者:hucongyan
项目:lulucms
public function init()
{
parent::init();
if (!isset($this->headerOptions['width'])) {
$this->headerOptions['width'] = $this->width;
}
$this->contentOptions = ['class' => 'da-icon-column', 'style' => 'width:' . $this->width . ';'];
}
作者:hysdo
项目:YobaCM
/**
* Initializes the default button rendering callbacks.
*/
protected function initDefaultButtons()
{
parent::initDefaultButtons();
if (!isset($this->buttons['active'])) {
$this->buttons['active'] = function ($url, $model) {
return Html::a('<span onclick="admin_api.request({id:' . $model['id'] . ', model:\'' . lcfirst((new \ReflectionClass($model))->getShortName()) . '\', method:\'post\', attributes:{active:' . ($model['active'] ? '0' : '1') . '}})" class="glyphicon ' . ($model['active'] ? 'glyphicon-ok' : 'glyphicon-ban-circle') . ' " style="color: ' . ($model['active'] ? 'yellow' : 'gray') . ' "></span>', '', ['title' => $model['active'] ? 'Отключить' : 'Включить']);
};
}
}
作者:prawe
项目:yii2-gri
public function init()
{
parent::init();
if (is_array($this->params)) {
$this->params = '&' . http_build_query($this->params);
} else {
$this->params = '&' . http_build_query(['ref' => Yii::$app->getRequest()->get('id')]);
}
}
作者:uran198
项目:yii2-translate-pane
public function init()
{
$this->header = $this->header ?: Module::t('Actions');
$this->footer = $this->footer ?: Module::t('Actions');
$this->headerOptions = ArrayHelper::merge(['class' => 'text-align-center', 'width' => '100'], $this->headerOptions);
$this->footerOptions = ArrayHelper::merge(['class' => 'text-align-center font-weight-bold th'], $this->footerOptions);
$this->contentOptions = ArrayHelper::merge(['class' => 'text-align-center nowrap'], $this->contentOptions);
parent::init();
}
作者:amarshim
项目:Yii2-Forms-Builde
protected function initDefaultButtons()
{
parent::initDefaultButtons();
if (!isset($this->buttons['form-view'])) {
$this->buttons['form-view'] = function ($url, $model, $key) {
$options = array_merge(['title' => Yii::t('yii', 'Add'), 'aria-label' => Yii::t('yii', 'Add'), 'data-pjax' => '0'], $this->buttonOptions);
return Html::a('<span class="glyphicon glyphicon-wrench"></span>', $url, $options);
};
}
}