id; } else { $filtertype = 'course'; $filterselect = $course->id; } /// require login to access notes require_login($course->id); add_to_log($courseid, 'notes', 'view', 'index.php?course='.$courseid.'&user='.$userid, 'view notes'); /// output HTML $strnotes = get_string('notes', 'notes'); $nav = array(); $nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc'); if ($userid) { $nav[] = array('name' => fullname($user), 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id. '&course=' . $course->id, 'type' => 'misc'); } $nav[] = array('name' => $strnotes, 'link' => '', 'type' => 'misc'); print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($nav)); $showroles = 1; $currenttab = 'notes'; require_once($CFG->dirroot .'/user/tabs.php'); $strsitenotes = get_string('sitenotes', 'notes'); $strcoursenotes = get_string('coursenotes', 'notes'); $strpersonalnotes = get_string('personalnotes', 'notes'); $straddnewnote = get_string('addnewnote', 'notes'); print_box_start(); if ($courseid != SITEID) { //echo '' . $strsitenotes . ' | ' . $strcoursenotes . ' | ' . $strpersonalnotes . ''; $context = get_context_instance(CONTEXT_COURSE, $courseid); $addid = has_capability('moodle/notes:manage', $context) ? $courseid : 0; $view = has_capability('moodle/notes:view', $context); note_print_notes('' . $strsitenotes, $addid, $view, 0, $userid, NOTES_STATE_SITE, 0); note_print_notes('' . $strcoursenotes. ' ('.$course->fullname.')', $addid, $view, $courseid, $userid, NOTES_STATE_PUBLIC, 0); note_print_notes('' . $strpersonalnotes, $addid, $view, $courseid, $userid, NOTES_STATE_DRAFT, $USER->id); } else { // Normal course //echo '' . $strsitenotes . ' | ' . $strcoursenotes . ''; $view = has_capability('moodle/notes:view', get_context_instance(CONTEXT_SYSTEM)); note_print_notes('' . $strsitenotes, 0, $view, 0, $userid, NOTES_STATE_SITE, 0); echo ''; if (!empty($userid)) { $courses = get_my_courses($userid); foreach($courses as $c) { $header = '' . $c->fullname . ''; if (has_capability('moodle/notes:manage', get_context_instance(CONTEXT_COURSE, $c->id))) { $addid = $c->id; } else { $addid = 0; } note_print_notes($header, $addid, $view, $c->id, $userid, NOTES_STATE_PUBLIC, 0); } } } print_box_end(); print_footer($course); ?>