Example #1
3
 /**
  * Button with multiple submit options.
  * @param ActiveForm $form
  * @param $model
  * @param $attribute
  * @param $items
  * @param string $content
  * @param array $options
  * @return string
  */
 public static function submitDropdown(ActiveForm $form, $model, $attribute, $items, $content = "Save", $options = [])
 {
     if (count($items) == 1) {
         return $form->field($model, $attribute, ['options' => ['class' => 'pull-left']])->label(false)->hiddenInput(['value' => key($items)]) . Html::submitButton(reset($items), $options);
     }
     $lis = '';
     foreach ($items as $key => $name) {
         $lis .= Html::tag('li', "<a href='#'>{$name}</a>", ['onclick' => "\$(this).closest('div').find('input').val('{$key}');\n                    \$(this).parents('form').submit();", 'class' => $model->{$attribute} == $key ? 'active' : '']);
     }
     return Html::beginTag('div', ['class' => 'btn-group']) . $form->field($model, $attribute, ['options' => ['class' => 'pull-left']])->label(false)->hiddenInput() . Html::button($content . '<span class="caret"></span>', ['class' => 'btn dropdown-toggle btn-primary', "data-toggle" => "dropdown"]) . Html::beginTag('ul', ['class' => 'dropdown-menu']) . $lis . Html::endTag('ul') . Html::endTag('div');
 }
Example #2
3
 /**
  * @param ActiveRecord $model Model instance
  * @param string $indexAction Route path to index action
  * @return string Rendered save buttons with redurectUrl!
  */
 public static function saveButtons(ActiveRecord $model, $indexAction = 'index', $buttonClass = 'btn-sm', $onlySaveAndBack = false)
 {
     $result = '<div class="form-group no-margin btn-group">';
     if ($onlySaveAndBack === false) {
         $result .= Html::a(Icon::show('arrow-circle-left') . Yii::t('app', 'Back'), Yii::$app->request->get('returnUrl', [$indexAction, 'id' => $model->id]), ['class' => 'btn btn-default ' . $buttonClass]);
     }
     if ($model->isNewRecord && $onlySaveAndBack === false) {
         $result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save & Go next'), ['class' => 'btn btn-success ' . $buttonClass, 'name' => 'action', 'value' => 'next']);
     }
     $result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save & Go back'), ['class' => 'btn btn-warning ' . $buttonClass, 'name' => 'action', 'value' => 'back']);
     if ($onlySaveAndBack === false) {
         $result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary ' . $buttonClass, 'name' => 'action', 'value' => 'save']);
     }
     $result .= '</div>';
     return $result;
 }
Example #3
2
 protected function launch()
 {
     echo Html::beginForm($this->url, 'get');
     echo Html::input('text', $this->queryParam, $this->query);
     echo Html::submitButton(\Yii::t('gromver.platform', 'Find'));
     echo Html::endForm();
 }
 public function actionForm()
 {
     echo Html::beginForm();
     echo Html::checkboxList('test', ['value 1' => 'item 1', 'value 2' => 'item 2', 'value 3' => 'item 3'], isset($_POST['test']) ? $_POST['test'] : null, function ($index, $label, $name, $value, $checked) {
         return Html::label($label . ' ' . Html::checkbox($name, $value, $checked), null, ['class' => 'inline checkbox']);
     });
     echo Html::submitButton();
     echo Html::endForm();
     print_r($_POST);
 }
 public function run()
 {
     parent::run();
     $model = new \app\models\ProjectSimpleForm();
     $form = ActiveForm::begin(['id' => 'project-simple-form', 'action' => ['/project/simplecreate'], 'layout' => 'inline', 'validateOnChange' => false, 'validateOnBlur' => false]);
     echo $form->field($model, 'title')->textInput(['maxlength' => 255, 'class' => 'form-control input-sm'])->label(false);
     echo '<div class="form-group">' . Html::submitButton(Yii::t('app', 'Create'), ['class' => 'btn btn-sm btn-success', 'style' => 'margin: 5px 5px 5px 0;']) . Html::resetButton(Yii::t('app', 'Cancel'), ['class' => 'btn btn-xs', 'style' => 'margin: 5px;']) . '</div>';
     ActiveForm::end();
     $this->registerJs();
 }
Example #6
1
 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();
 }
Example #7
1
 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();
 }
