@@ -21,8 +21,8 @@ class NewsController extends Controller
|
||||
if (request()->get('preview', null) != null) {
|
||||
$preview = "?preview=" . request()->get('preview');
|
||||
}
|
||||
$apiResult = $this->API('nieuws/bericht/' . $id . $preview);
|
||||
$newsItem = new \Model\NewsItem($apiResult->news);
|
||||
$apiResult = (object) $this->API('nieuws/bericht/' . $id . $preview);
|
||||
$newsItem = new \Model\NewsItem((object) $apiResult->news);
|
||||
|
||||
switch ($apiResult->version) {
|
||||
case 1:
|
||||
@@ -54,10 +54,10 @@ class NewsController extends Controller
|
||||
{
|
||||
$page = (int) $request->get('pagina', 1);
|
||||
$id = $request->get('id', '');
|
||||
$apiResult = $this->API('nieuws/overzicht?pagina=' . (int) max(1, $page) . '&aantal=5');
|
||||
$apiResult = (object) $this->API('nieuws/overzicht?pagina=' . (int) max(1, $page) . '&aantal=5');
|
||||
$news = [];
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
$news[] = new \Model\NewsItem($newsItem);
|
||||
$news[] = new \Model\NewsItem((object) $newsItem);
|
||||
}
|
||||
|
||||
return view('partial/newslist_small', ['id' => $id, 'news' => $news]);
|
||||
@@ -68,9 +68,9 @@ class NewsController extends Controller
|
||||
$page = (int) $request->get('pagina', 1);
|
||||
$id = $request->get('id', '');
|
||||
$populair = [];
|
||||
$apiResult = $this->API('nieuws/populair?pagina=' . (int) max(1, $page) . '&aantal=5');
|
||||
$apiResult = (object) $this->API('nieuws/populair?pagina=' . (int) max(1, $page) . '&aantal=5');
|
||||
foreach ($apiResult->news as $_newsItem) {
|
||||
$populair[] = new \Model\NewsItem($_newsItem);
|
||||
$populair[] = new \Model\NewsItem((object) $_newsItem);
|
||||
}
|
||||
|
||||
return view('partial/newslist_small', ['id' => $id, 'news' => $populair]);
|
||||
@@ -99,9 +99,9 @@ class NewsController extends Controller
|
||||
|
||||
public function activeblog()
|
||||
{
|
||||
$apiResult = $this->API('blog/overzicht');
|
||||
if (count($apiResult)) {
|
||||
$blog = new \Model\Blog($apiResult[0]);
|
||||
$apiResult = (object) $this->API('blog/overzicht');
|
||||
if (count((array) $apiResult)) {
|
||||
$blog = new \Model\Blog((object) $apiResult[0]);
|
||||
if ($blog->is_active) {
|
||||
return redirect($blog->url);
|
||||
}
|
||||
@@ -115,9 +115,9 @@ class NewsController extends Controller
|
||||
|
||||
parent::registerView($request, 'blog', $id);
|
||||
|
||||
$blog = $this->API('nieuws/liveblog/' . (int) $id);
|
||||
$blog = (object) $this->API('nieuws/liveblog/' . (int) $id);
|
||||
foreach ($blog->artikelen as &$item) {
|
||||
$item = new \Model\NewsItem($item);
|
||||
$item = new \Model\NewsItem((object) $item);
|
||||
}
|
||||
|
||||
if (request()->ajax()) {
|
||||
@@ -140,38 +140,38 @@ class NewsController extends Controller
|
||||
if ($url == 'overzicht' && $request->get('dateStart', null) && $request->get('dateEnd', null)) {
|
||||
$url = 'datum/' . $request->get('dateStart', null) . '/' . $request->get('dateEnd', null);
|
||||
}
|
||||
$apiResult = $this->API('nieuws/' . $url . '?pagina=' . (int) max(1, $page) . ($total ? '&aantal=' . $total : ''));
|
||||
$apiResult = (object) $this->API('nieuws/' . $url . '?pagina=' . (int) max(1, $page) . ($total ? '&aantal=' . $total : ''));
|
||||
$news = [];
|
||||
foreach ($apiResult->news ?? [] as $newsItem) {
|
||||
$news[] = new \Model\NewsItem($newsItem);
|
||||
$news[] = new \Model\NewsItem((object) $newsItem);
|
||||
}
|
||||
|
||||
$populair = [];
|
||||
if ($title == null) {
|
||||
$total = 5;
|
||||
}
|
||||
$apiResult = $this->API('nieuws/populair?pagina=' . (int) max(
|
||||
$apiResult = (object) $this->API('nieuws/populair?pagina=' . (int) max(
|
||||
1,
|
||||
$page
|
||||
) . ($total ? '&aantal=' . $total : ''));
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
$populair[] = new \Model\NewsItem($newsItem);
|
||||
$populair[] = new \Model\NewsItem((object) $newsItem);
|
||||
}
|
||||
|
||||
$podcast = null;
|
||||
$podcasts = [];
|
||||
if ($title == null) {
|
||||
$apiResult = $this->API('podcast/overzicht?aantal=3');
|
||||
$podcast = new \Model\Podcast($apiResult->podcasts[0]);
|
||||
$apiResult = (object) $this->API('podcast/overzicht?aantal=3');
|
||||
$podcast = new \Model\Podcast((object) $apiResult->podcasts[0]);
|
||||
foreach ($apiResult->podcasts as $_podcast) {
|
||||
$podcasts[] = new \Model\Podcast($_podcast);
|
||||
$podcasts[] = new \Model\Podcast((object) $_podcast);
|
||||
}
|
||||
}
|
||||
|
||||
$newsItems = [];
|
||||
$apiResult = $this->API('nieuws/overzicht?aantal=5');
|
||||
$apiResult = (object) $this->API('nieuws/overzicht?aantal=5');
|
||||
foreach ($apiResult->news as $_newsItem) {
|
||||
$newsItems[] = new \Model\NewsItem($_newsItem);
|
||||
$newsItems[] = new \Model\NewsItem((object) $_newsItem);
|
||||
}
|
||||
|
||||
return view($request->ajax() ? ($title == null ? 'partial/home_newslist_small' : 'partial/newslist_small') : ($title == null ? 'news' : 'newslist'), ['populair' => $populair, 'newsItems' => $newsItems, 'podcasts' => $podcasts, 'podcast' => $podcast, 'id' => $id, 'title' => $title, 'news' => $news, 'searchURL' => 'nieuws/zoeken']);
|
||||
@@ -179,7 +179,7 @@ class NewsController extends Controller
|
||||
|
||||
public function popular()
|
||||
{
|
||||
$apiResult = $this->API('nieuws/populair');
|
||||
$apiResult = (object) $this->API('nieuws/populair');
|
||||
$news = [];
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
$news[] = new \Model\NewsItem($newsItem);
|
||||
@@ -190,7 +190,7 @@ class NewsController extends Controller
|
||||
|
||||
public function regionieuws()
|
||||
{
|
||||
$data = $this->API('nieuws/regionieuws.json');
|
||||
$data = (object) $this->API('nieuws/regionieuws.json');
|
||||
return view('listen', [
|
||||
'source' => $this->API_URL . 'nieuws/regionieuws.mp3',
|
||||
'title' => 'Regionieuws',
|
||||
|
||||
Reference in New Issue
Block a user