Merge branch 'MDL-52258-master' of git://github.com/juancs/moodle

This commit is contained in:
Dan Poltawski 2016-01-05 14:46:12 +00:00
commit 3348fa77ff
3 changed files with 70 additions and 7 deletions

View File

@ -338,7 +338,18 @@ 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]));
}
$finishclass = false;
if (!empty($eventids)) {
// There is at least one event on this day.
$class .= ' hasevent';
@ -346,7 +357,7 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea
$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;
}
@ -367,26 +378,47 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea
$popupicon = 'i/userevent';
}
if ($event->timeduration) {
$startdate = $calendartype->timestamp_to_date_array($event->timestart);
$enddate = $calendartype->timestamp_to_date_array($event->timestart + $event->timeduration - 1);
if ($enddate['mon'] == $m && $enddate['year'] == $y && $enddate['mday'] == $day) {
$finishclass = true;
}
}
$dayhref->set_anchor('event_'.$event->id);
$popupcontent .= html_writer::start_tag('div');
$popupcontent .= $OUTPUT->pix_icon($popupicon, $popupalt, $component);
$name = format_string($event->name, true);
// Show ical source if needed.
if (!empty($event->subscription) && $CFG->calendar_showicalsource) {
$a = new stdClass();
$a->name = $name;
$a->source = $event->subscription->name;
$name = get_string('namewithsource', 'calendar', $a);
} else {
if ($finishclass) {
$samedate = $startdate['mon'] == $enddate['mon'] &&
$startdate['year'] == $enddate['year'] &&
$startdate['mday'] == $enddate['mday'];
if ($samedate) {
$name = format_string($event->name, true);
} else {
$name = format_string($event->name, true) . ' (' . get_string('eventendtime', 'calendar') . ')';
}
} else {
$name = format_string($event->name, true);
}
}
$popupcontent .= html_writer::link($dayhref, $name);
$popupcontent .= html_writer::end_tag('div');
}
if ($display->thismonth && $day == $d) {
$popupdata = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent);
$popupdata = calendar_get_popup(true, $daytime, $popupcontent);
} else {
$popupdata = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent);
$popupdata = calendar_get_popup(false, $daytime, $popupcontent);
}
$cellattributes = array_merge($cellattributes, $popupdata);
@ -400,6 +432,9 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea
} else if(isset($typesbyday[$day]['startuser'])) {
$class .= ' calendar_event_user';
}
if ($finishclass) {
$class .= ' duration_finish';
}
$cell = html_writer::link($dayhref, $day);
} else {
$cell = $day;
@ -439,7 +474,7 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea
$class .= ' today';
$today = get_string('today', 'calendar').' '.userdate(time(), get_string('strftimedayshort'));
if (!isset($eventsbyday[$day])) {
if (!isset($eventsbyday[$day]) && !isset($durationbyday[$day])) {
$class .= ' eventnone';
$popupdata = calendar_get_popup(true, false);
$cellattributes = array_merge($cellattributes, $popupdata);

View File

@ -320,6 +320,34 @@
height: 100%;
display: block;
}
&.duration_global {
border-top: 1px solid @calendarEventGlobalColor;
border-bottom: 1px solid @calendarEventGlobalColor;
&.duration_finish {
background-color: @calendarEventGlobalColor;
}
}
&.duration_course {
border-top: 1px solid @calendarEventCourseColor;
border-bottom: 1px solid @calendarEventCourseColor;
&.duration_finish {
background-color: @calendarEventCourseColor;
}
}
&.duration_group {
border-top: 1px solid @calendarEventGroupColor;
border-bottom: 1px solid @calendarEventGroupColor;
&.duration_finish {
background-color: @calendarEventGroupColor;
}
}
&.duration_user {
border-top: 1px solid @calendarEventUserColor;
border-bottom: 1px solid @calendarEventUserColor;
&.duration_finish {
background-color: @calendarEventUserColor;
}
}
}
caption {
font-size: inherit;

File diff suppressed because one or more lines are too long