From 3b532ae6f5d7c57f7bc6e3adadb11344988c95b9 Mon Sep 17 00:00:00 2001 From: samhemelryk Date: Thu, 24 Sep 2009 07:47:50 +0000 Subject: [PATCH] mod-hotpot MDL-19810 Added set_url calls, replaced deprecated functions --- mod/hotpot/attempt.php | 5 ++++- mod/hotpot/grade.php | 4 +++- mod/hotpot/index.php | 7 +++++-- mod/hotpot/report.php | 4 +++- mod/hotpot/review.php | 7 +++++-- mod/hotpot/show.php | 4 +++- mod/hotpot/view.php | 14 ++++++++++---- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/mod/hotpot/attempt.php b/mod/hotpot/attempt.php index 8cf1f9aa07..589f1fd5ba 100644 --- a/mod/hotpot/attempt.php +++ b/mod/hotpot/attempt.php @@ -1,9 +1,12 @@ -set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/attempt.php', array('attemptid'=>$attemptid))); + // get attempt, hotpot, course and course_module records if (! $attempt = $DB->get_record("hotpot_attempts", array("id"=>$attemptid))) { print_error('invalidattemptid', 'hotpot'); diff --git a/mod/hotpot/grade.php b/mod/hotpot/grade.php index 08ffc8a38e..5863989b4e 100644 --- a/mod/hotpot/grade.php +++ b/mod/hotpot/grade.php @@ -1,9 +1,11 @@ -set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/grade.php', array('id'=>$id))); + if (! $cm = get_coursemodule_from_id('hotpot', $id)) { print_error('invalidcoursemodule'); } diff --git a/mod/hotpot/index.php b/mod/hotpot/index.php index b2a1109586..ddfcfb73e2 100644 --- a/mod/hotpot/index.php +++ b/mod/hotpot/index.php @@ -1,4 +1,4 @@ -set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/index.php', array('id'=>$id))); + if (!$course = $DB->get_record('course', array('id'=>$id))) { print_error('invalidcourseid'); } diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index b65c681295..d9b20e0734 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -9,6 +9,7 @@ $hp = optional_param('hp', 0, PARAM_INT); // hotpot ID if ($id) { + $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/report.php', array('id'=>$id))); if (! $cm = get_coursemodule_from_id('hotpot', $id)) { print_error('invalidcoursemodule'); } @@ -20,6 +21,7 @@ } } else { + $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/report.php', array('hp'=>$hp))); if (! $hotpot = $DB->get_record("hotpot", array("id"=>$hp))) { print_error('invalidhotpotid', 'hotpot'); } @@ -442,7 +444,7 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) { $PAGE->set_title(format_string($course->shortname) . ": $hotpot->name"); $PAGE->set_heading($course->fullname); - $PAGE->set_button(update_module_button($cm->id, $course->id, $strmodulename)); + $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'hotpot')); echo $OUTPUT->header(); $course_context = get_context_instance(CONTEXT_COURSE, $course->id); diff --git a/mod/hotpot/review.php b/mod/hotpot/review.php index 76c4c67259..03e12b4171 100644 --- a/mod/hotpot/review.php +++ b/mod/hotpot/review.php @@ -1,4 +1,5 @@ -set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/review.php', array('id'=>$id,'attempt'=>$attempt))); if (! $cm = get_coursemodule_from_id('hotpot', $id)) { print_error('invalidcoursemodule'); } @@ -18,6 +20,7 @@ print_error('invalidcoursemodule'); } } else { + $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/review.php', array('hp'=>$hp,'attempt'=>$attempt))); if (! $hotpot = $DB->get_record("hotpot", array("id"=>$hp))) { print_error('invalidcoursemodule'); } @@ -56,7 +59,7 @@ $PAGE->requires->js('lib/overlib/overlib_cssstyle.js')->in_head(); $PAGE->set_title(format_string($course->shortname) . ": $hotpot->name"); $PAGE->set_heading($course->fullname); - $PAGE->set_button(update_module_button($cm->id, $course->id, $strmodulename)); + $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'hotpot')); echo $OUTPUT->header(); print ''; // for overlib echo $OUTPUT->heading($hotpot->name); diff --git a/mod/hotpot/show.php b/mod/hotpot/show.php index e29f3c7a76..c78a029bd7 100644 --- a/mod/hotpot/show.php +++ b/mod/hotpot/show.php @@ -1,4 +1,4 @@ -course = required_param('course', PARAM_INT); $params->reference = required_param('reference', PARAM_PATH); + $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/show.php', array('action'=>$params->action, 'course'=>$params->course, 'reference'=>$params->reference))); + require_login($params->course); if (!has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $params->course))) { diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index c5fb549d2d..59a8a15527 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -1,4 +1,5 @@ -set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/report.php', array('id'=>$id))); if (! $cm = get_coursemodule_from_id('hotpot', $id)) { print_error('invalidcoursemodule'); } @@ -23,6 +25,7 @@ } } else { + $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/hotpot/report.php', array('hp'=>$hp))); if (! $hotpot = $DB->get_record("hotpot", array("id"=>$hp))) { print_error('invalidhotpotid', 'hotpot'); } @@ -43,7 +46,7 @@ $title = format_string($course->shortname.': '.$hotpot->name, true); $heading = $course->fullname; - $button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot")); + $button = $OUTPUT->update_module_button($cm->id, 'hotpot'); $button = '
'.$button.'
'; $loggedinas = ''.user_login_string($course, $USER).''; @@ -370,8 +373,11 @@ $footer = ''.$footer; switch ($hotpot->navigation) { case HOTPOT_NAVIGATION_BAR: - //update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em') - print_header($title, $heading, '', "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags); + $PAGE->set_title($title); + $PAGE->set_heading($heading); + $PAGE->set_button($button); + $PAGE->set_headingmenu($loggedinas); + echo $OUTPUT->header(); if (!empty($available_msg)) { echo $OUTPUT->notification($available_msg); } -- 2.39.5