/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Spheres::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, 'date_post' => $this->date_post, 'date_update' => $this->date_update]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
예제 #2
0
		<?php 
$list_projects = ArrayHelper::map($projects, 'id', 'name');
echo $form->field($model, 'id_project')->dropDownList($list_projects);
?>

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

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

		<?php 
$sphere = Spheres::find()->all();
$list_sphere = ArrayHelper::map($sphere, 'id', 'name');
echo $form->field($model, 'id_sphere')->dropDownList($list_sphere, ['prompt' => 'Выберите из списка']);
?>

		<?
	    	// usage without model
			echo '<label>Дата старта кампании</label>';
			echo DatePicker::widget([
			    'name' => 'date_begin',
				'value' => $time_begin,
			    'pluginOptions' => [
			        'autoclose' => true,
					'format' => 'yyyy-mm-dd',
			        'todayHighlight' => true
			    ],