From fb676024168e57053e22587f52ec0acb27e41d7b Mon Sep 17 00:00:00 2001 From: samhemelryk Date: Mon, 7 Sep 2009 05:31:58 +0000 Subject: [PATCH] notes MDL-19818 Updated print_header and build_navigation to OUTPUT and PAGE equivalents --- notes/delete.php | 14 +++++++++----- notes/edit.php | 18 ++++++++++-------- notes/index.php | 18 +++++++++++------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/notes/delete.php b/notes/delete.php index 1d8ad9f3a9c2f..95dc23750eb8c 100644 --- a/notes/delete.php +++ b/notes/delete.php @@ -53,13 +53,17 @@ $optionsno = array('course'=>$course->id, 'user'=>$note->userid); // output HTML + $link = null; if (has_capability('moodle/course:viewparticipants', $context) || has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) { - $nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc'); + $link = new moodle_url($CFG->wwwroot.'/user/index.php',array('id'=>$course->id)); } - $nav[] = array('name' => fullname($user), 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id. '&course=' . $course->id, 'type' => 'misc'); - $nav[] = array('name' => get_string('notes', 'notes'), 'link' => $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&user=' . $user->id, 'type' => 'misc'); - $nav[] = array('name' => get_string('delete'), 'link' => '', 'type' => 'activity'); - print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($nav)); + $PAGE->navbar->add(get_string('participants'), $link); + $PAGE->navbar->add(fullname($user), new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$user->id,'course'=>$course->id))); + $PAGE->navbar->add(get_string('notes', 'notes'), new moodle_url($CFG->wwwroot.'/notes/index.php', array('user'=>$user->id,'course'=>$course->id))); + $PAGE->navbar->add(get_string('delete')); + $PAGE->set_title($course->shortname . ': ' . $strnotes); + $PAGE->set_heading($course->fullname); + echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('deleteconfirm', 'notes'), new moodle_url('delete.php',$optionsyes), new moodle_url('index.php',$optionsno)); echo '
'; note_print($note, NOTES_SHOW_BODY | NOTES_SHOW_HEAD); diff --git a/notes/edit.php b/notes/edit.php index 512aa9c3a8145..271085e3829d5 100644 --- a/notes/edit.php +++ b/notes/edit.php @@ -73,16 +73,18 @@ } /// output HTML - $nav = array(); + $link = null; if (has_capability('moodle/course:viewparticipants', $context) || has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) { - $nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc'); + $link = new moodle_url($CFG->wwwroot.'/user/index.php',array('id'=>$course->id)); } - $nav[] = array('name' => fullname($user), 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id. '&course=' . $course->id, 'type' => 'misc'); - $nav[] = array('name' => get_string('notes', 'notes'), 'link' => $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&user=' . $user->id, 'type' => 'misc'); - $nav[] = array('name' => $strnotes, 'link' => '', 'type' => 'activity'); - - print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($nav)); - + $PAGE->navbar->add(get_string('participants'), $link); + $PAGE->navbar->add(fullname($user), new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$user->id,'course'=>$course->id))); + $PAGE->navbar->add(get_string('notes', 'notes'), new moodle_url($CFG->wwwroot.'/notes/index.php', array('user'=>$user->id,'course'=>$course->id))); + $PAGE->navbar->add($strnotes); + $PAGE->set_title($course->shortname . ': ' . $strnotes); + $PAGE->set_heading($course->fullname); + + echo $OUTPUT->header(); echo $OUTPUT->heading(fullname($user)); $noteform->display(); diff --git a/notes/index.php b/notes/index.php index 88f19dbff9560..2672ef2e6d903 100644 --- a/notes/index.php +++ b/notes/index.php @@ -39,7 +39,7 @@ $filterselect = $user->id; if ($user->deleted) { - print_header(); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('userdeleted')); echo $OUTPUT->footer(); die; @@ -67,16 +67,20 @@ $systemcontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context $strnotes = get_string('notes', 'notes'); - $nav = array(); + $link = null; if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) { - $nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc'); + $link = new moodle_url($CFG->wwwroot.'/user/index.php',array('id'=>$course->id)); } + $PAGE->navbar->add(get_string('participants'), $link); if ($userid) { - $nav[] = array('name' => fullname($user), 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id. '&course=' . $course->id, 'type' => 'misc'); + $PAGE->navbar->add(fullname($user), new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$user->id,'course'=>$course->id))); } - $nav[] = array('name' => $strnotes, 'link' => '', 'type' => 'misc'); - - print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($nav)); + $PAGE->navbar->add($strnotes); + $PAGE->set_title($course->shortname . ': ' . $strnotes); + $PAGE->set_heading($course->fullname); + + echo $OUTPUT->header(); + echo $OUTPUT->heading(fullname($user)); $showroles = 1; $currenttab = 'notes';