Beispiel #1
0
 $table = new html_table();
 $attempts = rcontent_report_user_attempts($rcontent->id, $user);
 $showhreffield = false;
 foreach ($attempts as $at) {
     $row = array();
     if ($at->attempt == $attempt) {
         $row[] = $at->attempt;
     } else {
         $row[] = rcontent_report_get_attempt_link($id, $at);
     }
     if (!empty($at->starttime)) {
         $row[] = userdate($at->starttime, get_string('strftimedaydatetime'));
     } else {
         $row[] = "";
     }
     $row[] = rcontent_get_ellapsed_time($at->totaltime);
     $grade = rcontent_grade_user_attempt($rcontent->id, $user, $at->attempt, $unitid, $activityid);
     // Take status value from the 1st position of the array
     $status = rcontent_grade_calculate_status($rcontent->id, $at->userid, $at->attempt, $at->unitid, $at->activityid);
     if (!empty($status[0])) {
         $row[] = get_string($status[0], 'rcontent');
     } else {
         $row[] = '';
     }
     // Show grade
     $row[] = '<div id="rcontent_grade_' . $at->userid . '_' . $at->id . '">' . round($at->grade, 2) . '</div>';
     // Set grade range
     $range = "({$at->mingrade}-{$at->maxgrade})";
     // Show comments
     $comments = '<div id="rcontent_comments_' . $at->userid . '_' . $at->id . '">';
     if (strlen($at->comments) > 30) {
Beispiel #2
0
/** Find the start and finsh time for a a given detail attempt
 * @param int $rcontentid SCORM Id
 * @param int $userid User Id
 * @param int $attemt Attempt Id
 * @return object start and finsh time EPOC secods
 */
function rcontent_details_get_attempt_runtime($id)
{
    global $DB;
    $timedata = new StdClass();
    $timedata->start = "";
    $timedata->finish = "";
    if ($track = $DB->get_record('rcontent_grades_details', array('id' => $id))) {
        if ($track->starttime > 0) {
            $timedata->start = userdate($track->starttime, get_string('strftimedaydatetime'));
        } else {
            $timedata->start = '';
        }
        $timedata->finish = rcontent_get_ellapsed_time($track->totaltime);
    }
    return $timedata;
}
Beispiel #3
0
if (!$contextmodule) {
    $contextmodule = context_system::instance();
}
require_capability('mod/rcontent:updatescore', $contextmodule);
// Add parameter idgrade to the loader data
if (!($grade = rcontent_grade_user_attempt($rcontent->id, $userid, $attempt, $unitid, $activityid, $update))) {
    notice('Grade not found');
}
$user = $DB->get_record('user', array('id' => $userid));
$userdata = rcontent_get_user_data($userid);
$toform = new stdClass();
$toform->rcontentid = $rcontent->id;
$toform->id = $cm->id;
$toform->user = $user->id;
$toform->attempt = $attempt;
$toform->duration = rcontent_get_ellapsed_time($grade->totaltime);
$toform->gradeid = $grade->id;
$toform->grade = $grade->justgrade;
$toform->comment_editor['text'] = $grade->justcomments;
$toform->comment_editor['format'] = FORMAT_HTML;
$mform = new mod_rcontent_grade_form(null, array($rcontent, $toform, null), 'post', '', array('class' => 'gradeform'));
if (!$mform->is_cancelled() && ($data = $mform->get_data())) {
    // Save data in bd
    $update = new stdClass();
    $update->id = $data->gradeid;
    $update->grade = round($data->grade, 2);
    $update->comments = $data->comment_editor['text'];
    $update->timemodified = time();
    // Retrieve data of that registry from db to know if status must be update or not
    if ($rdatastatus = $DB->get_field('rcontent_grades', 'status', array('id' => $update->id))) {
        if ($rdatastatus == "POR_CORREGIR") {