Created
August 1, 2012 10:46
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8389e386d6cbde9dd828cd4bc7398d3e282f8e06 Mon Sep 17 00:00:00 2001 | |
From: Mark Johnson <[email protected]> | |
Date: Wed, 1 Dec 2010 09:56:46 +0000 | |
Subject: [PATCH 08/78] Added course names and links to calendar blocks | |
--- | |
calendar/lib.php | 15 ++++++++++++++- | |
1 file changed, 14 insertions(+), 1 deletion(-) | |
diff --git a/calendar/lib.php b/calendar/lib.php | |
index a6bc069..b5a987c 100644 | |
--- a/calendar/lib.php | |
+++ b/calendar/lib.php | |
@@ -286,6 +286,12 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y | |
$dayhref->set_anchor('event_'.$event->id); | |
$popupcontent .= html_writer::start_tag('div'); | |
+ | |
+ /* LOCAL: Add course fullname to popup MDL-19170 */ | |
+ global $DB; | |
+ if ($fullname = $DB->get_record('course', array('id' => $event->courseid))->fullname) { | |
+ $popupcontent .= $fullname.html_writer::empty_tag('br'); | |
+ } | |
$popupcontent .= $OUTPUT->pix_icon($popupicon, $popupalt, $component); | |
$popupcontent .= html_writer::link($dayhref, format_string($event->name, true)); | |
$popupcontent .= html_writer::end_tag('div'); | |
@@ -1057,7 +1063,14 @@ function calendar_get_block_upcoming($events, $linkhref = NULL) { | |
continue; | |
} | |
$events[$i] = calendar_add_event_metadata($events[$i]); | |
- $content .= '<div class="event"><span class="icon c0">'.$events[$i]->icon.'</span> '; | |
+ /* LOCAL: Add course link to Upcoming Events block | |
+ $content .= '<div class="event"><span class="icon c0">'.$events[$i]->icon.'</span> '; */ | |
+ $content .= html_writer::start_tag('div', array('class' => 'event')); | |
+ if (!empty($events[$i]->courselink)) { | |
+ $content .= $events[$i]->courselink; | |
+ } | |
+ $content .= html_writer::tag('span', $events[$i]->icon, array('class' => 'icon c0')); | |
+ | |
if (!empty($events[$i]->referer)) { | |
// That's an activity event, so let's provide the hyperlink | |
$content .= $events[$i]->referer; | |
-- | |
1.7.10 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 95c524a4d80421b61796ce1d92938dbdc4aaf59b Mon Sep 17 00:00:00 2001 | |
From: Mark Johnson <[email protected]> | |
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