function echo_all_grades() { global $Me, $User, $Pset, $Info; if ($Info->is_handout_commit()) { return; } $gj = ContactView::grade_json($Info); if (get($gj, "grades") || $Info->can_see_grades && $Me != $User) { echo_grade_total($gj); foreach ($Pset->grades as $ge) { echo_grade_entry($ge); } } $lhg = $Info->late_hours(); if ($lhg && $User == $Me && $Info->can_see_grades) { if ($lhg->hours || get($gj, "grades")) { echo '<div style="margin-top:1.5em">'; ContactView::echo_group("late hours", '<span class="grader61" data-pa-grade="late_hours">' . htmlspecialchars($lhg->hours) . '</span>', array(), array("nowrap" => true)); echo '</div>'; } } else { if ($User != $Me) { $lhag = $Info->late_hours(true); $value = '<span class="gradeholder61">' . Ht::entry("late_hours", $lhg ? $lhg->hours : "", array("onchange" => "jQuery(this).closest('form').submit()", "class" => "grader61")) . '</span>'; $value .= " " . Ht::submit("Save", array("tabindex" => 1)); $value .= ' <span class="ajaxsave61"></span>'; if ($lhag && $lhag->hours !== $lhg->hours) { $value .= ' <span class="autograde61">auto-late hours is ' . htmlspecialchars($lhag->hours) . '</span>'; } echo Ht::form($Info->hoturl_post("pset", array("setlatehours" => 1)), array("onsubmit" => "return gradesubmit61(this)")), '<div class="f-contain" style="margin-top:1.5em">'; ContactView::echo_group("late hours", $value, array(), array("nowrap" => true)); echo '</div></form>'; } } }