コード例 #1
0
ファイル: TSearch.php プロジェクト: Nechhist/to.ru
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = T::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, 'admin_id' => $this->admin_id, 'type' => $this->type, 'time' => $this->time, 'invisible' => $this->invisible]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'game', $this->game])->andFilterWhere(['like', 'img', $this->img])->andFilterWhere(['like', 'site', $this->site])->andFilterWhere(['like', 'opisanie', $this->opisanie])->andFilterWhere(['like', 'color_table', $this->color_table])->andFilterWhere(['like', 'color_text_unit', $this->color_text_unit])->andFilterWhere(['like', 'color_text_time', $this->color_text_time])->andFilterWhere(['like', 'color_line', $this->color_line])->andFilterWhere(['like', 'color_cell', $this->color_cell]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: TController.php プロジェクト: Nechhist/to.ru
 /**
  * Finds the T model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return T the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = T::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }