/** * Формирование Html кода поля для вывода в форме * @param ActiveForm $form объект форма * @param array $options массив html атрибутов поля * @param bool|int $index инднкс модели при табличном вводе * @return string */ public function renderInput(ActiveForm $form, array $options = [], $index = false) { $data = $this->modelField->getDataValue(); if (empty($data)) { return false; } $options = ArrayHelper::merge($this->options, $options, ["multiple" => true]); $widgetOptions = ArrayHelper::merge(["data" => $data], $this->widgetOptions, ["options" => $options]); $attr = $this->getFormAttrName($index, $this->modelField->attr); return $form->field($this->modelField->model, $attr)->widget(MultiSelect::className(), $widgetOptions); }
/** * @param array $dataFilter * @return string */ protected function filterMultiselect($dataFilter) { \bmelo\yii2\assets\MultiselectFilterAsset::register(Yii::$app->getView()); $opts = \yii\helpers\ArrayHelper::getValue($dataFilter, 2, []); //Defaults $options = ["options" => ['multiple' => "multiple"], 'data' => $dataFilter[1], 'model' => $this->grid->filterModel, 'attribute' => $this->attribute, "clientOptions" => array_merge(['allSelectedText' => 'Selecionar todos', 'includeSelectAllOption' => true, 'numberDisplayed' => 1, 'selectAllText' => 'Todos', 'nSelectedText' => 'selecionados', 'nonSelectedText' => "<span class='empty'></span>", 'buttonTitle' => new \yii\web\JsExpression('function(){return null;}')], $opts)]; return MultiSelect::widget($options); }
echo $model->errors['t_fr_id'][0]; } ?> </div> </div> <div class="form-group <?php if (isset($model->errors['t_l_id'])) { ?> has-error <?php } ?> "> <label for="">Sprache</label> <?php echo MultiSelect::widget(['data' => $languages, 'name' => 'Translation[t_l_id]', 'clientOptions' => ['maxHeight' => 300, 'enableCaseInsensitiveFiltering' => true, 'buttonWidth' => '800px'], 'options' => ['disabled' => !empty($translationId), 'multiple' => false, 'nonSelectedValue' => 0], 'value' => $model->t_l_id]); ?> <div class="help-block"><?php if (isset($model->errors['t_l_id'])) { echo $model->errors['t_l_id'][0]; } ?> </div> </div> <?php echo $form->field($model, 'frage')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'antworten')->textarea(['rows' => 6]);
<!-- Begin region selection dropdowns --> <div class="col-xs-11"> <?php echo "<div class=\"form-group field-update-region-form-access required\">"; echo '<div class="col-xs-3 region-list">'; foreach ($stateList as $state) { $inState = array(); foreach ($countyList as $county) { if ($county->state_id == $state->id) { $inState = $inState + [$county->id => $county->name]; } } echo "<label class=\"col-xs-6 control-label text-center\">" . $state->name . "</label>"; echo "<div class=\"col-xs-6\">"; echo MultiSelect::widget(['id' => $state->code, 'options' => ['multiple' => "multiple", 'class' => "form-control"], 'name' => 'UpdateRegionForm[access][]', 'data' => $inState, 'value' => $access, "clientOptions" => ["includeSelectAllOption" => true, 'numberDisplayed' => 1, 'selectAllNumber' => false, 'maxHeight' => 300, 'selectAllText' => 'Select All Counties', 'nSelectedText' => 'Counties Selected', 'nonSelectedText' => 'None Selected']]); echo "</div>"; if ($state->id == 13 || $state->id == 26 || $state->id == 39) { echo '</div>'; echo '<div class="col-xs-3 region-list">'; } } echo "</div>"; ?> </div> </div> <div class="row"> <div class="form-group"> <div class="col-xs-11"> <?php echo Html::submitButton('Update', ['class' => 'pull-right btn btn-primary update-region-submit', 'name' => 'update-region-button']);
echo $model->errors['p_id'][0]; } ?> </div> </div> <div class="form-group <?php if (isset($model->errors['b_id'])) { ?> has-error <?php } ?> "> <label for="">Bank</label> <?php echo MultiSelect::widget(['data' => $banks, 'name' => 'UserText[b_id]', 'clientOptions' => ['maxHeight' => 300, 'enableCaseInsensitiveFiltering' => true, 'buttonWidth' => '400px'], 'options' => ['multiple' => true], 'value' => $model->b_id]); ?> <div class="help-block"><?php if (isset($model->errors['b_id'])) { print_r($model->errors['b_id'][0]); } ?> </div> </div> <?php } ?> <?php echo $form->field($model, 'l_id')->dropDownList($languages);
?> <div class="form-form"> <?php $form = ActiveForm::begin(); ?> <div class="form-group <?php if (isset($model->errors['s_b_id'])) { ?> has-error <?php } ?> "> <label for="">Bank</label> <?php echo MultiSelect::widget(['data' => $banks, 'name' => 'Style[s_b_id]', 'clientOptions' => ['maxHeight' => 300, 'enableCaseInsensitiveFiltering' => true, 'buttonWidth' => '400px'], 'options' => ['multiple' => false, 'nonSelectedValue' => 0], 'value' => $model->s_b_id]); ?> <div class="help-block"><?php if (isset($model->errors['s_b_id'])) { echo $model->errors['s_b_id'][0]; } ?> </div> </div> <?php echo $form->field($model, 's_p_id')->dropDownList($groups); ?> <?php echo $form->field($model, 'style')->dropDownList($styles);
public function multiselect($items, $options = []) { //Defaults $opts = array_merge(["options" => ['multiple' => "multiple"], "data" => $items, "clientOptions" => ["includeSelectAllOption" => true, 'numberDisplayed' => 2]], $options); return $this->widget(MultiSelect::className(), $opts); }
?> <div class="alert alert-danger alert-dismissible" role="alert"> <?php echo $error; ?> </div> <?php } ?> <form action=<?php echo Url::toRoute("/bank/placeholders/set-alias"); ?> > <div class="form-group"> <label for="">Platzhalter setzen für</label> <?php echo MultiSelect::widget(['data' => $data, 'name' => 'bank', 'clientOptions' => ['maxHeight' => 300, 'enableCaseInsensitiveFiltering' => true, 'buttonWidth' => '400px'], 'options' => ['multiple' => true]]); ?> </div> <button class="btn btn-success">Platzhalter für diese Bank bearbeiten</button> </form> <style> label { display: block; } .dropdown-menu > li > a { padding: 8px 30px; } </style> </div>
echo $model->errors['z_b_id'][0]; } ?> </div> </div> <div class="form-group <?php if (isset($model->errors['z_p_id'])) { ?> has-error <?php } ?> "> <label for="">Benutzergruppe</label> <?php echo MultiSelect::widget(['data' => $groups, 'name' => 'Code[z_p_id]', 'clientOptions' => ['maxHeight' => 300, 'enableCaseInsensitiveFiltering' => true, 'buttonWidth' => '400px'], 'options' => ['multiple' => false], 'value' => $model->z_p_id]); ?> <div class="help-block"><?php if (isset($model->errors['z_p_id'])) { echo $model->errors['z_p_id'][0]; } ?> </div> </div> <?php echo $form->field($model, 'count')->textInput(); ?> <div class="form-group"> <?php
<div class="ocena-form"> <?php $form = ActiveForm::begin(['id' => 'ocenaForm']); ?> <?php echo $form->field($model, 'symbol')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'opis')->widget(TinyMce::classname(), ['options' => ['rows' => 15], 'language' => 'pl', 'clientOptions' => ['plugins' => ["advlist autolink lists link charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste"], 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"]]); ?> <?php echo MultiSelect::widget(['data' => Ocena::peksForMultiselect($kid), 'name' => 'wybranePek', 'options' => ['multiple' => 'multiple']]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<!--<?php echo $form->field($model, 'f_klasse')->dropDownList($classes); ?> --> <div class="form-group <?php if (isset($model->errors['f_klasse'])) { ?> has-error <?php } ?> "> <label for="">Klasse</label> <?php echo MultiSelect::widget(['data' => $classes, 'name' => 'Form[f_klasse]', 'clientOptions' => ['maxHeight' => 300, 'enableCaseInsensitiveFiltering' => true, 'buttonWidth' => '400px'], 'options' => ['multiple' => false, 'nonSelectedValue' => 0, 'onchange' => $model->isNewRecord ? '' : 'this.form.submit();'], 'value' => $model->f_klasse]); ?> <div class="help-block"><?php if (isset($model->errors['f_klasse'])) { echo $model->errors['f_klasse'][0]; } ?> </div> </div> <?php echo $form->field($model, 'f_p_id')->dropDownList($groups); ?> <?php echo Html::button('Fragenliste einblenden', ['id' => 'addQuestion', 'data' => ['toggle' => "modal", 'target' => '#myModal'], 'class' => 'btn btn-primary']);
?> <?php echo $form->field($model, 'weight')->textInput()->hint('По умолчанию 15'); ?> <?php echo $form->field($model, 'active')->dropDownList(\stronglab\productcatalog\models\Products::$activeText); ?> <?php if ($categories = Categories::getDropDown()) { ?> <?php echo $form->field($model, 'categories')->widget(MultiSelect::classname(), ['options' => ['multiple' => 'multiple', 'encode' => false], 'data' => $categories]); ?> <?php } ?> <?php echo $form->field($model, 'upload_files[]')->widget(FileInput::classname(), ['options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::toRoute(['/catalog/products/upload']), 'uploadExtraData' => ['model_id' => $model->id, 'category' => 'products'], 'showUpload' => false, 'initialPreviewShowDelete' => true, 'maxFileCount' => 10, 'layoutTemplates' => ['actionUpload' => ''], 'initialPreview' => $a(), 'initialPreviewConfig' => $b(), 'overwriteInitial' => false, 'allowedFileTypes' => ['image']]]); ?> <?php echo Hook::render($model, 'PRODUCT_FORM'); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Добавить' : 'Редактировать', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'id' => 'submit-product']);