Skip to content

Commit

Permalink
MDL-36967 Deprecate function print_overview()
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Jan 14, 2013
1 parent ca48fe5 commit ff23385
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 48 deletions.
48 changes: 0 additions & 48 deletions course/lib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -847,54 +847,6 @@ function print_log_ods($course, $user, $date, $order='l.time DESC', $modname,
return true; 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 * This function trawls through the logs looking for
* anything new since the user's last login * anything new since the user's last login
Expand Down
57 changes: 57 additions & 0 deletions lib/deprecatedlib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3084,3 +3084,60 @@ function format_weeks_get_section_dates($section, $course) {
} }
return null; 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();
}
}

0 comments on commit ff23385

Please sign in to comment.