コード例 #1
0
 /**
  * @param $args
  */
 public function index($args)
 {
     if (empty($args)) {
         return false;
     }
     setcookie("name", $args['name'], time() + 50000, '/');
     $forecast = new \models\ForecastModel(\models\DbClass::getInstance());
     $api = new \models\ApiModel();
     $city = $api->getCity($args['name']);
     $curWeather = $api->getCurrentWeather($args['name']);
     $this->smarty->assign('current_weather', $curWeather);
     $weather = $forecast->forecast($args['name']);
     $archive = $forecast->archive($args['name']);
     $this->smarty->assign('weather', $weather);
     $this->smarty->assign('archive', $archive);
     $this->smarty->assign('city', $city['title']);
     $this->smarty->display('forecast.tpl');
 }
コード例 #2
0
 /**
  * @param $args
  */
 public function dellCity($args)
 {
     if (empty($args)) {
         return false;
     }
     $city = new \models\CityModel(\models\DbClass::getInstance());
     $city->delCity($args['name']);
     $this->index();
 }