Example #8
1
 public function run()
 {
     if ($this->footerWrapper) {
         echo Html::beginTag('div', ['class' => 'form-group panel-footer']);
     }
     $submit_options = [];
     if ($this->form) {
         $submit_options['form'] = $this->form;
     }
     $extra = '';
     if ($this->extraBtns) {
         $extra = '&nbsp;' . implode(' ', (array) $this->extraBtns);
     }
     if (isset($this->model->isNewRecord) && $this->model->isNewRecord) {
         if ($this->saveLink) {
             $submit_options['class'] = 'btn btn-success';
             echo Html::submitButton(__('Create'), $submit_options);
         }
         echo $extra;
     } else {
         if ($this->saveLink) {
             $submit_options['class'] = 'btn btn-primary';
             echo Html::submitButton(__('Update'), $submit_options);
         }
         echo $extra;
         if ($this->removeLink) {
             echo ' ';
             echo Html::a(__('Delete'), ['delete', 'id' => $this->model->id], ['class' => 'btn btn-danger', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']);
         }
     }
     if ($this->footerWrapper) {
         echo Html::endTag('div');
     }
 }
 public function run()
 {
     $id = $this->getId();
     echo Html::beginForm(Url::canonical(), 'get', ['data-pjax' => '1', 'id' => $this->name]);
     echo Html::beginTag('div');
     echo Html::beginTag("select", ['id' => $id, 'multiple' => 'multiple', 'class' => 'invisible', 'style' => 'width: ' . $this->width . 'px;', 'name' => $this->name . '[]']);
     echo Html::renderSelectOptions($this->selectedValues, $this->_allValues);
     echo Html::endTag("select");
     echo Html::submitButton('OK', ['style' => 'margin: 0 5px;']);
     echo Html::endTag('div');
     echo Html::endForm();
     echo "<script type='text/javascript'>";
     echo "\$('#{$id}').removeClass('invisible');";
     echo "\$('#{$id}').multipleSelect()";
     echo "</script>";
 }
Example #10
0
 /**
  * Generates crud action button
  * @param string $action
  * @param bool|null $isNewRecord
  * @param array $options
  * @return string
  */
 public static function actionButton($action = self::ACTION_SAVE_AND_LEAVE, $isNewRecord = null, $options = [])
 {
     $content = ArrayHelper::getValue(static::getActionButtonContent($isNewRecord), $action, ArrayHelper::getValue($options, 'content', 'Submit'));
     ArrayHelper::remove($options, 'content');
     $options = array_merge(ArrayHelper::getValue(static::getActionButtonOptions(), $action, ['class' => 'btn btn-primary']), ['name' => self::ACTION_BUTTON_NAME, 'value' => $action], $options);
     return Html::submitButton($content, $options);
 }
Example #11
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     echo Html::beginTag('div', ['class' => 'main-sidebar']);
     echo Html::beginTag('div', ['class' => 'sidebar']);
     if (isset($this->user) and count($this->user) > 0) {
         $image = isset($this->user['image']) ? $this->user['image'] : '';
         $username = isset($this->user['username']) ? $this->user['username'] : '';
         echo Html::beginTag('div', ['class' => 'user-panel']);
         echo Html::beginTag('div', ['class' => 'pull-left image']);
         echo '<img src="' . $image . '" class="img-circle" alt="user" />';
         echo Html::endTag('div');
         echo Html::beginTag('div', ['class' => 'pull-left info']);
         echo Html::tag('p', $username);
         echo Html::tag('a', '<i class="fa fa-circle text-success"></i> Online');
         echo Html::endTag('div');
         echo Html::endTag('div');
     }
     if (isset($this->search) and count($this->search) > 0) {
         $method = isset($this->search['method']) ? $this->search['method'] : 'get';
         $action = isset($this->search['action']) ? $this->search['action'] : '';
         echo Html::beginTag('form', ['method' => $method, 'action' => $action, 'class' => 'sidebar-form']);
         echo Html::beginTag('div', ['class' => 'input-group']);
         echo Html::input('text', 'q', '', ['class' => 'form-control', 'placeholder' => 'Search...']);
         echo Html::beginTag('span', ['class' => 'input-group-btn']);
         echo Html::submitButton(Html::tag('i', '', ['class' => 'fa fa-search']), ['id' => 'search-btn', 'class' => "btn btn-flat"]);
         echo Html::endTag('span');
         echo Html::endTag('div');
         echo Html::endTag('form');
     }
 }
Example #12
0
 public static function submitButton($model)
 {
     $html = '<div class="form-group">';
     $html .= Html::submitButton($model->isNewRecord ? 'Thêm mới' : 'Cập nhật', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
     $html .= '</div>';
     return $html;
 }
 protected function renderVerificationButton()
 {
     $form = ActiveForm::begin(['action' => ['@contact/request-' . $this->type . '-confirmation'], 'class' => 'form-inline']);
     echo $form->field($this->model->contact, 'id')->hiddenInput()->label(false);
     echo Html::submitButton(Yii::t('hipanel:client', '{icon} Verify', ['icon' => Html::tag('i', '', ['class' => 'fa fa-check'])]), ['class' => 'btn btn-sm btn-info']);
     $form->end();
 }
Example #14
0
 public function run()
 {
     echo Html::endTag('div');
     $buttons = Html::tag('div', Html::submitButton(__('Search'), ['class' => 'btn btn-primary']));
     echo Html::tag('div', $buttons, ['class' => 'panel-footer ' . $this->extraClass . $this->targetClass]);
     echo Html::endTag('div');
     parent::run();
 }
Example #15
0
 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 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();
 }
Example #17
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $form = ActiveForm::begin();
     echo $form->errorSummary($this->commentModel);
     echo $form->field($this->commentModel, 'title')->textInput(['maxlength' => true]);
     echo $form->field($this->commentModel, 'content')->textarea($this->textAreaOptions);
     echo Html::submitButton(empty($this->buttonLabel) ? Yii::t('app', 'Save') : $this->buttonLabel, $this->buttonOptions);
     ActiveForm::end();
 }
 /**
  * Renders the widget.
  */
 public function run()
 {
     //echo $this->model->state;
     //for new record creation
     if ($this->model->isNewRecord || $this->model->state == AppActiveRecord::STATUS_DRAFT) {
         if (\yii::$app->user->can('saveasdraft')) {
             echo '&nbsp;&nbsp;';
             AjaxSubmitButton::begin(['label' => 'Save as Draft', 'options' => ['id' => 'saveasdraft-btn', 'class' => 'btn btn-lg btn-warning', 'type' => 'button'], 'ajaxOptions' => ['type' => 'POST', 'url' => Url::toRoute(array_merge(['saveasdraft'], $this->params)), 'success' => new \yii\web\JsExpression('function(data){                        
                         if(data.status){
                             location.href = "' . Url::toRoute(array_merge(['index'])) . '";
                         }
                      }')]]);
             AjaxSubmitButton::end();
             $this->view->registerJs("\$( '#saveasdraft-btn' ).click(function() {\n                \$(this).addClass('disabled');\n            });");
         }
     }
     if (\yii::$app->user->can('create') || \yii::$app->user->can('update')) {
         echo '&nbsp;&nbsp;';
         echo Html::submitButton('Save', ['class' => 'btn btn-lg btn-info aftervalidate']);
     }
     if (!$this->model->isNewRecord && $this->model->state != AppActiveRecord::STATUS_DRAFT && ($this->model->state != AppActiveRecord::STATUS_PUBLISH || $this->model->state != AppActiveRecord::STATUS_PUBLISHREADY)) {
         if ($this->model->state != AppActiveRecord::STATUS_PUBLISH && \yii::$app->user->can('publish')) {
             echo '&nbsp;&nbsp;';
             echo Html::submitButton('Publish', ['class' => 'btn btn-lg changeaction btn-success aftervalidate', 'data-url' => Url::toRoute(array_merge(['publish'], $this->params))]);
         } elseif ($this->model->state != AppActiveRecord::STATUS_PUBLISHREADY && $this->model->state != AppActiveRecord::STATUS_PUBLISH && \yii::$app->user->can('sendtopublish')) {
             echo '&nbsp;&nbsp;';
             echo Html::submitButton('Send to Publisher', ['class' => 'btn btn-lg changeaction btn-success aftervalidate', 'data-url' => Url::toRoute(array_merge(['sendtopublish'], $this->params))]);
         }
     }
     /*
             echo '&nbsp;&nbsp;';
             AjaxSubmitButton::begin([
                 'label' => 'Validate',
                 'options' => [
                     'class' => 'btn btn-lg btn-primary',
                     'type'  => 'submit',
                 ],
                 'ajaxOptions' => [
                     'type'  =>'POST',
                     'url'   => Url::toRoute(array_merge(['validate'],$this->params)),
                     'success' => new \yii\web\JsExpression('function(data){
                         $("#errorwarning").html(data.html);
                         if(data.status){
                             $(".aftervalidate").removeClass("disabled");
                         }
                      }'),
                 ],
             ]);
             AjaxSubmitButton::end();
             //*/
     echo '&nbsp;&nbsp;';
     echo Html::resetButton('Reset', ['class' => 'btn btn-lg btn-default']);
     echo '&nbsp;&nbsp;';
     echo Html::resetButton('Back', ['class' => 'btn btn-lg btn-default', 'onclick' => 'history.go(-1);return true;']);
     echo "\n" . Html::endTag('div');
     $this->view->registerJs("\$('.changeaction').click(function() {\n                    if(typeof \$(this).attr('data-url') != 'undefined' && \$(this).attr('data-url') != ''){\n                        \$(this).parents('form').attr('action',\$(this).attr('data-url')).submit();\n                    }\n                });");
 }
Example #19
0
 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();
 }
 /**
  * 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);
 }
Example #21
0
 private function _getList()
 {
     $menuItems = [];
     if (\Yii::$app->user->isGuest) {
         //          $menuItems[] = ['label' => 'Signup', 'visible' => \humanized\user\Module::getInstance()->params['enableSignUp'], 'url' => ['/user/account/signup']];
         $menuItems[] = ['label' => 'Login', 'url' => ['/user/account/login']];
     } else {
         $menuItems[] = '<li>' . Html::beginForm(['/user/account/logout'], 'post') . Html::submitButton('Logout (' . \Yii::$app->user->identity->email . ')', ['class' => 'btn btn-link']) . Html::endForm() . '</li>';
     }
     return $urls;
 }
Example #22
0
 /**
  * Renders the sort links.
  * @return string the rendering result
  */
 protected function renderSortLinks()
 {
     $attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
     $links = [];
     foreach ($attributes as $key => $name) {
         $links[$name] = $name;
     }
     echo Html::beginForm(null, 'get', []);
     echo Html::dropDownList('sort', null, $links, ['prompt' => 'Sortiraj po']);
     echo Html::submitButton('<i class="fa fa-sort"></i>', ['class' => 'btn btn-default margin-left-5']);
     echo Html::endForm();
 }
Example #23
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $popover = '';
     $popover .= Html::beginForm($this->action);
     if ($this->content) {
         $popover .= $this->content;
     }
     $popover .= Html::submitButton($this->btnText, ['class' => 'btn btn-success']);
     $popover .= Html::hiddenInput('id', $this->model['id']);
     $popover .= Html::endForm();
     $this->content = $popover;
     return parent::run();
 }
Example #24
0
 public function api_form($options = [])
 {
     $model = new Subscriber();
     $options = array_merge($this->_defaultFormOptions, $options);
     ob_start();
     $form = ActiveForm::begin(['enableAjaxValidation' => true, 'action' => Url::to(['/admin/subscribe/send']), 'layout' => 'inline']);
     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, 'email')->input('email', ['placeholder' => 'E-mail']);
     echo Html::submitButton(Yii::t('easyii/subscribe/api', 'Subscribe'), ['class' => 'btn btn-primary', 'id' => 'subscriber-send']);
     ActiveForm::end();
     return ob_get_clean();
 }
