if (!key_exists($students["userid"][$row_ite], (array) $cselected["students"][$j])) {
     $table->data[$row][] = '---';
     $table->data[$row][] = '---';
     continue;
 }
 $user_id = $students['userid'][$row_ite];
 $grade_item = $DB->get_record("grade_items", array('courseid' => $course->id, 'itemtype' => 'course'));
 $sql = "SELECT *\n                    FROM mdl_grade_grades\n                    WHERE itemid = (\n                    SELECT id\n                    FROM mdl_grade_items\n                    WHERE courseid ={$course->id}\n                    AND itemtype = 'course' )\n                    AND userid ={$user_id}";
 // $credithours=$course->credithours;
 $credithours = explode("+", $course->credithours);
 $credithours = $credithours[0] + $credithours[1];
 $grade = $DB->get_record_sql($sql);
 // print_r($grade);
 $attendance = get_percent_absent($students["userid"][$row_ite], $course);
 $course_sess_att = get_grade($students["userid"][$row_ite], $course);
 $course_sessions = get_maxgrade($students["userid"][$row_ite], $course);
 $all_sessions += $course_sessions;
 $course_sess_missed = $course_sessions - $course_sess_att;
 $all_sessions_missed += $course_sess_missed;
 $subjgrade = grade_format_gradevalue_letter($grade->finalgrade, $grade_item);
 if ($grade) {
     // $grade->finalgrade= number_format(($grade->finalgrade), 0);
     switch ($subjgrade) {
         case $subjgrade == 'A':
             $gradepoint = 4.0;
             break;
         case $subjgrade == 'B+':
             $gradepoint = 3.5;
             break;
         case $subjgrade == 'B':
             $gradepoint = 3.0;
function attforblock_user_outline($course, $user, $mod, $attforblock)
{
    /// Return a small object with summary information about what a
    /// user has done with a given particular instance of this module
    /// Used for user activity reports.
    /// $return->time = the time they did it
    /// $return->info = a short text description
    require_once 'locallib.php';
    $result = false;
    // this line was added as per Juan Carlos Rodríguez-del-Pino advice
    if (isstudent($course->id, $user->id)) {
        if ($sescount = get_attendance($user->id, $course)) {
            $strgrade = get_string('grade');
            $maxgrade = get_maxgrade($user->id, $course);
            $usergrade = get_grade($user->id, $course);
            $percent = get_percent($user->id, $course);
            $result->info = "{$strgrade}: {$usergrade} / {$maxgrade} ({$percent}%)";
        }
    }
    return $result;
}
Пример #3
0
function print_attendance_table($user, $course)
{
    $complete = get_attendance($user->id, $course);
    $percent = get_percent($user->id, $course) . ' %';
    $grade = get_grade($user->id, $course);
    echo '<table border="0" cellpadding="0" cellspacing="0" class="list">';
    attendance_print_row(get_string('sessionscompleted', 'attforblock') . ':', "<strong>{$complete}</strong>");
    $statuses = get_statuses($course->id);
    foreach ($statuses as $st) {
        attendance_print_row($st->description . ': ', '<strong>' . get_attendance($user->id, $course, $st->id) . '</strong>');
    }
    attendance_print_row(get_string('attendancepercent', 'attforblock') . ':', "<strong>{$percent}</strong>");
    attendance_print_row(get_string('attendancegrade', 'attforblock') . ':', "<strong>{$grade}</strong> / " . get_maxgrade($user->id, $course));
    attendance_print_row('&nbsp;', '&nbsp;');
    echo '</table>';
}
            $table->data[$student->id][] = print_user_picture($student->id, $course->id, $student->picture, 20, true, true);
            $table->data[$student->id][] = "<a href=\"view.php?id={$id}&amp;student={$student->id}\">" . fullname($student) . '</a>';
            foreach ($course_sess as $sessdata) {
                if ($att = get_record('attendance_log', 'sessionid', $sessdata->id, 'studentid', $student->id)) {
                    if (isset($statuses[$att->statusid])) {
                        $table->data[$student->id][] = $statuses[$att->statusid]->acronym;
                    } else {
                        $table->data[$student->id][] = '<font color="red"><b>' . $allstatuses[$att->statusid]->acronym . '</b></font>';
                    }
                } else {
                    $table->data[$student->id][] = '-';
                }
            }
            foreach ($statuses as $st) {
                $table->data[$student->id][] = get_attendance($student->id, $course, $st->id);
            }
            $table->data[$student->id][] = get_grade($student->id, $course) . '&nbsp;/&nbsp;' . get_maxgrade($student->id, $course);
            $table->data[$student->id][] = get_percent($student->id, $course) . '%';
        }
        echo '<br />';
        print_table($table);
    } else {
        print_heading(get_string('nothingtodisplay'), 'center');
    }
    echo get_string('status', 'attforblock') . ':<br />';
    foreach ($statuses as $st) {
        echo $st->acronym . ' - ' . $st->description . '<br />';
    }
}
print_footer($course);
exit;
                         $statuses = get_statuses($course->id);
                         foreach ($statuses as $st) {
                             echo '<th>' . $st->description . '</th>';
                         }
                         echo '<th>' . get_string('grade') . '</th>';
                         echo '<th>%</th></tr><tr><td></td>';
                         echo '</tr></thead>';
                         echo '<tbody><tr>';
                         echo '<td id="tshowstudent" name="tshowstudent">';
                         echo "<a href=\"view.php?id={$id}&amp;student={$student->id}\">" . fullname($student);
                         echo '</a></td><td id="tshowcourse" name="tshowcourse">';
                         echo "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">" . $course->fullname . '</a></td>';
                         foreach ($statuses as $st) {
                             echo '<td>' . get_attendance($student->id, $course, $st->id) . '</td>';
                         }
                         echo '<td>' . get_grade($studentselected, $course) . '&nbsp;/&nbsp;' . get_maxgrade($student->id, $course) . '</td>';
                         echo '<td>' . get_percent($studentselected, $course) . '%' . '</td>';
                         echo '</tr></tbody></table>';
                     }
                     if ($reportselected === 'all' or $reportselected === 'detailed') {
                         echo '<h3>' . "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">" . $course->fullname . '</a></h3>';
                         print_detailed_report($studentselected, $cm, $course->id);
                     }
                 }
             }
         }
     }
     if ($reportselected === 'detailed') {
         echo '</table>';
     }
 }
