Example #1
0
 /**
  * Trigger the grade_report_viewed event
  *
  * @since Moodle 2.9
  */
 public function viewed()
 {
     $event = \gradereport_user\event\grade_report_viewed::create(array('context' => $this->context, 'courseid' => $this->courseid, 'relateduserid' => $this->user->id));
     $event->trigger();
 }
Example #2
0
        // Only show one user's report
        $report = new grade_report_user($courseid, $gpr, $context, $userid);
        $studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
        print_grade_page_head($courseid, 'report', 'user', get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink);
        groups_print_course_menu($course, $gpr->get_return_url('index.php?id=' . $courseid, array('userid' => 0)));
        if ($user_selector) {
            $renderer = $PAGE->get_renderer('gradereport_user');
            $showallusersoptions = true;
            echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, $showallusersoptions);
        }
        if ($currentgroup and !groups_is_member($currentgroup, $userid)) {
            echo $OUTPUT->notification(get_string('groupusernotmember', 'error'));
        } else {
            if ($report->fill_table()) {
                echo '<br />' . $report->print_table(true);
            }
        }
    }
} else {
    //Students will see just their own report
    // Create a report instance
    $report = new grade_report_user($courseid, $gpr, $context, $userid);
    // print the page
    print_grade_page_head($courseid, 'report', 'user', get_string('pluginname', 'gradereport_user') . ' - ' . fullname($report->user));
    if ($report->fill_table()) {
        echo '<br />' . $report->print_table(true);
    }
}
$event = \gradereport_user\event\grade_report_viewed::create(array('context' => $context, 'courseid' => $courseid, 'relateduserid' => $userid));
$event->trigger();
echo $OUTPUT->footer();