Example #25
0
 public static function submitButton($content = 'Submit', $options = [], $permissions = null, $permissionsParams = [])
 {
     if (isset($permissions)) {
         if (is_array($permissions)) {
             throw new InvalidConfigException("{permissions} must be set as String");
         }
         if (\Yii::$app->getUser()->can($permissions, $permissionsParams)) {
             return parent::submitButton($content, $options);
         } else {
             return '';
         }
     }
     return parent::submitButton($content, $options);
 }
Example #26
0
 /**
  * Get the actions supported for replying
  */
 public function getActions($hidden = false)
 {
     $ret_val = '';
     foreach ($this->_actions as $type => $action) {
         switch ($type) {
             case 'reset':
                 $ret_val .= Html::resetButton(Html::tag($action['tag'], $action['text'], $action['tagOptions']), $action['options']);
                 break;
             case 'submit':
                 $ret_val .= Html::submitButton(Html::tag($action['tag'], $action['text'], $action['tagOptions']), $action['options']);
                 break;
         }
     }
     return Html::tag('div', $ret_val, ['role' => 'replyActions', 'class' => 'text-right ' . ($hidden == true ? 'hidden' : '')]);
 }
Example #27
0
 /**
  * Get the actions supported for replying
  */
 public function getActions($hidden = false)
 {
     $ret_val = '';
     $actions = array_merge($this->defaultActions(), $this->actions);
     foreach ($actions as $type => $action) {
         switch ($type) {
             case 'submit':
                 $ret_val .= Html::submitButton(Html::tag($action['tag'], $action['text'], $action['tagOptions']), $action['options']);
                 break;
             case 'reset':
                 $ret_val .= Html::resetButton(Html::tag($action['tag'], $action['text'], $action['tagOptions']), $action['options']);
                 break;
         }
     }
     return Html::tag('div', Html::tag('div', $ret_val, ['class' => 'btn-group']), ['role' => 'replyActions', 'class' => 'form-group pull-right' . ($hidden == true ? ' hidden ' : ''), "style" => "padding-right: 15px"]);
 }
Example #28
-1
 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();
 }
Example #29
-1
 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();
 }
Example #30
-1
 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();
 }