Added news themes

This commit is contained in:
2017-10-16 21:45:19 +02:00
parent 8fc1c482f1
commit dd88cbb4c8
3 changed files with 14 additions and 1 deletions

View File

@@ -13,7 +13,8 @@ SELECT `news`.`id`, `content`.`title`, `content`.`content`, `news`.`podcast` AS
`news`.`creationdt` AS `published`, `content`.`creator`, `news`.`pubupdatedt` AS `edited`, `news`.`creationdt` AS `published`, `content`.`creator`, `news`.`pubupdatedt` AS `edited`,
`news`.`startdt` AS `starts`, `news`.`enddt` AS `ends`, `news`.`startdt` AS `starts`, `news`.`enddt` AS `ends`,
`content`.`showsource` AS `showsource`, `sources`.`title` AS `source`, `sources`.`url` AS `source_url`, `content`.`showsource` AS `showsource`, `sources`.`title` AS `source`, `sources`.`url` AS `source_url`,
`themes`.`title` AS `theme`, `themes`.`thumbnail` AS `theme_thumbnail`, `regions`.`title` AS `region`, `regions`.`slug` as `region_slug` `themes`.`title` AS `theme`, `themes`.`thumbnail` AS `theme_thumbnail`, `themes`.`slug` AS `theme_slug`,
`regions`.`title` AS `region`, `regions`.`slug` as `region_slug`
FROM `news` FROM `news`
LEFT JOIN `news_target_content` AS `content` ON `content`.`news` = `news`.`id` LEFT JOIN `news_target_content` AS `content` ON `content`.`news` = `news`.`id`
LEFT JOIN `news_regions` AS `regions` ON `regions`.`id` = `news`.`region` LEFT JOIN `news_regions` AS `regions` ON `regions`.`id` = `news`.`region`
@@ -76,6 +77,10 @@ QUERY;
return $this->newslist($request, ['`regions`.`slug`' => $region]); return $this->newslist($request, ['`regions`.`slug`' => $region]);
} }
public function themelist(Request $request, $theme) {
return $this->newslist($request, ['`themes`.`slug`' => $theme]);
}
/** /**
* Agendaberichten ophalen * Agendaberichten ophalen
*/ */

View File

@@ -17,6 +17,7 @@ $app->get('/', function () use ($app) {
$app->get('nieuws/overzicht', 'NewsController@newslist' ); $app->get('nieuws/overzicht', 'NewsController@newslist' );
$app->get('nieuws/regio/{region:[a-z0-9]+}', 'NewsController@regionlist' ); $app->get('nieuws/regio/{region:[a-z0-9]+}', 'NewsController@regionlist' );
$app->get('nieuws/thema/{theme:[a-z0-9]+}', 'NewsController@themelist' );
$app->get('nieuws/populair', 'NewsController@popularNews' ); $app->get('nieuws/populair', 'NewsController@popularNews' );
$app->get('nieuws/bericht/{id:\d+}', 'NewsController@newsitem' ); $app->get('nieuws/bericht/{id:\d+}', 'NewsController@newsitem' );
$app->get('nieuws/regionieuws', 'PodcastController@latestNews' ); $app->get('nieuws/regionieuws', 'PodcastController@latestNews' );

View File

@@ -65,6 +65,13 @@ class NewsItem extends Model {
$this->region = new \Model\NewsRegion($data->region, $data->region_slug); $this->region = new \Model\NewsRegion($data->region, $data->region_slug);
} }
if(is_object($data->theme)) {
$this->theme = new \Model\NewsRegion($data->theme->title, $data->theme->slug);
} else {
$this->theme = new \Model\NewsRegion($data->theme, $data->theme_slug);
}
$images = ($images != null) ? $images $images = ($images != null) ? $images
: (isset($data->images) ? $data->images : null); : (isset($data->images) ? $data->images : null);
if($images) { if($images) {