示例#1
0
?>

        <?php 
echo $form->field($modelBook, 'category_id')->dropDownList(BookForm::createArrayMapTranslate(Category::className(), 'id', 'category_name'));
?>

        <?php 
echo $form->field($modelBook, 'library_id')->dropDownList(BookForm::createArrayMap(Library::className(), 'id', 'name'));
?>

        <?php 
echo $form->field($modelBook, 'edition')->textInput();
?>

        <?php 
echo $form->field($modelBook, 'year')->widget(yii\widgets\MaskedInput::classname(), ['mask' => '9999']);
?>

        <div class="form-group">
            <label class="control-label" for="book-key-words"><?php 
echo Yii::t('app', 'Key Words') . ' (' . Yii::t('app', 'Comma separated') . ')';
?>
</label>
            <?php 
echo Html::textInput('KeyWord[words]', isset($keyWords) ? $keyWords : null, ['id' => 'book-key-words', 'class' => 'form-control']);
?>
        </div>

        <?php 
echo $form->field($modelBook, 'description')->textarea(['rows' => 6]);
?>
示例#2
0
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
use common\widgets\edit\InputFile;
use common\widgets\edit\Redactor;
/**
 * @var yii\web\View $this
 * @var common\models\Organization $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="organization-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Заголовок...', 'maxlength' => 255]], 'main_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'organization']], 'intro' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Redactor::className(), 'options' => ['filemanager' => ['webpath' => '/'], 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Краткое описание...', 'rows' => 6]]], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Redactor::className(), 'options' => ['filemanager' => ['webpath' => '/'], 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Полное описание...', 'rows' => 6]]], 'doc_body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Redactor::className(), 'options' => ['filemanager' => ['webpath' => '/'], 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Договор...', 'rows' => 6]]], 'address' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Адресс...', 'maxlength' => 150]], 'metro' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Метро...', 'maxlength' => 50]], 'phone' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => yii\widgets\MaskedInput::className(), 'options' => ['options' => ['class' => 'form-control', 'placeholder' => yii::t('app', 'Enter') . ' Телефон...'], 'mask' => '+7(999)999-99-99', 'clientOptions' => ['clearIncomplete' => true]]], 'phone2' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => yii\widgets\MaskedInput::className(), 'options' => ['options' => ['class' => 'form-control', 'placeholder' => yii::t('app', 'Enter') . ' Телефон...'], 'mask' => '+7(999)999-99-99', 'clientOptions' => ['clearIncomplete' => true]]], 'email' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Email...', 'maxlength' => 50]], 'priority' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Заголовок...', 'maxlength' => 255]], 'type_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\Organization())->getTypeIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'icon_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'image']]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>

</div>
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
/**
 * @var yii\web\View $this
 * @var common\models\Specialist $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="specialist-search">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'action' => ['index'], 'method' => 'get']);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['phone' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => yii\widgets\MaskedInput::className(), 'options' => ['options' => ['class' => 'form-control', 'placeholder' => yii::t('app', 'Enter') . ' Телефон...'], 'mask' => '+7(999)999-99-99', 'clientOptions' => ['clearIncomplete' => false]]]]]);
?>
    <div class="form-group">
        <?php 
echo Html::a(Yii::t('app', 'Reset'), ['index'], ['class' => 'btn btn-default', 'style' => 'margin-left: 15px; margin-right: 10px']);
?>
        <?php 
echo Html::submitButton(Yii::t('app', Yii::t('app', 'Search')), ['class' => 'btn btn-default', 'onclick' => ' $.pjax.reload({container: "#w2", data: $("#w0").serialize()  }); return false;']);
?>
  
    </div>

    <?php 
ActiveForm::end();
?>
示例#4
0
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
use common\widgets\edit\InputFile;
use common\widgets\edit\Redactor;
/**
 * @var yii\web\View $this
 * @var common\models\Specialist $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="specialist-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['intro' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Redactor::className(), 'options' => ['filemanager' => ['webpath' => '/'], 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Краткое описание...', 'rows' => 6]]], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Redactor::className(), 'options' => ['filemanager' => ['webpath' => '/'], 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Полное описание...', 'rows' => 6]]], 'middle_name' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Отчество...', 'maxlength' => 255]], 'email' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Email...', 'maxlength' => 100]], 'first_name' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Имя...', 'maxlength' => 255]], 'last_name' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Фамилия...', 'maxlength' => 255]], 'phone' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => yii\widgets\MaskedInput::className(), 'options' => ['options' => ['class' => 'form-control', 'placeholder' => yii::t('app', 'Enter') . ' Телефон...'], 'mask' => '+7(999)999-99-99', 'clientOptions' => ['clearIncomplete' => true]]], 'photo_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'image']], 'specTypes_list' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(\common\models\SpecialistType::find()->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...', 'multiple' => true], 'pluginOptions' => ['tags' => true, 'maximumInputLength' => 10]]]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>

</div>
示例#5
0
<?php 
Pjax::begin(['options' => ['id' => 'w0', 'timeout' => 3000]]);
?>

    <?php 
$form = ActiveForm::begin(['enableClientValidation' => true, 'type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data', ['data-pjax' => true]]]);
/*$dataProvider = array(1,2,3,4,5);
  echo TabularForm::widget([
      'form' => $form,
      'dataProvider' => $dataProvider,
      'attributes' => [
          'role' => [
              'id' => TabularForm::INPUT_DROPDOWN_LIST, 
              'items'=>['0' => 'Активный','1' => 'Отключен','2'=>'Удален']
          ],
      ],
  ]);*/
$params = [];
echo $form->field($model, 'role')->dropDownList($model->getRoles(), $params);
$params2 = [];
echo $form->field($model, 'status')->dropDownList($model->getStatuses(), $params2);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['last_name' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Фамилия...', 'maxlength' => 150]], 'first_name' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Имя...', 'maxlength' => 255]], 'middle_name' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Отчество...', 'maxlength' => 255]], 'birthday_date' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Дата рождения...', 'maxlength' => 10, 'value' => $model->birthday_date]], 'email' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Email...', 'maxlength' => 255]], 'phone' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => yii\widgets\MaskedInput::className(), 'options' => ['options' => ['class' => 'form-control', 'placeholder' => yii::t('app', 'Enter') . ' Телефон...'], 'mask' => '+7(999)999-99-99', 'clientOptions' => ['clearIncomplete' => true]]], 'password' => ['type' => Form::INPUT_PASSWORD, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Пароль', 'maxlength' => 20]], 'confirmpassword' => ['type' => Form::INPUT_PASSWORD, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Повтор пароля', 'maxlength' => 20]]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>

</div>