} else { $points_RET = DBGet(DBQuery('SELECT s.STUDENT_ID,\'' . '-1' . '\' AS ASSIGNMENT_TYPE_ID,sum(' . db_case(array('gg.POINTS', "'-1'", "'0'", 'gg.POINTS')) . ') AS PARTIAL_POINTS,sum(' . db_case(array('gg.POINTS', "'-1'", "'0'", 'ga.POINTS')) . ') AS PARTIAL_TOTAL,\'' . '1' . '\' AS FINAL_GRADE_PERCENT FROM students s JOIN schedule ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.COURSE_PERIOD_ID=\'' . $course_period_id . '\') JOIN gradebook_assignments ga ON ((ga.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID OR ga.COURSE_ID=\'' . $course_id . '\' AND ga.STAFF_ID=\'' . User('STAFF_ID') . '\') AND ga.MARKING_PERIOD_ID' . ($programconfig[User('STAFF_ID')]['ELIGIBILITY_CUMULITIVE'] == 'Y' ? ' IN (' . GetChildrenMP('SEM', UserMP()) . ')' : '=\'' . UserMP() . '\'') . ') LEFT OUTER JOIN gradebook_grades gg ON (gg.STUDENT_ID=s.STUDENT_ID AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID) WHERE ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL) GROUP BY s.STUDENT_ID,ss.START_DATE '), array(), array('STUDENT_ID')); } if (count($points_RET)) { foreach ($points_RET as $student_id => $student) { $total = $total_percent = 0; foreach ($student as $partial_points) { if ($partial_points['PARTIAL_TOTAL'] != 0) { $total += $partial_points['PARTIAL_POINTS'] * $partial_points['FINAL_GRADE_PERCENT'] / $partial_points['PARTIAL_TOTAL']; $total_percent += $partial_points['FINAL_GRADE_PERCENT']; } } if ($total_percent != 0) { $total /= $total_percent; } $grade = $grades_RET[_makeLetterGrade($total, 0, 0, 'ID')][1]; if ($grade['GPA_VALUE'] == '0' || !$grade['GPA_VALUE']) { $code = 'FAILING'; } elseif (strpos($grade['TITLE'], 'D') !== false || $grade['GPA_VALUE'] < 2) { $code = 'BORDERLINE'; } else { $code = 'PASSING'; } if ($current_RET[$student_id]) { $sql = 'UPDATE eligibility SET ELIGIBILITY_CODE=\'' . $code . '\' WHERE SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\' AND STUDENT_ID=\'' . $student_id . '\''; } else { $sql = 'INSERT INTO eligibility (STUDENT_ID,SCHOOL_DATE,SYEAR,PERIOD_ID,COURSE_PERIOD_ID,ELIGIBILITY_CODE) values(\'' . $student_id . '\',\'' . DBDate() . '\',\'' . UserSyear() . '\',\'' . UserPeriod() . '\',\'' . $course_period_id . '\',\'' . $code . '\')'; } DBQuery($sql); } $current_RET = DBGet(DBQuery('SELECT ELIGIBILITY_CODE,STUDENT_ID FROM eligibility WHERE SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\''), array(), array('STUDENT_ID'));
function _makeExtraCols($assignment_id, $column) { global $THIS_RET, $total_points, $current_RET, $old_student_id, $student_count, $tabindex, $count_students, $max_allowed; $rounding = DBGet(DBQuery('SELECT VALUE FROM program_user_config WHERE USER_ID=\'' . User('STAFF_ID') . '\' AND TITLE=\'ROUNDING\' AND PROGRAM=\'Gradebook\' ')); if (count($rounding)) { $_SESSION['ROUNDING'] = $rounding[1]['VALUE']; } $days_left = floor((strtotime($THIS_RET['DUE_' . $assignment_id], 0) - strtotime($THIS_RET['START_DATE'], 0)) / 86400); if ($days_left >= 1) { if ($THIS_RET['STUDENT_ID'] != $old_student_id) { $student_count++; $tabindex = $student_count; $old_student_id = $THIS_RET['STUDENT_ID']; } else { $tabindex += $count_students; } if ($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'] == '-1') { $points = '*'; } elseif (strpos($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '.')) { $points = rtrim(rtrim($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '0'), '.'); } else { $points = $current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS']; } if ($_SESSION['ROUNDING'] == 'UP') { $points_m = ceil($points); } elseif ($_SESSION['ROUNDING'] == 'DOWN') { $points_m = floor($points); } elseif ($_SESSION['ROUNDING'] == 'NORMAL') { $points_m = round($points); } else { $points_m = $points; } $make_letter_points = $points_m / 100; $tot_point = $total_points[$assignment_id]; if ($total_points[$assignment_id] != 0) { if ($points != '*') { if ($points != '') { $rounding = DBGet(DBQuery('SELECT VALUE FROM program_user_config WHERE USER_ID=\'' . User('STAFF_ID') . '\' AND TITLE=\'ROUNDING\' AND PROGRAM=\'Gradebook\' ')); $points_r = $points_m / $tot_point * 100; if ($rounding[1]['ROUNDING'] == 'UP') { $points_r = ceil($points_r); } elseif ($rounding[1]['ROUNDING'] == 'DOWN') { $points_r = floor($points_r); } elseif ($rounding[1]['ROUNDING'] == 'NORMAL') { $points_r = round($points_r); } else { $points_r = round($points_r, 2); } return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> ' . ($THIS_RET['D' . $assignment_id] || $points != '' ? $points > $total_points[$assignment_id] * $max_allowed ? '<FONT color=red>' : '' : '<FONT color=gray>') . $points_r . '%' . ($THIS_RET['D' . $assignment_id] || $points != '' ? $points > $total_points[$assignment_id] * $max_allowed ? '</FONT>' : '' : '') . '<BR> <B>' . _makeLetterGrade($points_m / $tot_point) . '</B>' . ($THIS_RET['D' . $assignment_id] || $points != '' ? '' : '</FONT>') . '</TD></TR></TABLE>'; } else { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> ' . ($THIS_RET['D' . $assignment_id] || $points != '' ? $points > $total_points[$assignment_id] * $max_allowed ? '<FONT color=red>' : '' : '<FONT color=gray>') . ' Not Graded</TD></TR></TABLE>'; } } else { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> N/A<BR> N/A</TD></TR></TABLE>'; } } else { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> E/C</TD></TR></TABLE>'; } } return 'N/A'; }
function _makeGrade($value, $column) { global $THIS_RET, $current_RET, $import_RET, $grades_RET, $grades_select, $student_count, $tabindex; $tc_grade = 'n'; if ($column == 'REPORT_CARD_GRADE') { if (!isset($_REQUEST['_openSIS_PDF'])) { $student_count++; $tabindex = $student_count; if ($import_RET[$THIS_RET['STUDENT_ID']]) { $select = $import_RET[$THIS_RET['STUDENT_ID']][1]['REPORT_CARD_GRADE_ID']; $extra_select = array($select => $grades_select[$import_RET[$THIS_RET['STUDENT_ID']][1]['REPORT_CARD_GRADE_ID']]); $div = false; } else { $select = _makeLetterGrade($current_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT'] / 100, "", User('STAFF_ID'), "%"); $rounding = DBGet(DBQuery('SELECT VALUE FROM program_user_config WHERE USER_ID=\'' . User('STAFF_ID') . '\' AND TITLE=\'ROUNDING\' AND PROGRAM=\'Gradebook\' ')); if (count($rounding)) { $_SESSION['ROUNDING'] = $rounding[1]['VALUE']; } else { $_SESSION['ROUNDING'] = ''; } if ($_SESSION['ROUNDING'] == 'UP') { $select = ceil($select); } elseif ($_SESSION['ROUNDING'] == 'DOWN') { $select = floor($select); } elseif ($_SESSION['ROUNDING'] == 'NORMAL') { $select = round($select); } $dbf = DBGet(DBQuery('SELECT DOES_BREAKOFF,GRADE_SCALE_ID FROM course_periods WHERE COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\'')); if ($dbf[1]['DOES_BREAKOFF'] == 'Y' && $select !== '') { // $grd_id=DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE BREAK_OFF <='.$select.' AND SYEAR=\''.UserSyear().'\' AND SCHOOL_ID=\''.UserSchool().'\' AND GRADE_SCALE_ID=\''.$dbf[1]['GRADE_SCALE_ID'].'\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER LIMIT 0,1')); // $prog_config_RET = DBGet(DBQuery('SELECT TITLE,VALUE FROM program_user_config WHERE CAST(VALUE AS UNSIGNED)<='.$select.' AND TITLE LIKE \''.UserCoursePeriod().'-'.'\' AND USER_ID=\''.User('STAFF_ID').'\' AND PROGRAM=\'Gradebook\' ORDER BY CAST(VALUE AS UNSIGNED) DESC LIMIT 0,1')); // $tc_grade='n'; $get_details = DBGet(DBQuery('SELECT TITLE,VALUE FROM program_user_config WHERE TITLE LIKE \'' . UserCoursePeriod() . '-%' . '\' AND USER_ID=\'' . User('STAFF_ID') . '\' AND PROGRAM=\'Gradebook\' ORDER BY VALUE DESC ')); if (count($get_details)) { foreach ($get_details as $i => $d) { if ($select >= $d['VALUE']) { $id = $i; break; } } $grade_id = explode('-', $get_details[$id]['TITLE']); $select = $grade_id[1]; $tc_grade = 'y'; } //if() } if ($tc_grade == 'n') { $select = $current_RET[$THIS_RET['STUDENT_ID']][1]['REPORT_CARD_GRADE_ID']; } $extra_select = array(); $div = true; } if ($_REQUEST['modfunc'] == 'clearall') { $select = ''; } $return = SelectInput($select, 'values[' . $THIS_RET['STUDENT_ID'] . '][grade]', '', $extra_select + $grades_select, false, 'tabindex=' . $tabindex, $div); } else { if ($import_RET[$THIS_RET['STUDENT_ID']]) { $select = $import_RET[$THIS_RET['STUDENT_ID']][1]['REPORT_CARD_GRADE_ID']; } else { $select = $current_RET[$THIS_RET['STUDENT_ID']][1]['REPORT_CARD_GRADE_ID']; } $return = '<b>' . $grades_RET[$select][1]['TITLE'] . '</b>'; } } elseif ($column == 'GRADE_PERCENT') { if ($import_RET[$THIS_RET['STUDENT_ID']]) { $select = $import_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT']; } else { $select = $current_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT']; $rounding = DBGet(DBQuery('SELECT VALUE FROM program_user_config WHERE USER_ID=\'' . User('STAFF_ID') . '\' AND TITLE=\'ROUNDING\' AND PROGRAM=\'Gradebook\' ')); if (count($rounding)) { $_SESSION['ROUNDING'] = $rounding[1]['VALUE']; } else { $_SESSION['ROUNDING'] = ''; } if ($_SESSION['ROUNDING'] == 'UP') { $select = ceil($select); } elseif ($_SESSION['ROUNDING'] == 'DOWN') { $select = floor($select); } elseif ($_SESSION['ROUNDING'] == 'NORMAL') { $select = round($select); } $return = $select == '' ? '' : $select + 0 . '%'; } } return $return; }
function _makeExtra($value, $column) { global $THIS_RET, $student_points, $total_points, $percent_weights; if ($column == 'POINTS') { if ($THIS_RET['TOTAL_POINTS'] != '0') { if ($value != '-1') { if (($THIS_RET['DUE'] || $value != '') && $value != '') { $student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value; $total_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $THIS_RET['TOTAL_POINTS']; $percent_weights[$THIS_RET['ASSIGNMENT_TYPE_ID']] = $THIS_RET['FINAL_GRADE_PERCENT']; } return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>' . (rtrim(rtrim($value, '0'), '.') + 0) . '</font></TD><TD><font size=-1> / </font></TD><TD><font size=-1>' . $THIS_RET['TOTAL_POINTS'] . '</font></TD></TR></TABLE>'; } else { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>Excluded</font></TD><TD></TD><TD></TD></TR></TABLE>'; } } else { $student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value; return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>' . (rtrim(rtrim($value, '0'), '.') + 0) . '</font></TD><TD><font size=-1> / </font></TD><TD><font size=-1>' . $THIS_RET['TOTAL_POINTS'] . '</font></TD></TR></TABLE>'; } } elseif ($column == 'LETTER_GRADE') { if ($THIS_RET['TOTAL_POINTS'] != '0') { if ($value != '-1') { if ($THIS_RET['DUE'] && $value == '') { return 'Not Graded'; } else { if ($THIS_RET['DUE'] || $value != '') { return Percent($value / $THIS_RET['TOTAL_POINTS'], 0) . ' ' . _makeLetterGrade($value / $THIS_RET['TOTAL_POINTS'], $THIS_RET['COURSE_PERIOD_ID'], UserStaffID()); } else { return 'not due'; } } } else { return 'n/a n/a'; } } else { return 'e/c'; } } }
$w5 = round(100 * (1.0 - $all['MAX'] / $scale)); $w3 = 100 - $w1 - $w2 - $w4 - $w5; #$bargraph1 = '<TABLE border=0 width=100% cellspacing=0 cellpadding=0><TR bgcolor=#c0c0c0>'.($w1>0?"<TD width=$w1%></TD>":'').($w2>0?"<TD width=$w2% bgcolor=#00a000></TD>":'')."<TD width=0% bgcolor=$c2> </TD>".($w3>0?"<TD width=$w3% bgcolor=#00a000></TD>":'')."<TD width=0% bgcolor=$c4> </TD>".($w4>0?"<TD width=$w4% bgcolor=#00a000></TD>":'').($w5>0?"<TD width=$w5%></TD>":'').'</TR></TABLE>'; $bargraph1 = $all['MIN'] . " - " . $all['MAX']; $scale = $all['LOWER'] + $all['HIGHER'] + 1; $w1 = round(100 * $all['LOWER'] / $scale); $w3 = round(100 * $all['HIGHER'] / $scale); $w2 = 100 - $w1 - $w3; #$bargraph2 = '<TABLE border=0 width=100% cellspacing=0 cellpadding=0><TR bgcolor=#c0c0c0>'.($w1>0||$lower>0?"<TD width=$w1%></TD>":'')."<TD width=$w2% bgcolor=#ff0000> </TD>".($w3>0||$higher>0?"<TD width=$w3%></TD>":'').'</TR></TABLE>'; } } #else # $bargraph1 = $bargraph2 = '<TABLE border=0 width=100% cellspacing=0 cellpadding=0><TR bgcolor=#c0c0c0><TD width=100%> </TD></TR></TABLE>'; } #$LO_ret[] = array('TITLE'=>$assignment['TITLE'],'CATEGORY'=>$assignment['CATEGORY'],'POINTS'=>($assignment['POINTS']=='-1'?'*':($assignment['POINTS']==''?'<FONT color=red>0</FONT>':rtrim(rtrim(number_format($assignment['POINTS'],1),'0'),'.'))).' / '.$assignment['POINTS_POSSIBLE'],'PERCENT'=>($assignment['POINTS_POSSIBLE']=='0'?'':($assignment['POINTS']=='-1'?'*':number_format(100*$assignment['POINTS']/$assignment['POINTS_POSSIBLE'],1).'%')),'LETTER'=>($assignment['POINTS_POSSIBLE']=='0'?'e/c':($assignment['POINTS']=='-1'?'n/a':'<b>'._makeLetterGrade($assignment['POINTS']/$assignment['POINTS_POSSIBLE'],$course['COURSE_PERIOD_ID'],$staff_id))).'</b>','ASSIGNED_DATE'=>$assignment['ASSIGNED_DATE'].($assignment['POINTS']==''?($assignment['ASSIGNED_DATE']?'<BR>':'').'<FONT color=red>Not Graded</FONT>':''))+($do_stats?array('BAR1'=>$bargraph1,'BAR2'=>$bargraph2):array()); $LO_ret[] = array('TITLE' => $assignment['TITLE'], 'CATEGORY' => $assignment['CATEGORY'], 'POINTS' => ($assignment['POINTS'] == '-1' ? '*' : ($assignment['POINTS'] == '' ? '<FONT color=red>0</FONT>' : rtrim(rtrim(number_format($assignment['POINTS'], 1), '0'), '.'))) . ' / ' . $assignment['POINTS_POSSIBLE'], 'PERCENT' => $assignment['POINTS_POSSIBLE'] == '0' ? '' : ($assignment['POINTS'] == '-1' ? '*' : number_format(100 * $assignment['POINTS'] / $assignment['POINTS_POSSIBLE'], 2) . '%'), 'LETTER' => ($assignment['POINTS_POSSIBLE'] == '0' ? 'e/c' : ($assignment['POINTS'] == '-1' ? 'n/a' : '<b>' . _makeLetterGrade($assignment['POINTS'] / $assignment['POINTS_POSSIBLE'], $course['COURSE_PERIOD_ID'], $staff_id))) . '</b>', 'ASSIGNED_DATE' => $assignment['ASSIGNED_DATE'], 'DUE_DATE' => $assignment['DUE_DATE']) + ($do_stats ? array('BAR1' => $bargraph1, 'BAR2' => $bargraph2) : array()); } unset($LO_ret[0]); ListOutput($LO_ret, $LO_columns, 'Assignment', 'Assignments', array(), array(), array('center' => false, 'save' => $_REQUEST['id'] != 'all', 'search' => false)); } else { if ($_REQUEST['id'] != 'all') { DrawHeader('There are no grades available for this student.'); } } } } } function _makeTipTitle($value, $column) { global $THIS_RET; if (($THIS_RET['DESCRIPTION'] || $THIS_RET['ASSIGNED_DATE'] || $THIS_RET['DUE_DATE']) && !$_REQUEST['_openSIS_PDF']) {
if ($columns['grade']) { if (substr($columns['grade'], -1) == '%') { $percent = substr($columns['grade'], 0, -1); $grade = _makeLetterGrade($percent / 100, $course_period_id, 0, 'ID'); } else { $grade = $columns['grade']; $percent = _makePercentGrade($grade, $course_period_id); } } elseif ($columns['percent'] != '') { $percent = rtrim($columns['percent'], '%') + 0; if ($percent > 999.9) { $percent = 999.9; } elseif ($percent < 0) { $percent = 0; } $grade = _makeLetterGrade($percent / 100, $course_period_id, 0, 'ID'); } //$grade_id = DBGet(DBQuery('SELECT '.db_seq_nextval('STUDENT_REPORT_CARD_GRADES_SEQ').' AS ID '.FROM_DUAL)); $id = DBGet(DBQuery("SHOW TABLE STATUS LIKE 'STUDENT_REPORT_CARD_GRADES'")); $grade_id[1]['ID'] = $id[1]['AUTO_INCREMENT']; $ngrade_id = $grade_id[1]['ID']; if (stripos($_SERVER['SERVER_SOFTWARE'], 'linux')) { $columns['comment'] = mysql_real_escape_string($columns['comment']); } $sql = "INSERT INTO STUDENT_REPORT_CARD_GRADES (SYEAR,SCHOOL_ID,STUDENT_ID,COURSE_PERIOD_ID,MARKING_PERIOD_ID,REPORT_CARD_GRADE_ID,GRADE_PERCENT,\r\n COMMENT,GRADE_LETTER,WEIGHTED_GP,UNWEIGHTED_GP,COURSE_TITLE,GP_SCALE,CREDIT_ATTEMPTED,CREDIT_EARNED)\r\n\t\t\t\t\tvalues('" . UserSyear() . "','" . UserSchool() . "','" . $student_id . "','" . $course_period_id . "','" . $_REQUEST['mp'] . "','" . $grade . "','" . $percent . "',\r\n '" . clean_param($columns['comment'], PARAM_NOTAGS) . " ','" . $grades_RET[$grade][1]['TITLE'] . "','" . $grades_RET[$grade][1]['WEIGHTED_GP'] . "','" . $grades_RET[$grade][1]['UNWEIGHTED_GP'] . "','" . $course_RET[1]['COURSE_NAME'] . "','" . $grades_RET[$grade][1]['GP_SCALE'] . "','" . $course_RET[1]['CREDITS'] . "','" . ($grades_RET[$grade][1]['WEIGHTED_GP'] > 0 ? $course_RET[1]['CREDITS'] : 0) . "')"; } if ($sql) { DBQuery($sql); } if (isset($columns['grade'])) { if (!$columns['grade']) {
unset($id_mod); foreach ($get_details as $i_mod => $d_mod) { if ($mps[$mp][1]['GRADE_PERCENT'] >= $d_mod['VALUE'] && !isset($id_mod)) { $id_mod = $i_mod; } } $grade_id_mod = explode('-', $get_details[$id_mod]['TITLE']); $grades_RET[$i][$mp] = _makeLetterGrade($mps[$mp][1]['GRADE_PERCENT'] / 100, $course_period_id, $dbf[1]['TEACHER_ID'], "") . ' '; $tc_grade = 'y'; } if ($tc_grade == 'n') { $grades_RET[$i][$mp] = _makeLetterGrade($mps[$mp][1]['GRADE_PERCENT'] / 100, $course_period_id, $dbf[1]['TEACHER_ID'], "") . ' '; } } else { if ($mps[$mp][1]['GRADE_PERCENT'] != NULl) { $grades_RET[$i][$mp] = _makeLetterGrade($mps[$mp][1]['GRADE_PERCENT'] / 100, $course_period_id, $dbf[1]['TEACHER_ID'], "") . ' '; } } if ($_REQUEST['elements']['percents'] == 'Y' && $mps[$mp][1]['GRADE_PERCENT'] > 0) { if ($mps[$mp][1]['GRADE_PERCENT'] != NULl) { $grades_RET[$i][$mp] .= '<br>' . $mps[$mp][1]['GRADE_PERCENT'] . '%'; } // } $last_mp = $mp; } } if ($_REQUEST['elements']['period_absences'] == 'Y') { if ($mps[$last_mp][1]['DOES_ATTENDANCE']) { $grades_RET[$i]['ABSENCES'] = $mps[$last_mp][1]['YTD_ABSENCES'] . ' / ' . $mps[$last_mp][1]['MP_ABSENCES']; } else {
} if ($sql) { $sql = "UPDATE STUDENT_REPORT_CARD_GRADES SET " . $sql . " WHERE STUDENT_ID='" . $student_id . "' AND COURSE_PERIOD_ID='" . $course_period_id . "' AND MARKING_PERIOD_ID='" . $_REQUEST['mp'] . "'"; } } elseif ($columns['percent'] != '' || $columns['grade'] || $columns['comment']) { if ($columns['percent'] != '') { $percent = rtrim($columns['percent'], '%'); if ($percent > 999.9) { $percent = '999.9'; } elseif ($percent < 0) { $percent = '0'; } if ($columns['grade']) { $grade = $columns['grade']; } else { $grade = $percent != '' ? _makeLetterGrade($percent / 100, $course_period_id, 0, 'ID') : ''; } } elseif ($columns['grade']) { $percent = _makePercentGrade($columns['grade'], $course_period_id); $grade = $columns['grade']; $letter = $grades_RET[$grade][1]['TITLE']; $weighted = $grades_RET[$grade][1]['WEIGHTED_GP']; $unweighted = $grades_RET[$grade][1]['UNWEIGHTED_GP']; $scale = $grades_RET[$grade][1]['GP_SCALE']; } else { $percent = $grade = $letter = $weighted = $unweighted = $scale = ''; } $sql = "INSERT INTO STUDENT_REPORT_CARD_GRADES (SYEAR,SCHOOL_ID,STUDENT_ID,COURSE_PERIOD_ID,MARKING_PERIOD_ID,REPORT_CARD_GRADE_ID,GRADE_PERCENT,COMMENT,GRADE_LETTER,WEIGHTED_GP,UNWEIGHTED_GP,GP_SCALE,COURSE_TITLE,CREDIT_ATTEMPTED,CREDIT_EARNED)\n\t\t\t\tvalues('" . UserSyear() . "','" . UserSchool() . "','" . $student_id . "','" . $course_period_id . "','" . $_REQUEST['mp'] . "','" . $grade . "','" . $percent . "','" . str_replace("\\'", "''", $columns['comment']) . "','" . $grades_RET[$grade][1]['TITLE'] . "','" . $weighted . "','" . $unweighted . "','" . $scale . "','" . $course_RET[1]['COURSE_NAME'] . "','" . $course_RET[1]['CREDITS'] . "','" . ($weighted && $weighted > 0 ? $course_RET[1]['CREDITS'] : '0') . "')"; } else { $percent = $grade = ''; }
function _makePercent($value, $column) { global $THIS_RET, $current_RET, $grades_RET, $student_count, $tabindex, $import_RET; if ($column == 'GRADE_PERCENT') { if (!isset($_REQUEST['_openSIS_PDF'])) { $student_count++; $tabindex = $student_count; if ($import_RET[$THIS_RET['STUDENT_ID']]) { $return = TextInput($import_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT'] == '' ? '' : _makeLetterGrade($import_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT'] / 100, "", User('STAFF_ID'), "%") + 0 . '%', "values[{$THIS_RET['STUDENT_ID']}][percent]", '', (0 ? 'readonly ' : '') . 'size=6 maxlength=6 tabindex=' . $tabindex, false); } else { $return = TextInput($current_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT'] == '' ? '' : _makeLetterGrade($current_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT'] / 100, "", User('STAFF_ID'), "%") + 0 . '%', "values[{$THIS_RET['STUDENT_ID']}][percent]", '', (0 ? 'readonly ' : '') . 'size=6 maxlength=6 tabindex=' . $tabindex, !$current_RET[$THIS_RET['STUDENT_ID']][1]['DIV']); } } else { $return = $current_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT'] == '' ? '' : _makeLetterGrade($current_RET[$THIS_RET['STUDENT_ID']][1]['GRADE_PERCENT'] / 100, "", User('STAFF_ID'), "%") + 0 . '%'; } } elseif ($column == 'REPORT_CARD_GRADE') { $return = '<b>' . $grades_RET[$current_RET[$THIS_RET['STUDENT_ID']][1]['REPORT_CARD_GRADE_ID']][1]['TITLE'] . '</b>'; } return $return; }
function _makeExtraCols($assignment_id, $column) { global $THIS_RET, $total_points, $current_RET, $old_student_id, $student_count, $tabindex, $count_students, $max_allowed; if ($THIS_RET['STUDENT_ID'] != $old_student_id) { $student_count++; $tabindex = $student_count; $old_student_id = $THIS_RET['STUDENT_ID']; } else { $tabindex += $count_students; } if ($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'] == '-1') { $points = '*'; } elseif (strpos($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '.')) { $points = rtrim(rtrim($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '0'), '.'); } else { $points = $current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS']; } if ($total_points[$assignment_id] != 0) { if ($points != '*') { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> ' . ($THIS_RET['D' . $assignment_id] || $points != '' ? $points > $total_points[$assignment_id] * $max_allowed ? '<FONT color=red>' : '' : '<FONT color=gray>') . Percent($points / $total_points[$assignment_id], 0) . ($THIS_RET['D' . $assignment_id] || $points != '' ? $points > $total_points[$assignment_id] * $max_allowed ? '</FONT>' : '' : '') . '<BR> <B>' . _makeLetterGrade($points / $total_points[$assignment_id]) . '</B>' . ($THIS_RET['D' . $assignment_id] || $points != '' ? '' : '</FONT>') . '</TD></TR></TABLE>'; } else { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> N/A<BR> N/A</TD></TR></TABLE>'; } } else { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> E/C</TD></TR></TABLE>'; } }
function _makeExtraCols($assignment_id, $column) { global $THIS_RET, $assignments_RET, $current_RET, $old_student_id, $student_count, $tabindex, $count_students, $max_allowed, $program_config; if ($THIS_RET['STUDENT_ID'] != $old_student_id) { $student_count++; $tabindex = $student_count; $old_student_id = $THIS_RET['STUDENT_ID']; } else { $tabindex += $count_students; } $total_points = $assignments_RET[$assignment_id][1]['POINTS']; if ($_REQUEST['include_all'] || ($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'] != '' || !$assignments_RET[$assignment_id][1]['DUE_EPOCH'] || $assignments_RET[$assignment_id][1]['DUE_EPOCH'] >= $THIS_RET['START_EPOCH'] && (!$THIS_RET['END_EPOCH'] || $assignments_RET[$assignment_id][1]['DUE_EPOCH'] <= $THIS_RET['END_EPOCH']))) { if ($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'] == '-1') { $points = '*'; } elseif (mb_strpos($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '.')) { $points = rtrim(rtrim($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '0'), '.'); } else { $points = $current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS']; } if ($total_points != 0) { if ($points != '*') { // return '<TABLE cellspacing=0 cellpadding=0><TR align=center><TD>'.TextInput($points,'values['.$THIS_RET['STUDENT_ID'].']['.$assignment_id.'][POINTS]','',' size=2 maxlength=7 tabindex='.$tabindex).'<HR>'.$total_points.'</TD><TD> '.($assignments_RET[$assignment_id][1]['DUE']||$points!=''?($points>$total_points*$max_allowed?'<span style="color:red">':''):'<span style="color:gray">').Percent($points/$total_points,0).($assignments_RET[$assignment_id][1]['DUE']||$points!=''?($points>$total_points*$max_allowed?'</span>':''):'').'<BR /> <B>'._makeLetterGrade($points/$total_points).'</B>'.'</TD></TR></TABLE>'; // modif Francois: display letter grade according to Configuration return TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex, false) . ' / ' . $total_points . ($program_config['GRADES_DOES_LETTER_PERCENT'][1]['VALUE'] <= 0 ? '' : ' − ' . ($assignments_RET[$assignment_id][1]['DUE'] || $points != '' ? $points > $total_points * $max_allowed ? '<span style="color:red">' : '' : '<span style="color:gray">') . Percent($points / $total_points, 0) . ($assignments_RET[$assignment_id][1]['DUE'] || $points != '' ? $points > $total_points * $max_allowed ? '</span>' : '' : '')) . ($program_config['GRADES_DOES_LETTER_PERCENT'][1]['VALUE'] >= 0 ? '' : ' − <B>' . _makeLetterGrade($points / $total_points) . '</B>'); } else { // return '<TABLE cellspacing=0 cellpadding=1><TR align=center><TD>'.TextInput($points,'values['.$THIS_RET['STUDENT_ID'].']['.$assignment_id.'][POINTS]','',' size=2 maxlength=7 tabindex='.$tabindex).'<HR>'.$total_points.'</TD><TD> '._('N/A').'<BR /> '._('N/A').'</TD></TR></TABLE>'; return TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex, false) . ' / ' . $total_points . ' − ' . _('N/A'); } } else { //return '<TABLE class="cellpadding-1 cellspacing-0"><TR class="center"><TD>'.TextInput($points,'values['.$THIS_RET['STUDENT_ID'].']['.$assignment_id.'][POINTS]','',' size=2 maxlength=7 tabindex='.$tabindex).'<HR>'.$total_points.'</TD><TD> E/C</TD></TR></TABLE>'; return TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex, false) . ' / ' . $total_points . ' − ' . 'E/C'; } } }
$grades_RET[$i + 1]['bgcolor'] = 'FFFFFF'; foreach ($course_periods as $course_period_id => $mps) { $i++; $grades_RET[$i]['STUDENT_ID'] = $student_id; $grades_RET[$i]['COURSE_PERIOD_ID'] = $course_period_id; $grades_RET[$i]['MARKING_PERIOD_ID'] = key($mps); $grades_RET[$i]['COURSE_TITLE'] = $mps[key($mps)][1]['COURSE_TITLE']; $grades_RET[$i]['TEACHER'] = $mps[$last_mp][1]['TEACHER']; foreach ($_REQUEST['mp_arr'] as $mp) { if ($mps[$mp]) { if ($mps[$mp][1]['GRADE_PERCENT'] != Null || $mps[$mp][1]['GRADE_PERCENT'] != '') { $grades_RET[$i][$mp] = $grades_RET[$i][$mp] = _makeLetterGrade($mps[$mp][1]['GRADE_PERCENT'] / 100, $course_period_id, $mps[$last_mp][1]['TEACHER_ID'], "") . ' '; } if ($_REQUEST['elements']['percents'] == 'Y' && $mps[$mp][1]['GRADE_PERCENT'] > 0 && $mps[$mp][1]['GRADE_PERCENT'] != NULl) { if ($mps[$mp][1]['GRADE_PERCENT'] != '') { $grades_RET[$i][$mp . '%'] = _makeLetterGrade($mps[$mp][1]['GRADE_PERCENT'] / 100, $course_period_id, $mps[$last_mp][1]['TEACHER_ID'], "%") . '%'; } } $last_mp = $mp; } } if ($_REQUEST['elements']['period_absences'] == 'Y') { if ($mps[$last_mp][1]['DOES_ATTENDANCE']) { $grades_RET[$i]['ABSENCES'] = $mps[$last_mp][1]['YTD_ABSENCES'] . ' / ' . $mps[$last_mp][1]['MP_ABSENCES']; } else { $grades_RET[$i]['ABSENCES'] = 'n/a'; } } if ($_REQUEST['elements']['comments'] == 'Y') { $sep = ''; foreach ($mps[$last_mp][1]['COMMENTS_RET'] as $comment) {
if ($do_stats && $_REQUEST['do_stats']) { if ($all_RET[$assignment['ASSIGNMENT_ID']]) { $all = $all_RET[$assignment['ASSIGNMENT_ID']][1]; if ($assignment['POINTS'] != '-1' && $assignment['POINTS'] != '') { $bargraph1 = bargraph1($assignment['POINTS'], $all['MIN'], $all['AVG'], $all['MAX'], $assignment['POINTS_POSSIBLE']); $bargraph2 = bargraph2(0, $all['LOWER'], $all['HIGHER']); } else { $bargraph1 = bargraph1(true, $all['MIN'], $all['AVG'], $all['MAX'], $assignment['POINTS_POSSIBLE']); $bargraph2 = bargraph2(true); } } else { $bargraph1 = bargraph1(false); $bargraph2 = bargraph2(false); } } $LO_ret[] = array('TITLE' => $assignment['TITLE'], 'CATEGORY' => $assignment['CATEGORY'], 'POINTS' => ($assignment['POINTS'] == '-1' ? '*' : ($assignment['POINTS'] == '' ? '<FONT color=red>0</FONT>' : rtrim(rtrim($assignment['POINTS'], '0'), '.'))) . ' / ' . $assignment['POINTS_POSSIBLE'], 'PERCENT' => $assignment['POINTS_POSSIBLE'] == '0' ? 'e/c' : ($assignment['POINTS'] == '-1' ? '*' : number_format(100 * $assignment['POINTS'] / $assignment['POINTS_POSSIBLE'], 1) . '%'), 'LETTER' => $programconfig[$staff_id]['LETTER_GRADE_ALL'] == 'Y' ? '' : ($assignment['POINTS_POSSIBLE'] == '0' ? 'n/a' : ($assignment['POINTS'] == '-1' ? 'n/a' : ($assignment['POINTS_POSSIBLE'] >= $programconfig[$staff_id]['LETTER_GRADE_MIN'] ? '<b>' . _makeLetterGrade($assignment['POINTS'] / $assignment['POINTS_POSSIBLE'], $course['COURSE_PERIOD_ID'], $staff_id) . '</b>' : ''))), 'COMMENT' => $assignment['COMMENT'] . ($assignment['POINTS'] == '' ? ($assignment['COMMENT'] ? '<BR>' : '') . '<FONT color=red>no grade</FONT>' : '')) + ($do_stats && $_REQUEST['do_stats'] ? array('BAR1' => $bargraph1, 'BAR2' => $bargraph2) : array()); } if ($_REQUEST['id'] == 'all') { echo '<BR>'; DrawHeader('<B>' . substr($course['TITLE'], 0, strpos(str_replace(' - ', ' ^ ', $course['TITLE']), '^')) . '</B> - ' . substr($course['TITLE'], strrpos(str_replace(' - ', ' ^ ', $course['TITLE']), '^') + 2), "<A HREF=Modules.php?modname={$_REQUEST['modname']}" . ($do_stats ? "&do_stats={$_REQUEST['do_stats']}" : '') . ">" . _('Back to Totals') . "</A>"); } unset($LO_ret[0]); ListOutput($LO_ret, $LO_columns, _('Assignment'), _('Assignments'), array(), array(), array('center' => false, 'save' => $_REQUEST['id'] != 'all', 'search' => false)); } else { if ($_REQUEST['id'] != 'all') { DrawHeader(_('There are no grades available for this student.')); } } } } }
function _makeGrade($value, $column) { global $THIS_RET, $total_points, $current_RET, $percent_RET, $programconfig; if (!is_numeric($_REQUEST['assignment_id']) && !$_REQUEST['student_id']) { if ($programconfig['WEIGHT'] == 'Y' && count($percent_RET[$THIS_RET['STUDENT_ID']])) { $total = 0; foreach ($percent_RET[$THIS_RET['STUDENT_ID']] as $type_id => $type) { $total += $type[1]['PARTIAL_PERCENT']; } } elseif ($current_RET[$THIS_RET['STUDENT_ID']][1]['TOTAL_POINTS']) { $total = $current_RET[$THIS_RET['STUDENT_ID']][1]['POINTS'] / $current_RET[$THIS_RET['STUDENT_ID']][1]['TOTAL_POINTS']; } else { $total = 0; } return _makeLetterGrade($total, UserCoursePeriod()); } else { if ($current_RET[$THIS_RET['STUDENT_ID']][$_REQUEST['assignment_id']][1]['POINTS'] != '*') { return _makeLetterGrade($current_RET[$THIS_RET['STUDENT_ID']][$_REQUEST['assignment_id']][1]['POINTS'] / $total_points, UserCoursePeriod()); } else { return _('N/A'); } } }
function _makeExtra($value, $column) { global $THIS_RET, $student_points, $total_points, $percent_weights; if ($column == 'POINTS') { if ($THIS_RET['TOTAL_POINTS'] != '0') { if ($value != '-1') { if (($THIS_RET['DUE'] || $value != '') && $value != '') { $student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value; $total_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $THIS_RET['TOTAL_POINTS']; $percent_weights[$THIS_RET['ASSIGNMENT_TYPE_ID']] = $THIS_RET['FINAL_GRADE_PERCENT']; } return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>' . (rtrim(rtrim($value, '0'), '.') + 0) . '</font></TD><TD><font size=-1> / </font></TD><TD><font size=-1>' . $THIS_RET['TOTAL_POINTS'] . '</font></TD></TR></TABLE>'; } else { return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>Excluded</font></TD><TD></TD><TD></TD></TR></TABLE>'; } } else { $student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value; return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>' . (rtrim(rtrim($value, '0'), '.') + 0) . '</font></TD><TD><font size=-1> / </font></TD><TD><font size=-1>' . $THIS_RET['TOTAL_POINTS'] . '</font></TD></TR></TABLE>'; } } elseif ($column == 'LETTER_GRADE') { if ($THIS_RET['TOTAL_POINTS'] != '0') { if ($value != '-1') { if ($THIS_RET['DUE'] && $value == '') { return 'Not Graded'; } else { if ($THIS_RET['DUE'] || $value != '') { $qr = DBGet(DBQuery('SELECT TEACHER_ID FROM course_periods WHERE COURSE_PERIOD_ID=' . $THIS_RET['COURSE_PERIOD_ID'])); return _makeLetterGrade($value / $THIS_RET['TOTAL_POINTS'], $THIS_RET['COURSE_PERIOD_ID'], $qr[1]['TEACHER_ID'], "%") . '% ' . _makeLetterGrade($value / $THIS_RET['TOTAL_POINTS'], $THIS_RET['COURSE_PERIOD_ID'], $qr[1]['TEACHER_ID']); } else { return 'Due'; } } } else { return 'N/A'; } } else { return 'E/C'; } } }
function _makeExtra($value, $column) { global $THIS_RET, $student_points, $total_points, $percent_weights; if ($column == 'POINTS') { if ($THIS_RET['TOTAL_POINTS'] != '0') { if ($value != '-1') { if ($THIS_RET['DUE'] || $value != '') { $student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value; $total_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $THIS_RET['TOTAL_POINTS']; $percent_weights[$THIS_RET['ASSIGNMENT_TYPE_ID']] = $THIS_RET['FINAL_GRADE_PERCENT']; } return '<TABLE class="cellpadding-0 cellspacing-0"><TR><TD><span class="size-1">' . (rtrim(rtrim($value, '0'), '.') + 0) . '</span></TD><TD><span class="size-1"> / </span></TD><TD><span class="size-1">' . $THIS_RET['TOTAL_POINTS'] . '</span></TD></TR></TABLE>'; } else { return '<TABLE class="cellpadding-0 cellspacing-0"><TR><TD><span class="size-1">' . _('Excluded') . '</span></TD><TD></TD><TD></TD></TR></TABLE>'; } } else { $student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value; return '<TABLE class="cellpadding-0 cellspacing-0"><TR><TD><span class="size-1">' . (rtrim(rtrim($value, '0'), '.') + 0) . '</span></TD><TD><span class="size-1"> / </span></TD><TD><span class="size-1">' . $THIS_RET['TOTAL_POINTS'] . '</span></TD></TR></TABLE>'; } } elseif ($column == 'PERCENT_GRADE') { if ($THIS_RET['TOTAL_POINTS'] != '0') { if ($value != '-1') { if ($THIS_RET['DUE'] || $value != '') { return Percent($value / $THIS_RET['TOTAL_POINTS'], 1); } else { return 'not due'; } } else { return _('N/A'); } } else { return 'e/c'; } } elseif ($column == 'LETTER_GRADE') { if ($THIS_RET['TOTAL_POINTS'] != '0') { if ($value != '-1') { if ($THIS_RET['DUE'] || $value != '') { return _makeLetterGrade($value / $THIS_RET['TOTAL_POINTS']); } else { return 'not due'; } } else { return _('N/A'); } } else { return 'e/c'; } } }