public function index() { $this->latitude = isset($_GET['lat']) ? $_GET['lat'] : Config::get('mirror.latitude'); $this->longitude = isset($_GET['long']) ? $_GET['long'] : Config::get('mirror.longitude'); $locale_controller = new LocaleController(); $locale_data = $locale_controller->get_locale($this->latitude, $this->longitude); $weather_controller = new WeatherController(); $weather_data = $weather_controller->get_weather($this->latitude, $this->longitude); // Athens $calendar_controller = new CalendarController(); $calendar_data = $calendar_controller->get_calendar(Config::get('mirror.ical_url'), 7); $news_controller = new NewsController(); foreach (Config::get('mirror.news_sources') as $source) { $news_controller->add_source($source, 5); } $news_data = $news_controller->fetch_sources(); $locale = $locale_data; $date = date('l, F d, Y'); $time = date('g:i a'); $weather = $weather_data; $calendar = $calendar_data; $news = $news_data; return view('mirror.main', ['date' => $date, 'time' => $time, 'locale' => $locale, 'weather' => $weather, 'calendar' => $calendar, 'news' => $news]); }
public function detailnews($id, $name) { $news = NewsController::getNewsWhereID($id); $menu = MenuController::getMenu(); $categorys = CategoryController::getCategory(); $convert = new convertString(); $info = InfoController::getInfo(); $newsnews = NewsController::getNewsNew(); // lấy ra tin mới nhất $newsRelesion = NewsController::getNewsReleasion($news[0]->categoryNewsID, $news[0]->id); // lấy ra tin tức liên quan $newMaxView = NewsController::getNewsMaxView(); // lấy ra 5 tin tức có lượt view nhiều nhất $news[0]->view += 1; $data[0] = $news[0]; NewsController::update($data, $id); /////update view $header = array("title" => $news[0]->name, "keyword" => $news[0]->name, "description" => $news[0]->name); if (count($menu) > 0) { $menu = $this->ConvertMenuToArray($menu); } if (count($news) > 0) { return view('news.detailnews', array('menu' => $menu, 'news' => $news, "categorys" => $categorys, "info" => $info, "convert" => $convert, "newMaxView" => $newMaxView, "newsRelesion" => $newsRelesion, "header" => $header, "newsnews" => $newsnews)); } else { return view('product.error', array("menu" => $menu, "categorys" => $categorys, "info" => $info, "header" => $header, "newsnews" => $newsnews)); } }