From ff233851a0465a861f46bd60d1f20505898800a9 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Mon, 3 Dec 2012 12:44:14 +0800 Subject: [PATCH] MDL-36967 Deprecate function print_overview() --- course/lib.php | 48 ------------------------------------ lib/deprecatedlib.php | 57 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/course/lib.php b/course/lib.php index 5230240934630..288e01c3a8bfd 100644 --- a/course/lib.php +++ b/course/lib.php @@ -847,54 +847,6 @@ function print_log_ods($course, $user, $date, $order='l.time DESC', $modname, return true; } - -function print_overview($courses, array $remote_courses=array()) { - global $CFG, $USER, $DB, $OUTPUT; - - $htmlarray = array(); - if ($modules = $DB->get_records('modules')) { - foreach ($modules as $mod) { - if (file_exists(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php')) { - include_once(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php'); - $fname = $mod->name.'_print_overview'; - if (function_exists($fname)) { - $fname($courses,$htmlarray); - } - } - } - } - foreach ($courses as $course) { - $fullname = format_string($course->fullname, true, array('context' => context_course::instance($course->id))); - echo $OUTPUT->box_start('coursebox'); - $attributes = array('title' => s($fullname)); - if (empty($course->visible)) { - $attributes['class'] = 'dimmed'; - } - echo $OUTPUT->heading(html_writer::link( - new moodle_url('/course/view.php', array('id' => $course->id)), $fullname, $attributes), 3); - if (array_key_exists($course->id,$htmlarray)) { - foreach ($htmlarray[$course->id] as $modname => $html) { - echo $html; - } - } - echo $OUTPUT->box_end(); - } - - if (!empty($remote_courses)) { - echo $OUTPUT->heading(get_string('remotecourses', 'mnet')); - } - foreach ($remote_courses as $course) { - echo $OUTPUT->box_start('coursebox'); - $attributes = array('title' => s($course->fullname)); - echo $OUTPUT->heading(html_writer::link( - new moodle_url('/auth/mnet/jump.php', array('hostid' => $course->hostid, 'wantsurl' => '/course/view.php?id='.$course->remoteid)), - format_string($course->shortname), - $attributes) . ' (' . format_string($course->hostname) . ')', 3); - echo $OUTPUT->box_end(); - } -} - - /** * This function trawls through the logs looking for * anything new since the user's last login diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 4ace5edf3cc2b..e23dff2b6eb1a 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -3084,3 +3084,60 @@ function format_weeks_get_section_dates($section, $course) { } return null; } + +/** + * Displays the list of courses with user notes + * + * This function is not used in core. It was replaced by block course_overview + * + * @deprecated since 2.5 + * + * @param array $courses + * @param array $remote_courses + */ +function print_overview($courses, array $remote_courses=array()) { + global $CFG, $USER, $DB, $OUTPUT; + debugging('Function print_overview() is deprecated. Use block course_overview to display this information', DEBUG_DEVELOPER); + + $htmlarray = array(); + if ($modules = $DB->get_records('modules')) { + foreach ($modules as $mod) { + if (file_exists(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php')) { + include_once(dirname(dirname(__FILE__)).'/mod/'.$mod->name.'/lib.php'); + $fname = $mod->name.'_print_overview'; + if (function_exists($fname)) { + $fname($courses,$htmlarray); + } + } + } + } + foreach ($courses as $course) { + $fullname = format_string($course->fullname, true, array('context' => context_course::instance($course->id))); + echo $OUTPUT->box_start('coursebox'); + $attributes = array('title' => s($fullname)); + if (empty($course->visible)) { + $attributes['class'] = 'dimmed'; + } + echo $OUTPUT->heading(html_writer::link( + new moodle_url('/course/view.php', array('id' => $course->id)), $fullname, $attributes), 3); + if (array_key_exists($course->id,$htmlarray)) { + foreach ($htmlarray[$course->id] as $modname => $html) { + echo $html; + } + } + echo $OUTPUT->box_end(); + } + + if (!empty($remote_courses)) { + echo $OUTPUT->heading(get_string('remotecourses', 'mnet')); + } + foreach ($remote_courses as $course) { + echo $OUTPUT->box_start('coursebox'); + $attributes = array('title' => s($course->fullname)); + echo $OUTPUT->heading(html_writer::link( + new moodle_url('/auth/mnet/jump.php', array('hostid' => $course->hostid, 'wantsurl' => '/course/view.php?id='.$course->remoteid)), + format_string($course->shortname), + $attributes) . ' (' . format_string($course->hostname) . ')', 3); + echo $OUTPUT->box_end(); + } +}