Пример #1
0
 public function informerAction()
 {
     $model = new WeatherModel();
     $yandex_xml = $model->getXmlYandexForecast();
     $yandex_default_values = $model->getDefaultYandexValues();
     $default_value = Cookie::get('city_id') ? Cookie::get('city_id') : $yandex_default_values['default_value'];
     $weather = new Weather($yandex_xml['weather_source'], $default_value);
     $data = $weather->xmlProcessing();
     $city_name = array_shift($data);
     $args = ['data' => $data, 'city_name' => $city_name];
     return $this->weatherRender('informer.phtml', $args);
 }
Пример #2
0
 public function changeCityAction()
 {
     $request = new Request();
     $model = new WeatherModel();
     $yandex_xml = $model->getXmlYandexForecast();
     $city_id = $request->post('city_id');
     /*
      * Getting weather report for city
      */
     $weather = new Weather($yandex_xml['weather_source'], $city_id);
     $data = $weather->xmlProcessing();
     $city_name = array_shift($data);
     $args = ['data' => $data, 'city_name' => $city_name];
     /*
      * Rendering page with city
      */
     return $this->weatherRender('result.phtml', $args);
 }