/**
     * @inheritdoc
     */
    public function init()
    {
        $script = <<<JS
jQuery(document).on('click', '.order-link', function(e) {

    e.preventDefault();
    var csrfToken = \$('meta[name="csrf-token"]').attr("content");
    var url = jQuery(this).attr('href');
    var obj = this;
    jQuery.ajax({
       method: 'post',
       url: url,
       data: {_csrf: csrfToken},
       success: function(data) {

           jQuery('#'+jQuery( obj ).closest( ".grid-view" ).attr('id')).yiiGridView("applyFilter");
       }
    });
});
JS;
        $view = $this->grid->getView();
        GridViewAsset::register($view);
        $view->registerJs($script);
        parent::init();
        // TODO: Change the autogenerated stub
    }
Example #2
0
 public function init()
 {
     parent::init();
     if (!isset($this->headerOptions['width'])) {
         $this->headerOptions['width'] = $this->width;
     }
 }
Example #3
0
 public function init()
 {
     parent::init();
     if (!$this->filter) {
         $this->filter = \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsSite::find()->all(), 'code', 'name');
     }
 }
 public function init()
 {
     parent::init();
     $this->content = function (ModelBase $model, $key, $index, DataColumn $column) {
         return Html::a($model->{$column->attribute}, ['view', 'id' => $model->primaryKey], ['title' => Yii::t('common', 'View')]);
     };
 }
Example #5
0
 public function init()
 {
     if (!Yii::$app->getRequest()->getIsAjax()) {
         DropdownAsset::register($this->grid->getView());
     }
     parent::init();
 }
Example #6
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $this->setDefaultOptions();
     $this->setCellStyleOptions();
     $this->initOptions();
     $this->grid->view->registerJs($this->sortButtonJs());
 }
Example #7
0
 public function init()
 {
     parent::init();
     $model = $this->grid->filterModel;
     if ($model) {
         $this->filter = $model->getPossibleStatuses();
     }
 }
Example #8
0
 public function init()
 {
     parent::init();
     if (!isset($this->headerOptions['width'])) {
         $this->headerOptions['width'] = $this->width;
     }
     $this->contentOptions = ['style' => 'word-wrap: break-word; word-break: break-all;'];
 }
 public function init()
 {
     $this->headerOptions = ['class' => 'text-center', 'style' => 'width: 115px'];
     $this->contentOptions = ['class' => 'text-center'];
     parent::init();
     $this->content = function (ModelBase $model, $key, $index, DataColumn $column) {
         return ControllerBase::getYesNoLabel($model->{$column->attribute});
     };
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!isset($this->ajaxOptions['type'])) {
         $this->ajaxOptions['type'] = 'POST';
     }
     $this->ajaxOptions['data'] = new \yii\web\JsExpression('data');
     $this->grid->view->registerJs("\$('.editableCell').change(function() {\n                data = {};\n                data[\$(this).attr('name')] = \$(this).val();\n                submitAttributes = \$(this).data('submit-attributes').split(',');\n                for (var i in submitAttributes) {\n                    data[submitAttributes[i]] = \$(this).data('attribute'+i);\n                }\n                data['dropDownColumnSubmit'] = true;\n                \$.ajax(" . \yii\helpers\Json::encode($this->ajaxOptions) . ");\n        });");
     return parent::init();
 }
Example #11
0
 public function init()
 {
     parent::init();
     if (empty($this->content)) {
         $this->content = function ($model) {
             /** @var \frontend\modules\torrent\models\Torrent $model */
             return Html::a($model->getCategoryTag(), '/search?iht=' . $model->category_id, ['title' => 'Browse ' . $model->getCategoryTag() . ' torrents']);
         };
     }
 }
Example #12
0
 public function init()
 {
     parent::init();
     if (empty($this->content)) {
         $this->content = function ($model) {
             /** @var \frontend\modules\torrent\models\Torrent $model */
             return Yii::$app->formatter->asShortSize($model->size);
         };
     }
 }
Example #13
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->controller) {
         throw new InvalidConfigException("controller - " . \Yii::t('app', "not specified") . ".");
     }
     if (!$this->controller instanceof AdminModelEditorController) {
         throw new InvalidConfigException(\Yii::t('app', "{controller} must be inherited from") . ": " . AdminModelEditorController::className());
     }
 }
