public function run() { $label = Html::activeLabel($this->translations[0], $this->fieldName, ['class' => 'control-label']); $tabs = Tabs::widget(['encodeLabels' => false, 'items' => $this->_tabItems, 'options' => ['class' => 'translation-tabs']]); $content = Html::tag('div', $label . $tabs, ['class' => 'form-group nav-tabs-custom language-tabs']); return $content; }
public function renderLabel() { $label = $this->encodeLabel ? Html::encode($this->label) : $this->label; if (!isset($this->labelOptions['for'])) { $this->labelOptions['for'] = $this->hasModel() ? $this->attribute : $this->name; } return $this->hasModel() ? Html::activeLabel($this->model, $this->attribute, $this->labelOptions) : Html::label($this->label, $this->labelOptions['for'], $this->labelOptions); }
public function run() { echo Html::activeLabel($this->model, $this->titleAttribute); echo Html::activeTextInput($this->model, $this->titleAttribute, ['id' => 'title-input', 'maxlength' => 64]); echo '<div id="slug-block">'; echo Html::activeLabel($this->model, $this->slugAttribute); echo Html::activeTextInput($this->model, $this->slugAttribute, ['id' => 'slug-input', 'value' => '', 'maxlength' => 64]); echo ' <div id="results"></div> </div><!--/slug-block--> '; $this->registerAssets(); }
public function render($content = null) { if ($content === null) { if (!isset($this->parts['{input}'])) { $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions); } if (!isset($this->parts['{label}'])) { $labelsHelp = $this->model->attributeHints(); if (isset($labelsHelp[$this->attribute])) { $this->labelOptions['label'] = '<span data-toggle="tooltip" title="" data-original-title="'; $this->labelOptions['label'] .= Html::encode($labelsHelp[$this->attribute]); $this->labelOptions['label'] .= '">'; $this->labelOptions['label'] .= Html::encode($this->model->getAttributeLabel($this->attribute)); $this->labelOptions['label'] .= ' <span class="glyphicon glyphicon-question-sign" style="font-size: 8pt;" aria-hidden="true"></span>'; $this->labelOptions['label'] .= '</span>'; } else { $this->labelOptions['label'] = Html::encode($this->model->getAttributeLabel($this->attribute)); } $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions); } if (!isset($this->parts['{error}'])) { $this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions); } if (!isset($this->parts['{hint}'])) { $this->parts['{hint}'] = ''; } $content = strtr($this->template, $this->parts); } elseif (!is_string($content)) { $content = call_user_func($content, $this); } return $this->begin() . "\n" . $content . "\n" . $this->end(); }
/** * @inheritdoc */ public function renderHtml() { if ($this->model !== null) { return Html::activeLabel($this->model, $this->attribute, $this->options); } return Html::label($this->text, null, $this->options); }
public function init() { parent::init(); $this->_inputStr = '<div class="form-group">'; if ($this->hasModel()) { $this->_inputStr .= Html::activeLabel($this->model, $this->attribute); } else { $this->_inputStr .= Html::label($this->name); } $this->_inputStr .= '<div id="' . Html::encode($this->name) . '" class="input-group date">'; if ($this->hasModel()) { $value = Html::getAttributeValue($this->model, $this->attribute); } else { $value = $this->value; } if ($value !== null) { $value = Yii::$app->formatter->asDatetime($value); } $options = $this->options; $options['class'] = 'form-control'; //$options['readonly'] = ''; $options['value'] = $value; if ($this->hasModel()) { $this->_inputStr .= Html::activeTextInput($this->model, $this->attribute, $options); } else { $this->_inputStr .= Html::textInput($this->name, $this->value, $options); } $this->_inputStr .= '<span class="input-group-addon"> <span class="glyphicon-calendar glyphicon"></span> </span> </div> </div> '; }
public function init() { parent::init(); $this->_inputStr = '<div class="form-group">'; $this->_inputStr .= Html::activeLabel($this->model, $this->attribute); $this->_inputStr .= Html::activeDropDownList($this->model, $this->attribute, \common\models\User::getUserGroup(), $this->options); $this->_inputStr .= '</div>'; }
/** * Renders the input * * @return string */ protected function renderInput() { $this->options = array_merge($this->options, ['style' => $this->inputStyle]); if (!$this->hideInput) { return Html::activeLabel($this->model, $this->attribute, ['class' => 'control-label']) . '<div class="input-group drp-container form-drp-input" style="' . $this->wrapperStyle . '">' . $this->getInput('textInput') . Html::submitButton('<span class="glyphicon glyphicon-floppy-save"></span> ' . \Yii::t('admin', 'Export'), ['class' => 'btn btn-info']) . '</div>' . '<div class="help-block ">' . Html::error($this->model, $this->attribute, ['class' => 'help-block help-block-error']) . '</div>'; } $tag = ArrayHelper::remove($this->containerOptions, 'tag', 'div'); $content = str_replace('{input}', $this->getInput('hiddenInput'), $this->containerTemplate); $content = str_replace('{error}', '<div class="help-block ">' . Html::error($this->model, $this->attribute, ['class' => 'help-block help-block-error']) . '</div>', $content); return Html::tag($tag, $content, $this->containerOptions); }
public function checkbox($options = [], $type = 'checkbox', $enclosedByLabel = true) { if ($type == 'checkbox') { $classname = '\\vx\\Semantic\\Modules\\Checkbox'; } else { $classname = '\\vx\\Semantic\\Modules\\Radio'; } $config = $this->getCheckboxListOptions($options); $checkboxOptions = $config['checkbox']; $options = ['options']; $this->parts['{label}'] = ''; $this->parts['{input}'] = $classname::widget(['class' => $classname::className(), 'model' => $this->model, 'attribute' => $this->attribute, 'options' => $options, 'label' => Html::activeLabel($this->model, $this->attribute, $this->labelOptions), 'inputOptions' => $checkboxOptions['inputOptions'], 'labelOptions' => $checkboxOptions['labelOptions'], 'type' => $checkboxOptions['type'], 'readOnly' => $checkboxOptions['readOnly'], 'disabled' => $checkboxOptions['disabled'], 'fitted' => $checkboxOptions['fitted'], 'encodeLabel' => $checkboxOptions['encodeLabel']]); return $this; }
public function run() { $model = $this->model; $attribute = $this->attribute; $path = $model->{$attribute} ?: $this->path . "/images/noimage.gif"; $this->_html .= '<div class="form-group field-article-author" id="container">'; $this->_html .= Html::activeLabel($model, $attribute); $this->_html .= Html::activeHiddenInput($model, $attribute, ['id' => 'hidden_input', 'value' => $path]); $this->_html .= '<div id="pickfiles" style="height:50px;min-width:50px;max-width: 300px;overflow: hidden;"><img height="50" src="' . $path . '" /></div>'; $this->_html .= '</div> '; UploadAsset::register($this->view); $this->view->registerJs('$(function(){ initCoverImageUploader("pickfiles","container","2mb","' . $this->url . '","' . Yii::$app->request->getCsrfToken() . '","' . $this->path . '"); });'); return $this->_html; }
/** * Generates a form field. * A form field is associated with a model and an attribute. It contains a label, an input and an error message * and use them to interact with end users to collect their inputs for the attribute. * @param Model $model the data model * @param string $attribute the attribute name or expression. See [[Html::getAttributeName()]] for the format * about attribute expression. * @param array $options the additional configurations for the field object. These are properties of [[ActiveField]] * or a subclass, depending on the value of [[fieldClass]]. * @return string the created ActiveField object * @see fieldConfig */ public function imageField($model, $attribute, $options = []) { if ($model->{$attribute}) { $src = '@web/' . $model->{$attribute}; } else { $src = '@web/images/no_image.jpg'; } $imageField = ''; $imageField .= Html::activeLabel($model, $attribute, ['class' => 'col-sm-12 control-label']); $imageField .= Html::beginTag('label', ['for' => Html::getInputId($model, $attribute), ['class' => 'col-sm-8']]); $imageField .= Html::img($src, $options); $imageField .= Html::endTag('label'); $imageField .= Html::beginTag('span', ['class' => 'image-trash glyphicon glyphicon-remove-circle']); $imageField .= Html::endTag('span'); $imageField .= Html::activeFileInput($model, $attribute, ['style' => 'display:none']); $imageField .= Html::activeHiddenInput($model, 'removeImage', ['value' => '0']); return $imageField; }
/** * @inheritdoc */ public function render($content = null) { if ($content === null) { if (!isset($this->parts['{input}'])) { $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions); } if (!isset($this->parts['{label}'])) { $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions); } if (!isset($this->parts['{error}'])) { $this->parts['{error}'] = $this->_error($this->model, $this->attribute, $this->errorOptions); } if (!isset($this->parts['{hint}'])) { $this->parts['{hint}'] = ''; } $content = strtr($this->template, $this->parts); } elseif (!is_string($content)) { $content = call_user_func($content, $this); } return $this->begin() . "\n" . $content . "\n" . $this->end(); }
protected function renderField($fieldName) { $type = $this->checkCustomType($fieldName); if (!$type) { $type = $this->schema->columns[$fieldName]->type; } $field = $this->form->field($this->owner, $fieldName); switch ($type) { case self::TypeHidden: $input = $field->hiddenInput(); break; case self::TypePassword: $input = $field->passwordInput(); break; case self::TypeFile: $input = $field->fileInput(); break; case self::TypeBoolean: $input = $field->checkbox(); break; case self::TypeDropDown: $input = $field->dropDownList($this->config['dropDown'][$fieldName]); break; case self::TypeText: $input = $field->textarea(); break; default: $input = $field->textInput(); } if (array_key_exists($fieldName, $this->widget)) { $input->widget($this->widget[$fieldName]['class'], $this->widget[$fieldName]['config']); } if ($type != self::TypeHidden) { $label = $type == self::TypeBoolean ? '' : Html::activeLabel($this->owner, $fieldName); $error = implode(', ', $this->owner->getErrors($fieldName)); return "<div class='field {$type}'>\n {$label}\n {$input->parts['{input}']}\n {$error}\n </div>"; } else { return $input->parts['{input}']; } }
public function init() { parent::init(); $this->options['encodeSpaces'] = true; $this->options['prompt'] = '不选择'; $categories = CategoryTree::getInstance()->getAllCategories(); if (!empty($categories)) { foreach ($categories as $v) { $tempArr = []; $tempArr[$v['mid']] = str_repeat(' ', $v['depth'] - 1) . $v['name']; $this->_categories += $tempArr; if ($this->currentOptionDisabled) { $model = $this->model; $this->options['options'][$model->mid] = ['disabled' => true]; } } } $this->_inputStr = '<div class="form-group">'; $this->_inputStr .= Html::activeLabel($this->model, $this->attribute); $this->_inputStr .= Html::activeDropDownList($this->model, $this->attribute, $this->_categories, $this->options); $this->_inputStr .= '</div>'; }
public function init() { parent::init(); $this->options['encodeSpaces'] = true; $this->options['prompt'] = '不选择'; $categories = Category::getChildCategories(intval($this->parent)); if (!empty($categories)) { foreach ($categories as $v) { $tempArr = []; $tempArr[$v['id']] = str_repeat(' ', $v['class'] - 1) . $v['name']; $this->_categories += $tempArr; if ($this->currentOptionDisabled) { $model = $this->model; $this->options['options'][$model->id] = ['disabled' => 'disabled']; } } } $this->_html = '<div class="form-group">'; $this->_html .= Html::activeLabel($this->model, $this->attribute); $this->_html .= Html::activeDropDownList($this->model, $this->attribute, $this->_categories, $this->options); $this->_html .= '</div>'; }
/** @inheritdoc */ public function render($content = null) { if ($content === null) { if (!isset($this->parts['{input}'])) { $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions); } if (!isset($this->parts['{label}'])) { $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions); } if (!isset($this->parts['{error}'])) { $this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions); } if (!isset($this->parts['{hint}'])) { $this->parts['{hint}'] = ''; } $containerTag = ArrayHelper::remove($this->containerOptions, 'tag', 'div'); $this->parts['{input}'] = Html::tag($containerTag, "{$this->parts['{input}']}\n" . ArrayHelper::remove($this->parts, '{error}') . "\n" . ArrayHelper::remove($this->parts, '{hint}'), $this->containerOptions); $content = strtr($this->template, $this->parts); } elseif (!is_string($content)) { $content = call_user_func($content, $this); } return $this->begin() . "\n" . $content . "\n" . $this->end(); }
<?php use yii\helpers\Html; $this->registerJs($model->addValidators($this, 'name'), 5); ?> <?php echo Html::activeLabel($model, 'name', ['class' => 'uk-form-label']); ?> <div class="uk-from-controls"> <?php echo Html::activeInput('text', $model, 'name', ['class' => 'uk-width-1-1']); ?> <div class="uk-form-help-block uk-text-danger"></div> </div>
$this->params['breadcrumbs'][] = ['label' => 'Usuarios', 'url' => ['usuario/index']]; $this->params['breadcrumbs'][] = ['label' => 'Editar: ' . $model->attributes['nombres'] . ' ' . $model->attributes['apellidos'], 'url' => ['usuario/editar?id=' . $model->attributes['id']]]; $this->params['breadcrumbs'][] = $this->title; ?> <?php echo Html::beginForm($action = 'passwordupdate', $method = 'post', $options = []); ?> <div class="row"> <div class="col-lg-3"> <div class="form-group"> <?php echo Html::activeHiddenInput($model, "id"); ?> <?php echo Html::activeLabel($model, 'password', $options = []); ?> <?php echo Html::input('password', 'password', null, ['class' => 'form-control', 'placeholder' => 'Contraseña']); ?> </div> <div class="form-group"> <?php echo Html::label('Verificar', $options = []); ?> <?php echo Html::input('password', 'repeat_password', null, ['class' => 'form-control', 'placeholder' => 'Verificar contraseña']); ?> </div> <?php echo Html::submitButton('Procesar', ['class' => 'btn btn-default']);
/** * Generates a label tag for [[attribute]]. * @param string|boolean $label the label to use. If null, the label will be generated via [[Model::getAttributeLabel()]]. * If false, the generated field will not contain the label part. * Note that this will NOT be [[Html::encode()|encoded]]. * @param array $options the tag options in terms of name-value pairs. It will be merged with [[labelOptions]]. * The options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded * using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered. * @return static the field object itself */ public function label($label = null, $options = []) { if ($label === false) { $this->parts['{label}'] = ''; return $this; } $options = array_merge($this->labelOptions, $options); if ($label !== null) { $options['label'] = $label; } $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $options); return $this; }
public function checkbox($options = [], $enclosedByLabel = true) { $this->parts['{label}'] = ''; $this->parts['{input}'] = Checkbox::widget(['class' => Checkbox::className(), 'model' => $this->model, 'attribute' => $this->attribute, 'options' => $options, 'label' => Html::activeLabel($this->model, $this->attribute, $this->labelOptions)]); return $this; }
<div class "form-group field-insumos-idprodutoinsumo required" id="<?= 'inputinsumo' .$i ?>"> <?php /*echo $form->field($models[$i], $idprodutoInsumo)->widget(Select2::classname(), [ //'name'=>'insumos[]', 'data' => $insumos, 'value'=>[77777777777777777], 'options' => ['placeholder' => 'Selecione o insumo', 'id'=>'idinsumo'.$i, ], 'pluginOptions' => [ 'allowClear'=>true, ], ]);*/ echo Html::activeLabel($models[$i], $idprodutoInsumo, ['class'=>'control-label']); echo Select2::widget([ 'model'=>$models[$i], 'name' =>'Insumos[idprodutoInsumo][]', 'value' => $models[$i]->idprodutoInsumo, // initial value 'data' => $insumos, 'options' => ['placeholder' => 'Selecione o insumo', 'id'=>'idinsumo'.$i, ], 'pluginOptions' => [ 'allowClear'=>true, ], 'pluginEvents'=>[ "change" => "function() {
<td colspan="3"><i>Please enter your username and password</i></td> </tr> <tr> <td width="80px"><?php echo Html::activeLabel($model, 'username'); ?> </td> <td>:</td> <td><?php echo Html::activeTextInput($model, 'username'); ?> </td> </tr> <tr> <td><?php echo Html::activeLabel($model, 'password'); ?> </td> <td>:</td> <td><?php echo Html::activePasswordInput($model, 'password'); ?> </td> </tr> <tr> <td></td> <td></td> <td><?php echo Html::activeCheckbox($model, 'rememberMe'); ?> </td>
<div class="form-group field-<?php echo \kartik\helpers\Html::getInputId($model, $property_key); ?> "> <?php if ($multiple) { ?> <?php echo \yii\helpers\Html::hiddenInput(\yii\helpers\Html::getInputName($model, $property_key), ''); ?> <?php } ?> <?php echo \yii\helpers\Html::activeLabel($model, $property_key, ['class' => 'col-md-2 control-label']); ?> <div class="col-md-10"> <?php $addUrl = \yii\helpers\Url::to(['/backend/properties/add-static-value', 'key' => $property_key, 'returnUrl' => Yii::$app->request->url]); ?> <?php echo kartik\widgets\Select2::widget(['name' => \yii\helpers\Html::getInputName($model, $property_key), 'data' => ['' => ''] + app\models\PropertyStaticValues::getSelectForPropertyId($property_id), 'options' => ['multiple' => $multiple ? true : false], 'pluginOptions' => ['allowClear' => false, 'escapeMarkup' => new \yii\web\JsExpression('function (markup) {return markup;}'), 'language' => new \yii\web\JsExpression('{ noResults:function(){ var NowValue = encodeURI($(".select2-dropdown--below input.select2-search__field").val()); return "<a data-toggle=\'modal\' href=\'' . $addUrl . '&value="+ NowValue +"\' data-target=\'#newStaticValue\'>Add static value</a>" } }')], 'value' => is_array($model->{$property_key}) ? $model->{$property_key} : explode(', ', $model->{$property_key})]); ?> </div> </div>
* Time: 18:15 */ use yii\widgets\ActiveForm; use yii\helpers\Html; $form = ActiveForm::begin(['id' => 'assignment-form']); ?> <?php echo $form->field($model, 'roles')->checkboxList($roles); echo $form->field($model, 'app')->checkboxList($app); $flag = 1; foreach ($permissions as $items) { ?> <?php if ($flag === 1) { $label = Html::activeLabel($model, 'permissions', ['class' => 'control-label']); $flag = 0; } else { $label = ''; } ?> <?php echo $form->field($model, 'permissions', ['parts' => ['{label}' => $label]])->checkboxList($items, ['unselect' => null, 'class' => 'own-routes-list']); } ?> <div class="form-group"> <?php echo Html::submitButton('修改', ['class' => 'btn btn-success btn-sm']); ?> </div>
?> </div> <div class="col-md-8"> <?php echo Html::activeTextarea($model, 'itemTemplate', ['class' => 'form-control', 'rows' => 2]); ?> </div> <div class="col-md-4"> <div>HTML-шаблон элемента меню. Переменные для шаблона: </div> <div><b>{Текст}</b> - текст ссылки</div> <div><b>{URL}</b> - веб-адрес страницы</div> </div> </div> <div class="row form-group"> <div class="col-md-12"><?php echo Html::activeLabel($model, 'endTemplate'); ?> </div> <div class="col-md-8"> <?php echo Html::activeTextarea($model, 'endTemplate', ['class' => 'form-control', 'rows' => 2]); ?> </div> <div class="col-md-4"> HTML-код, который будет выведен <strong>после</strong> элементов меню. </div> </div> <?php $this->endBlock(); ?> <?php
<?php echo Html::beginForm(); ?> <?php $this->beginBlock('panel1'); ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Внешний вид</h3> </div> <div class="panel-body"> <div class="row"> <div class="col-md-12"> <?php echo Html::activeLabel($model, 'appearance'); ?> </div> <div class="col-md-6"> <?php echo Html::activeDropDownList($model, 'appearance', ['nav-tabs' => 'Вкладки', 'nav-pills' => 'Кнопки']); ?> </div> </div> </div> </div> <?php $this->endBlock(); ?> <?php $this->beginBlock('panel2');
echo $model->id; ?> "> <?php $form = ActiveForm::begin(['id' => 'product_update-form']); ?> <div class="col-md-4"> <input type="hidden" name="id" value="<?php echo $model->id; ?> " id="product_id"> <?php echo Html::activeLabel($ProductCategoryRel, 'category_id'); ?> <?php echo Select2::widget(['model' => $ProductCategoryRel, 'attribute' => 'category_id', 'data' => ProductCategory::getHierarchy_cat(), 'options' => ['placeholder' => 'Select Category ...', 'multiple' => true], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'slug')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'short_desc')->textArea(['col' => 2]); ?>
if ($s == 'city') { echo "<th class='text-center'>" . Yii::t('report', 'City') . "</th>"; } else { if ($s == 'emp_bloodgroup') { echo "<th class='text-center'>" . Yii::t('report', 'Blood Group') . "</th>"; } else { if ($s == 'emp_joining_date') { echo "<th class='text-center'>" . Yii::t('report', 'Joining Date') . "</th>"; } else { if ($s == 'emp_guardian_mobile_no') { echo "<th class='text-center'>" . Yii::t('report', 'Guardian No') . "</th>"; } else { if ($s == 'emp_email_id') { echo "<th class='text-center'>" . Html::activeLabel($emp_info, $s) . "</th>"; } else { echo "<th class='text-center'>" . Html::activeLabel($emp_info, $s) . " </th>"; } } } } } } } } } } } echo "</tr>"; $i = 1; $m = 1; foreach ($employee_data as $t => $sd) {
<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 Html::activeDropDownList($model, $attribute, $element->variants, ['option' => 'value']); ?> <div class="uk-form-help-block uk-text-danger"></div> </div>
public function renderLabel() { if (!isset($this->labelOptions['for'])) { $this->labelOptions['for'] = $this->inputOptions['id']; } return $this->hasModel() ? Html::activeLabel($this->model, $this->attribute, $this->labelOptions) : Html::label($this->label, $this->labelOptions['for'], $this->labelOptions); }