Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Authors::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname]);
     return $dataProvider;
 }
Exemplo n.º 2
0
    $searchModel->dateFrom = Yii::$app->formatter->asDate($searchModel->dateFrom);
    $searchModel->dateTo = Yii::$app->formatter->asDate($searchModel->dateTo);
} else {
    $searchModel->dateFrom = null;
    $searchModel->dateTo = null;
}
?>

<?php 
$form = yii\bootstrap\ActiveForm::begin(['method' => 'get', 'action' => ['books/index']]);
?>

<div>
    <div style="width: 30%; float: left">
    <?php 
echo $form->field($searchModel, 'author_id')->dropDownList(ArrayHelper::map(models\Authors::find()->all(), 'id', 'fullName'), ['prompt' => 'автор'])->label(false);
?>
    </div>
    <div style="width: 30%; float: left">
        <?php 
echo $form->field($searchModel, 'name')->label(false)->textInput(['placeholder' => 'Название книги']);
?>
    </div>
    <div style="clear: both"></div>
    <div>
        <div style="width: 30%; float: left">
            <?php 
echo $form->field($searchModel, 'dateFrom')->widget(DatePicker::classname(), ['language' => 'ru'])->label(false)->textInput(['placeholder' => 'Дата выхода c']);
?>
        </div>
        <div style="width: 30%; float: left">
Exemplo n.º 3
0
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\BooksSearch */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="books-search">

    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get', 'options' => ['data-pjax' => '1']]);
?>

    <div class="row">
        <div class="col-md-4">
            <?php 
echo $form->field($model, 'author_id')->dropDownList(ArrayHelper::map(\common\models\Authors::find()->all(), 'id', 'fullName'), ['prompt' => '--Автор--']);
?>
        </div>
        <div class="col-md-8">
            <?php 
echo $form->field($model, 'name');
?>
        </div>
    </div>

    <div class="row">
        <div class="col-md-2 text-search">
                Дата выхода книги:
        </div>
        <div class="col-md-2">
            <?php 
Exemplo n.º 4
0
?>
</code>.
</p>


<?php 
$form = ActiveForm::begin(['id' => 'book-update-form', 'options' => ['enctype' => 'multipart/form-data']]);
?>

<?php 
echo $form->field($model, 'name');
?>

<?php 
echo $form->field($model, 'date')->widget(\yii\jui\DatePicker::classname(), ['language' => 'ru'])->textInput(['placeholder' => 'Дата выхода']);
?>

<?php 
echo $form->field($model, 'author_id')->dropDownList(ArrayHelper::map(Authors::find()->all(), 'id', 'fullName'), ['prompt' => 'автор']);
echo $form->field($model, 'preview')->fileInput();
?>


<div class="form-group">
    <?php 
echo Html::submitButton('update', ['class' => 'btn btn-primary', 'name' => 'update-button']);
?>
</div>

<?php 
ActiveForm::end();