Skip to content

Commit

Permalink
MDL-52258 calendar: show event duration on block
Browse files Browse the repository at this point in the history
Highlight the days on the calendar for the entire duration
of the event, not just the start day. The days are highlighted
with the same colour as the starting day and will also show
the event popup on hover.
  • Loading branch information
ryanwyllie authored and juancs committed Dec 10, 2015
1 parent 0dfcc25 commit 4f2ff25
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
13 changes: 11 additions & 2 deletions calendar/lib.php
Expand Up @@ -338,15 +338,24 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea
$class = 'day';
}

if (isset($eventsbyday[$day])) {
$eventids = array();
if (!empty($eventsbyday[$day])) {
$eventids = $eventsbyday[$day];
}

if (!empty($durationbyday[$day])) {
$eventids = array_unique(array_merge($eventids, $durationbyday[$day]));
}

if (!empty($eventids)) {
// There is at least one event on this day.

$class .= ' hasevent';
$hrefparams['view'] = 'day';
$dayhref = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $hrefparams), 0, 0, 0, $daytime);

$popupcontent = '';
foreach($eventsbyday[$day] as $eventid) {
foreach($eventids as $eventid) {
if (!isset($events[$eventid])) {
continue;
}
Expand Down
20 changes: 20 additions & 0 deletions theme/bootstrapbase/less/moodle/calendar.less
Expand Up @@ -20,6 +20,22 @@
background-color: @calendarEventUserColor;
}

.duration_global {
background-color: @calendarEventGlobalColor;
}

.duration_course {
background-color: @calendarEventCourseColor;
}

.duration_group {
background-color: @calendarEventGroupColor;
}

.duration_user {
background-color: @calendarEventUserColor;
}

// Calendar restyling.
.path-calendar {
.calendartable {
Expand Down Expand Up @@ -314,6 +330,10 @@
td {
&.weekend {
.muted;

a {
.muted;
}
}
a {
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions theme/bootstrapbase/style/moodle.css

Large diffs are not rendered by default.

0 comments on commit 4f2ff25

Please sign in to comment.