コード例 #1
0
ファイル: printlib.php プロジェクト: kfr2/phpmygrades
/**
 * print a list of the user's classes
 *
 * parses the data from parse_class_list()
 */
function print_students_classes($id)
{
    $class_list = classes_by_semester($id, current_semester);
    $classes = explode(",", $class_list);
    // get rid of the empty part of the array
    $empty = count($classes) - 1;
    unset($classes[$empty]);
    print "<table>";
    foreach ($classes as $class) {
        // get the class's name
        $class_name = query("SELECT `name` FROM `classes` WHERE `ID`='{$class}' LIMIT 1");
        $result = result($class_name);
        $class_name = $result->name;
        print "<tr><td><a href=\"classes.php?class={$class}\" title=\"{$class_name}\">{$class_name}</a></td><td>" . class_average($id, $class, current_semester) . "</td></tr>";
    }
    print "</table>";
}
コード例 #2
0
ファイル: classes.php プロジェクト: kfr2/phpmygrades
             $other_semesters .= "<a href=\"classes.php?class={$requested_class}&amp;gp={$classdata[$n]}\" title=\"assignments for grading period {$classdata[$n]}\">{$classdata[$n]}</a> ";
             $n++;
         }
     } else {
         $this_semester = $grading_period;
         $n = 4;
         $other_semesters = "";
         while (isset($classdata[$n])) {
             if ($classdata[$n] != $this_semester) {
                 $other_semesters .= "<a href=\"classes.php?class={$requested_class}&amp;gp={$classdata[$n]}\" title=\"assignments for grading period {$classdata[$n]}\">{$classdata[$n]}</a> ";
             }
             $n++;
         }
     }
     print "<p>Current Grading Period: {$this_semester}<br />Other Grading Periods: {$other_semesters}</p>";
     print "<p>Average: " . class_average($the_student, $requested_class, $grading_period) . "%</p></div>";
 }
 // get his or her assignments
 $list_of_grades = get_latest_grades($the_student, "all", $requested_class, $grading_period) or die("Error getting your grades.");
 if ($list_of_grades == "No grades.") {
     print "<br />You currently have no grades for this class.";
     die;
 }
 $grades = explode("--", $list_of_grades);
 // for alternating colours
 $colour = 0;
 foreach ($grades as $grade) {
     if ($grade != "") {
         list($class_id, $assignment_number, $assignment_name, $date_assigned, $points_possible, $points_scored, $grading_period, $comment) = split("::", $grade);
         print "<div class=\"grades";
         if ($colour == 0) {