public function actionIndex() { $data = []; $rss = new RSSRead(); $rss->setUrl('http://www.rynekzdrowia.pl/Kanal/all.xml', 'www.rynekzdrowia.pl'); $rss->parseRSS(); $data = $rss->data; $infoModel = Infos::find()->where(['and', time() . ' > start_time', time() . ' < end_time'])->orderBy('insert_time DESC')->one(); if ($infoModel != null) { $title = $infoModel->content; $titleClass = 'warning'; } else { $title = 'SGA InfoBoard'; $titleClass = ''; } $weather = Weather::find()->orderBy('update_time DESC')->one(); if ($weather == null || $weather->update_time < time() - 15 * 60) { $weather = new Weather(); $weather->updateWeather(); } $weekdays = ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota']; $model = new MissingData(); $model->getData(); $missingData = $model->getJSONStrings(); return $this->render('index', ['data' => $data, 'weather' => $weather, 'weekdays' => $weekdays, 'missingData' => $missingData, 'title' => $title, 'titleClass' => $titleClass]); }
public function actionIndex() { $data = []; $rss = new RSSRead(); $rss->setUrl('http://www.rynekzdrowia.pl/Kanal/all.xml', 'www.rynekzdrowia.pl'); // $rss->setUrl('http://www.newsweek.pl/rss.xml', 'www.newsweek.pl'); $rss->parseRSS(); $data = $rss->data; $weather = Weather::find()->orderBy('update_time DESC')->one(); if ($weather == null || $weather->update_time < time() - 15 * 60) { $weather = new Weather(); $weather->updateWeather(); } $weekdays = ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota']; $sprint = new SprintRead(); $sprint->getSprint(); $sprintData = $sprint->getJSONStrings(); return $this->render('index', ['data' => $data, 'weather' => $weather, 'weekdays' => $weekdays, 'sprintData' => $sprintData]); }