Calendar starts last Monday instead of today
This commit is contained in:
@@ -17,7 +17,7 @@ SELECT `news`.`id`, `content`.`title`, `content`.`content`, `news`.`podcast`, `n
|
||||
`news`.`creationdt` AS `published`, `content`.`creator`, `content`.`editingdt` AS `edited`, `content`.`editor`,
|
||||
`news`.`startdt` AS `starts`, `news`.`enddt` AS `ends`,
|
||||
`content`.`showsource`, `sources`.`title` AS `source`, `sources`.`url` AS `source_url`,
|
||||
`themes`.`title` AS `theme`, `themes`.`thumbnail` AS `theme_thumbnail`, `regions`.`title` AS `region`
|
||||
`themes`.`title` AS `theme`, `themes`.`thumbnail` AS `theme_thumbnail`, `regions`.`title` AS `region`
|
||||
FROM `news`
|
||||
LEFT JOIN `news_target_content` AS `content` ON `content`.`news` = `news`.`id`
|
||||
LEFT JOIN `news_regions` AS `regions` ON `regions`.`id` = `news`.`region`
|
||||
@@ -69,9 +69,10 @@ QUERY;
|
||||
* Agendaberichten ophalen
|
||||
*/
|
||||
public function calendarlist(Request $request) {
|
||||
$monday = new \DateTime('last Monday');
|
||||
$agendaItems = app('db')->select(self::$BASE_SQL
|
||||
. ' AND `news`.`enddt` >= CURRENT_DATE() '
|
||||
. ' ORDER BY `news`.`startdt` ASC, `news`.`enddt` ASC', ['category' => self::$CALENDAR_CATEGORY]);
|
||||
. ' AND `news`.`enddt` >= :monday '
|
||||
. ' ORDER BY `news`.`startdt` ASC, `news`.`enddt` ASC', ['category' => self::$CALENDAR_CATEGORY, 'monday' => $monday]);
|
||||
|
||||
$result = array();
|
||||
foreach($agendaItems as $agendaItem) {
|
||||
|
||||
Reference in New Issue
Block a user