public function run() { $out = ''; $countryDropdown = Select2::widget(['name' => 'country', 'value' => '', 'data' => Country::dropdown(), 'options' => ['label' => 'yaya', 'placeholder' => 'Select Country ...', 'id' => 'country-selection']]); $locationDropdown = $this->form->field($this->model, 'location_id')->label(false)->widget(DepDrop::classname(), ['type' => DepDrop::TYPE_SELECT2, 'options' => ['id' => 'location-selection'], 'select2Options' => ['pluginOptions' => ['allowClear' => TRUE]], 'pluginOptions' => ['depends' => ['country-selection'], 'placeholder' => 'Select Location', 'url' => Url::to(['/location/admin/load'])]]); $this->_printField($countryDropdown, $out); $this->_printField($locationDropdown, $out); return $out; }
/** * */ public function init() { if (empty($this->parentName)) { throw new InvalidParamException('RelativeSelect2 $parentName must be set!'); } if (empty($this->url)) { throw new InvalidParamException('RelativeSelect2 $url must be set!'); } if ($this->parentModel instanceof Model) { $this->options['data']['select2-parent-name'] = Html::getInputName($this->parentModel, $this->parentName); } else { $this->options['data']['select2-parent-name'] = $this->hasModel() ? Html::getInputName($this->model, $this->parentName) : $this->parentName; } if (is_array($this->url)) { $this->url = Url::to($this->url); } $this->options['data']['select2-url'] = $this->url; if (!empty($this->model) && isset($this->model->{$this->attribute})) { if (is_array($this->model->{$this->attribute})) { $this->options['data']['select2-selected-items'] = implode(',', $this->model->{$this->attribute}); } else { $this->options['data']['select2-selected-items'] = $this->model->{$this->attribute}; } } else { $this->options['data']['select2-selected-items'] = $this->value; } parent::init(); RelativeSelect2Asset::register($this->getView()); }
private function renderDropDownList($data, $value = null) { if (!count($data)) { return; } return Select2::widget(['id' => md5(Html::getInputId($this->model, $this->attribute) . mt_rand(0, 999999999) . mt_rand(0, 999999999)), 'name' => '', 'value' => $value, 'data' => array_merge([0 => '...'], $data), 'language' => 'ru']); }
public function run() { echo '<form id="form1" data-pjax-exclude method="GET">'; parent::run(); echo '<div class="form-group"><div class="col-lg-11">'; echo Html::submitButton('Select users', ['class' => 'btn btn-primary']); echo '</div></div></form>'; }
public function init() { $this->setDefaultOptions(); if ($this->getSelect2Type() == 'ajax') { $this->setAjaxOptions(); } parent::init(); }
public function run() { $variantsList = $this->field->variants; $variantsList = ArrayHelper::map($variantsList, 'id', 'value'); $variantsList[0] = '-'; ksort($variantsList); $checked = $this->model->getFieldVariantId($this->field->slug); $select = Select2::widget(['name' => 'choice-field-value', 'value' => $checked, 'data' => $variantsList, 'language' => 'ru', 'options' => ['placeholder' => 'Выберите значение ...'], 'pluginOptions' => ['allowClear' => true]]); $variants = Html::tag('div', $select, $this->options); return $variants; }
/** Render widget */ public function run() { $m = new $this->model_name(); $data = $m->allAsArray; // Without model and implementing a multiple select if ($this->title != '') { echo '<label class="control-label">' . $this->title . '</label>'; } echo \kartik\select2\Select2::widget(['name' => $this->behavior->post_name, 'data' => $data, 'value' => $this->model->relatedIdsArray, 'options' => ['placeholder' => $this->placeholder, 'multiple' => true, 'sorter' => 'function(data) { return data.sort(); }']]); }
function selectField($attribute, $data, $widgetOptions = [], $fieldOptions = []) { $defaultFieldOptions = ['options' => ['class' => 'form-group']]; $defaultInputOptions = ['class' => 'form-control select', 'placeholder' => $this->model->getAttributeLabel($attribute) . '...']; $fieldOptions = array_replace_recursive($defaultFieldOptions, $fieldOptions); $inputOptions = array_replace_recursive($defaultInputOptions, isset($widgetOptions['inputOptions']) ? $widgetOptions['inputOptions'] : []); if ($this->viewMode || in_array($attribute, $this->disabledFields)) { $fieldOptions['enableClientValidation'] = false; $inputOptions['disabled'] = 'disabled'; } $defaultWidgetOptions = ['data' => $data, 'options' => $inputOptions, 'pluginOptions' => ['allowClear' => true, 'minimumResultsForSearch' => 1]]; $widgetOptions = array_replace_recursive($defaultWidgetOptions, $widgetOptions); return $this->form->field($this->model, $attribute, $fieldOptions)->widget(Select2::classname(), $widgetOptions); }
/** * @inherit doc * @throw InvalidConfigException */ public function init() { if (empty($this->pluginOptions['url'])) { throw new InvalidConfigException("The 'pluginOptions[\"url\"]' property has not been set."); } if (empty($this->pluginOptions['depends']) || !is_array($this->pluginOptions['depends'])) { throw new InvalidConfigException("The 'pluginOptions[\"depends\"]' property must be set and must be an array of dependent dropdown element ID."); } if (empty($this->options['class'])) { $this->options['class'] = 'form-control'; } if ($this->type === self::TYPE_SELECT2) { Config::checkDependency('select2\\Select2', 'yii2-widget-select2', 'for dependent dropdown for TYPE_SELECT2'); } parent::init(); if ($this->type !== self::TYPE_SELECT2 && !empty($this->options['placeholder'])) { $this->data = ['' => $this->options['placeholder']] + $this->data; } if ($this->type === self::TYPE_SELECT2 && (!empty($this->options['placeholder']) || !empty($this->select2Options['options']['placeholder']))) { $this->pluginOptions['placeholder'] = ''; } elseif ($this->type === self::TYPE_SELECT2 && !empty($this->pluginOptions['placeholder']) && $this->pluginOptions['placeholder'] !== false) { $this->options['placeholder'] = $this->pluginOptions['placeholder']; $this->pluginOptions['placeholder'] = ''; } $this->_view = $this->getView(); $this->registerAssets(); if ($this->type === self::TYPE_SELECT2) { if (empty($this->data)) { $this->data = ['' => '']; } if ($this->hasModel()) { $settings = ArrayHelper::merge($this->select2Options, ['model' => $this->model, 'attribute' => $this->attribute, 'data' => $this->data, 'options' => $this->options]); } else { $settings = ArrayHelper::merge($this->select2Options, ['name' => $this->name, 'value' => $this->value, 'data' => $this->data, 'options' => $this->options]); } echo Select2::widget($settings); $id = 'jQuery("#' . $this->options['id'] . '")'; $text = ArrayHelper::getValue($this->pluginOptions, 'loadingText', 'Loading ...'); $this->_view->registerJs("{$id}.on('depdrop.beforeChange',function(e,i,v){{$id}.select2('data',{text: '{$text}'});});"); $this->_view->registerJs("{$id}.on('depdrop.change',function(e,i,v,c){{$id}.select2('val',{$id}.val());});"); } else { echo $this->getInput(!empty($this->typename) ? $this->typename : 'dropdownList', true); } }
public function run() { $variantsList = $this->filter->variants; $variantsList = ArrayHelper::map($variantsList, 'id', 'value'); $variantsList[0] = '-'; ksort($variantsList); $checked = false; foreach ($variantsList as $variantId => $value) { if ($this->model->checkedId($variantId)) { $checked = $variantId; break; } } $select = Select2::widget(['name' => 'choise-option', 'value' => $checked, 'data' => $variantsList, 'language' => 'ru', 'options' => ['placeholder' => 'Выберите значение ...'], 'pluginOptions' => ['allowClear' => true]]); $variants = Html::tag('div', $select, $this->options); $new = []; $new[] = Html::input('text', 'variant_value', '', ['placeholder' => 'Новый вариант', 'data-filter-id' => $this->filter->id, 'data-create-action' => Url::toRoute(['/filter/filter-variant/create']), 'class' => ' form-control']); $new[] = Html::button(Html::tag('i', '', ['class' => 'glyphicon glyphicon-plus']), ['class' => 'btn btn-success']); $variants .= Html::tag('div', implode('', $new), ['class' => 'new-variant']); return $variants; }
/** * Registers the needed assets */ public function registerAssets() { $view = $this->getView(); DepDropAsset::register($view); DepDropExtAsset::register($view); $this->registerPlugin('depdrop'); if ($this->type === self::TYPE_SELECT2) { $loading = ArrayHelper::getValue($this->pluginOptions, 'loadingText', 'Loading ...'); $this->select2Options['data'] = $this->data; $this->select2Options['options'] = $this->options; if ($this->hasModel()) { $settings = ArrayHelper::merge($this->select2Options, ['model' => $this->model, 'attribute' => $this->attribute]); } else { $settings = ArrayHelper::merge($this->select2Options, ['name' => $this->name, 'value' => $this->value]); } echo Select2::widget($settings); $id = $this->options['id']; $view->registerJs("initDepdropS2('{$id}','{$loading}');"); } else { echo $this->getInput('dropdownList', true); } }
/** * @param $view View * @return string * @throws \Exception */ public static function widgetSendMessageModal(&$view) { $view->registerJs("messageurl = '" . Url::to(['/users/send-message'], true) . "';"); ob_start(); Modal::begin(['header' => '<h3>' . Yii::t('app', 'Send Message') . '</h3>', 'id' => 'messagemodal', 'size' => 'modal-md', 'closeButton' => ['label' => '', 'class' => 'close glyphicon glyphicon-remove'], 'options' => ['tabindex' => false], 'footer' => '<button type="button" class="btn btn-default pull-right" data-dismiss="modal">' . Yii::t('app', 'Cancel') . '</button>' . '<button type="button" class="btn btn-primary pull-left" id="sendBtn">' . Yii::t('app', 'Send') . '</button>']); $url = \yii\helpers\Url::to(['/users/search']); echo Select2::widget(['options' => ['placeholder' => 'To:'], 'model' => new \app\models\User(), 'theme' => Select2::THEME_KRAJEE, 'name' => 'receiver_id', 'pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 3, 'ajax' => ['url' => $url, 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(city) { return city.text; }'), 'templateSelection' => new JsExpression('function (city) { return city.text; }')]]); $Message = Yii::t('app', 'Message'); $placeholder = Yii::t('app', 'Enter you message..'); echo <<<HTML <div style="margin:20px 0 25px 0;"> <div class="form-group"> <label for="comment">{$Message} :</label> <textarea placeholder="{$placeholder}" class="form-control" rows="5" id="message" style="max-width:100%;"></textarea> </div> </div> HTML; Modal::end(); return ob_get_clean(); }
echo $form->field($model, 'id')->textInput(['disabled' => 'disabled', 'placeholder' => 'autonumber']); ?> <?php echo $form->field($model, 'number')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'city_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type city', 'depends' => ['rgndistrictform-province_id'], 'url' => Url::to(['/rgn-city/depdrop-options', 'selected' => $model->city_id]), 'loadingText' => 'Loading cities ...']]); ?> <?php echo $form->field($model, 'province_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type province', 'depends' => ['rgndistrictform-country_id'], 'url' => Url::to(['/rgn-province/depdrop-options', 'selected' => $model->province_id]), 'loadingText' => 'Loading provinces ...']]); ?> <?php echo $form->field($model, 'country_id')->widget(Select2::classname(), ['data' => RgnCountry::asOption(), 'pluginOptions' => ['placeholder' => 'Select or type Country', 'multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]]); ?> </p> <?php $this->endBlock(); ?> <?php echo Tabs::widget(['encodeLabels' => false, 'items' => [['label' => 'RgnDistrict', 'content' => $this->blocks['main'], 'active' => true]]]); ?> <hr/> <?php echo $form->errorSummary($model); ?> <?php
<div class="row"> <div class="col-lg-6 col-xs-6"> <?php echo $form->field($model, 'category_id')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите категорию ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'producer_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Producer::find()->all(), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите бренд ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-lg-6 col-xs-6"> <?php echo $form->field($model, 'category_ids')->label('Прочие категории')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['multiple' => true, 'placeholder' => 'Доп. категории ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> </div> <?php echo $form->field($model, 'text')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video'], 'options' => ['minHeight' => 400, 'maxHeight' => 400, 'buttonSource' => true, 'imageUpload' => Url::toRoute(['tools/upload-imperavi'])]]); ?> <?php echo $form->field($model, 'short_text')->textInput(['maxlength' => true]); ?> <?php echo Gallery::widget(['model' => $model]); ?>
$form = ActiveForm::begin(['layout' => 'horizontal']); ?> <div> <?php echo $form->errorSummary($model); ?> <?php $this->beginBlock('main'); ?> <p> <?php /*= $form->field($model, 'client_id')->dropDownList(\yii\helpers\ArrayHelper::map(\common\models\Client::find()->active()->all(), 'id', 'name'), ['prompt' => '']) */ ?> <?php echo $form->field($model, 'client_id')->widget(\kartik\select2\Select2::className(), ['data' => \yii\helpers\ArrayHelper::map(\common\models\Client::find()->active()->all(), 'id', 'name'), 'options' => ['prompt' => '']]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'email')->input('email', ['maxlength' => true]); ?> <?php echo $form->field($model, 'phone')->input('tel', ['maxlength' => true, 'placeholder' => '(10 digits only)']); ?> <?php
foreach ($rces as $i => $rce) { $ids[$i] = $rce->reserva_id; } $data = ArrayHelper::map(Reserva::find()->where(['not in', 'id', $ids])->all(), 'id', 'ReservaSelect'); ?> <?php echo $form->field($model, "reserva_id")->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Seleccionar Reserva...', 'id' => 'reservaId'], 'pluginOptions' => ['width' => '300px', 'disabled' => !$model->isNewRecord]]); ?> <?php $data = ArrayHelper::map(Profesional::find()->all(), 'id', 'Nombres'); ?> <?php echo $form->field($model, "persona_id_realiza_examen")->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Seleccionar Profesional que realiza el Examen...'], 'pluginOptions' => ['width' => '300px', 'disabled' => !$model->isNewRecord]]); ?> <?php foreach ($modelsExamenes as $i => $modelExamen) { $script = <<<JS // here you right all your javascript stuff \$('#reservaId').change(function(){ var reservaId = \$(this).val(); \$.get('index.php?r=examen/get-datos-examen',{ reservaId : reservaId },function(data){ var data = \$.parseJSON(data); \$('#rceexamenexamen-{$i}-monto_a_pagar').attr('value',data[{$i}].monto); \$('#rceexamenexamen-{$i}-descripcion').attr('value',data[{$i}].descripcion); \$('#rceexamenexamen-{$i}-observaciones').attr('value',data[{$i}].observaciones); });
echo $form->field($model, 'liceoCurso')->textInput(['maxlength' => true]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'correo')->textInput(['maxlength' => true]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'direccion')->textInput(['maxlength' => true]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'comunas_comuna_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Comunas::find()->all(), 'comuna_id', 'comuna_nombre'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'Seleccione su comuna'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'telefono')->textInput(['maxlength' => true]); ?> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
use kartik\select2\Select2; use yii\widgets\ActiveForm; use yii\helpers\Html; ?> <?php $form = ActiveForm::begin(['enableClientValidation' => false, 'enableAjaxValidation' => true]); ?> <?php echo $form->field($model, 'name'); ?> <?php echo $form->field($model, 'description'); ?> <?php echo $form->field($model, 'rule'); ?> <?php echo $form->field($model, 'children')->widget(Select2::className(), ['data' => $model->getUnassignedItems(), 'options' => ['id' => 'children', 'multiple' => true]]); ?> <?php echo Html::submitButton(Yii::t('rbac', 'Save'), ['class' => 'btn btn-success btn-block']); ?> <?php ActiveForm::end();
$this->title = "Заявки"; $specList = ArrayHelper::map(Occupations::find()->all(), 'id', 'name'); ?> <div class="request-edit"> <div class="panel panel-info" style="width: 300px; float: left;"> <div class="panel-heading"> <h4 class="panel-title"> Заполните начальные данные </h4> </div><!-- panel-heading --> <div class="panel-body form-group"> <?php echo Select2::widget(['class' => "form-control", 'id' => "ocupations", 'name' => "ocupations", 'value' => '', 'data' => $specList, 'options' => ['multiple' => false, 'placeholder' => 'Выберите специальность ...']]); echo '<p />'; echo Select2::widget(['class' => "form-control", 'id' => "specialists", 'name' => "specialists", 'value' => '', 'options' => ['multiple' => false, 'placeholder' => '...']]); echo '<p /><label for="date"> Дата приёма с: </label>'; echo DatePicker::widget(['id' => 'date_from', 'name' => 'date_from', 'language' => 'ru', 'value' => date('d-m-Y', time()), 'template' => '{addon}{input}', 'clientOptions' => ['autoclose' => true, 'format' => 'dd-mm-yyyy']]); echo '<p /><label for="date"> Дата приёма по: </label>'; echo DatePicker::widget(['id' => 'date_to', 'name' => 'date_to', 'language' => 'ru', 'value' => date('d-m-Y', time()), 'template' => '{addon}{input}', 'clientOptions' => ['autoclose' => true, 'format' => 'dd-mm-yyyy']]); ?> <p /><p /> <!-- <a class="btn btn-default" href="">Показать</a>--> <div class="form-group form-inline"> <div class="checkbox"> <input id="one_day" type="checkbox" class=”form-control”/>
Тип визита </th> <td> <?php echo $form->field($model, 'visit_type')->radioList([Records::CASH => 'Наличные', Records::INSURER => 'Страховая компания'])->label(FALSE); ?> </td> </tr> <tr> <th> Страховая компания </th> <td> <?php $list = ArrayHelper::map(Insurers::find()->orderBy('name')->all(), 'id', 'name'); echo $form->field($model, 'insurer_id')->widget(Select2::classname(), ['data' => $list, 'language' => 'ru', 'options' => ['placeholder' => 'Выберите страховщика ...'], 'pluginOptions' => ['allowClear' => true]])->label(FALSE); ?> </td> </tr> </table> <div class="form-group"> <?php echo Html::submitButton('Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<br> <?php echo Html::endForm(); ?> </div> <div style="text-align: justify;" class="col-lg-4"> <h4> Αποφάσεις για ΑΦΜ για Οργανισμό </h4> <?php // Form 1 : Decisions per month pew organizations echo Html::beginForm('index.php?r=results/resultsb21afmorg', 'post'); // 2. Show selected Organisations echo '<label class="control-label">Οργανισμοί</label>'; echo Select2::widget(['name' => 'select_orgs', 'data' => $currentOrgs, 'value' => '', 'options' => ['placeholder' => 'Οργανισμός...', 'multiple' => false]]); echo Html::textInput("set_afm"); ?> <br> <?php echo Html::submitButton('Εμφάνιση'); ?> <br> <?php echo Html::endForm(); ?> </div> </div>
?> </div> </div> <div class="panel panel-default"> <div class="panel-heading">消息模版</div> <div class="panel-body"> <?php echo $form->field($model, "smsTemplate_id")->widget(Select2::className(), ["data" => $templates, 'options' => ['placeholder' => '选择消息模版'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> </div> <div class="panel panel-default"> <div class="panel-heading">选择设备</div> <div class="panel-body"> <?php echo $form->field($model, "sms_device_type")->widget(Select2::className(), ["data" => [0 => '有线设备', 1 => '无线设备']]); ?> <?php echo $form->field($model, 'dev_ips', ['skipFormLayout' => true, 'inputOptions' => ['style' => 'width:1000px;']]); ?> </div> </div> <div class="panel panel-default"> <div class="panel-heading">告警条件设置</div> <div class="panel-body" id="condition"> </div> </div> <?php echo $form->field($model, "alarmSet")->hiddenInput(["id" => "alarmSet"]);
</td> <td><?php echo Yii::t('app', 'Credit'); ?> </td> <td><?php echo Yii::t('app', 'Debit'); ?> </td> </tr> </thead> <tbody> <tr> <td> <?php echo $form->field($model, 'account_id', ['template' => '{input}'])->widget(Select2::className(), ['data' => \yii\helpers\ArrayHelper::map(Accounts::find()->All(), 'id', 'name')]); ?> </td> <td> <span id="nameTransactions_account_id"></span> </td> <td> <input size="6" id="sourcepos" type="text" class="number" name="FormTransaction[sourcepos]" onchange="CalcSum()" value="0"> </td> <td> <input size="6" id="sourceneg" type="text" class="number" name="FormTransaction[sourceneg]" onchange="CalcSum()" value="0"> </td> </tr> </tbody> <tfoot>
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'image[]')->fileInput(['multiple' => true]); ?> <?php echo \bariew\postAbstractModule\widgets\ImageGallery::widget(['model' => $model, 'field' => 'thumb1']); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'categories')->widget(Select2::className(), ['data' => $model->categoriesList(), 'options' => ['placeholder' => false, 'multiple' => true]]); ?> <?php echo $form->field($model, 'brief')->widget(\yii\imperavi\Widget::className(), ['options' => ['minHeight' => 100, 'fileUpload' => Url::toRoute(['file-upload', 'attr' => 'brief', 'id' => $model->id]), 'imageUpload' => Url::toRoute(['image-upload', 'attr' => 'brief', 'id' => $model->id]), 'imageGetJson' => Url::toRoute(['image-list', 'attr' => 'brief', 'id' => $model->id]), 'imageUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }'), 'fileUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }')]]); ?> <?php echo $form->field($model, 'content')->widget(\yii\imperavi\Widget::className(), ['options' => ['minHeight' => 300, 'fileUpload' => Url::toRoute(['file-upload', 'attr' => 'content', 'id' => $model->id]), 'imageUpload' => Url::toRoute(['image-upload', 'attr' => 'content', 'id' => $model->id]), 'imageGetJson' => Url::toRoute(['image-list', 'attr' => 'content', 'id' => $model->id]), 'imageUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }'), 'fileUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }')]]); ?> <?php echo $form->field($model, 'status')->dropDownList($model->statusList()); ?> <div class="form-group text-right">
echo $form->field($model, 'phone')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'gambar')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]); ?> <!--$form->field($model, 'image')->fileInput() ?>--> <?php echo $form->field($model, 'itemType')->widget(Select2::classname(), ['data' => $datastatik, 'options' => ['placeholder' => 'pilih ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <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>
/*Html::encode()*/ // plain text, not json } ?> <?php if (!empty($model->tags)) { ?> <br>-- <br> <?php foreach ($model->tags as $tag) { ?> <?php echo Html::a("#" . $tag->name, Url::toRoute(['/', 'query' => "#" . $tag->name])); ?> <?php } ?> <?php } ?> <hr> <?php $form = ActiveForm::begin(['action' => '', 'method' => 'post']); echo Html::tag("div", $form->field($model, 'id')->hiddenInput() . $form->field($model, 'text')->hiddenInput() . $form->field($model, 'hash')->hiddenInput() . $form->field($model, 'created')->hiddenInput() . $form->field($model, 'ip')->hiddenInput() . $form->field($model, 'user_agent')->hiddenInput(), ['style' => "display: none;"]); echo $form->field($model, 'tags')->widget(Select2::className(), ['data' => ArrayHelper::map(Tag::find()->all(), 'id', 'name'), 'options' => ['multiple' => true, 'placeholder' => 'Теги', 'id' => 'moderation-tags-' . $model->id], 'pluginOptions' => ['tags' => true, 'maximumInputLength' => 255]]); echo Html::tag("div", Html::a('Редактировать', ['edit', 'id' => $model->id], ['class' => 'btn btn-warning']) . " " . Html::submitButton('Опубликовать', ['class' => 'btn btn-success']), ['style' => "text-align: center;"]); $form->end(); ?> </div> </div>
echo $form->field($user, 'status')->dropDownList($user::statusDropdown()); ?> </div> </div> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($user, 'role_id')->widget(Select2::classname(), ['data' => array_reverse($role::dropdown(), true), 'hideSearch' => true, 'pluginEvents' => ["select2:select" => "function(e) {\n if( e.params.data.id == '2' ) {\n \$('#formList').show();\n } else {\n \$('#formList').hide();\n }\n }"]])->label(Yii::t('app', 'Role')); ?> </div> <div class="col-sm-6" id="formList"> <?php echo Html::label(Yii::t('app', 'Grant Access')); ?> <?php echo Select2::widget(['name' => 'forms', 'data' => $forms, 'value' => isset($userForms) ? $userForms : null, 'options' => ['placeholder' => Yii::t('app', 'Select forms...'), 'multiple' => true], 'pluginOptions' => ['allowClear' => true]]); ?> <p class="help-block"><?php echo Yii::t('app', 'By default, users have no access.'); ?> </p> </div> </div> <div class="row"> <div class="col-sm-2"> <?php // use checkbox for ban_time ?> <?php // convert `ban_time` to int so that the checkbox gets set properly ?>
echo $form->field($model, 'tumbon')->widget(DepDrop::className(), ['data' => $tum, 'options' => ['placeholder' => '<--คลิกเลือกตำบล-->'], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['employees-chw', 'employees-ampur'], 'url' => yii\helpers\Url::to(['/employees/get-dist']), 'loadingText' => 'กำลังค้นข้อมูล...']]); ?> </div> <div class="col-xs-3 col-sm-3 col-md-3"> <?php echo $form->field($model, 'tel')->widget(\yii\widgets\MaskedInput::classname(), ['mask' => '999-999-9999']); ?> </div> <div class="col-xs-3 col-sm-3 col-md-3"> <?php echo $form->field($model, 'comein')->widget(DatePicker::className(), ['language' => 'th', 'dateFormat' => 'yyyy-MM-dd', 'clientOptions' => ['changeMonth' => true, 'changeYear' => true], 'options' => ['class' => 'form-control']]); ?> </div> <div class="col-xs-3 col-sm-3 col-md-3"> <?php echo $form->field($model, 'department_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Departments::find()->all(), 'id', 'name'), 'language' => 'th', 'options' => ['placeholder' => 'เลือกแผนก ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-xs-3 col-sm-3 col-md-3"> <?php echo $form->field($model, 'education')->dropDownList(['ปริณญาตรี' => 'ปริณญาตรี', 'ปริณญาโท' => 'ปริณญาโท', 'สูงกว่าระดับปริณญาโทขึ้นไป' => 'สูงกว่าระดับปริณญาโทขึ้นไป', 'ปวส/อนุปริณญา' => 'ปวส/อนุปริณญา', 'มัธยมศึกษา6' => 'มัธยมศึกษา6', 'มัธยมศึกษา3' => 'มัธยมศึกษา3', 'ประถมศึกษา' => 'ประถมศึกษา'], ['prompt' => '']); ?> </div> </div> <div class="row"> <div class="col-xs-6 col-sm-6col-md-6"> <?php echo $form->field($model, 'ability')->checkboxList(app\models\Employees::itemAlias('ability')); ?> </div> </div>
public static function getFormAttribs() { return ['id' => ['type' => TabularForm::INPUT_HIDDEN, 'columnOptions' => ['hidden' => true]], 'cat_title' => ['type' => TabularForm::INPUT_WIDGET, 'widgetClass' => \kartik\select2\Select2::classname(), 'options' => ['data' => ArrayHelper::map(Page::find()->asArray()->all(), 'id', 'page_title')]], 'cat_desc' => ['type' => TabularForm::INPUT_TEXT]]; }
<div id="dscAudiencia" class="col-lg-4" style="display:none"> <?php echo $form->field($model, 'dsc_audiencia')->textInput(['maxlength' => true]); ?> </div> <div id="nmProcesso" class="col-lg-4" style="display:none"> <?php echo $form->field($model, 'nm_processo')->textInput(['maxlength' => true]); ?> </div> <div class="col-lg-4"> <?php echo $form->field($model, 'id_juiz')->label('Informe o nome ou CPF do juiz')->widget(Select2::classname(), ['language' => 'pt', 'pluginOptions' => ['allowClear' => false, 'size' => Select2::LARGE, 'minimumInputLength' => 3, 'ajax' => ['url' => Url::to(['juiz/lista']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(juiz) { return juiz.num_cpf != \'\' ? juiz.dsc_nome +" - "+juiz.num_cpf : juiz.dsc_nome }'), 'templateResult' => new JsExpression('formataCampo'), 'templateSelection' => new JsExpression('function (juiz) { return juiz.dsc_nome; }'), 'select2:selecting' => new JsExpression("function() { console.log('selecting'); }")]]); echo Html::a('Adicionar Juiz', '#', ['data-toggle' => 'modal', 'data-target' => '#modalJuiz']); ?> </div> <div class="col-lg-4"> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Cadastrar' : 'Atualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> </div> <?php ActiveForm::end();