本文整理汇总了PHP中yii\grid\ActionColumn::className方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionColumn::className方法的具体用法?PHP ActionColumn::className怎么用?PHP ActionColumn::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\grid\ActionColumn
的用法示例。
在下文中一共展示了ActionColumn::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actions
/**
* @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;
}
示例2: actions
/**
* @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;
}
示例3: actions
/**
* 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']]);
}]]];
}
示例4: actions
/**
* @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;
}
示例5: actions
/**
* @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;
}
示例6: RaptorImageSearch
use yii\widgets\ActiveForm;
use yii\widgets\Pjax;
use yii\grid\GridView;
use yii\grid\ActionColumn;
use kartik\file\FileInput;
use app\models\search\RaptorImageSearch;
/* @var $this yii\web\View */
/* @var $image app\models\File */
/* @var $form yii\widgets\ActiveForm */
$searchModel = new RaptorImageSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams, $model->id);
?>
<?php
Pjax::begin(['timeout' => Yii::$app->constants->pjaxTimeout]);
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'columns' => [['class' => ActionColumn::className(), 'template' => '{delete}{download}', 'buttons' => ['download' => function ($url) {
return Html::a('<span style="padding-left: 10px;" class="glyphicon glyphicon-download-alt"></span>', $url, ['title' => 'Download Photo', 'data-pjax' => 0]);
}], 'urlCreator' => function ($action, $model) {
if ($action === 'delete') {
return ['raptor-image/delete', 'id' => $model->id];
}
if ($action === 'download') {
return ['raptor-image/download', 'id' => $model->id];
}
}, 'headerOptions' => ['style' => 'width: 100px;'], 'contentOptions' => ['style' => 'text-align: center; vertical-align: middle;']], ['label' => 'Raptor Image', 'format' => ['image', ['height' => '100']], 'value' => function ($model) {
return isset($model->file) ? '@web/images/' . $model->file->avatar : '';
}]]]);
Pjax::end();
?>
示例7: function
</td>
</tr>
</table>
<?php
ActiveForm::end();
?>
<?php
echo DataTables::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'clientOptions' => ["bStateSave" => true, "paging" => false, "info" => false, "sDom" => '<"top"i>rt<"bottom"lp><"clear">'], 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'header' => 'ID', 'contentOptions' => ['style' => 'text-align: center; vertical-align: middle']], ['attribute' => 'name', 'label' => 'Название', 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'preview', 'label' => 'Превью', 'format' => ['raw'], 'value' => function ($data) {
return Html::img(Yii::getAlias('@web') . $data->preview, ['class' => 'data-id-img', 'width' => '60', 'height' => '75']);
}], ['attribute' => 'author_id', 'label' => 'Автор', 'value' => 'fullName', 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'date', 'label' => 'Дата выхода книги', 'format' => ['date', 'php:d F Y'], 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'date_crate', 'label' => 'Дата добавления', 'format' => ['date', 'php:d F Y'], 'contentOptions' => ['style' => 'vertical-align: middle']], ['class' => ActionColumn::className(), 'header' => 'Кнопки действия', 'template' => '{update} {view} {delete}', 'contentOptions' => ['style' => 'vertical-align: middle'], 'buttons' => ['update' => function ($url, $model, $key) {
return Html::a('<span> [ред] </span>', $url, ['title' => 'Редактировать', 'data-method' => 'post', 'data-pjax' => '0', 'target' => '_blank']);
}, 'delete' => function ($url, $model, $key) {
return Html::a('<span >[удл]</span>', $url, ['title' => Yii::t('yii', 'Удалить'), 'data-confirm' => 'Вы уверены, что хотите удалить?', 'data-method' => 'post', 'data-pjax' => 'o']);
}, 'view' => function ($url, $model, $key) {
return Html::a('<span>[просм]</span>', Yii::getAlias('@web') . $url, ['title' => Yii::t('yii', 'Просмотреть'), 'data-toggle' => 'modal', 'data-target' => '#activity-modal', 'data-pjax' => '0', 'value' => Yii::getAlias('@web') . $url, 'target' => 'modal', 'class' => 'my-modal-link']);
}]]]]);
?>
<?php
Modal::begin(['id' => 'activity-modal', 'header' => '<h4 class="modal-title">Просмотр</h4>', 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Закрыть</a>']);
?>
<div id="modal-content">
示例8: function
echo $filesSize;
?>
</span>
<span>/</span>
<span class="limit">
<?php
echo Yii::$app->params['userWorkSpace'];
?>
</span>
<div class="panel-footer">Mbytes used</div>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
<!-- Upload form end -->
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'path:ntext', 'size:ntext', ['class' => ActionColumn::className(), 'buttons' => ['share' => function ($url, $model) {
$customurl = Yii::$app->getUrlManager()->createUrl(['files/share', 'id' => $model['id']]);
return Html::a('<span class="glyphicon glyphicon-share"></span>', $customurl, ['title' => Yii::t('yii', 'Share')]);
}, 'download' => function ($url, $model) {
$customurl = Yii::$app->getUrlManager()->createUrl(['files/download_his_file', 'id_file' => $model['id']]);
return Html::a('<span class="glyphicon glyphicon-download"></span>', $customurl, ['title' => Yii::t('yii', 'Download')]);
}], 'template' => '{share} {download} {delete}']]]);
?>
</div>
示例9: implode
$boxButtons = $actions = [];
$showActions = false;
if (Yii::$app->user->can('BCreateRoles')) {
$boxButtons[] = '{create}';
}
if (Yii::$app->user->can('BUpdateRoles')) {
$actions[] = '{update}';
$showActions = $showActions || true;
}
if (Yii::$app->user->can('BDeleteRoles')) {
$boxButtons[] = '{batch-delete}';
$actions[] = '{delete}';
$showActions = $showActions || true;
}
if ($showActions === true) {
$gridConfig['columns'][] = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)];
}
$boxButtons = !empty($boxButtons) ? implode(' ', $boxButtons) : null;
?>
<div class="row">
<div class="col-xs-12">
<?php
Box::begin(['title' => $this->params['subtitle'], 'bodyOptions' => ['class' => 'table-responsive'], 'batchParam' => 'names', 'buttonsTemplate' => $boxButtons, 'grid' => $gridId]);
?>
<?php
echo GridView::widget($gridConfig);
?>
<?php
Box::end();
?>
示例10:
/* @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>
示例11:
<?php
echo $form->field($model, '[' . $k . ']metaKeywords')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, '[' . $k . ']metaDescription')->textarea(['rows' => 5]);
?>
<?php
echo $form->field($model, '[' . $k . ']content')->widget(\app\modules\core\components\Redactor::className());
?>
<?php
echo $form->field($model, '[' . $k . ']fullContent')->widget(\app\modules\core\components\Redactor::className());
?>
<?php
if (!$model->isNewRecord) {
?>
<h2>Детали</h2>
<?php
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getDetails()->position(), 'pagination' => false]), 'columns' => ['title', 'content', ['class' => \yii\grid\ActionColumn::className(), 'controller' => 'details', 'header' => \yii\helpers\Html::a('<i class="glyphicon glyphicon-plus"></i> Добавить', ['details/create', 'productId' => $model->id, 'lang' => $model->lang]), 'template' => '{update}{delete}']]]);
?>
<?php
}
?>
</div>
</div>
示例12: function
<?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>
示例13: implode
$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();
示例14: function
</ul>
<br>
<?php
Pjax::begin();
echo PageSizer::widget();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterSelector' => 'select#per-page', 'tableOptions' => ['class' => 'table table-striped table-hover'], 'columns' => [['attribute' => 'username', 'label' => Yii::t('podium/view', 'Username') . Helper::sortOrder('username'), 'encodeLabel' => false, 'format' => 'raw', 'value' => function ($model) {
return Html::a($model->podiumName, ['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug], ['data-pjax' => '0']);
}], ['attribute' => 'role', 'label' => Yii::t('podium/view', 'Role') . Helper::sortOrder('role'), 'encodeLabel' => false, 'format' => 'raw', 'filter' => User::getRoles(), 'value' => function ($model) {
return Helper::roleLabel($model->role);
}], ['attribute' => 'created_at', 'label' => Yii::t('podium/view', 'Joined') . Helper::sortOrder('created_at'), 'encodeLabel' => false, 'value' => function ($model) {
return Yii::$app->formatter->asDatetime($model->created_at);
}], ['attribute' => 'threads_count', 'label' => Yii::t('podium/view', 'Threads'), 'encodeLabel' => false, 'value' => function ($model) {
return $model->threadsCount;
}], ['attribute' => 'posts_count', 'label' => Yii::t('podium/view', 'Posts'), 'encodeLabel' => false, 'value' => function ($model) {
return $model->postsCount;
}], ['class' => ActionColumn::className(), 'header' => Yii::t('podium/view', 'Actions'), 'contentOptions' => ['class' => 'text-right'], 'headerOptions' => ['class' => 'text-right'], 'template' => '{view}' . (!Yii::$app->user->isGuest ? ' {pm}' : ''), 'buttons' => ['view' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug], ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'View Member')]);
}, 'pm' => function ($url, $model) {
if ($model->id !== User::loggedId()) {
return Html::a('<span class="glyphicon glyphicon-envelope"></span>', ['messages/new', 'user' => $model->id], ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Send Message')]);
} else {
return Html::a('<span class="glyphicon glyphicon-envelope"></span>', '#', ['class' => 'btn btn-xs disabled text-muted']);
}
}]]]]);
Pjax::end();
?>
<div class="panel panel-default">
<div class="panel-body small">
<ul class="list-inline pull-right">
<li><a href="<?php
echo Url::to(['default/index']);
示例15: function
?>
<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>