Skip to content

Commit c47ff22

Browse files
authored
Merge pull request #16 from GeoSot/GeoSot-patch-1
fix: class is initialized outside each event scope, and in case of two events in the same time-frame we get duplicated classes
2 parents 52edb61 + d0e1708 commit c47ff22

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/phpCalendar/Calendar.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,7 @@ public function asWeekView($date = false, $color = false)
992992

993993
$datetime = $date->setTime(substr($time, 0, 2), substr($time, 3, 2));
994994

995-
$events = $this->findEvents($datetime, 'week');
996-
997-
$class = '';
998-
999-
$event_summary = '';
995+
$events = $this->findEvents($datetime, 'week');
1000996

1001997
$today_class = ($date->format('Y-m-d H') == $today->format('Y-m-d H')) ? ' today' : '';
1002998

@@ -1006,6 +1002,11 @@ public function asWeekView($date = false, $color = false)
10061002

10071003
if ($events) {
10081004
foreach ($events as $index => $event) {
1005+
1006+
$class = '';
1007+
1008+
$event_summary = '';
1009+
10091010
if (in_array($event, $used_events)) {
10101011
$event_summary = ' ';
10111012
} else {

0 commit comments

Comments
 (0)