Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Template::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', 'name', $this->name])->andFilterWhere(['like', 'file_name', $this->file_name]);
     return $dataProvider;
 }
Esempio n. 2
0
echo $form->field($model, 'seo_title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'seo_description')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'seo_keywords')->textarea(['rows' => 6]);
?>

    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <?php 
echo Html::activeDropDownList($model, 'template_id', ArrayHelper::map(Template::find()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'Выберите шаблон']);
?>
            </div>
        </div>
    </div>

    <?php 
echo $form->field($model, 'index_page')->checkbox(['disabled' => $model::getIndexPage() !== null && $model->id !== $model::getIndexPage()->id]);
?>

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

    <div class="row">
        <div class="col-md-6">