public function search($params) { $query = PogodaXXI::find()->where(['max_temp' => '']); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); $query->andFilterWhere(['like', 'title', $this->title]); return $dataProvider; }
public function loadModel($id) { $model = PogodaXXI::findOne($id); if ($model === null) { throw new \yii\web\HttpException(404, 'The requested page does not exist.'); } return $model; }
function actionFillPogodaxxi() { $time_first = mktime(0, 0, 0, 1, 1, 2001); $time_end = mktime(0, 0, 0, 1, 1, 2009); // echo date('d-m-Y',$time_first).PHP_EOL; //echo date('d-m-Y',$time_first+(60*60*24)).PHP_EOL; $i = 0; //$time = $time_first; while ($i < 3650) { $i++; if ($time_first + 60 * 60 * 24 * $i > $time_end) { break; } //$time += $time_first+(60*60*24); $day = new PogodaXXI(); $day->year = (int) date('Y', $time_first + 60 * 60 * 24 * $i); $day->date = (int) date('j', $time_first + 60 * 60 * 24 * $i); $day->month = (int) date('n', $time_first + 60 * 60 * 24 * $i); $day->week = (int) date('W', $time_first + 60 * 60 * 24 * $i); $day->day_week = (int) date('w', $time_first + 60 * 60 * 24 * $i); $day->save(false); echo date('d-m-Y', $time_first + 60 * 60 * 24 * $i) . ' done ' . PHP_EOL; } }