init() публичный Метод

public init ( )
Пример #1
1
 public function init()
 {
     parent::init();
     $this->headerOptions['width'] = '120px';
     
     $this->template = '{update} {delete}';
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset($this->header)) {
         $this->header = Yii::t('app', 'Disabled status');
     }
 }
Пример #3
0
 public function init()
 {
     if (!Yii::$app->getRequest()->getIsAjax()) {
         DropdownAsset::register($this->grid->getView());
     }
     parent::init();
 }
Пример #4
0
 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 . ';'];
 }
 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();
 }
Пример #6
0
 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')]);
     }
 }
Пример #7
0
 /**
  * @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']);
     };
 }
Пример #8
0
 public function init()
 {
     parent::init();
     $methods = get_class_methods($this);
     preg_match_all('/button(\\w+)/', join(" ", $methods), $m);
     foreach ($m[1] as $button) {
         $this->buttons[lcfirst($button)] = function ($url, $model, $key) use($button) {
             $result = call_user_func_array([$this, "button" . $button], [$url, $model, $key]);
             if ($result instanceof ButtonColumn) {
                 return $result->asLink();
             } else {
                 return $result;
             }
         };
     }
 }
Пример #9
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!is_array($this->permissions)) {
         throw new InvalidConfigException('$permissions has to be an array of allowed permissions for each button.');
     }
     if (!empty($this->permissions)) {
         foreach ($this->permissions as $key => $allowedPermissions) {
             if (!$this->checkIfUserHas($allowedPermissions)) {
                 $this->buttons[$key] = function ($url, $model, $key) {
                     return;
                 };
             }
         }
     }
     parent::init();
     $this->initDefaultButtons();
 }
 /**
  * @inheritdoc
  *
  * @throws \yii\base\InvalidConfigException on invalid right config
  */
 public function init()
 {
     parent::init();
     //copy template value to internal var
     if ($this->template instanceof \Closure) {
         $this->templateInternal = $this->template;
     }
     //iterate over rights
     foreach ($this->buttonRights as $name => $value) {
         if (!isset($this->buttons[$name])) {
             continue;
         }
         if (!$this->checkRight($name, $value)) {
             unset($this->buttons[$name]);
         }
     }
 }
Пример #11
0
    public function init(){

        $visibleColumn=$this->statusColumn;

        $this->buttons = [
            'update' => function($url,$model){
                return $this->updateButton($url,$model);
            },
            'view' => function($url,$model){
                return $this->viewButton($url,$model);
            },
            'delete' => function($url,$model) use ($visibleColumn){
                return ($model->hasAttribute($visibleColumn) && $model->$visibleColumn) ? $this->deleteButton($url,$model) : '';
            }
        ];
        parent::init();
    }
Пример #12
0
 public function init()
 {
     parent::init();
     if (!isset($this->buttonOptions['class'])) {
         $this->buttonOptions['class'] = ['btn', 'btn-default', 'btn-action'];
     }
     if (!isset($this->header)) {
         $url = $this->createUrl('create', null, null, null);
         $this->header = $this->createButton($url, 'Создать', ['btn-create']);
     }
     /**
      * @param Kurs $model
      * @return bool
      */
     $this->visibleButtons['iup'] = function ($model) {
         return $model->tip === TipKursa::PP || $model->tip === TipKursa::PO;
     };
 }
Пример #13
0
 public function init()
 {
     $this->_isDropdown = ($this->grid->bootstrap && $this->dropdown);
     if (!isset($this->header)) {
         $this->header = Yii::t('kvgrid', 'Actions');
     }
     $this->parseFormat();
     $this->parseVisibility();
     parent::init();
     $this->initDefaultButtons();
     $this->setPageRows();
 }
Пример #14
0
 /**
  * Initializes the action column and triggers rendering of default buttons.
  * See [[initDefaultButtons]] for details.
  */
 public function init()
 {
     parent::init();
     $this->initDefaultButtons();
 }
Пример #15
0
 public function init()
 {
     /** @noinspection PhpUndefinedFieldInspection */
     $this->_isDropdown = $this->grid->bootstrap && $this->dropdown;
     if (!isset($this->header)) {
         $this->header = Yii::t('kvgrid', 'Actions');
     }
     $this->parseFormat();
     $this->parseVisibility();
     parent::init();
     $this->initDefaultButtons();
     $this->setPageRows();
 }
Пример #16
0
 public function init()
 {
     parent::init();
     //$this->headerOptions['width'] = '120px';
     $this->contentOptions = ['class' => 'da-icon-column'];
 }
Пример #17
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $view = $this->grid->getView();
     ActionColumnAsset::register($view);
 }
Пример #18
0
 public function init()
 {
     parent::init();
     $this->headerOptions['width'] = '120px';
 }
Пример #19
0
 /**
  * @inherit
  */
 public function init()
 {
     parent::init();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->template = '<div class="btn-group" role="group">' . $this->template . '</div>';
     parent::init();
 }