예제 #1
1
/**
 * Profile report callback.
 *
 * @param object $course The course.
 * @param object $user The user.
 * @param boolean $viewasuser True when we are viewing this as the targetted user sees it.
 */
function grade_report_user_profilereport($course, $user, $viewasuser = false)
{
    global $OUTPUT;
    if (!empty($course->showgrades)) {
        $context = context_course::instance($course->id);
        /// return tracking object
        $gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'user', 'courseid' => $course->id, 'userid' => $user->id));
        // Create a report instance
        $report = new grade_report_user($course->id, $gpr, $context, $user->id, $viewasuser);
        // print the page
        echo '<div class="grade-report-user">';
        // css fix to share styles with real report page
        if ($report->fill_table()) {
            echo $report->print_table(true);
        }
        echo '</div>';
    }
}
예제 #2
0
/**
 * Profile report callback.
 *
 * @param object $course The course.
 * @param object $user The user.
 * @param boolean $viewasuser True when we are viewing this as the targetted user sees it.
 */
function grade_report_user_profilereport($course, $user, $viewasuser = false)
{
    global $OUTPUT;
    if (!empty($course->showgrades)) {
        $context = context_course::instance($course->id);
        //first make sure we have proper final grades - this must be done before constructing of the grade tree
        grade_regrade_final_grades($course->id);
        /// return tracking object
        $gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'user', 'courseid' => $course->id, 'userid' => $user->id));
        // Create a report instance
        $report = new grade_report_user($course->id, $gpr, $context, $user->id, $viewasuser);
        // print the page
        echo '<div class="grade-report-user">';
        // css fix to share styles with real report page
        echo $OUTPUT->heading(get_string('pluginname', 'gradereport_user') . ' - ' . fullname($report->user));
        if ($report->fill_table()) {
            echo $report->print_table(true);
        }
        echo '</div>';
    }
}
예제 #3
0
파일: index.php 프로젝트: r007/PMoodle
                print_heading(get_string('modulename', 'gradereport_user') . ' - ' . fullname($report->user));
                if ($report->fill_table()) {
                    echo $report->print_table(true);
                }
                echo "<p style = 'page-break-after: always;'></p>";
            }
            $gui->close();
        } elseif ($userid) {
            // Only show one user's report
            $report = new grade_report_user($courseid, $gpr, $context, $userid);
            print_heading(get_string('modulename', 'gradereport_user') . ' - ' . fullname($report->user));
            if ($report->fill_table()) {
                echo $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_heading(get_string('modulename', 'gradereport_user') . ' - ' . fullname($report->user));
        if ($report->fill_table()) {
            echo $report->print_table(true);
        }
    }
} else {
    // no access to grades!
    echo "Can not view grades.";
    //TODO: localize
}
print_footer($course);
예제 #4
0
파일: index.php 프로젝트: harshasunny/grade
        $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, false, false, true, null, null, $report->user);
        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, $userid, $courseid);
                //START BY @HARSHA
                //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);
    }
}
// Trigger report viewed event.
$report->viewed();
echo $OUTPUT->footer();
require_once $CFG->dirroot . '/grade/lib.php';
require_once $CFG->dirroot . '/grade/report/user/lib.php';
$courseid = $COURSE->id;
$userid = $USER->id;
$context = context_course::instance($COURSE->id);
$report = '';
if ($PAGE->pagelayout == 'course') {
    if (has_capability('moodle/grade:view', $context) and $COURSE->showgrades) {
        // First make sure we have proper final grades - this must be done before constructing of the grade tree.
        grade_regrade_final_grades($courseid);
        // Return tracking object.
        $gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'user', 'courseid' => $courseid, 'userid' => $userid));
        $report = new grade_report_user($courseid, $gpr, $context, $userid);
        if ($report->fill_table()) {
            // Get course overall grade value from User Grade Report
            $html = $report->print_table(true);
            // Get User Grade report table.
            $t = explode("<tr>", $html);
            // Split table into individual lines.
            $text = explode("</span>", $t[count($t) - 1]);
            // Split initial html out of last line.
            $gradetext = explode(" ", $text[1]);
            // Split last line into chunks.
            for ($i = 0; $i < count($gradetext); $i++) {
                // Use html identifier to find course total
                if ($gradetext[$i] == "column-percentage'") {
                    $percentageposition = $i + 1;
                }
            }
            $grade = explode('>', $gradetext[$percentageposition]);
            // Get rid of > off front of grade