Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marxjohnson/3225749 to your computer and use it in GitHub Desktop.
Save marxjohnson/3225749 to your computer and use it in GitHub Desktop.
Patch for Moodle 2 to add the course fullname to calendar block popups, and course links to the Upcoming Events block. Copyright Richard Taunton Sixth Form College, UK. Licenced under GNU GPL.
From 95c524a4d80421b61796ce1d92938dbdc4aaf59b Mon Sep 17 00:00:00 2001
From: Mark Johnson <mark.johnson@tauntons.ac.uk>
Date: Wed, 16 Mar 2011 11:10:37 +0000
Subject: [PATCH 19/78] Tweaked local modification to only attempt to show
course name for course events in calendar block
---
calendar/lib.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/calendar/lib.php b/calendar/lib.php
index b5a987c..c052c03 100644
--- a/calendar/lib.php
+++ b/calendar/lib.php
@@ -289,7 +289,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
/* LOCAL: Add course fullname to popup MDL-19170 */
global $DB;
- if ($fullname = $DB->get_record('course', array('id' => $event->courseid))->fullname) {
+ if (!empty($event->courseid) && $fullname = $DB->get_record('course', array('id' => $event->courseid))->fullname) {
$popupcontent .= $fullname.html_writer::empty_tag('br');
}
$popupcontent .= $OUTPUT->pix_icon($popupicon, $popupalt, $component);
--
1.7.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment