| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | 
							- <?php
 
- /**
 
-  * @link http://www.yiiframework.com/
 
-  * @copyright Copyright (c) 2008 Yii Software LLC
 
-  * @license http://www.yiiframework.com/license/
 
-  */
 
- namespace common\helpers;
 
- use Yii;
 
- use yii\grid\ActionColumn;
 
- use yii\helpers\Html;
 
- use yii\helpers\Url;
 
- /**
 
-  * ActionColumn is a column for the [[GridView]] widget that displays buttons for viewing and manipulating the items.
 
-  *
 
-  * To add an ActionColumn to the gridview, add it to the [[GridView::columns|columns]] configuration as follows:
 
-  *
 
-  * ```php
 
-  * 'columns' => [
 
-  *     // ...
 
-  *     [
 
-  *         'class' => ActionColumn::className(),
 
-  *         // you may configure additional properties here
 
-  *     ],
 
-  * ]
 
-  * ```
 
-  *
 
-  * For more details and usage information on ActionColumn, see the [guide article on data widgets](guide:output-data-widgets).
 
-  *
 
-  * @author Qiang Xue <qiang.xue@gmail.com>
 
-  * @since 2.0
 
-  */
 
- class DiyActionColumn extends ActionColumn
 
- {
 
-     public $header = '操作';
 
-     public $headerOptions =  ['class' => 'action-column','style'=>'min-width:135px'];
 
-     /**
 
-      * Initializes the default button rendering callback for single button
 
-      * @param string $name Button name as it's written in template
 
-      * @param string $iconName The part of Bootstrap glyphicon class that makes it unique
 
-      * @param array $additionalOptions Array of additional options
 
-      * @since 2.0.11
 
-      */
 
-     protected function initDefaultButton($name, $iconName, $additionalOptions = [])
 
-     {
 
-         if (!isset($this->buttons[$name]) && strpos($this->template, '{' . $name . '}') !== false) {
 
-             $this->buttons[$name] = function ($url, $model, $key) use ($name, $iconName, $additionalOptions) {
 
-                 switch ($name) {
 
-                     case 'view':
 
-                         $title = Yii::t('yii', 'View');
 
-                         break;
 
-                     case 'update':
 
-                         $title = Yii::t('yii', 'Update');
 
-                         break;
 
-                     case 'delete':
 
-                         $title = Yii::t('yii', 'Delete');
 
-                         break;
 
-                     default:
 
-                         $title = ucfirst($name);
 
-                 }
 
-                 $options = array_merge([
 
-                     'title' => $title,
 
-                     'aria-label' => $title,
 
-                     'data-pjax' => '0',
 
-                     'class' => 'btn btn-success btn-xs',
 
-                     'data-toggle' => 'tooltip',
 
-                 ], $additionalOptions, $this->buttonOptions);
 
-                 return Html::a($title, $url, $options);
 
-             };
 
-         }
 
-     }
 
- }
 
 
  |