Example #14
0
 public function init()
 {
     parent::init();
     if (empty($this->content)) {
         $this->content = function ($model) {
             /** @var \frontend\modules\torrent\models\Torrent $model */
             return Yii::$app->formatter->asRelativeTime($model->created_at);
         };
     }
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     // Set the filter options based on the info we have
     $this->filter = [$this->successValue => $this->successLabel, $this->dangerValue => $this->dangerLabel];
     $this->filterInputOptions = ['prompt' => $this->promptLabel, 'class' => 'form-control', 'id' => null];
     // Get the view
     $view = $this->grid->getView();
     ActiveCheckColumnAsset::register($view);
     return parent::init();
     // TODO: Change the autogenerated stub
 }
Example #16
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->format === null) {
         if (stripos($this->attribute, 'deleted') !== false || stripos($this->attribute, 'active') !== false) {
             $this->format = 'boolean';
         } else {
             $this->format = 'text';
         }
     }
 }
Example #17
0
 public function init()
 {
     parent::init();
     /*$this->filter = ArrayHelper::map(
           \Yii::$app->cms->findUser()->all(),
           'id',
           'displayName'
       );*/
     if ($this->grid->filterModel && $this->attribute) {
         $this->filter = \skeeks\cms\modules\admin\widgets\formInputs\SelectModelDialogUserInput::widget(['model' => $this->grid->filterModel, 'attribute' => $this->attribute]);
     }
 }
Example #18
0
 /**
  * (non-PHPdoc)
  * @see \yii\base\Object::init()
  */
 public function init()
 {
     if ($this->filter !== null && is_array($this->filter) && $this->filter) {
         unset($this->filterInputOptions['placeholder']);
     } else {
         unset($this->filterInputOptions['prompt']);
     }
     if ($this->filterInputOptionsExtra) {
         $this->filterInputOptions = array_merge($this->filterInputOptions, $this->filterInputOptionsExtra);
     }
     parent::init();
 }
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $this->_messageCategory = 'rk-rowaction';
     $this->initI18N('@rokorolov/rowaction', $this->_messageCategory);
     if ($this->deleteMessage === null) {
         $this->deleteMessage = Yii::t($this->_messageCategory, 'Are you sure you want to delete this item?');
     }
     Html::addCssClass($this->actionOptions, 'rk-row-actions');
     $this->initDefaultButtons();
     $this->registerScripts();
 }
Example #20
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     $this->setDefaultOptions();
     if ($this->toggleUrl) {
         if ($this->withPjax) {
             $this->grid->view->registerJs($this->jsWithPjax());
         } else {
             $this->grid->view->registerJs($this->jsWithoutPjax());
         }
     }
     $this->initOptions();
 }
Example #21
0
 /**
  * @inhertidoc
  */
 public function init()
 {
     parent::init();
     $this->ensureEnum($this->grid->filterModel, $this->attribute);
     if ($this->value === null) {
         $this->value = function ($model, $key, $index, $column) {
             return ArrayHelper::getValue($this->enum, ArrayHelper::getValue($model, $this->attribute));
         };
     }
     if ($this->filter === null) {
         $this->filter = $this->enum;
     }
 }
Example #22
0
 /**
  * @inheritdoc
  *
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if ($this->url === null) {
         throw new InvalidConfigException('Url can not be empty.');
     }
     parent::init();
     if (!$this->format) {
         $this->format = 'raw';
     }
     $rel = $this->attribute . '_editable' . $this->classSuffix;
     $this->options['pjax'] = '0';
     $this->options['rel'] = $rel;
     $this->registerClientScript();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     //parent initialization
     parent::init();
     //cache css-classes-array
     if (self::$CSS_CLASSES == null) {
         $arrCssClasses = [$this->textAlignLeftClass, $this->textAlignCenterClass, $this->textAlignRightClass];
         self::$CSS_CLASSES = array_filter($arrCssClasses, function ($key) use($arrCssClasses) {
             return !empty($arrCssClasses[$key]);
         });
     }
     //apply settings
     $this->applyColumnWidths();
     $this->applyTextAlignments();
 }
    public function init()
    {
        parent::init();
        if (empty($this->content)) {
            $this->content = function ($model) {
                /** @var \frontend\modules\torrent\models\Torrent $model */
                return Html::a($model->name, $model->getUrl()) . '
								<div class="table-mini-text">
																	' . Html::a('<i class="icon-12 arrow"></i>', $model->getDownloadLink(), ['title' => 'TORRENT LINK', 'class' => 'border-none v-sub']) . Html::a('<i class="icon-12 magnite"></i>', $model->getMagnetLink(), ['title' => 'MAGNET LINK', 'class' => 'border-none v-sub']) . '
									<span class="txt-min m-left-10">

									</span>
								</div>';
            };
        }
    }
 public function init()
 {
     // Get the view
     $view = $this->grid->getView();
     // Register the asset bundle
     ActiveCheckColumnAsset::register($view);
     // Set the filter options
     $this->filter = [false => 'No value', true => 'Has value'];
     $this->filterInputOptions = ['prompt' => 'Choose status', 'class' => 'form-control', 'id' => null];
     // Load custom information for this instance
     parent::init();
     // TODO: Change the autogenerated stub
     // Check to make sure that we have a URL set
     if ($this->setUrl === null) {
         throw new ErrorException('URL not set');
     }
     // Translate the URL
     $this->setUrl = Url::to($this->setUrl);
 }
