public function api_form() { $model = new GuestbookModel(); $settings = Yii::$app->getModule('admin')->activeModules['guestbook']->settings; ob_start(); $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/guestbook/send'])]); switch (Yii::$app->session->getFlash(GuestbookModel::FLASH_KEY)) { case 'success': $message = Yii::$app->getModule('admin')->activeModules['guestbook']->settings['preModerate'] ? Yii::t('easyii/guestbook/api', 'Message successfully sent and will be published after moderation') : Yii::t('easyii/guestbook/api', 'Message successfully added'); echo Alert::widget(['options' => ['class' => 'alert-success'], 'body' => $message]); break; case 'error': echo Alert::widget(['options' => ['class' => 'alert-danger'], 'body' => Yii::t('easyii/guestbook/api', 'An error has occurred')]); break; } echo $form->field($model, 'name'); 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 Order(); $model->scenario = 'confirm'; $settings = Yii::$app->getModule('admin')->activeModules['shopcart']->settings; $options = array_merge($this->_defaultFormOptions, $options); ob_start(); $form = ActiveForm::begin(['action' => Url::to(['/admin/shopcart/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, 'address'); if ($settings['enableEmail']) { echo $form->field($model, 'email'); } if ($settings['enablePhone']) { echo $form->field($model, 'phone'); } echo $form->field($model, 'comment')->textarea(); 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['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(); }
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(); }
/** * ACTION INDEX */ public function actionIndex() { /* variable content View Employe Author: -ptr.nov- // $searchModel_Dept = new DeptSearch(); //$dataProvider_Dept = $searchModel_Dept->search(Yii::$app->request->queryParams); Yii::$app->Mailer->compose() ->setFrom('*****@*****.**') ->setTo('*****@*****.**') ->setSubject('Message subject') ->setTextBody('Plain text content') //->setHtmlBody('<b>HTML content</b>') ->send(); //return $this->render('index'); */ $form = ActiveForm::begin(); $model = new DynamicModel(['TextBody', 'Subject']); $model->addRule(['TextBody', 'Subject'], 'required'); $ok = 'Test LG ERP FROM HOME .... GOOD NIGHT ALL, SEE U LATER '; $form->field($model, 'Subject')->textInput(); ActiveForm::end(); Yii::$app->mailer->compose()->setFrom(['*****@*****.**' => 'LG-ERP-POSTMAN'])->setTo('*****@*****.**')->setSubject('daily test email')->setTextBody($ok)->send(); /* \Yii::$app->mailer->compose() ->setFrom('*****@*****.**') ->setTo('*****@*****.**') ->setSubject('test subject') ->send(); */ }
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(); }
public function run() { $model = new \frontend\models\Search(); $form = ActiveForm::begin(['action' => '/search']); echo $form->field($model, 'search', ['template' => '{error}{input}'])->textInput()->label(false); echo Html::submitInput('', ['class' => 'search_submit']); ActiveForm::end(); }
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 render() { ob_start(); $form = ActiveForm::begin(); echo $form->errorSummary($this); echo $this->renderFormFile($form, $this); echo Html::tag('div', Html::submitButton(Yii::t('cms', 'Save'), ['class' => 'btn btn-primary']), ['class' => 'form-group']); ActiveForm::end(); return ob_get_clean(); }
public function renderSummary() { if ($this->summary) { $form = ActiveForm::begin(['id' => 'pagerForm', 'method' => 'post', 'options' => ['onsubmit' => 'return navTabSearch(this);']]); echo '<input type="hidden" name="pageNum" value="1" />'; echo '<input type="hidden" name="numPerPage" value="' . $this->dataProvider->getPagination()->getPageSize() . '"/>'; echo '<input type="hidden" name="orderField" value="${param.orderField}" />'; echo '<input type="hidden" name="orderDirection" value="${param.orderDirection}" />'; ActiveForm::end(); } else { return null; } }
/** * Renders the widget. */ public function run() { echo Html::beginTag('div', ['class' => 'portlet-input input-inline']); echo Html::beginTag('div', ['class' => 'input-icon right']); echo Html::tag('i', '', ['class' => 'icon-magnifier']); ActiveForm::begin(['action' => $this->url, 'method' => 'get']); echo Html::activeInput('text', $this->searchModel, 'searchField', ['class' => 'form-control input-circle', 'placeholder' => 'search...', 'autofocus' => true]); ActiveForm::end(); echo Html::endTag('div'); // portlet-input input-inline echo Html::endTag('div'); // input-icon right echo ' '; echo Html::a(Html::tag('i', '', ['class' => 'fa fa-refresh']), $this->resetUrl, ['class' => 'btn btn-circle purple btn-sm', 'accesskey' => '', 'data-toggle' => 'tooltip', 'title' => 'Reset Search']); }
public function run() { Pjax::begin(['enablePushState' => false, 'formSelector' => $this->getFormId()]); if (\Yii::$app->session->getFlash('yii2-params-updated')) { // TODO: review this custom alert code $closeButton = Html::button('×', ['data-dismiss' => 'alert', 'aria-hidden' => 'true', 'class' => 'close']); echo Html::tag('div', $closeButton . "Params updated successfully!", ['class' => 'alert-info alert fade in']); } /** @var \zarv1k\params\models\DynamicParam[] $models */ $models = \zarv1k\params\models\Params::getDynamicModels(); $form = ActiveForm::begin(['id' => $this->getFormId(), 'action' => \Yii::$app->getUrlManager()->createUrl("{$this->_moduleId}/manage")]); /** @var ActiveField $activeField */ $activeField = \Yii::$container->get('yii\\widgets\\ActiveField'); // TODO: review get from di foreach ($models as $model) { echo $form->field($model, "[{$model->owner->id}]{$model->owner->code}", ['labelOptions' => ArrayHelper::merge($activeField->labelOptions, ['label' => $model->owner->description, 'title' => $model->owner->name]), 'inputOptions' => ArrayHelper::merge($activeField->inputOptions, ['placeholder' => $model->owner->description, 'title' => $model->owner->name])]); } echo Html::submitButton($this->getSubmitContent(), $this->getSubmitOptions()); ActiveForm::end(); Pjax::end(); }
/** * @param int $mode * @param string $selection * @param array $items * @param array $config * @return string */ protected function getActual($mode, $selection, array $items, array $config = []) { switch ($mode) { case static::MODE_NAME_VALUE_AJAX: case static::MODE_MODEL_ATTRIBUTE_AJAX: case static::MODE_MODEL_ATTRIBUTE_VALUE_AJAX: /* @var $request \yii\jquery\multipleselect\tests\Request */ $request = Yii::$app->getRequest(); $request->setIsAjax(true); } switch ($mode) { case static::MODE_NAME_VALUE: case static::MODE_NAME_VALUE_AJAX: SingleSelect::$counter = 0; return SingleSelect::widget(array_merge($config, ['name' => 'number', 'value' => $selection, 'items' => $items])); case static::MODE_MODEL_ATTRIBUTE_VALUE: case static::MODE_MODEL_ATTRIBUTE_VALUE_AJAX: $model = new TestForm(); if (array_key_exists('options', $config)) { $config['options']['value'] = $selection; } else { $config['options'] = ['value' => $selection]; } case static::MODE_MODEL_ATTRIBUTE: case static::MODE_MODEL_ATTRIBUTE_AJAX: if (!isset($model)) { $model = new TestForm(); $model->number = $selection; } ob_start(); ob_implicit_flush(false); $form = ActiveForm::begin(); $actual = (string) $form->field($model, 'number', ['template' => '{input}'])->widget(SingleSelect::className(), array_merge($config, ['items' => $items])); ActiveForm::end(); ob_end_clean(); return $actual; } throw new Exception(); }
</div> <div class="col-xs-1"> <div class="cond-accion2"> <a id="atr-cond-del" class="del-orden" title="Eliminar orden"><span class="glyphicon glyphicon-remove"></span></a> </div> </div> </div> </div> <div class="row"> <div class="errores">Hay errores en las consultas, <br> Debe haber campos o atributos incompletos.</div> </div> <div class="row listar"> <?php $form = ActiveForm::begin(['options' => ['id' => 'formfiltro']]); ?> <input id="consulta" name="consulta" type="hidden"></input> <div id="btn-listar" class="btn btn-primary" title="Imprimir Listado">Imprimir Listado</div> </form><?php ActiveForm::end(); ?> </div> </div> </div> <script type="text/javascript"> $(document).ready(function(){ var comparadores = document.querySelectorAll(".comparador"); for(var i=0;i<comparadores.length;i++){ var comp=comparadores[i]; addEventHandler(comp,'dragstart',dragStart); } var atributos = document.querySelectorAll(".btn-atributo");
public function run() { ActiveForm::end(); echo Html::endTag('div'); echo Html::endTag('div'); }
/** * */ public function run() { if ($this->enable) { //Begin ActtiveForm widget $this->form = ActiveForm::begin(['id' => 'create-user', 'options' => ['class' => 'form', 'enctype' => 'multipart/form-data']]); $this->_setupFields(); echo Html::submitButton('Submit', ['class' => 'btn btn-primary']); //Begin ActtiveForm widget ActiveForm::end(); } }
public function init() { $this->twig = new \Twig_Environment(null, array_merge(['cache' => Yii::getAlias($this->cachePath), 'charset' => Yii::$app->charset], $this->options)); // Adding custom extensions if (!empty($this->extensions)) { foreach ($this->extensions as $extension) { $this->twig->addExtension(new $extension()); } } // Adding custom globals (objects or static classes) if (!empty($this->globals)) { $this->addGlobals($this->globals); } // Adding custom functions if (!empty($this->functions)) { $this->addFunctions($this->functions); } // Adding custom filters if (!empty($this->filters)) { $this->addFilters($this->filters); } // Adding custom extensions if (!empty($this->extensions)) { $this->addExtensions($this->extensions); } // Change lexer syntax if (!empty($this->lexerOptions)) { $this->setLexerOptions($this->lexerOptions); } // Adding global 'void' function (usage: {{void(App.clientScript.registerScriptFile(...))}}) $this->twig->addFunction('void', new \Twig_Function_Function(function ($argument) { })); $this->twig->addFunction('path', new \Twig_Function_Function(function ($path, $args = []) { return Url::to(array_merge([$path], $args)); })); $this->twig->addFunction('url', new \Twig_Function_Function(function ($path, $args = []) { return Url::to(array_merge([$path], $args), true); })); $this->twig->addFunction('form_begin', new \Twig_Function_Function(function ($args = []) { return ActiveForm::begin($args); })); $this->twig->addFunction('form_end', new \Twig_Function_Function(function () { ActiveForm::end(); })); $this->twig->addGlobal('app', \Yii::$app); }
?> <?php } ?> <?php echo $form->field($model, 'comment')->textArea(); ?> <?php echo Html::submitButton(Yii::t('common', 'Next step'), ['class' => 'btn btn-primary']); ?> <?php ActiveForm::end(); ?> </div> </div> </div> <div class="col-sm-6"> <div class="row"> <div class="block info"> <?php echo $category->description; ?> </div> <div class="call"> Kom je er niet uit of heb je vragen?<br /> <a href="tel:+31858769957">085 876 99 57</a>
<div class="col-lg-3"> </div> <div class="col-lg-9"> <?php if ($model->image_profile) { echo '<img src="' . \Yii::$app->request->BaseUrl . '/' . $model->image_profile . '" width="90px"> '; echo Html::a('Delete Image', ['deleteimg', 'id' => $model->user_id, 'field' => 'image_profile'], ['class' => 'btn btn-danger']) . '<p>'; } ?> </div> </div> <div class = "form-group"> <div class = "col-lg-offset-3 col-lg-9"> <?php echo \yii\helpers\Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-block btn-primary']); ?> <br> </div> </div> <?php \yii\widgets\ActiveForm::end(); ?> </div> </div> </div> </div>
'action' => ['index'], 'method' => 'get', ]); ?> <?= $form->field($model, 'id') ?> <?= $form->field($model, 'name') ?> <?= $form->field($model, 'product_group_id') ?> <?= $form->field($model, 'code') ?> <?= $form->field($model, 'detail') ?> <?php // echo $form->field($model, 'created_time') ?> <?php // echo $form->field($model, 'last_update') ?> <?php // echo $form->field($model, 'user_id') ?> <?php // echo $form->field($model, 'product_unit_id') ?> <div class="form-group"> <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> </div> <?php ActiveForm::end(); ?> </div>
/** * Renders search box * @return string the rendering result */ public function renderSearch() { $defaultFormOptions = ['options' => ['class' => 'sidebar-search']]; $defaultInputOptions = ['name' => 'search', 'value' => '', 'options' => ['placeholder' => 'Search...']]; $formOptions = ArrayHelper::merge(ArrayHelper::getValue($this->search, 'form', []), $defaultFormOptions); $inputOptions = ArrayHelper::merge(ArrayHelper::getValue($this->search, 'input', []), $defaultInputOptions); ob_start(); ob_implicit_flush(false); CoreActiveForm::begin($formOptions); echo '<div class="form-container">'; echo '<div class="input-box">'; echo '<a href="#" class="remove"></a>'; echo Html::input('text', $inputOptions['name'], $inputOptions['value'], $inputOptions['options']); echo '<input type="button" class="submit">'; echo '</div>'; echo '</div>'; CoreActiveForm::end(); return ob_get_clean(); }
<div class="col col-sm-2">Kod <?php // \Yii::t('app', 'Remember me') ?> </div> <div class="col col-sm-8"><?php echo $form->field($ref, 'code')->label(false); ?> </div> </div> <div class="row"> <div class="col col-sm-2">Keterangan </div> <div class="col col-sm-8"><?php echo $form->field($ref, 'descr')->label(false); ?> </div> </div> <div class="row"> <div class="col col-sm-2"> </div> <div class="col col-sm-8"> <button class="btn btn-primary"><i class="fa fa-floppy-o bigger-130"></i> Simpan</button> <a href="index.php?r=ref/list&kat=<?php echo $ref->cat; ?> " class="btn btn-default"><i class="fa fa-backward"></i> Kembali</a> </div> </div> <?php $form = ActiveForm::end(); ?> </div>
/** * @inheritdoc */ public function run() { $output = $this->renderDetailView(); if (is_array($this->panel) && !empty($this->panel) && $this->panel !== false) { $output = $this->renderPanel($output); } $output = strtr($this->mainTemplate, ['{detail}' => Html::tag('div', $output, $this->container)]); Html::addCssClass($this->viewButtonsContainer, 'kv-buttons-1'); Html::addCssClass($this->editButtonsContainer, 'kv-buttons-2'); $buttons = Html::tag('span', $this->renderButtons(1), $this->viewButtonsContainer) . Html::tag('span', $this->renderButtons(2), $this->editButtonsContainer); echo str_replace('{buttons}', Html::tag('div', $buttons, $this->buttonContainer), $output); ActiveForm::end(); }
/** * Renders search box * @return string the rendering result */ protected function renderSearch() { $defaultFormOptions = ['options' => ['class' => 'sidebar-search']]; $defaultInputOptions = ['name' => 'search', 'value' => '', 'options' => ['placeholder' => 'Search...', 'class' => 'form-control']]; $formOptions = ArrayHelper::merge(ArrayHelper::getValue($this->search, 'form', []), $defaultFormOptions); $inputOptions = ArrayHelper::merge(ArrayHelper::getValue($this->search, 'input', []), $defaultInputOptions); ob_start(); ob_implicit_flush(false); echo Html::tag('span', ' ', ['class' => 'hor-menu-search-form-toggler']); echo '<div class="search-form">'; CoreActiveForm::begin($formOptions); echo '<div class="input-group">'; echo Html::input('text', $inputOptions['name'], $inputOptions['value'], $inputOptions['options']); echo '<div class="input-group-btn">'; echo '<button type="button" class="btn"></button>'; echo '</div>'; // end .input-group-btn echo '</div>'; // end .input-group echo '</div>'; // end .search-form CoreActiveForm::end(); return ob_get_clean(); }
/** * */ private function bodyDialog() { ActiveForm::begin(['id' => 'dot-translation-form', 'action' => [$this->router]]); echo Html::tag('div', null, ['id' => 'dots-filter']); echo Html::hiddenInput('category', '', ['id' => 'dots-inp-category']); echo Html::hiddenInput('message', '', ['id' => 'dots-inp-message']); echo Html::tag('div', null, ['id' => 'dots-variables']); foreach ($this->languages as $id_language => $language) { echo Html::beginTag('div', ['class' => 'form-group']); echo Html::beginTag('div', ['class' => 'is_empty_cont']); echo Html::label(Yii::t("i18n-dot", "Empty", ['dot' => false]), 'is_empty_' . $id_language, ['class' => 'is_empty_label']); echo Html::checkbox('is_empty[' . $id_language . ']', false, ['class' => 'empty_checkbox', 'id' => 'is_empty_' . $id_language, 'uncheck' => 0]); echo Html::endTag('div'); echo Html::label($language[$this->langColLabel], 'dot-translation-' . $id_language); echo Html::textarea('translation[' . $id_language . ']', '', ['class' => 'form-control', 'id' => 'dot-translation-' . $id_language]); echo Html::endTag('div'); } echo Html::submitButton(Yii::t("i18n-dot", "Change", ['dot' => false]), ['class' => 'btn btn-primary', 'id' => 'dot-btn']); ActiveForm::end(); }
//date_default_timezone_set('America/Sao_Paulo'); ?> <div class="pedido-index"> <h1><?= Html::encode($this->title) ?></h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?= Html::a(Yii::t('app', 'Create {model}', ['model' => 'Pedido']), ['create'], ['class' => 'btn btn-success', 'title'=>'Clique aqui para cadastrar um novo Pedido']) ?> </p> <div class="form-group"> <?= Html::label('Situação do Pedido') ?> <?php $form = \yii\widgets\ActiveForm::begin(['action' => 'index', 'id' => $situacaoDoPedido, 'method' => 'get',]); ?> <?= Html::dropDownList('situacao-pedido', $situacaoDoPedido, $situacaopedido, ['class' => 'form-control']) ?> <?php $form = \yii\widgets\ActiveForm::end(); ?> </div> <?php $this->registerJs('$("select").change(function(){$(this).submit()});'); ?> <div class="table-responsive"> <?php Pjax::begin(); ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, // 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], [ 'attribute' => 'situacaopedido',
public function api_form() { $model = new FeedbackModel(); $settings = Yii::$app->getModule('admin')->activeModules['feedback']->settings; ob_start(); $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]); switch (Yii::$app->session->getFlash(FeedbackModel::FLASH_KEY)) { case 'success': echo Alert::widget(['options' => ['class' => 'alert-success'], 'body' => Yii::t('easyii/feedback/api', 'Feedback send. We will answer you soon')]); break; case 'error': echo Alert::widget(['options' => ['class' => 'alert-danger'], 'body' => Yii::t('easyii/feedback/api', 'An error has occurred')]); break; } 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(); }
/** * Base method of the class * @return string */ public function run() { $form = ActiveForm::begin($this->options); echo $this->printFields($form); echo $this->printSubmitButton(); ActiveForm::end(); }
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(); }
/** * @param int $mode * @param string $value * @param array $config * @return string */ protected function getActual($mode, $value, array $config = []) { switch ($mode) { case static::MODE_NAME_VALUE_AJAX: case static::MODE_MODEL_ATTRIBUTE_AJAX: case static::MODE_MODEL_ATTRIBUTE_VALUE_AJAX: /* @var $request \yii\jui\timepicker\tests\Request */ $request = Yii::$app->getRequest(); $request->setIsAjax(true); } switch ($mode) { case static::MODE_NAME_VALUE: case static::MODE_NAME_VALUE_AJAX: DatetimePicker::$counter = 0; return DatetimePicker::widget(array_merge($config, ['name' => 'datetime', 'value' => $value])); case static::MODE_MODEL_ATTRIBUTE_VALUE: case static::MODE_MODEL_ATTRIBUTE_VALUE_AJAX: $model = new TestForm(); if (array_key_exists('options', $config)) { $config['options']['value'] = $value; } else { $config['options'] = ['value' => $value]; } case static::MODE_MODEL_ATTRIBUTE: case static::MODE_MODEL_ATTRIBUTE_AJAX: if (!isset($model)) { $model = new TestForm(); $model->datetime = $value; } ob_start(); ob_implicit_flush(false); $form = ActiveForm::begin(); $actual = (string) $form->field($model, 'datetime', ['template' => '{input}'])->widget(DatetimePicker::className(), $config); ActiveForm::end(); ob_end_clean(); return $actual; } throw new Exception(); }