Пример #6
0
function attforblock_user_outline($course, $user, $mod, $attforblock)
{
    /// Return a small object with summary information about what a
    /// user has done with a given particular instance of this module
    /// Used for user activity reports.
    /// $return->time = the time they did it
    /// $return->info = a short text description
    require_once 'locallib.php';
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    if (has_capability('moodle/course:view', $context)) {
        //if (isstudent($course->id, $user->id)) {
        if ($sescount = get_attendance($user->id, $course)) {
            $strgrade = get_string('grade');
            $maxgrade = get_maxgrade($user->id, $course);
            $usergrade = get_grade($user->id, $course);
            $percent = get_percent($user->id, $course);
            $result->info = "{$strgrade}: {$usergrade} / {$maxgrade} ({$percent}%)";
        }
    }
    return $result;
}
function print_attendance_line($student, $course)
{
    echo '<table class="generaltable"><thead><tr>';
    foreach ($statuses as $st) {
        echo '<th>' . $st->description . '</th>';
    }
    echo '<th>' . get_string('grade') . '</th>';
    echo '<th>%</th></tr><tr><td></td>';
    echo '</tr></thead><tbody><tr>';
    foreach ($statuses as $st) {
        echo '<td>' . get_attendance($student->id, $course, $st->id) . '</td>';
    }
    echo '<td>' . get_grade($student, $course) . '&nbsp;/&nbsp;' . get_maxgrade($student->id, $course) . '</td>';
    echo '<td>' . get_percent($student, $course) . '%' . '</td>';
    echo '</tr></tbody></table>';
}