当前位置: 首页>>代码示例>>PHP>>正文


PHP grid\ActionColumn类代码示例

本文整理汇总了PHP中yii\grid\ActionColumn的典型用法代码示例。如果您正苦于以下问题:PHP ActionColumn类的具体用法?PHP ActionColumn怎么用?PHP ActionColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ActionColumn类的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;
 }
开发者ID:anli,项目名称:yii2-rbac,代码行数:11,代码来源:UserRoleColumn.php

示例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;
 }
开发者ID:anli,项目名称:yii2-auth0,代码行数:16,代码来源:ApiUserColumn.php

示例3: 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;
 }
开发者ID:anli,项目名称:yii2-helper,代码行数:16,代码来源:Column.php

示例4: 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']]);
     }]]];
 }
开发者ID:dawei101,项目名称:yii2-admin-module,代码行数:16,代码来源:Grid.php

示例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;
 }
开发者ID:anli,项目名称:yii2-rbac,代码行数:19,代码来源:UserColumn.php

示例6: init

 public function init()
 {
     parent::init();
     $this->headerOptions['width'] = '120px';
     
     $this->template = '{update} {delete}';
 }
开发者ID:huasxin,项目名称:lulucms2,代码行数:7,代码来源:ActionColumn.php

示例7: createUrl

 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);
     }
 }
开发者ID:carono,项目名称:yii2-components,代码行数:8,代码来源:ActionColumn.php

示例8: init

 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 . ';'];
 }
开发者ID:hucongyang,项目名称:lulucms2,代码行数:8,代码来源:ActionColumn.php

示例9: initDefaultButtons

 /**
  * 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'] ? 'Отключить' : 'Включить']);
         };
     }
 }
开发者ID:hysdop,项目名称:YobaCMS,代码行数:12,代码来源:ActionColumnCustom.php

示例10: init

 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')]);
     }
 }
开发者ID:prawee,项目名称:yii2-grid,代码行数:9,代码来源:ActionChildColumn.php

示例11: init

 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();
 }
开发者ID:uran1980,项目名称:yii2-translate-panel,代码行数:9,代码来源:ActionColumn.php

示例12: initDefaultButtons

 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);
         };
     }
 }
开发者ID:amarshimi,项目名称:Yii2-Forms-Builder,代码行数:10,代码来源:DynamicFormsButtons.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->buttons['update'] = function ($url, $model) {
         return Html::a('<i class="fa fa-pencil"></i> Edit', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'class' => 'btn btn-primary btn-xs']);
     };
     $this->buttons['delete'] = function ($url, $model) {
         return Html::a('<i class="fa fa-trash-o"></i> Delete', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0', 'class' => 'btn btn-primary btn-xs']);
     };
 }
开发者ID:perminder-klair,项目名称:kato-core,代码行数:13,代码来源:ActionColumn.php

示例14: renderFilterCellContent

 /**
  * @inheritdoc
  */
 protected function renderFilterCellContent()
 {
     if ($this->gridType == 'datatable') {
         if (is_string($this->filter)) {
             return $this->filter;
         } elseif ($this->filter === true) {
             // default search and reset button for all filters
             return '<div class="margin-bottom-5"><button class="btn btn-sm blue filter-submit margin-bottom"><i class="fa fa-search"></i> Search</button></div><button class="btn btn-sm red filter-cancel"><i class="fa fa-times"></i> Reset</button>';
         }
     }
     return parent::renderFilterCellContent();
 }
开发者ID:fangface,项目名称:yii2-concord,代码行数:15,代码来源:ActionColumn.php

示例15: renderDataCellContent

 protected function renderDataCellContent($model, $key, $index)
 {
     $dropdownId = $this->grid->getId() . '-dropdown2-menu-' . $index;
     $this->template = implode(' ', array_keys(array_filter(['<li>{view}</li>' => ModelHelper::canRead($model), '<li>{update}</li>' => ModelHelper::canUpdate($model), '<li>{delete}</li>' => ModelHelper::canDelete($model)])));
     $fix = ['~(glyphicon\\-eye\\-open"\\>\\</span\\>)(\\</a\\>)~i' => '$1 ' . Yii::t('mozayka', 'View') . '$2', '~(glyphicon\\-pencil"\\>\\</span\\>)(\\</a\\>)~i' => '$1 ' . Yii::t('mozayka', 'Update') . '$2', '~(glyphicon\\-trash"\\>\\</span\\>)(\\</a\\>)~i' => '$1 ' . Yii::t('mozayka', 'Delete') . '$2', '~\\s+title\\="[^"]*"~i' => '', '~\\s+data\\-confirm\\="[^"]*"~i' => '', '~\\s+data\\-method\\="[^"]*"~i' => ''];
     $cellContent = preg_replace(array_keys($fix), array_values($fix), parent::renderDataCellContent($model, $key, $index));
     // dropdown2-menu
     if ($cellContent && $cellContent != $this->grid->emptyCell) {
         $cellContent = Html::button('<span class="glyphicon glyphicon-cog"></span>', ['title' => Yii::t('mozayka', 'Actions'), 'class' => 'btn btn-default btn-xs', 'data-dropdown2' => '#' . $dropdownId]) . Html::tag('div', Html::tag('ul', $cellContent, ['class' => 'dropdown2-menu']), ['id' => $dropdownId, 'class' => 'dropdown2 dropdown2-tip' . (array_search($this, $this->grid->columns) + 1 > count($this->grid->columns) / 2 ? ' dropdown2-anchor-right' : '')]);
     }
     return $cellContent;
 }
开发者ID:ivan-chkv,项目名称:yii2-mozayka,代码行数:12,代码来源:ActionColumn.php


注:本文中的yii\grid\ActionColumn类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。