Ejemplo n.º 1
0
 /**
  * [[@doctodo method_description:generate]].
  *
  * @return unknown
  */
 public function generate()
 {
     if (empty($this->_items)) {
         return '';
     }
     $result = [];
     $formOptions = ['options' => ['class' => ''], 'enableClientValidation' => false];
     if (Yii::$app->request->isAjax) {
         Html::addCssClass($formOptions['options'], 'ajax');
     }
     if ($this->hasFile() && !isset($formOptions['options']['enctype'])) {
         $formOptions['options']['enctype'] = 'multipart/form-data';
     }
     list($this->form, $formStartRow) = ActiveForm::begin($formOptions, false);
     $result[] = $formStartRow;
     // $result[] = Html::beginForm('', 'post', array('class' => $this->class));
     $result[] = Html::beginTag('div', ['class' => '']);
     foreach ($this->_items as $item) {
         $result[] = $item->generate();
     }
     //if (!Yii::$app->request->isAjax) {
     $result[] = Html::beginTag('div', ['class' => 'row form-group submit-group']);
     $result[] = Html::beginTag('div', ['class' => 'col-sm-12']);
     $result[] = Html::submitButton('Save', ['class' => 'btn btn-primary']);
     $result[] = Html::endTag('div');
     $result[] = Html::endTag('div');
     //}
     $result[] = Html::endTag('div');
     $result[] = ActiveForm::end(false);
     return implode("\n", $result);
 }
Ejemplo n.º 2
0
<?php

use canis\helpers\Html;
use yii\widgets\ActiveForm;
$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title;
$formOptions = ['class' => 'form-horizontal'];
if (!Yii::$app->request->isAjax) {
    echo '<div class="col-md-offset-3 col-md-6">';
} else {
    Html::addCssClass($formOptions, 'ajax');
}
$form = ActiveForm::begin(['id' => 'login-form', 'options' => $formOptions, 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-lg-12\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-3 control-label']]]);
echo $form->field($model, 'email');
echo $form->field($model, 'password')->passwordInput();
echo $form->field($model, 'rememberMe', ['template' => "<div class=\"col-md-offset-1 col-lg-9 \">{input}</div>\n<div class=\"col-lg-8\">{error}</div>"])->checkbox();
echo '<div class="submit-group col-md-offset-1 col-lg-9 ">';
echo Html::submitButton('Login', ['class' => 'btn btn-primary']);
echo '</div>';
echo '</div>';
ActiveForm::end();
Ejemplo n.º 3
0
echo Html::endTag('ul');
echo Html::beginTag('div', ['class' => 'tab-content well']);
// simple
Html::addCssClass($simpleOptions, 'tab-pane');
$simpleOptions['id'] = 'simple-filter';
echo Html::beginTag('div', $simpleOptions);
echo $searchForm->field($searchModel, 'query', ['inputOptions' => ['id' => 'simple-filter-input', 'placeholder' => 'Search', 'class' => 'form-control']]);
echo Html::endTag('div');
// advanced
Html::addCssClass($advancedOptions, 'tab-pane');
$advancedOptions['id'] = 'advanced-filter';
echo Html::beginTag('div', $advancedOptions);
$queryBuilderOptions = [];
$queryBuilderOptions['filters'] = $type->dummyModel->filterFields;
$builderId = 'advanced-filter-builder';
echo Html::tag('div', '', ['id' => $builderId]);
$js[] = "\$('#{$builderId}').queryBuilder(" . json_encode($queryBuilderOptions) . ");";
echo Html::endTag('div');
echo Html::submitButton('Search', ['class' => 'btn btn-default']);
echo Html::endTag('div');
ActiveForm::end();
echo Html::endTag('div');
// filter body
echo Html::endTag('div');
// filter section
echo Html::beginTag('div', ['class' => 'panel panel-default']);
echo Html::tag('div', Html::tag('div', 'Results', ['class' => 'panel-title']), ['class' => 'panel-heading']);
echo Html::beginTag('div', ['class' => 'panel-body', 'id' => 'filter-results']);
echo Html::endTag('div');
echo Html::endTag('div');
$this->registerJs(implode("\n", $js));