Ejemplo n.º 1
0
echo "<tr><td>Subject Average</td>";
foreach ($subjects as $subj) {
    echo "<td>" . get_subject_avg($student_marks, $subj) . "</td>\n";
}
echo "<td>Class Average: <br />" . get_class_avg($student_marks) . "</td>\n</tr>\n";
echo "</table>";
echo "<p>Students achieveing <b>below</b> average: ";
foreach ($student_marks as $knum => $marks) {
    if (get_average($marks) < get_class_avg($student_marks)) {
        echo $knum . " ";
    }
}
echo "</p>\n";
echo "<p>Students achieveing <b>above</b> average: ";
foreach ($student_marks as $knum => $marks) {
    if (get_average($marks) > get_class_avg($student_marks)) {
        echo $knum . " ";
    }
}
echo "</p>\n";
function get_average($marks)
{
    $total = 0;
    foreach ($marks as $subject => $mark) {
        $total += $mark;
    }
    return $total / count($marks);
}
function get_subject_avg($data, $subj)
{
    $total = 0;
Ejemplo n.º 2
0
</td>
		</tr>
<?php 
        } else {
            ?>
		<tr>
			<td><?php 
            echo $row["title"];
            ?>
</td>
			<td><?php 
            echo $grade == "" ? _AT("na") : $grade;
            ?>
</td>
			<td><?php 
            echo get_class_avg($row["gradebook_test_id"]);
            ?>
</td>
			<td><?php 
            echo $row["due_date"];
            ?>
</td>
			<td><?php 
            echo $grade == "" ? _AT("pending") : _AT("completed");
            ?>
</td>
			<td><?php 
            echo _AT("na");
            ?>
</td>
		</tr>