} } else { if ($current_completed) { DBQuery('DELETE FROM grades_completed WHERE STAFF_ID=\'' . User('STAFF_ID') . '\' AND MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\' AND PERIOD_ID=\'' . UserPeriod() . '\''); } } $current_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.REPORT_CARD_GRADE_ID,g.GRADE_PERCENT,g.REPORT_CARD_COMMENT_ID,g.COMMENT FROM student_report_card_grades g WHERE g.COURSE_PERIOD_ID=\'' . $course_period_id . '\' AND g.MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\''), array(), array('STUDENT_ID')); $current_commentsA_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.REPORT_CARD_COMMENT_ID,g.COMMENT FROM student_report_card_comments g WHERE g.COURSE_PERIOD_ID=\'' . $course_period_id . '\' AND g.MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\' AND g.REPORT_CARD_COMMENT_ID IN (SELECT ID FROM report_card_comments WHERE COURSE_ID IS NOT NULL)'), array(), array('STUDENT_ID', 'REPORT_CARD_COMMENT_ID')); $current_commentsB_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.REPORT_CARD_COMMENT_ID FROM student_report_card_comments g WHERE g.COURSE_PERIOD_ID=\'' . $course_period_id . '\' AND g.MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\' AND g.REPORT_CARD_COMMENT_ID IN (SELECT ID FROM report_card_comments WHERE COURSE_ID IS NULL)'), array(), array('STUDENT_ID')); $max_current_commentsB = 0; foreach ($current_commentsB_RET as $comments) { if (count($comments) > $max_current_commentsB) { $max_current_commentsB = count($comments); } } $current_completed = count(DBGet(DBQuery('SELECT \'\' FROM grades_completed WHERE STAFF_ID=\'' . User('STAFF_ID') . '\' AND MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\' AND PERIOD_ID=\'' . UserPeriod() . '\''))); unset($_SESSION['_REQUEST_vars']['values']); } if (clean_param($_REQUEST['values'], PARAM_NOTAGS) && ($_POST['values'] || $_REQUEST['ajax']) && $_REQUEST['submit']['cancel']) { unset($_SESSION['_REQUEST_vars']['values']); } //////////************start of standard portion************////////// //////////////////////customized for sd///////////////////////// if ($_REQUEST['modfunc'] == 'enter_standards') { //print_r($_REQUEST); //////////////////edit portion///////////////////////// // if($_REQUEST['process']=='edit' && ($_REQUEST['student_standards'] || $_REQUEST['student_standards_comment'] )) if ($_REQUEST['process'] == 'edit' && $_REQUEST['student_standards']) { foreach ($_REQUEST['student_standards'] as $key => $value) { // edit standard grade DBQuery("UPDATE student_standards SET GRADE_ID='" . $value[GRADE_ID] . "' WHERE ID={$key}");
} if ($_REQUEST['values'] && ($_POST['values'] || $_REQUEST['ajax'])) { $course_period_id = UserCoursePeriod(); foreach ($_REQUEST['values'] as $student_id => $value) { if ($current_RET[$student_id]) { $sql = 'UPDATE eligibility SET ELIGIBILITY_CODE=\'' . $value . '\' WHERE SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND PERIOD_ID=\'' . UserPeriod() . '\' 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 . '\',\'' . $value . '\')'; } DBQuery($sql); } $RET = DBGet(DBQuery('SELECT \'completed\' AS COMPLETED FROM eligibility_completed WHERE STAFF_ID=\'' . User('STAFF_ID') . '\' AND SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND PERIOD_ID=\'' . UserPeriod() . '\'')); if (!count($RET)) { DBQuery('INSERT INTO eligibility_completed (STAFF_ID,SCHOOL_DATE,PERIOD_ID) values(\'' . User('STAFF_ID') . '\',\'' . DBDate() . '\',\'' . UserPeriod() . '\')'); } $current_RET = DBGet(DBQuery('SELECT ELIGIBILITY_CODE,STUDENT_ID FROM eligibility WHERE SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND PERIOD_ID=\'' . UserPeriod() . '\''), array(), array('STUDENT_ID')); } $extra['SELECT'] .= ",'' AS PASSING,'' AS BORDERLINE,'' AS FAILING,'' AS INCOMPLETE"; $extra['functions'] = array('PASSING' => 'makeRadio', 'BORDERLINE' => 'makeRadio', 'FAILING' => 'makeRadio', 'INCOMPLETE' => 'makeRadio'); $columns = array('PASSING' => '' . _('Passing') . '', 'BORDERLINE' => '' . _('Borderline') . '', 'FAILING' => '' . _('Failing') . '', 'INCOMPLETE' => '' . _('Incomplete') . ''); $stu_RET = GetStuList($extra); echo "<FORM ACTION=Modules.php?modname={$_REQUEST['modname']} method=POST>"; DrawHeaderHome(ProgramTitle()); if ($today > $END_DAY || $today < $START_DAY || $today == $START_DAY && date('Gi') < $START_HOUR . $START_MINUTE || $today == $END_DAY && date('Gi') > $END_HOUR . $END_MINUTE) { if ($START_HOUR > 12) { $START_HOUR -= 12; $START_M = 'PM'; } else { $START_M = 'AM'; } if ($END_HOUR > 12) {
if ($column == 'COMMENT') { $value = str_replace("'", "\\'", $value); } if ($value != '-1') { $value = paramlib_validation($column, $value); } #$sql .= $column."='".str_replace("\'","''",$value)."',"; if (stripos($_SERVER['SERVER_SOFTWARE'], 'linux')) { $value = mysql_real_escape_string($value); } $sql .= $column . "='" . $value . " ',"; } $sql = substr($sql, 0, -1) . " WHERE STUDENT_ID='{$student_id}' AND ASSIGNMENT_ID='{$assignment_id}' AND COURSE_PERIOD_ID='{$course_period_id}'"; } elseif ($columns['POINTS'] != '' || $columns['COMMENT']) { $columns['COMMENT'] = str_replace("'", "\\'", $columns['COMMENT']); $sql = 'INSERT INTO gradebook_grades (STUDENT_ID,PERIOD_ID,COURSE_PERIOD_ID,ASSIGNMENT_ID,POINTS,COMMENT) values(\'' . clean_param($student_id, PARAM_INT) . '\',\'' . clean_param(UserPeriod(), PARAM_INT) . '\',\'' . clean_param($course_period_id, PARAM_INT) . '\',\'' . clean_param($assignment_id, PARAM_INT) . '\',\'' . $columns['POINTS'] . '\',\'' . clean_param($columns['COMMENT'], PARAM_NOTAGS) . '\')'; } if ($sql) { DBQuery($sql); // DBQuery("UPDATE gradebook_assignments SET UNGRADED=2 WHERE ASSIGNMENT_ID IN (SELECT ASSIGNMENT_ID FROM gradebook_grades WHERE POINTS IS NULL)"); DBQuery('UPDATE gradebook_assignments SET UNGRADED=2 WHERE ASSIGNMENT_ID IN (SELECT ASSIGNMENT_ID FROM gradebook_grades WHERE POINTS IS NULL OR POINTS=\'\') OR ASSIGNMENT_ID NOT IN (SELECT ASSIGNMENT_ID FROM gradebook_grades WHERE POINTS IS NOT NULL OR POINTS!=\'\')'); } } } if ($_REQUEST['student_id']) { $current_RET[$_REQUEST['student_id']] = DBGet(DBQuery('SELECT g.ASSIGNMENT_ID FROM gradebook_grades g,gradebook_assignments a WHERE a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND a.MARKING_PERIOD_ID=\'' . UserMP() . '\' AND g.STUDENT_ID=\'' . $_REQUEST[student_id] . '\' AND g.COURSE_PERIOD_ID=\'' . $course_period_id . '\'' . ($_REQUEST['assignment_id'] == 'all' ? '' : ' AND g.ASSIGNMENT_ID=\'' . $_REQUEST[assignment_id] . '\'')), array(), array('ASSIGNMENT_ID')); } elseif ($_REQUEST['assignment_id'] == 'all') { $current_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.ASSIGNMENT_ID,g.POINTS FROM gradebook_grades g,gradebook_assignments a WHERE a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND a.MARKING_PERIOD_ID=\'' . UserMP() . '\' AND g.COURSE_PERIOD_ID=\'' . $course_period_id . '\''), array(), array('STUDENT_ID', 'ASSIGNMENT_ID')); } else { $current_RET = DBGet(DBQuery('SELECT STUDENT_ID,POINTS,COMMENT,ASSIGNMENT_ID FROM gradebook_grades WHERE ASSIGNMENT_ID=\'' . $_REQUEST[assignment_id] . '\' AND COURSE_PERIOD_ID=\'' . $course_period_id . '\''), array(), array('STUDENT_ID', 'ASSIGNMENT_ID')); }
} if ($_REQUEST['values'] && $_POST['values']) { $course_period_id = UserCoursePeriod(); foreach ($_REQUEST['values'] as $student_id => $value) { if ($current_RET[$student_id]) { $sql = "UPDATE ELIGIBILITY SET ELIGIBILITY_CODE='" . $value . "' WHERE SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}' AND PERIOD_ID='" . UserPeriod() . "' 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 . "','" . $value . "')"; } DBQuery($sql); } $RET = DBGet(DBQuery("SELECT 'completed' AS COMPLETED FROM ELIGIBILITY_COMPLETED WHERE STAFF_ID='" . User('STAFF_ID') . "' AND SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}' AND PERIOD_ID='" . UserPeriod() . "'")); if (!count($RET)) { DBQuery("INSERT INTO ELIGIBILITY_COMPLETED (STAFF_ID,SCHOOL_DATE,PERIOD_ID) values('" . User('STAFF_ID') . "','" . DBDate() . "','" . UserPeriod() . "')"); } $current_RET = DBGet(DBQuery("SELECT ELIGIBILITY_CODE,STUDENT_ID FROM ELIGIBILITY WHERE SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}' AND PERIOD_ID='" . UserPeriod() . "'"), array(), array('STUDENT_ID')); } $extra['SELECT'] .= ",'' AS PASSING,'' AS BORDERLINE,'' AS FAILING,'' AS INCOMPLETE"; $extra['functions'] = array('PASSING' => 'makeRadio', 'BORDERLINE' => 'makeRadio', 'FAILING' => 'makeRadio', 'INCOMPLETE' => 'makeRadio'); $columns = array('PASSING' => _('Passing'), 'BORDERLINE' => _('Borderline'), 'FAILING' => _('Failing'), 'INCOMPLETE' => _('Incomplete')); $stu_RET = GetStuList($extra); echo "<FORM ACTION=Modules.php?modname={$_REQUEST['modname']} method=POST>"; DrawHeader(ProgramTitle()); if ($today > $END_DAY || $today < $START_DAY || $today == $START_DAY && date('Gi') < $START_HOUR . $START_MINUTE || $today == $END_DAY && date('Gi') > $END_HOUR . $END_MINUTE) { echo ErrorMessage(array(sprintf(_('You can only enter eligibility from %s %s to %s %s.'), $days[$START_DAY], Localize('time', array('hour' => $START_HOUR, 'minute' => $START_MINUTE)), $days[$END_DAY], Localize('time', array('hour' => $END_HOUR, 'minute' => $END_MINUTE)))), 'error'); } else { DrawHeader("<A HREF=Modules.php?modname={$_REQUEST['modname']}&modfunc=gradebook>" . _('Use Gradebook Grades') . "</A>", '<INPUT type=submit value="' . _('Save') . '">'); $LO_columns = array('FULL_NAME' => _('Student'), 'STUDENT_ID' => _('Centre ID'), 'GRADE_ID' => _('Grade')) + $columns; ListOutput($stu_RET, $LO_columns, _('Student'), _('Students')); echo '<CENTER><INPUT type=submit value="' . _('Save') . '"></CENTER>'; }
} $extra['cpvdate'] = " AND cpv.DAYS='" . $day_check . "'"; } if ($_SESSION['PROFILE'] == 'teacher' && $codes_RET_count[1]['CODES'] == 0) { $stu_RET = array(); } else { if ($_SESSION['PROFILE'] == 'teacher' && $codes_RET_count[1]['CODES'] != 0) { $stu_RET = GetStuListAttn($extra); } else { $stu_RET = GetStuListAttn($extra); } } $date_note = $date != date('Y-m-d') ? ' <span class=red>The selected date is not today</span>' : ''; # commented as requested if ($_REQUEST['table'] == '0') { $completed_RET = DBGet(DBQuery('SELECT \'Y\' as COMPLETED,STAFF_ID,SUBSTITUTE_STAFF_ID,IS_TAKEN_BY_SUBSTITUTE_STAFF FROM attendance_completed WHERE (STAFF_ID=\'' . User('STAFF_ID') . '\' OR SUBSTITUTE_STAFF_ID=\'' . User('STAFF_ID') . '\') AND SCHOOL_DATE=\'' . $date . '\' AND PERIOD_ID=\'' . UserPeriod() . '\' AND CPV_ID=\'' . CpvId() . '\'')); if ($completed_RET) { if ($completed_RET[1]['IS_TAKEN_BY_SUBSTITUTE_STAFF'] != 'Y' && User('STAFF_ID') == $completed_RET[1]['SUBSTITUTE_STAFF_ID']) { $note = ErrorMessage(array('<IMG SRC=assets/check.gif>Primary teacher has taken attendance today for this period.'), 'note'); } elseif ($completed_RET[1]['IS_TAKEN_BY_SUBSTITUTE_STAFF'] == 'Y' && User('STAFF_ID') == $completed_RET[1]['STAFF_ID']) { $note = ErrorMessage(array('<IMG SRC=assets/check.gif>Secondary teacher has taken attendance today for this period.'), 'note'); } else { $note = ErrorMessage(array('<IMG SRC=assets/check.gif>You have taken attendance today for this period.'), 'note'); } } if ($_SESSION['miss_attn'] == 1) { $get_profile_type = DBGet(DBQuery('SELECT PROFILE FROM user_profiles WHERE ID=' . UserProfileID())); if ($_REQUEST['username'] == 'admin' || $get_profile_type[1]['PROFILE'] == 'admin') { $note1 = '<a href=Modules.php?modname=users/TeacherPrograms.php?include=attendance/MissingAttendance.php&From=' . $From . '&to=' . $to . '><< Back to Missing Attendance List </a>'; } }
$columns = array(); } $extra['SELECT'] .= ',s.STUDENT_ID AS COMMENT,s.STUDENT_ID AS ATTENDANCE_REASON'; $columns += array('COMMENT' => _('Teacher Comment')); if (!is_array($extra['functions'])) { $extra['functions'] = array(); } $extra['functions'] += array('FULL_NAME' => '_makeTipMessage', 'COMMENT' => 'makeCommentInput', 'ATTENDANCE_REASON' => 'makeAttendanceReason'); $extra['DATE'] = $date; $stu_RET = GetStuList($extra); if ($attendance_reason) { $columns += array('ATTENDANCE_REASON' => _('Office Comment')); } $date_note = $date != DBDate() ? ' <span style="color:red">' . _('The selected date is not today') . '</span> |' : ''; $date_note .= AllowEdit() ? ' <span style="color:green">' . _('You can edit this attendance') . '</span>' : ' <span style="color:red">' . _('You cannot edit this attendance') . '</span>'; $completed_RET = DBGet(DBQuery("SELECT 'Y' as COMPLETED FROM ATTENDANCE_COMPLETED WHERE STAFF_ID='" . User('STAFF_ID') . "' AND SCHOOL_DATE='{$date}' AND PERIOD_ID='" . UserPeriod() . "' AND TABLE_NAME='" . $_REQUEST['table'] . "'")); if (count($completed_RET)) { $note = ErrorMessage(array('<IMG SRC="assets/check.png" class="alignImg" /> ' . _('You already have taken attendance today for this period.')), 'note'); } echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&table=' . $_REQUEST['table'] . '" method="POST">'; DrawHeader(PrepareDate($date, '_date', false, array('submit' => true)) . $date_note, SubmitButton(_('Save'))); //DrawHeader($note); echo $note; $LO_columns = array('FULL_NAME' => _('Student'), 'STUDENT_ID' => _('RosarioSIS ID'), 'GRADE_ID' => _('Grade Level')) + $columns; //$tabs[] = array('title'=>'Attendance','link'=>"Modules.php?modname=$_REQUEST[modname]&table=0&month_date=$_REQUEST[month_date]&day_date=$_REQUEST[day_date]&year_date=$_REQUEST[year_date]"); //$categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'")); foreach ($categories_RET as $category) { $tabs[] = array('title' => ParseMLField($category['TITLE']), 'link' => "Modules.php?modname={$_REQUEST['modname']}&table={$category['ID']}&month_date={$_REQUEST['month_date']}&day_date={$_REQUEST['day_date']}&year_date={$_REQUEST['year_date']}"); } echo '<BR />'; if (count($categories_RET)) {
} $completed = DBGet(DBQuery('SELECT count(\'Y\') AS COMPLETED FROM FOOD_SERVICE_COMPLETED WHERE STAFF_ID=\'' . User('STAFF_ID') . '\' AND SCHOOL_DATE=\'' . $date . '\' AND PERIOD_ID=\'' . UserPeriod() . '\' AND MENU_ID=\'' . $_REQUEST['menu_id'] . '\'')); if ($completed[1]['COMPLETED']) { $note = ErrorMessage(array('<IMG SRC=assets/check.gif>' . _('You have taken lunch counts today for this period.')), 'note'); } echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>"; DrawHeader(PrepareDate($date, '_date', false, array('submit' => true)) . $date_note, SubmitButton(_('Save'))); DrawHeader($note); $meal_RET = DBGet(DBQuery('SELECT DESCRIPTION FROM CALENDAR_EVENTS WHERE SYEAR=' . UserSyear() . ' AND SCHOOL_ID=' . UserSchool() . ' AND SCHOOL_DATE=\'' . $date . '\' AND TITLE=\'' . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . '\'')); if ($meal_RET) { echo '<TABLE width=100% border=0>'; echo '<TR><TD align=center>'; echo '<B>Today\'s ' . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . ':</B> ' . $meal_RET[1]['DESCRIPTION']; echo '</TD></TR></TABLE><HR>'; } $items_RET = DBGet(DBQuery('SELECT fsi.ITEM_ID,fsi.DESCRIPTION,fsmi.DOES_COUNT,(SELECT COUNT FROM FOOD_SERVICE_COMPLETED WHERE STAFF_ID=\'' . User('STAFF_ID') . '\' AND SCHOOL_DATE=\'' . $date . '\' AND PERIOD_ID=\'' . UserPeriod() . '\' AND ITEM_ID=fsi.ITEM_ID AND MENU_ID=fsmi.MENU_ID) AS COUNT FROM FOOD_SERVICE_ITEMS fsi,FOOD_SERVICE_MENU_ITEMS fsmi WHERE fsmi.MENU_ID=\'' . $_REQUEST['menu_id'] . '\' AND fsi.ITEM_ID=fsmi.ITEM_ID AND fsmi.DOES_COUNT IS NOT NULL ORDER BY fsmi.SORT_ORDER'), array('COUNT' => 'makeTextInput')); echo '<TABLE width=100%><TR><TD width=50%>'; $LO_columns = array('DESCRIPTION' => _('Item'), 'COUNT' => _('Count')); if (count($menus_RET) > 1) { $tabs = array(); foreach ($menus_RET as $id => $meal) { $tabs[] = array('title' => $meal[1]['TITLE'], 'link' => "Modules.php?modname={$_REQUEST['modname']}&menu_id={$id}&day_date={$_REQUEST['day_date']}&month_date={$_REQUEST['month_date']}&year_date={$_REQUEST['year_date']}"); } echo '<BR>'; echo '<CENTER>' . WrapTabs($tabs, "Modules.php?modname={$_REQUEST['modname']}&menu_id={$_REQUEST['menu_id']}&day_date={$_REQUEST['day_date']}&month_date={$_REQUEST['month_date']}&year_date={$_REQUEST['year_date']}") . '</CENTER>'; $extra = array('count' => false, 'download' => false, 'search' => false); } else { $extra = array('search' => false); $plural = ($singular = $menus_RET[1][1]['TITLE'] . ' Item') . 's'; } ListOutput($items_RET, $LO_columns, $singular, $plural, false, false, $extra);
} else { Search_Miss_Attn('staff_id', 'teacher'); } if (UserStaffID()) { $QI = DBQuery("SELECT DISTINCT cp.PERIOD_ID,cp.COURSE_PERIOD_ID,sp.TITLE,sp.SHORT_NAME,cp.MARKING_PERIOD_ID,cp.DAYS,sp.SORT_ORDER,c.TITLE AS COURSE_TITLE FROM COURSE_PERIODS cp, SCHOOL_PERIODS sp,COURSES c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID='" . UserSchool() . "' AND (cp.TEACHER_ID='" . UserStaffID() . "' OR cp.SECONDARY_TEACHER_ID='" . UserStaffID() . "') ORDER BY sp.SORT_ORDER "); $RET = DBGet($QI); // get the fy marking period id, there should be exactly one fy marking period $fy_id = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_YEARS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'")); $fy_id = $fy_id[1]['MARKING_PERIOD_ID']; if (isset($cp_id)) { $_REQUEST['period'] = $cp_id; } if ($_REQUEST['period']) { $_SESSION['UserCoursePeriod'] = $_REQUEST['period']; } if (!UserPeriod()) { $_SESSION['UserPeriod'] = $RET[1]['PERIOD_ID']; } if (!UserCoursePeriod()) { $_SESSION['UserCoursePeriod'] = $RET[1]['COURSE_PERIOD_ID']; } $incl_page = $_REQUEST['include']; if ($incl_page != 'Attendance/Missing_Attendance.php') { if (!$_SESSION['take_mssn_attn']) { $period_select = "Choose Period: <SELECT name=period onChange='document.forms[1].submit();'>"; $period_select .= "<OPTION value='na' selected>N/A</OPTION>"; } else { $period_select = "<SELECT name=period onChange='document.forms[1].submit();' style='visibility:hidden;'>"; } foreach ($RET as $period) { $period_select .= "<OPTION value={$period['COURSE_PERIOD_ID']}" . (UserCoursePeriod() == $period['COURSE_PERIOD_ID'] ? ' SELECTED' : '') . ">" . $period['SHORT_NAME'] . ($period['MARKING_PERIOD_ID'] != $fy_id ? ' ' . GetMP($period['MARKING_PERIOD_ID'], 'SHORT_NAME') : '') . (strlen($period['DAYS']) < 5 ? ' ' . $period['DAYS'] : '') . ' - ' . $period['COURSE_TITLE'] . "</OPTION>";
#################### if (isset($_REQUEST['student_id'])) { $RET = DBGet(DBQuery('SELECT FIRST_NAME,LAST_NAME,MIDDLE_NAME,NAME_SUFFIX,SCHOOL_ID FROM students,student_enrollment WHERE students.STUDENT_ID=\'' . $_REQUEST['student_id'] . '\' AND student_enrollment.STUDENT_ID = students.STUDENT_ID ')); $count_student_RET = DBGet(DBQuery("SELECT COUNT(*) AS NUM FROM students")); if ($count_student_RET[1]['NUM'] > 1) { DrawHeaderHome('Selected Student: ' . $RET[1]['FIRST_NAME'] . ' ' . ($RET[1]['MIDDLE_NAME'] ? $RET[1]['MIDDLE_NAME'] . ' ' : '') . $RET[1]['LAST_NAME'] . ' ' . $RET[1]['NAME_SUFFIX'] . ' (<A HREF=Side.php?student_id=new&modcat=' . $_REQUEST['modcat'] . '><font color=red>Deselect</font></A>) | <A HREF=Modules.php?modname=' . $_REQUEST['modname'] . '&search_modfunc=list&next_modname=' . $_REQUEST['modname'] . '&ajax=true&bottom_back=true&return_session=true&&day_start=' . $_REQUEST[day_start] . '&&month_start=' . $_REQUEST[month_start] . '&&year_start=' . $_REQUEST[year_start] . '&&period_id=' . $_REQUEST[period_id] . '&&myclasses=' . $_REQUEST[myclasses] . '&&chk=1 target=body>Back to Student List</A>'); } else { if ($count_student_RET[1]['NUM'] == 1) { DrawHeaderHome('Selected Student: ' . $RET[1]['FIRST_NAME'] . ' ' . ($RET[1]['MIDDLE_NAME'] ? $RET[1]['MIDDLE_NAME'] . ' ' : '') . $RET[1]['LAST_NAME'] . ' ' . $RET[1]['NAME_SUFFIX'] . ' (<A HREF=Side.php?student_id=new&modcat=' . $_REQUEST['modcat'] . '><font color=red>Deselect</font></A>) '); } } } #################### if ($_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || UserStudentID() || User('PROFILE') == 'parent' || User('PROFILE') == 'student') { if (!UserStudentID() && !$_REQUEST['student_id']) { $periods_RET = DBGet(DBQuery('SELECT sp.PERIOD_ID,sp.TITLE FROM school_periods sp WHERE sp.SYEAR=\'' . UserSyear() . '\' AND sp.SCHOOL_ID=\'' . UserSchool() . '\' AND EXISTS(SELECT \'\' FROM course_periods cp,course_period_var cpv WHERE cpv.PERIOD_ID=sp.PERIOD_ID AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND cpv.DOES_ATTENDANCE=\'Y\'' . (User('PROFILE') == 'teacher' ? ' AND cpv.PERIOD_ID=\'' . UserPeriod() . '\'' : '') . ') ORDER BY sp.SORT_ORDER')); $period_select = "<SELECT name=period_id onchange='this.form.submit();'><OPTION value=\"\">Daily</OPTION>"; if (count($periods_RET)) { foreach ($periods_RET as $period) { $period_select .= "<OPTION value={$period['PERIOD_ID']}" . ($_REQUEST['period_id'] == $period['PERIOD_ID'] ? ' SELECTED' : '') . ">{$period['TITLE']}</OPTION>"; } } $period_select .= '</SELECT>'; } if (User('PROFILE') == 'teacher') { $myclasses = '<SELECT name="myclasses" onchange="this.form.submit();">'; $myclasses .= '<OPTION value=""' . ($_REQUEST['myclasses'] == '' ? ' SELECTED' : '') . '>All course periods</OPTION>'; $myclasses .= '<OPTION value="my_classes"' . ($_REQUEST['myclasses'] == 'my_classes' ? ' SELECTED' : '') . '>All my course periods</OPTION>'; $myclasses .= '<OPTION value="selected_class"' . ($_REQUEST['myclasses'] == 'selected_class' ? ' SELECTED' : '') . '>Selected course period</OPTION>'; $myclasses .= '</SELECT>'; }
} } else { if ($current_completed) { DBQuery("DELETE FROM GRADES_COMPLETED WHERE STAFF_ID='" . User('STAFF_ID') . "' AND MARKING_PERIOD_ID='" . $_REQUEST['mp'] . "' AND PERIOD_ID='" . UserPeriod() . "'"); } } $current_RET = DBGet(DBQuery("SELECT g.STUDENT_ID,g.REPORT_CARD_GRADE_ID,g.GRADE_PERCENT,g.REPORT_CARD_COMMENT_ID,g.COMMENT FROM STUDENT_REPORT_CARD_GRADES g WHERE g.COURSE_PERIOD_ID='{$course_period_id}' AND g.MARKING_PERIOD_ID='" . $_REQUEST['mp'] . "'"), array(), array('STUDENT_ID')); $current_commentsA_RET = DBGet(DBQuery("SELECT g.STUDENT_ID,g.REPORT_CARD_COMMENT_ID,g.COMMENT FROM STUDENT_REPORT_CARD_COMMENTS g WHERE g.COURSE_PERIOD_ID='{$course_period_id}' AND g.MARKING_PERIOD_ID='" . $_REQUEST['mp'] . "' AND g.REPORT_CARD_COMMENT_ID IN (SELECT ID FROM REPORT_CARD_COMMENTS WHERE COURSE_ID IS NOT NULL)"), array(), array('STUDENT_ID', 'REPORT_CARD_COMMENT_ID')); $current_commentsB_RET = DBGet(DBQuery("SELECT g.STUDENT_ID,g.REPORT_CARD_COMMENT_ID FROM STUDENT_REPORT_CARD_COMMENTS g WHERE g.COURSE_PERIOD_ID='{$course_period_id}' AND g.MARKING_PERIOD_ID='" . $_REQUEST['mp'] . "' AND g.REPORT_CARD_COMMENT_ID IN (SELECT ID FROM REPORT_CARD_COMMENTS WHERE COURSE_ID IS NULL)"), array(), array('STUDENT_ID')); $max_current_commentsB = 0; foreach ($current_commentsB_RET as $comments) { if (count($comments) > $max_current_commentsB) { $max_current_commentsB = count($comments); } } $current_completed = count(DBGet(DBQuery("SELECT '' FROM GRADES_COMPLETED WHERE STAFF_ID='" . User('STAFF_ID') . "' AND MARKING_PERIOD_ID='" . $_REQUEST['mp'] . "' AND PERIOD_ID='" . UserPeriod() . "'"))); unset($_SESSION['_REQUEST_vars']['values']); } if (clean_param($_REQUEST['values'], PARAM_NOTAGS) && ($_POST['values'] || $_REQUEST['ajax']) && $_REQUEST['submit']['cancel']) { unset($_SESSION['_REQUEST_vars']['values']); } $time = strtotime(DBDate('postgres')); $mps_select = "<SELECT name=mp onChange='this.form.submit();'>"; if ($pros != '') { foreach (explode(',', str_replace("'", '', $pros)) as $pro) { if ($_REQUEST['mp'] == $pro && GetMP($pro, 'POST_START_DATE') && ($time >= strtotime(GetMP($pro, 'POST_START_DATE')) && $time <= strtotime(GetMP($pro, 'POST_END_DATE')))) { $allow_edit = true; } if (GetMP($pro, 'DOES_GRADES') == 'Y') { $mps_select .= "<OPTION value=" . $pro . ($pro == $_REQUEST['mp'] ? ' SELECTED' : '') . ">" . GetMP($pro) . "</OPTION>"; }
if ($columns['POINTS'] < 0) { $columns['POINTS'] = '0'; } elseif ($columns['POINTS'] > 9999.99) { $columns['POINTS'] = '9999.99'; } } } $sql = ''; if ($current_RET[$student_id][$assignment_id]) { $sql = "UPDATE GRADEBOOK_GRADES SET "; foreach ($columns as $column => $value) { $sql .= $column . "='" . $value . "',"; } $sql = mb_substr($sql, 0, -1) . " WHERE STUDENT_ID='{$student_id}' AND ASSIGNMENT_ID='{$assignment_id}' AND COURSE_PERIOD_ID='" . UserCoursePeriod() . "'"; } elseif ($columns['POINTS'] != '' || $columns['COMMENT']) { $sql = "INSERT INTO GRADEBOOK_GRADES (STUDENT_ID,PERIOD_ID,COURSE_PERIOD_ID,ASSIGNMENT_ID,POINTS,COMMENT) values('{$student_id}','" . UserPeriod() . "','" . UserCoursePeriod() . "','" . $assignment_id . "','" . $columns['POINTS'] . "','" . $columns['COMMENT'] . "')"; } if ($sql) { DBQuery($sql); } } } unset($_REQUEST['values']); unset($_SESSION['_REQUEST_vars']['values']); unset($current_RET); } $_SESSION['type_id'] = $_REQUEST['type_id']; $_SESSION['assignment_id'] = $_REQUEST['assignment_id']; $LO_options = array('search' => false); if (UserStudentID()) { $extra['WHERE'] = " AND s.STUDENT_ID='" . UserStudentID() . "'";
if ($_REQUEST['day_start'] && $_REQUEST['month_start'] && $_REQUEST['year_start']) { $start_date = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . substr($_REQUEST['year_start'], 2, 4); } else { $start_date = '01-' . strtoupper(date('M-y')); } if ($_REQUEST['day_end'] && $_REQUEST['month_end'] && $_REQUEST['year_end']) { $end_date = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . substr($_REQUEST['year_end'], 2, 4); } else { $end_date = DBDate(); } //if(User('PROFILE')=='teacher') // $_REQUEST['period_id'] = UserPeriod(); if ($_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || User('PROFILE') == 'parent' || User('PROFILE') == 'student') { if (!UserStudentID() && !$_REQUEST['student_id']) { //$periods_RET = DBGet(DBQuery("SELECT PERIOD_ID,TITLE FROM SCHOOL_PERIODS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' ORDER BY SORT_ORDER")); $periods_RET = DBGet(DBQuery("SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp WHERE sp.SYEAR='" . UserSyear() . "' AND sp.SCHOOL_ID='" . UserSchool() . "' AND EXISTS(SELECT '' FROM COURSE_PERIODS cp WHERE cp.PERIOD_ID=sp.PERIOD_ID and cp.DOES_ATTENDANCE='Y'" . (User('PROFILE') == 'teacher' ? " AND cp.PERIOD_ID='" . UserPeriod() . "'" : '') . ") ORDER BY sp.SORT_ORDER")); $period_select = "<SELECT name=period_id onchange='this.form.submit();'><OPTION value=\"\">Daily</OPTION>"; if (count($periods_RET)) { foreach ($periods_RET as $period) { $period_select .= "<OPTION value={$period['PERIOD_ID']}" . ($_REQUEST['period_id'] == $period['PERIOD_ID'] ? ' SELECTED' : '') . ">{$period['TITLE']}</OPTION>"; } } $period_select .= '</SELECT>'; } $PHP_tmp_SELF = PreparePHP_SELF(); echo "<FORM action={$PHP_tmp_SELF} method=POST>"; DrawHeaderHome(PrepareDate($start_date, '_start') . ' - ' . PrepareDate($end_date, '_end') . ' : <INPUT type=submit class=btn_medium value=Go>', $period_select); echo '</FORM>'; } if ($_REQUEST['period_id']) { $extra['SELECT'] .= ",(SELECT count(*) FROM ATTENDANCE_PERIOD ap,ATTENDANCE_CODES ac\n\t\t\t\t\t\tWHERE ac.ID=ap.ATTENDANCE_CODE AND (ac.STATE_CODE='A' OR ac.STATE_CODE='H') AND ap.STUDENT_ID=ssm.STUDENT_ID\n\t\t\t\t\t\tAND ap.PERIOD_ID='{$_REQUEST['period_id']}'\n\t\t\t\t\t\tAND ap.SCHOOL_DATE BETWEEN '" . date('Y-m-d', strtotime($start_date)) . "' AND '" . date('Y-m-d', strtotime($end_date)) . "') AS STATE_ABS";
$sql = ''; if ($current_RET[$student_id][$assignment_id]) { $sql = "UPDATE GRADEBOOK_GRADES SET "; foreach ($columns as $column => $value) { if ($value != '-1') { $value = paramlib_validation($column, $value); } #$sql .= $column."='".str_replace("\'","''",$value)."',"; if (stripos($_SERVER['SERVER_SOFTWARE'], 'linux')) { $value = mysql_real_escape_string($value); } $sql .= $column . "='" . $value . " ',"; } $sql = substr($sql, 0, -1) . " WHERE STUDENT_ID='{$student_id}' AND ASSIGNMENT_ID='{$assignment_id}' AND COURSE_PERIOD_ID='{$course_period_id}'"; } elseif ($columns['POINTS'] != '' || $columns['COMMENT']) { $sql = "INSERT INTO GRADEBOOK_GRADES (STUDENT_ID,PERIOD_ID,COURSE_PERIOD_ID,ASSIGNMENT_ID,POINTS,COMMENT) values('" . clean_param($student_id, PARAM_INT) . "','" . clean_param(UserPeriod(), PARAM_INT) . "','" . clean_param($course_period_id, PARAM_INT) . "','" . clean_param($assignment_id, PARAM_INT) . "','" . $columns['POINTS'] . "','" . clean_param($columns['COMMENT'], PARAM_NOTAGS) . "')"; } if ($sql) { DBQuery($sql); // DBQuery("UPDATE GRADEBOOK_ASSIGNMENTS SET UNGRADED=2 WHERE ASSIGNMENT_ID IN (SELECT ASSIGNMENT_ID FROM GRADEBOOK_GRADES WHERE POINTS IS NULL)"); DBQuery("UPDATE GRADEBOOK_ASSIGNMENTS SET UNGRADED=2 WHERE ASSIGNMENT_ID IN (SELECT ASSIGNMENT_ID FROM GRADEBOOK_GRADES WHERE POINTS IS NULL OR POINTS='') OR ASSIGNMENT_ID NOT IN (SELECT ASSIGNMENT_ID FROM GRADEBOOK_GRADES WHERE POINTS IS NOT NULL OR POINTS!='')"); } } } if ($_REQUEST['student_id']) { $current_RET[$_REQUEST['student_id']] = DBGet(DBQuery("SELECT g.ASSIGNMENT_ID FROM GRADEBOOK_GRADES g,GRADEBOOK_ASSIGNMENTS a WHERE a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND a.MARKING_PERIOD_ID='" . UserMP() . "' AND g.STUDENT_ID='{$_REQUEST['student_id']}' AND g.COURSE_PERIOD_ID='{$course_period_id}'" . ($_REQUEST['assignment_id'] == 'all' ? '' : " AND g.ASSIGNMENT_ID='{$_REQUEST['assignment_id']}'")), array(), array('ASSIGNMENT_ID')); } elseif ($_REQUEST['assignment_id'] == 'all') { $current_RET = DBGet(DBQuery("SELECT g.STUDENT_ID,g.ASSIGNMENT_ID,g.POINTS FROM GRADEBOOK_GRADES g,GRADEBOOK_ASSIGNMENTS a WHERE a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND a.MARKING_PERIOD_ID='" . UserMP() . "' AND g.COURSE_PERIOD_ID='{$course_period_id}'"), array(), array('STUDENT_ID', 'ASSIGNMENT_ID')); } else { $current_RET = DBGet(DBQuery("SELECT STUDENT_ID,POINTS,COMMENT,ASSIGNMENT_ID FROM GRADEBOOK_GRADES WHERE ASSIGNMENT_ID='{$_REQUEST['assignment_id']}' AND COURSE_PERIOD_ID='{$course_period_id}'"), array(), array('STUDENT_ID', 'ASSIGNMENT_ID')); }