/** * @inheritdoc */ public function run() { $jsOptions = ['clientOptions' => $this->clientOptions]; $this->options['id'] = 'input-id'; if ($this->hasModel()) { echo Html::activeInput('file', $this->model, $this->attribute, $this->options); echo Html::img('#', ['id' => 'cropper-box']); echo Html::button('Crop', ['id' => 'cropImage']); $input_name = Html::getInputName($this->model, $this->attribute); $input_id = Html::getInputId($this->model, $this->attribute); echo Html::hiddenInput($input_name . '[file]', '', ['id' => $input_id . '_image']); $jsOptions['model'] = $this->model; $jsOptions['attribute'] = $this->attribute; } else { echo Html::fileInput($this->name, $this->value, $this->options); echo Html::img('#', ['id' => 'cropper-box']); echo Html::button('Crop', ['id' => 'cropImage']); } if ($this->uploadUrl) { $this->uploadUrl = \Yii::getAlias($this->uploadUrl); } $jsOptions['uploadUrl'] = $this->uploadUrl; $jsOptions['uploadCroppedUrl'] = $this->uploadCroppedUrl; $jsOptions['changeUrl'] = $this->changeUrl; $jsOptions['name'] = $this->name; $jsOptions['aspectRatio'] = $this->aspectRatio; $this->registerPlugin($jsOptions); }
public function renderSavedValueInput() { if ($this->hasModel()) { $value = Html::getAttributeValue($this->model, $this->attribute); } else { $value = $this->value; } if ($value !== null && $value !== '') { // format value according to saveDateFormat try { $value = Yii::$app->formatter->asDate($value, $this->saveDateFormat); } catch (InvalidParamException $e) { // ignore exception and keep original value if it is not a valid date } } $this->options['savedValueInputID'] = $this->options['id'] . '-saved-value'; $options = $this->options; $options['id'] = $options['savedValueInputID']; $options['value'] = $value; // render hidden input if ($this->hasModel()) { $contents = Html::activeHiddenInput($this->model, $this->attribute, $options); } else { $contents = Html::hiddenInput($this->name, $value, $options); } return $contents; }
public function init() { parent::init(); \Yii::setAlias('@webuploader', __DIR__); if (empty($this->driver)) { $this->driver = isset(\Yii::$app->params['webuploader_driver']) ? \Yii::$app->params['webuploader_driver'] : 'local'; } if ($this->driver == 'local') { // 初始化@static别名,默认@web/static,最好根据自己的需求提前设置好@static别名 $static = \Yii::getAlias('@static', false); $staticroot = \Yii::getAlias('@staticroot', false); if (!$static || !$staticroot) { \Yii::setAlias('@static', '@web/static'); \Yii::setAlias('@staticroot', '@webroot/static'); } } $this->server = $this->server ?: Url::to(['/site/webupload', 'driver' => $this->driver]); $this->options['boxId'] = isset($this->options['boxId']) ? $this->options['boxId'] : 'picker'; $this->options['previewWidth'] = isset($this->options['previewWidth']) ? $this->options['previewWidth'] : '250'; $this->options['previewHeight'] = isset($this->options['previewHeight']) ? $this->options['previewHeight'] : '150'; if ($this->hasModel()) { $this->hiddenInput = Html::activeHiddenInput($this->model, $this->attribute); } else { $this->hiddenInput = Html::hiddenInput($this->name, $this->value); } }
public function api_form($options = []) { $model = new FeedbackModel(); $settings = Yii::$app->getModule('admin')->activeModules['feedback']->settings; $options = array_merge($this->_defaultFormOptions, $options); ob_start(); $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]); echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0])); echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1])); echo $form->field($model, 'name'); echo $form->field($model, 'email')->input('email'); if ($settings['enablePhone']) { echo $form->field($model, 'phone'); } if ($settings['enableTitle']) { echo $form->field($model, 'title'); } echo $form->field($model, 'text')->textarea(); if ($settings['enableCaptcha']) { echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className()); } echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']); ActiveForm::end(); return ob_get_clean(); }
protected function get_content($data, $isActiveForm = FALSE) { $res = array(); // Ссылка добавления настройка для секции $res[] = Html::a('<i class="fa fa-cog"></i> add', [$this->add_set_link], ['class' => 'add_settings_in_section']); foreach ($data as $item) { $res[] = '<div class="row">' . '<div class="form-group">' . Html::label($item['key'], $item['key'], ['class' => 'col-sm-2 control-label']) . '<div class="col-sm-3">' . $this->set_input_type($item['type'], $item['key'], $item['value']) . Html::hiddenInput($item['key'] . '[type]', $item['type']) . '</div>' . '</div>' . '<div class="col-sm-4">' . Html::tag('span', $item['description']) . '</div>' . Html::label('active', 'active', ['class' => 'col-sm-2 control-label']) . '<div class="col-sm-1">' . Html::checkbox($item['key'] . '[active]', $this->has_checked($this->has_checked($item['active'])), ['data-atr' => 'icheck', 'class' => 'flat-red']) . '</div>'; } return $res; }
public function api_form($options = []) { $model = new FeedbackModel(); $settings = Yii::$app->getModule('admin')->activeModules['awarness']->settings; $options = array_merge($this->_defaultFormOptions, $options); ob_start(); $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/awarness/send']), 'options' => ['class' => 'col-md-offset-4']]); echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0])); echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1])); echo ' <div class="form-group center-block col-md-6">'; ' <input class="form-control" placeholder="Name" name="Feedback[name]"> <input class="form-control" placeholder="Subject" name="Feedback[title]"> <input class="form-control" placeholder="Your Mail" name="Feedback[email]" > <textarea class="form-control" rows="3" placeholder="Your Message" name="Feedback[text]" id="feedback-text"></textarea> <button type="submit" class="btn dry-btn-3 center-block">Send Request</button> </div> '; // echo $form->field($model, 'name'); // echo $form->field($model, 'email')->input('email'); // // if($settings['enablePhone']) echo $form->field($model, 'phone'); // if($settings['enableTitle']) echo $form->field($model, 'title'); // // echo $form->field($model, 'text')->textarea(); // // if($settings['enableCaptcha']) echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className()); // // echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']); ActiveForm::end(); return ob_get_clean(); }
public function api_form($options = []) { $model = new FeedbackModel(); $settings = Yii::$app->getModule('admin')->activeModules['agencies']->settings; $options = array_merge($this->_defaultFormOptions, $options); ob_start(); $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]); echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0])); echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1])); var_dump($model->getErrors()); echo ' <input type="text" placeholder="Title" class="form-control" name="Feedback[title]" > <input type="text" placeholder="Company Name" class="form-control" name="Feedback[name]" id="feedback-name"> <div class="help-block"></div> <input type="text" placeholder="Phone" class="form-control" name="Feedback[phone]" > <input type="text" placeholder="Email" class="form-control" name="Feedback[email]" > <textarea name="Feedback[text]" id="feedback-text" class="form-control msg" rows="5" placeholder="your message"></textarea> <div class="row"> <div class="col-md-12"> <button class="btn dry-btn center-block" type="submit">Send Request</button> </div> </div>'; // echo $form->field($model, 'name'); // echo $form->field($model, 'email')->input('email'); // // if($settings['enablePhone']) echo $form->field($model, 'phone'); // if($settings['enableTitle']) echo $form->field($model, 'title'); // // echo $form->field($model, 'text')->textarea(); // // if($settings['enableCaptcha']) echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className()); // // echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']); ActiveForm::end(); return ob_get_clean(); }
/** * Renders the widget. */ public function run() { $contents = []; if ($this->inline) { if ($this->hasModel()) { $contents[] = Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { $contents[] = Html::hiddenInput($this->name, $this->value, $this->options); } $contents[] = Html::tag('div', '', $this->containerOptions); } else { if ($this->hasModel()) { $contents[] = Html::activeTextInput($this->model, $this->attribute, $this->options); } else { $contents[] = Html::textInput($this->name, $this->value, $this->options); } } echo implode("\n", $contents); if ($this->language) { DatePickerAsset::$extraJs[] = 'plugins/bootstrap-datepicker-extended/js/locales/bootstrap-datepicker.' . $this->language . '.js'; $this->clientOptions['language'] = $this->language; } DatePickerAsset::register($this->view); $this->registerPlugin('datepicker'); if ($this->inline) { $this->view->registerJs("\n !(function(\$){\n var el = \$('#{$this->options['id']}'),\n val = el.val(),\n container = \$('#{$this->containerOptions['id']}');\n container.on('changeDate', function(e){\n el.val(e.format());\n });\n if(val) {\n container.datepicker('update', new Date(Date.parse(val)));\n }\n })(jQuery);\n ", View::POS_READY); } }
/** * @inheritdoc */ public function run() { if ($this->hasModel()) { $name = Html::getInputName($this->model, $this->attribute); $value = null; if (is_array($this->model->{$this->attribute})) { $value = StringHelper::base64EncodeUrl(serialize((array) $this->model->{$this->attribute})); } else { if (is_string($this->model->{$this->attribute})) { $value = $this->model->{$this->attribute}; } } $this->options['id'] = Html::getInputId($this->model, $this->attribute); //$element = Html::activeHiddenInput($this->model, $this->attribute, $this->options); $element = Html::hiddenInput($name, $value, $this->options); } else { $element = Html::hiddenInput($this->name, $this->value, $this->options); } $this->registerPlugin(); $this->clientOptions['componentSelectId'] = $this->componentSelectId; $this->clientOptions['componentSettingsId'] = Html::getInputId($this->model, $this->attribute); $this->clientOptions['id'] = $this->id; $this->clientOptions['backend'] = UrlHelper::construct('/cms/admin-universal-component-settings/index')->setSystemParam(Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->enableAdmin()->toString(); return $this->render('element', ['widget' => $this, 'element' => $element]); }
public function run() { if ($this->hasModel()) { $replace['{input}'] = Html::activeHiddenInput($this->model, $this->attribute, $this->options); $attributeId = Html::getInputId($this->model, $this->attribute); $id = Html::getInputId($this->model, 'hydra_' . $this->attribute); $name = Html::getInputName($this->model, 'hydra_' . $this->attribute); $this->value = $this->model[$this->attribute]; } else { $replace['{input}'] = Html::hiddenInput($this->name, $this->value, $this->options); $name = $id = 'hydra_' . $this->name; $attributeId = $this->name; } $fileInputName = empty($this->fileInputName) ? $name : $this->fileInputName; $replace['{preview}'] = 'Файл еще не загружен'; if (!empty($this->value)) { $replace['{preview}'] = $this->value; $extension = Yii::$app->hydra->getExtension($this->value); if (Yii::$app->hydra->isImage($extension)) { $replace['{preview}'] = Html::img(Yii::$app->hydra->getCacheUrl($this->value, $this->resolution), ['id' => $id . '_image']); } $replace['{reset-button}'] = Html::tag($this->resetButton['tag'], $this->resetButton['label'], ArrayHelper::merge(['onClick' => '$("#' . $attributeId . '").val("");$("#' . $id . '_image' . '").remove();$(this).remove();'], $this->resetButton['options'])); } $replace['{input}'] .= Html::fileInput($fileInputName, null, ArrayHelper::merge(['id' => $id], $this->fileInput['options'])); return strtr($this->template, $replace); }
/** * @inheritdoc */ public function run() { if ($this->hasModel()) { return Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { return Html::hiddenInput($this->name, '', $this->options); } }
/** * @inheritdoc */ public function run() { $this->registerAssets(); if ($this->name === null) { return Html::activeHiddenInput($this->model, $this->attribute, $this->options); } return Html::hiddenInput($this->name, $this->value, $this->options); }
public function renderWidget() { if ($this->hasModel()) { $result = Html::activeHiddenInput($this->model, $this->attribute); } else { $result = Html::hiddenInput($this->name, $this->value); } }
/** * Renders a text input for widget display along with an internal * hidden input to validate and save the raw number (float) data. */ protected function renderInput() { $name = $this->_displayOptions['id']; Html::addCssClass($this->_displayOptions, 'form-control'); $input = Html::textInput($name, $this->value, $this->_displayOptions); $input .= $this->hasModel() ? Html::activeHiddenInput($this->model, $this->attribute, $this->options) : Html::hiddenInput($this->name, $this->value, $this->options); echo $input; }
private function renderInput() { if ($this->hasModel()) { return Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { return Html::hiddenInput($this->name, $this->value, $this->options); } }
public function run() { echo Html::beginForm(Url::to([$this->actionUrl]), 'post', []); if (!empty($this->returnUrl)) { echo Html::hiddenInput('returnUrl', $this->returnUrl); } echo Html::dropDownList('language', Yii::$app->language, Yii::$app->czaHelper->getEnabledLangs(), ['id' => $this->htmlId(), 'onchange' => 'this.form.submit()']); echo Html::endForm(); }
/** * Скрытое текстовое поле * @param type $rowParams - параметры * @param type $value - значения * @return type */ public function Hidden($rowParams = [], $value = "", $item = []) { $params = $this->MakeRowParams($rowParams["params"]); if (isset($params["value"])) { $value = $params["value"]; } $tag = Html::hiddenInput($this->ReturnGroup($rowParams), $value, $params); return $tag; }
/** * @inheritdoc */ public function run() { $this->registerClientScript(); if ($this->hasModel()) { echo Html::activeHiddenInput($this->model, $this->attribute, ['id' => null]) . Html::activeInput('file', $this->model, $this->attribute, $this->options); } else { echo Html::hiddenInput($this->name, $this->value, ['id' => null]) . Html::input('file', $this->name, $this->value, $this->options); } }
public function run() { $form = \yii\widgets\ActiveForm::begin(['id' => 'simple-search-form', 'action' => [$this->options['action']], 'enableAjaxValidation' => false]); echo Html::textInput('search', null, ['class' => 'form-control', 'hint' => YBoard::t('yboard', 'Search')]); echo Html::hiddenInput('type', '0'); echo Html::hiddenInput('choice', '0'); Html::submitButton('Submit', ['class' => 'small-search-button']); \yii\widgets\ActiveForm::end(); }
public function run() { $view = $this->getView(); JsoneditorAsset::register($view); $editorName = BaseInflector::camelize($this->id) . 'Editor'; $view->registerJs("var container = document.getElementById('" . $this->options['id'] . "');\n var options = " . Json::encode($this->editorOptions) . ";\n var json = " . $this->value . ";\n " . $editorName . " = new JSONEditor(container, options, json);\n jQuery('#" . $this->id . "').parents('form').eq(0).submit(function() {\n jQuery('#" . $this->id . "').val(" . $editorName . ".getText());\n return true;\n });"); echo Html::hiddenInput($this->name, $this->value, ['id' => $this->id]); echo Html::tag('div', '', $this->options); }
public function run() { $view = $this->getView(); FileUploadAsset::register($view); $this->createUploaderOptions(); $this->options['class'] = 'required'; echo Html::hiddenInput(Html::getInputName($this->model, $this->attribute), '', ['id' => 'dwz-file-uploader']); echo Html::activeInput('file', $this->model, $this->attribute, $this->options); }
/** * @inheritdoc */ public function run() { if ($this->hasModel()) { echo Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { echo Html::hiddenInput($this->name, $this->value, $this->options); } $this->registerClientScript(); }
public function run() { //Sets $items = []; $i = 1; foreach ($this->items as $id => $title) { $items[] = '<span class="ui-icon ui-icon-arrowthick-2-n-s"></span> ' . $i++ . '. ' . Html::hiddenInput('sort[]', $id) . $title; } return $this->render('sorting', ['items' => $items, 'empty' => $this->empty, 'button' => $this->button]); }
public function init() { $this->fieldConfig['horizontalCssClasses']['label'] = 'col-sm-' . $this->labelCols; $this->fieldConfig['horizontalCssClasses']['wrapper'] = 'col-sm-' . (self::COLS_TOTAL - $this->labelCols); parent::init(); $params = Yii::$app->request->queryParams; if (!empty($params['_return_url'])) { echo Html::hiddenInput('_return_url', $params['_return_url']); } }
/** * @inheritdoc */ public function run() { $this->registerScripts(); if ($this->hasModel()) { $input = Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { $input = Html::hiddenInput($this->name, $this->value, $this->options); } return $this->render($this->template, ['selector' => $this->getSelector(), 'input' => $input, 'inputName' => $this->inputName, 'value' => $this->hasModel() ? $this->model->{$this->attribute} : $this->value, 'preview' => $this->preview, 'crop' => $this->crop, 'model' => $this->model, 'attribute' => $this->attribute]); }
/** * Renders the widget. */ public function run() { $this->registerClientScript(); if ($this->hasModel()) { $input = Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { $input = Html::hiddenInput($this->name, $this->value, $this->options); } echo strtr($this->template, ['{input}' => $input, '{jstree}' => Html::tag('div', '', ['id' => $this->getJsTreeId()])]); }
/** * @return string bootstrap-picker button with hiddenInput field where we put selected value */ public function run() { if ($this->hasModel()) { $inp = Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { $inp = Html::hiddenInput($this->name, $this->value, $this->options); } $picker = Html::button('Выберите иконку', $this->pickerOptions); return Html::tag('div', $picker . $inp, $this->containerOptions); }
public function run() { echo Html::beginForm($this->getComponent()->paymentAction, 'post', $this->options); echo Html::hiddenInput('shopId', $this->getComponent()->shopId); echo Html::hiddenInput('scid', $this->getComponent()->scId); echo Html::hiddenInput('sum', $this->order->getTotalPrice()); echo Html::hiddenInput('customerNumber', $this->userIdentity->getCustomerId()); if (is_array($this->paymentType)) { echo Html::dropDownList('paymentType', array_keys($this->paymentType)[0], $this->paymentType); } if (is_array($this->data)) { foreach ($this->data as $key => $value) { echo Html::hiddenInput($key, $value); } } if ($phone = $this->userIdentity->getCustomerPhone()) { echo Html::hiddenInput('cps_phone', $phone); } if ($email = $this->userIdentity->getCustomerEmail()) { echo Html::hiddenInput('cps_email', $email); } if ($orderId = $this->order->getId()) { echo Html::hiddenInput('orderNumber', $orderId); } echo Html::submitButton(Yii::t($this->getComponent()->messagesCategory, $this->submitText)); echo Html::endForm(); }
/** * @inheritdoc */ public function run() { $hasModel = $this->hasModel(); if ($hasModel) { if (array_key_exists('value', $this->options)) { $value = $this->options['value']; } else { $value = Html::getAttributeValue($this->model, $this->attribute); } } else { $value = $this->value; } $altValue = $value; if ($hasModel) { $this->options = array_merge($this->options, ['name' => false, 'value' => $value]); $this->altOptions['value'] = $altValue; $output = Html::activeTextInput($this->model, $this->attribute, $this->options) . Html::activeHiddenInput($this->model, $this->attribute, $this->altOptions); } else { $output = Html::textInput(false, $value, $this->options) . Html::hiddenInput($this->name, $altValue, $this->altOptions); } $js = 'jQuery(\'#' . $this->options['id'] . '\').inputmask(' . Json::htmlEncode($this->clientOptions) . ').keyup(function (event) { jQuery(\'#' . $this->altOptions['id'] . '\').val(jQuery(this).inputmask(\'unmaskedvalue\')); });'; if (Yii::$app->getRequest()->getIsAjax()) { $output .= Html::script($js); } else { $view = $this->getView(); InputMaskAsset::register($view); $view->registerJs($js); } return $output; }
public function api_form($options = []) { $model = new FeedbackModel(); $settings = Yii::$app->getModule('admin')->activeModules['feedback']->settings; $options = array_merge($this->_defaultFormOptions, $options); ob_start(); $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send']), 'options' => ['class' => 'col form']]); echo '<p class="caption">' . Text::get('contact-page-leave-us-a-message') . '</p>'; echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0])); echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1])); echo $form->field($model, 'name', ['options' => ['tag' => 'fieldset'], 'errorOptions' => ['class' => 'msg-error', 'tag' => 'p'], 'template' => '{input}{error}', 'selectors' => ['input' => '#input-001']])->input('text', ['id' => 'input-001', 'placeholder' => Yii::t('all', 'Name')]); echo $form->field($model, 'email', ['options' => ['tag' => 'fieldset'], 'errorOptions' => ['class' => 'msg-error', 'tag' => 'p'], 'template' => '{input}{error}', 'selectors' => ['input' => '#input-002']])->input('email', ['id' => 'input-002', 'placeholder' => Yii::t('all', 'Your e-mail')]); if ($settings['enablePhone']) { echo $form->field($model, 'phone'); } if ($settings['enableTitle']) { echo $form->field($model, 'title'); } echo $form->field($model, 'text', ['options' => ['tag' => 'fieldset'], 'errorOptions' => ['class' => 'msg-error', 'tag' => 'p'], 'template' => '{input}{error}', 'selectors' => ['input' => '#input-005']])->textArea(['rows' => '6', 'id' => 'input-005', 'placeholder' => Yii::t('all', 'Message text')]); if ($settings['enableCaptcha']) { echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className()); } echo Html::submitButton(Yii::t('all', 'send a message'), ['class' => 'btn btn-primary']); ActiveForm::end(); return ob_get_clean(); }