Skip to content

Commit

Permalink
notes MDL-19818 Updated print_header and build_navigation to OUTPUT a…
Browse files Browse the repository at this point in the history
…nd PAGE equivalents
  • Loading branch information
samhemelryk committed Sep 7, 2009
1 parent 534f203 commit fb67602
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
14 changes: 9 additions & 5 deletions notes/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<br />';
note_print($note, NOTES_SHOW_BODY | NOTES_SHOW_HEAD);
Expand Down
18 changes: 10 additions & 8 deletions notes/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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. '&amp;course=' . $course->id, 'type' => 'misc');
$nav[] = array('name' => get_string('notes', 'notes'), 'link' => $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&amp;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();
Expand Down
18 changes: 11 additions & 7 deletions notes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. '&amp;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';
Expand Down

0 comments on commit fb67602

Please sign in to comment.