/** * @inheritdoc */ public function registerClientScript() { parent::registerClientScript(); JuiAsset::register($this->view); $id = $this->options["id"]; $this->view->registerJs("\n\n\t \$('#{$id}').select2('container').find('ul.select2-choices').sortable({\n containment: 'parent',\n start: function() { \$('#{$id}').select2('onSortStart'); },\n update: function() { \$('#{$id}').select2('onSortEnd'); }\n });\n "); }
<div class="col-sm-6"> <?php echo $form->field($model, 'ruleName')->widget(Widget::className(), ['options' => ['prompt' => Module::t('rbac', 'BACKEND_PERMISSIONS_RULE_NAME_PROMPT')], 'settings' => ['width' => '100%'], 'items' => $ruleArray]); ?> </div> </div> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($model, 'description')->textarea()->label(Module::t('rbac', 'BACKEND_PERMISSIONS_ATTR_DESCRIPTION')); ?> </div> <div class="col-sm-6"> <?php echo $form->field($model, 'data')->textarea()->label(Module::t('rbac', 'BACKEND_PERMISSIONS_ATTR_DATA')); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?php echo $form->field($model, 'children')->widget(Widget::className(), ['options' => ['multiple' => true, 'placeholder' => Module::t('rbac', 'BACKEND_PERMISSIONS_CHILDREN_PROMPT')], 'settings' => ['width' => '100%'], 'items' => $permissionArray])->label(Module::t('rbac', 'BACKEND_PERMISSIONS_ATTR_CHILDREN')); ?> </div> </div> <?php $box->endBody(); $box->beginFooter(); echo Html::submitButton(!isset($update) ? Module::t('rbac', 'BACKEND_PERMISSIONS_CREATE_SUBMIT') : Module::t('rbac', 'BACKEND_PERMISSIONS_UPDATE_SUBMIT'), ['class' => !isset($update) ? 'btn btn-primary btn-large' : 'btn btn-success btn-large']); $box->endFooter(); ActiveForm::end();
?> <i class="uk-icon-info-circle uk-float-right" data-uk-toggle="{target:'.hint-<?php echo $input_id; ?> '}"></i> <?php echo Html::activeLabel($model, $attribute, ['class' => 'uk-form-label']); ?> <p class="hint-<?php echo $input_id; ?> uk-hidden"> <?php echo $element->adminHint; ?> </p> <?php } else { ?> <?php echo Html::activeLabel($model, $attribute, ['class' => 'uk-form-label']); } ?> <div class="uk-from-controls"> <?php echo \vova07\select2\Widget::widget(['model' => $model, 'attribute' => $attribute, 'options' => ['multiple' => true, 'placeholder' => 'Choose item'], 'settings' => ['width' => '100%'], 'items' => $element->variants]); ?> <div class="uk-form-help-block uk-text-danger"></div> </div>
/** * Create ActiveField object. * * @param \yii\widgets\ActiveForm $form * @param \yii\db\ActiveRecord $model Model * @param string $attribute Model attribute * @param array $options Attribute options * @param string $type ActiveField type * @return \yii\widgets\ActiveField ActiveField object * @throws InvalidConfigException */ protected function createField($form, $model, $attribute, $options, $type = 'textInput') { $options = $this->getAttributeOptions($attribute, $options); $field = $form->field($model, $attribute); if (isset($options['hint'])) { $hintOptions = []; if (isset($options['hintOptions'])) { $hintOptions = $options['hintOptions']; unset($options['hintOptions']); } $field->hint($options['hint'], $hintOptions); unset($options['hint']); } if (isset($options['label'])) { $labelOptions = []; if (isset($options['labelOptions'])) { $labelOptions = $options['labelOptions']; unset($options['labelOptions']); } $field->label($options['label'], $labelOptions); unset($options['label']); } if (isset($options['input'])) { $input = $options['input']; unset($options['input']); $field = $field->input($input, $options); } else { if ($type == 'dropDownList' || $type == 'listBox' || $type == 'checkboxList' || $type == 'radioList') { $items = $this->getAttributeChoices($model, $attribute); $field->{$type}($items, $options); } elseif ($type == 'select') { if (isset($options['items'])) { $options['items'] = $options['items'] + $this->getAttributeChoices($model, $attribute); } else { $options['items'] = $this->getAttributeChoices($model, $attribute); } $field->widget(Select2Widget::className(), $options); } elseif ($type == 'widget') { if (isset($options['widgetClass'])) { $class = $options['widgetClass']; unset($options['widgetClass']); } else { throw new InvalidConfigException('Widget class missing from configuration.'); } $field->widget($class, $options); } else { $field->{$type}($options); } } return $field; }
use yii\helpers\Html; use yii\helpers\ArrayHelper; $this->registerJs($model->addValidators($this, $attribute), 5); $multiselect = isset($params['multiselect']) ? (int) $params['multiselect'] : 0; ?> <?php if ($multiselect && count($model->app->catlist)) { ?> <?php echo Html::activeLabel($model, 'category', ['class' => 'uk-form-label']); ?> <?php echo \vova07\select2\Widget::widget(['model' => $model, 'attribute' => 'category', 'options' => ['multiple' => true, 'placeholder' => 'Choose item'], 'settings' => ['width' => '100%'], 'items' => $model->app->catlist]); ?> <?php } elseif (($parent_categories = ArrayHelper::map(Yii::$app->controller->app->parentCategories, 'id', 'name')) !== null && count($parent_categories)) { ?> <?php echo Html::activeLabel($model, 'category', ['class' => 'uk-form-label']); ?> <div class="uk-form-controls"> <?php echo Html::activeDropDownList($model, $attribute . '[0]', $parent_categories, ['id' => 'item-' . $attribute, 'prompt' => 'выбрать из списка', 'class' => 'uk-width-1-1 category-select']); ?> <?php
echo $form->field($searchModel, 'title')->textInput(); ?> </div> <div class="col-md-3"> <?php echo $form->field($searchModel, 'created_at')->widget(DatePicker::className(), ['options' => ['placeholder' => Yii::t('announcement', 'Select publication date')], 'pluginOptions' => ['format' => 'yyyy-mm-dd', 'viewSelect' => 'month', 'autoclose' => true, 'todayHighlight' => true]]); ?> </div> <div class="col-md-3"> <?php echo $form->field($searchModel, 'category')->widget(Widget::className(), ['options' => ['multiple' => true, 'placeholder' => Yii::t('announcement', 'Choose category'), 'class' => 'form-control'], 'bootstrap' => true, 'settings' => ['width' => '100%'], 'items' => $categories]); ?> </div> <div class="col-md-3"> <?php echo $form->field($searchModel, 'region')->widget(Widget::className(), ['options' => ['multiple' => true, 'placeholder' => Yii::t('announcement', 'Choose region'), 'class' => 'form-control'], 'settings' => ['width' => '100%'], 'items' => $regions]); ?> </div> <div class="col-md-12"> <?php echo Html::submitButton(Yii::t('yii', 'Search'), ['class' => 'btn btn-default search']); ?> <img class="onload" src="data:image/gif;base64,R0lGODlhGgAUAOMAALza7NTm9Mze9OTu9MTa7Nzq9Mzi9OTy/MTe9P///wAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJDgAJACwAAAAAGgAUAAAEkTDJSau9OOvNewcEAAQSEhKGZIAAIgWsaBhCmiACMpdzruYrANCm09mAC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nusoElBkERFwKg40SMRBtl2XNDWFRPg4DQADAwA3i7hCBMhACH5BAkOABEALAAAAAAaABQAhJzG5NTm9LzW7KzO7MTe9Pz+/OTu9KTK5MTa7LTS7Mze9Nzq9Lza7KzS7OTy/KTK7Mzi9P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWxYCSOZGmeaCoaQRuoMNM0CQCrjCAkD4MwjFeE8ENARIKBsiFiJIA9CERxHCoI0iaQkGjuGL1rdgjBVhNEp9cZNYsI4upWHXFCGVOCEIHFIn10OU9tY2ZlTT9cazx4CghCRBBGWgSBT2B4bmSaAoBddXZRZXtYk6CVn3aMcW9Sh3WJqZ2YRI8iCLh+EZc7TU88C8EBDiILAcYGIgFlYzlQNymqD9AoYA8PB9QnBdzc2jAhACH5BAkOAAwALAAAAAAaABQAg6zO7Mze9Lza7Nzq9LzW7NTm9MTa7OTy/KzS7Mzi9OTu9MTe9P///wAAAAAAAAAAAASYkMlJq7046817F4YgFNISGomUgMIiGUAMCEkSpMwSLHVZ7yXRYrbr5RI8XHHhYpwECFqyVMTxUM1Qa2ZbkJw8nippCIaiSGMSqUpgXy0oLWD4mtw4FLK5EBnQU0eBaW5mcjVeL1dWeFkgfwJVPohte3AiUSZ1LwYGYk6eniUEIgADpwUHEgMFrAoSB62nqzxAHre4ubq7FBEAOw=="/> </div> </div> <?php ActiveForm::end(); ?> <?php Pjax::end(); ?>
<?php if ($canSendRequest) { ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Request Options</h3> </div> <div class="panel-body request-options-block"> <div class="form-horizontal"> <div class="form-group"> <?php echo Html::label('Method', 'req_method', ['class' => 'control-label col-sm-2']); ?> <div class="col-sm-6"> <?php echo \vova07\select2\Widget::widget(['name' => 'req_method', 'items' => ['' => ''] + $methodsListOptions, 'options' => ['style' => 'width: 250px'], 'settings' => ['placeholder' => 'Select request Method'], 'events' => ['change' => new JsExpression('yii_teleduino.onSelectChange')]]); ?> </div> </div> <div class="form-group"> <div id="teleduino-method-description" class="col-sm-offset-2 col-sm-6 alert alert-info"></div> <?php echo Html::hiddenInput('teleduino-get-method-form-url', Url::to(['get-method-form'], true), ['id' => 'teleduino-get-method-form-url']); ?> </div> </div> <div id="teleduino-request-form-container"></div> </div>