Example #26
0
 public function init()
 {
     parent::init();
     $this->filter = ArrayHelper::map(\Yii::$app->cms->findUser()->all(), 'id', 'displayName');
     /*$model = $this->grid->filterModel;
       $this->filter = Chosen::widget([
           'attribute' => $this->attribute,
           'model' => $model,
           'name' => Html::getInputName($model, $this->attribute),
           'items' => ArrayHelper::map(
               \Yii::$app->cms->findUser()->all(),
               'id',
               'name'
           )
       ]);*/
     /*$model = $this->grid->filterModel;
       $this->filter = AutoComplete::widget([
           'attribute' => $this->attribute,
           'model' => $model,
           'name' => Html::getInputName($model, $this->attribute),
           'clientOptions' => [
               'source' => \Yii::$app->cms->findUser()->select(['id as value', 'name as label'])->all(),
           ],
           /*'items' => ArrayHelper::map(
               \Yii::$app->cms->findUser()->all(),
               'id',
               'name'
           )
       ]);*/
     /*
             $this->filter = Chosen::begin([
                 'model' => $this->m
                 'items' => ArrayHelper::map(
                     \Yii::$app->cms->findUser()->all(),
                     'id',
                     'name'
                 )
             ])->run();*/
 }
Example #27
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->initDefaultButtons();
 }
 public function init()
 {
     parent::init();
     Yii::$app->view->registerJs("\n        \n            \$('#{$this->grid->id} .toggle').click(function(e){\n                e.preventDefault();\n\n                var a = \$(this);\n\n                \$.get(a.attr('href'), function(){\n                    if (a.hasClass('label-danger'))\n                    {\n                        a.removeClass('label-danger').addClass('label-success');\n                        a.find('i').removeClass('fa-ban').addClass('fa-check');\n                    }\n                    else\n                    {\n                        a.addClass('label-danger').removeClass('label-success');\n                        a.find('i').addClass('fa-ban').removeClass('fa-check');\n                    }\n                });\n\n                return false;\n            });\n        ");
 }
 /**
  * @inheritdoc
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if ($this->url === null) {
         throw new InvalidConfigException("'Url' property must be specified.");
     }
     parent::init();
     Html::addCssClass($this->headerOptions, 'toggle-column');
     Html::addCssClass($this->contentOptions, 'toggle-column');
     Html::addCssClass($this->footerOptions, 'toggle-column');
     $this->format = 'raw';
     $this->onLabel = $this->onLabel ?: Yii::t('app', 'On');
     $this->offLabel = $this->offLabel ?: Yii::t('app', 'Off');
     $this->emptyLabel = $this->emptyLabel ?: Yii::t('app', 'Not set');
     $this->registerClientScript();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->_view = $this->grid->getView();
     if ($this->mergeHeader && !isset($this->vAlign)) {
         $this->vAlign = GridView::ALIGN_MIDDLE;
     }
     if ($this->grid->bootstrap === false) {
         Html::removeCssClass($this->filterInputOptions, 'form-control');
     }
     $this->parseFormat();
     $this->parseVisibility();
     $this->checkValidFilters();
     parent::init();
     $this->setPageRows();
     $this->initGrouping();
 }