function GetCurrentMP($mp, $date, $error = true) { global $_openSIS; switch ($mp) { case 'FY': $table = 'school_years'; break; case 'SEM': $table = 'school_semesters'; break; case 'QTR': $table = 'school_quarters'; break; case 'PRO': $table = 'school_progress_periods'; break; } if (!$_openSIS['GetCurrentMP'][$date][$mp]) { $_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM ' . $table . ' WHERE \'' . $date . '\' BETWEEN START_DATE AND END_DATE AND SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\'')); } if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) { return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']; } elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) { ErrorMessage(array('' . _("You are not currently in a marking period") . '')); } //ShowErr("You are not currently in a marking period"); }
function GetCurrentMP($mp, $date, $error = true) { global $_openSIS; switch ($mp) { case 'FY': $table = 'SCHOOL_YEARS'; break; case 'SEM': $table = 'SCHOOL_SEMESTERS'; break; case 'QTR': $table = 'SCHOOL_QUARTERS'; break; case 'PRO': $table = 'SCHOOL_PROGRESS_PERIODS'; break; } if (!$_openSIS['GetCurrentMP'][$date][$mp]) { $_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM {$table} WHERE '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'")); } if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) { return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']; } elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) { ErrorMessage(array("You are not currently in a marking period")); } //ShowErr("You are not currently in a marking period"); }
function UpdateAttendanceDaily($student_id, $date = '', $comment = false) { $daysWeek = _('SuMoTuWeThFrSa'); /// Days of the week if (!$date) { $date = DBDate(); } $sql = "SELECT\n\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac\n\t\t\tWHERE\n\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cp.PERIOD_ID\n\t\t\t\tAND position(substring('{$daysWeek}' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)*2+1 FOR 2) IN cp.DAYS)>0\n\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t"; $RET = DBGet(DBQuery($sql)); $total = $RET[1]['TOTAL']; if ($total == 0) { return; } $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='A'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL']; $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='H'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL'] * 0.5; if ($total >= 300) { $length = '1.0'; } elseif ($total >= 150) { $length = '.5'; } else { $length = '0.0'; } $current_RET = DBGet(DBQuery("SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'")); if (count($current_RET) && $current_RET[1]['MINUTES_PRESENT'] != $total) { DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='{$total}',STATE_VALUE='{$length}'" . ($comment !== false ? ",COMMENT='" . str_replace("\\'", "''", $comment) . "'" : '') . " WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) && $comment !== false && $current_RET[1]['COMMENT'] != $comment) { DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='" . str_replace("\\'", "''", $comment) . "' WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) == 0) { DBQuery("INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT) values('" . UserSyear() . "','{$student_id}','{$date}','{$total}','{$length}','" . GetCurrentMP('QTR', $date) . "','" . str_replace("\\'", "''", $comment) . "')"); } }
function GetStaffList(&$extra) { global $profiles_RET; $functions = array('PROFILE' => 'makeProfile'); switch (User('PROFILE')) { case 'admin': $profiles_RET = DBGet(DBQuery("SELECT * FROM USER_PROFILES"), array(), array('ID')); $sql = "SELECT CONCAT(\n\t\t\t\t\tCOALESCE(s.LAST_NAME,' '),', ',COALESCE(s.FIRST_NAME,' '),' ',COALESCE(s.MIDDLE_NAME,' ')) AS FULL_NAME,\n\t\t\t\t\ts.PROFILE,s.PROFILE_ID,s.STAFF_ID,s.SCHOOLS " . $extra['SELECT'] . "\n\t\t\t\tFROM\n\t\t\t\t\tSTAFF s " . $extra['FROM'] . "\n\t\t\t\tWHERE\n\t\t\t\t\ts.SYEAR='" . UserSyear() . "'"; if ($_REQUEST['_search_all_schools'] != 'Y') { $sql .= " AND (s.SCHOOLS LIKE '%," . UserSchool() . ",%' OR s.SCHOOLS IS NULL OR s.SCHOOLS='') "; } if ($_REQUEST['username']) { $sql .= "AND UPPER(s.USERNAME) LIKE '" . strtoupper($_REQUEST['username']) . "%' "; } if ($_REQUEST['last']) { $sql .= "AND UPPER(s.LAST_NAME) LIKE '" . strtoupper($_REQUEST['last']) . "%' "; } if ($_REQUEST['first']) { $sql .= "AND UPPER(s.FIRST_NAME) LIKE '" . strtoupper($_REQUEST['first']) . "%' "; } if ($_REQUEST['profile']) { $sql .= "AND s.PROFILE='" . $_REQUEST['profile'] . "' "; } $sql .= $extra['WHERE'] . ' '; $sql .= "ORDER BY FULL_NAME"; if ($extra['functions']) { $functions += $extra['functions']; } return DBGet(DBQuery($sql), $functions); break; } }
function _makeCalendar($value, $column) { global $THIS_RET, $_CENTRE, $calendars_RET; if (!$calendars_RET) { $calendars_RET = DBGet(DBQuery("SELECT CALENDAR_ID,DEFAULT_CALENDAR,TITLE FROM ATTENDANCE_CALENDARS WHERE SYEAR='" . UserSyear() . "'"), array(), array('CALENDAR_ID')); } return $calendars_RET[$value][1]['TITLE']; }
function _makeCalendar($value, $column) { global $THIS_RET, $_openSIS, $calendars_RET; if (!$calendars_RET) { $calendars_RET = DBGet(DBQuery('SELECT CALENDAR_ID,DEFAULT_CALENDAR,TITLE FROM school_calendars WHERE SYEAR=\'' . UserSyear() . '\''), array(), array('CALENDAR_ID')); } return $calendars_RET[$value][1]['TITLE']; }
function GetTeacher($teacher_id, $title = '', $column = 'FULL_NAME', $schools = true) { global $_openSIS; if (!$_openSIS['GetTeacher']) { $QI = DBQuery("SELECT STAFF_ID,CONCAT(LAST_NAME,', ',FIRST_NAME) AS FULL_NAME,USERNAME,PROFILE FROM STAFF WHERE SYEAR='" . UserSyear() . "'" . ($schools ? " AND SCHOOLS LIKE '%," . UserSchool() . ",%'" : '')); $_openSIS['GetTeacher'] = DBGet($QI, array(), array('STAFF_ID')); } return $_openSIS['GetTeacher'][$teacher_id][1][$column]; }
function GetTeacher($teacher_id, $title = '', $column = 'FULL_NAME', $schools = true) { global $_CENTRE; if (!$_CENTRE['GetTeacher']) { $QI = DBQuery("SELECT STAFF_ID,LAST_NAME||', '||FIRST_NAME AS FULL_NAME,USERNAME,PROFILE FROM STAFF WHERE SYEAR='" . UserSyear() . "'" . ($schools ? " AND (SCHOOLS IS NULL OR SCHOOLS LIKE '%," . UserSchool() . ",%')" : '')); $_CENTRE['GetTeacher'] = DBGet($QI, array(), array('STAFF_ID')); } return $_CENTRE['GetTeacher'][$teacher_id][1][$column]; }
function GetPeriod($period_id, $title = '') { global $_CENTRE; if (!$_CENTRE['GetPeriod']) { $sql = "SELECT TITLE, PERIOD_ID FROM SCHOOL_PERIODS WHERE SYEAR='" . UserSyear() . "'"; $_CENTRE['GetPeriod'] = DBGet(DBQuery($sql), array(), array('PERIOD_ID')); } return $_CENTRE['GetPeriod'][$period_id][1]['TITLE']; }
function UpdateSchoolArray($school_id = null) { if (!$school_id) { $school_id = UserSyear(); } $_SESSION['SchoolData'] = DBGet(DBQuery("SELECT * FROM SCHOOLS WHERE ID = '" . $school_id . "' AND SYEAR = '" . UserSyear() . "'")); $_SESSION['SchoolData'] = $_SESSION['SchoolData'][1]; $_SESSION['SchoolData']; }
function GetPeriod($period_id, $title = '') { global $_openSIS; if (!$_openSIS['GetPeriod']) { $sql = 'SELECT TITLE, PERIOD_ID FROM school_periods WHERE SYEAR=\'' . UserSyear() . '\''; $_openSIS['GetPeriod'] = DBGet(DBQuery($sql), array(), array('PERIOD_ID')); } return $_openSIS['GetPeriod'][$period_id][1]['TITLE']; }
function GetTeacher($teacher_id, $title = '', $column = 'FULL_NAME', $schools = true) { global $_openSIS; if (!$_openSIS['GetTeacher']) { $QI = DBQuery('SELECT STAFF_ID,CONCAT(LAST_NAME,\', \',FIRST_NAME) AS FULL_NAME,USERNAME,PROFILE FROM staff s INNER JOIN staff_school_relationship USING(staff_id),login_authentication la WHERE s.STAFF_ID=la.USER_ID AND s.PROFILE=\'teacher\' AND syear=' . UserSyear()); $_openSIS['GetTeacher'] = DBGet($QI, array(), array('STAFF_ID')); } return $_openSIS['GetTeacher'][$teacher_id][1][$column]; }
function UpdateSchoolArray($school_id = null) { if (!$school_id) { $school_id = UserSchool(); } $_SESSION['SchoolData'] = DBGet(DBQuery("SELECT * FROM SCHOOLS WHERE ID = '" . $school_id . "' AND SYEAR = '" . UserSyear() . "'")); $_SESSION['SchoolData'] = $_SESSION['SchoolData'][1]; //modif Francois: if only one school, no Search All Schools option $schools_nb = DBGet(DBQuery("SELECT COUNT(*) AS SCHOOLS_NB FROM SCHOOLS WHERE SYEAR = '" . UserSyear() . "';")); $_SESSION['SchoolData']['SCHOOLS_NB'] = $schools_nb[1]['SCHOOLS_NB']; $_SESSION['SchoolData']; }
function GetCurrentMP($mp, $date, $error = true) { global $_ROSARIO; if (!$_ROSARIO['GetCurrentMP'][$date][$mp]) { $_ROSARIO['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='{$mp}' AND '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'")); } if ($_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) { return $_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']; } elseif ($error) { ErrorMessage(array(_('You are not currently in a marking period')), 'fatal'); } }
function _makeLetterGrade($percent, $course_period_id = 0, $staff_id = 0, $ret = 'TITLE') { global $programconfig, $_ROSARIO; if (!$course_period_id) { $course_period_id = UserCoursePeriod(); } if (!$staff_id) { $staff_id = User('STAFF_ID'); } if (!$programconfig[$staff_id]) { $config_RET = DBGet(DBQuery("SELECT TITLE,VALUE FROM PROGRAM_USER_CONFIG WHERE USER_ID='" . $staff_id . "' AND PROGRAM='Gradebook'"), array(), array('TITLE')); if (count($config_RET)) { foreach ($config_RET as $title => $value) { $programconfig[$staff_id][$title] = $value[1]['VALUE']; } } else { $programconfig[$staff_id] = true; } } if (!$_ROSARIO['_makeLetterGrade']['courses'][$course_period_id]) { $_ROSARIO['_makeLetterGrade']['courses'][$course_period_id] = DBGet(DBQuery("SELECT DOES_BREAKOFF,GRADE_SCALE_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $course_period_id . "'")); } $does_breakoff = $_ROSARIO['_makeLetterGrade']['courses'][$course_period_id][1]['DOES_BREAKOFF']; $grade_scale_id = $_ROSARIO['_makeLetterGrade']['courses'][$course_period_id][1]['GRADE_SCALE_ID']; $percent *= 100; if ($does_breakoff == 'Y') { if ($programconfig[$staff_id]['ROUNDING'] == 'UP') { $percent = ceil($percent); } elseif ($programconfig[$staff_id]['ROUNDING'] == 'DOWN') { $percent = floor($percent); } elseif ($programconfig[$staff_id]['ROUNDING'] == 'NORMAL') { $percent = round($percent); } } else { $percent = round($percent); } // school default if ($ret == '%') { return $percent; } if (!$_ROSARIO['_makeLetterGrade']['grades'][$grade_scale_id]) { $_ROSARIO['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery("SELECT TITLE,ID,BREAK_OFF,COMMENT FROM REPORT_CARD_GRADES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND GRADE_SCALE_ID='{$grade_scale_id}' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER")); } //$grades = array('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-','F'); foreach ($_ROSARIO['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) { if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF']) { //modif Francois: use Report Card Grades comments //return $ret=='ID' ? $grade['ID'] : $grade['TITLE']; return $grade[$ret]; } } }
function _makePaymentsRemove($value, $column) { global $THIS_RET, $refunded_payments_RET; if (!$refunded_payments_RET) { $refunded_payments_RET = DBGet(DBQuery("SELECT p.REFUNDED_PAYMENT_ID FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND (p.REFUNDED_PAYMENT_ID IS NOT NULL AND p.REFUNDED_PAYMENT_ID!='') AND p.SYEAR='" . UserSyear() . "' AND p.SCHOOL_ID='" . UserSchool() . "'"), array(), array('REFUNDED_PAYMENT_ID')); } if (!$THIS_RET['REFUNDED_PAYMENT_ID'] && !$refunded_payments_RET[$THIS_RET['ID']]) { $return = button('remove', _('Refund'), '"Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=refund&id=' . $THIS_RET['ID'] . '"'); } elseif ($refunded_payments_RET[$THIS_RET['ID']]) { $return = '<span style="color:#00A642; text-align:center">' . _('Refunded') . '</span>'; } return $return . button('remove', _('Delete'), '"Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=remove&id=' . $THIS_RET['ID'] . '"'); }
function _makePaymentsRemove($value, $column) { global $THIS_RET, $refunded_payments_RET; if (!$refunded_payments_RET) { $refunded_payments_RET = DBGet(DBQuery("SELECT p.REFUNDED_PAYMENT_ID FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND (p.REFUNDED_PAYMENT_ID IS NOT NULL AND p.REFUNDED_PAYMENT_ID!='') AND p.SYEAR='" . UserSyear() . "' AND p.SCHOOL_ID='" . UserSchool() . "'"), array(), array('REFUNDED_PAYMENT_ID')); } if (!$THIS_RET['REFUNDED_PAYMENT_ID'] && !$refunded_payments_RET[$THIS_RET['ID']]) { $return = button('remove', _('Refund'), "Modules.php?modname={$_REQUEST['modname']}&modfunc=refund&id={$THIS_RET['ID']}"); } elseif ($refunded_payments_RET[$THIS_RET['ID']]) { $return = '<center><font color=#00FF66>' . _('Refunded') . '</font></center>'; } return $return . button('remove', _('Delete'), "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&id={$THIS_RET['ID']}"); }
function GetUserSchools($staff_id, $str = false) { $str_return = ''; $schools = DBGet(DBQuery('SELECT SCHOOL_ID FROM staff_school_relationship WHERE staff_id=' . $staff_id . ' AND syear=' . UserSyear())); foreach ($schools as $school) { $return[] = $school['SCHOOL_ID']; $str_return .= $school['SCHOOL_ID'] . ','; } if ($str == true) { return substr($str_return, 0, -1); } else { return $return; } }
function _makeLetterGrade($percent, $course_period_id = 0, $staff_id = 0, $ret = '') { global $programconfig, $_openSIS; if (!$course_period_id) { $course_period_id = UserCoursePeriod(); } if (!$staff_id) { $staff_id = User('STAFF_ID'); } if (!$programconfig[$staff_id]) { $config_RET = DBGet(DBQuery('SELECT TITLE,VALUE FROM program_user_config WHERE USER_ID=\'' . $staff_id . '\' AND PROGRAM=\'Gradebook\''), array(), array('TITLE')); if (count($config_RET)) { foreach ($config_RET as $title => $value) { $programconfig[$staff_id][$title] = $value[1]['VALUE']; } } else { $programconfig[$staff_id] = true; } } if (!$_openSIS['_makeLetterGrade']['courses'][$course_period_id]) { $_openSIS['_makeLetterGrade']['courses'][$course_period_id] = DBGet(DBQuery('SELECT DOES_BREAKOFF,GRADE_SCALE_ID FROM course_periods WHERE COURSE_PERIOD_ID=\'' . $course_period_id . '\'')); } $does_breakoff = $_openSIS['_makeLetterGrade']['courses'][$course_period_id][1]['DOES_BREAKOFF']; $grade_scale_id = $_openSIS['_makeLetterGrade']['courses'][$course_period_id][1]['GRADE_SCALE_ID']; $percent *= 100; // if ($does_breakoff=='Y') // { if ($programconfig[$staff_id]['ROUNDING'] == 'UP') { $percent = ceil($percent); } elseif ($programconfig[$staff_id]['ROUNDING'] == 'DOWN') { $percent = floor($percent); } elseif ($programconfig[$staff_id]['ROUNDING'] == 'NORMAL') { $percent = round($percent, 2); } else { $percent = round($percent, 2); } // school default if ($ret == '%') { return $percent; } if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id]) { $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' AND GRADE_SCALE_ID=\'' . $grade_scale_id . '\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER')); } //$grades = array('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-','F'); foreach ($_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) { if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF']) { return $ret == 'ID' ? $grade['ID'] : $grade['TITLE']; } } }
function UpdateAttendanceDaily($student_id, $date = '', $comment = false) { if (!$date) { $date = DBDate(); } $sql = "SELECT\r\n\t\t\t\tsum(sp.LENGTH) AS TOTAL\r\n\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac\r\n\t\t\tWHERE\r\n\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND cp.DOES_ATTENDANCE='Y'\r\n\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\r\n\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\r\n\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cp.PERIOD_ID\r\n\t\t\t\tAND position(substring('UMTWHFS' FROM DAYOFWEEK('{$date}') FOR 1) IN cp.DAYS)>0\r\n\t\t\t\tAND s.STUDENT_ID='{$student_id}'\r\n\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\r\n\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\r\n\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\r\n\t\t\t"; $RET = DBGet(DBQuery($sql)); $total = $RET[1]['TOTAL']; if ($total == 0) { return; } $sql = "SELECT sum(sp.LENGTH) AS TOTAL\r\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\r\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='A'\r\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL']; $sql = "SELECT sum(sp.LENGTH) AS TOTAL\r\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\r\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='H'\r\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL'] * 0.5; /* if($total>=300) $length = '1.0'; elseif($total>=150) $length = '.5'; else $length = '0.0'; */ if (stripos($_SERVER['SERVER_SOFTWARE'], 'linux')) { $comment = str_replace("'", "\\'", $comment); } $sys_pref = DBGet(DBQuery("SELECT * FROM SYSTEM_PREFERENCE WHERE SCHOOL_ID=" . UserSchool())); $fdm = $sys_pref[1]['FULL_DAY_MINUTE']; $hdm = $sys_pref[1]['HALF_DAY_MINUTE']; if ($total >= $fdm) { $length = '1.0'; } elseif ($total >= $hdm) { $length = '.5'; } else { $length = '0.0'; } $current_RET = DBGet(DBQuery("SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'")); if (count($current_RET) && $current_RET[1]['MINUTES_PRESENT'] != $total) { DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='{$total}',STATE_VALUE='{$length}'" . ($comment !== false ? ",COMMENT='" . str_replace("", "", $comment) . "'" : '') . " WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) && $comment !== false && $current_RET[1]['COMMENT'] != $comment) { DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='" . str_replace("", "", $comment) . "' WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) == 0) { DBQuery("INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT) values('" . UserSyear() . "','{$student_id}','{$date}','{$total}','{$length}','" . GetCurrentMP('QTR', $date) . "','" . str_replace("", "", $comment) . "')"); } }
function _rollover($table) { global $id; switch ($table) { //modif Francois: copy School Configuration case 'CONFIG': DBQuery("INSERT INTO CONFIG (SCHOOL_ID,TITLE,CONFIG_VALUE) SELECT '{$id}' AS SCHOOL_ID,TITLE,CONFIG_VALUE FROM CONFIG WHERE SCHOOL_ID='" . UserSchool() . "';"); DBQuery("INSERT INTO PROGRAM_CONFIG (SCHOOL_ID,SYEAR,PROGRAM,VALUE,TITLE) SELECT '{$id}' AS SCHOOL_ID,SYEAR,PROGRAM,VALUE,TITLE FROM PROGRAM_CONFIG WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "';"); break; case 'SCHOOL_PERIODS': DBQuery("INSERT INTO SCHOOL_PERIODS (PERIOD_ID,SYEAR,SCHOOL_ID,SORT_ORDER,TITLE,SHORT_NAME,LENGTH,ATTENDANCE,ROLLOVER_ID) SELECT nextval('SCHOOL_PERIODS_SEQ'),SYEAR,'{$id}' AS SCHOOL_ID,SORT_ORDER,TITLE,SHORT_NAME,LENGTH,ATTENDANCE,PERIOD_ID FROM SCHOOL_PERIODS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"); break; case 'SCHOOL_GRADELEVELS': $table_properties = db_properties($table); $columns = ''; foreach ($table_properties as $column => $values) { if ($column != 'ID' && $column != 'SCHOOL_ID' && $column != 'NEXT_GRADE_ID') { $columns .= ',' . $column; } } DBQuery("INSERT INTO {$table} (ID,SCHOOL_ID" . $columns . ") SELECT nextval('" . $table . "_SEQ'),'{$id}' AS SCHOOL_ID" . $columns . " FROM {$table} WHERE SCHOOL_ID='" . UserSchool() . "'"); break; case 'SCHOOL_MARKING_PERIODS': DBQuery("INSERT INTO SCHOOL_MARKING_PERIODS (MARKING_PERIOD_ID,PARENT_ID,SYEAR,MP,SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_COMMENTS,ROLLOVER_ID) SELECT " . db_seq_nextval('MARKING_PERIOD_SEQ') . ",PARENT_ID,SYEAR,MP,'{$id}' AS SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_COMMENTS,MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"); DBQuery("UPDATE SCHOOL_MARKING_PERIODS SET PARENT_ID=(SELECT mp.MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS mp WHERE mp.SYEAR=school_marking_periods.SYEAR AND mp.SCHOOL_ID=school_marking_periods.SCHOOL_ID AND mp.ROLLOVER_ID=school_marking_periods.PARENT_ID) WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='{$id}'"); break; case 'REPORT_CARD_GRADES': DBQuery("INSERT INTO REPORT_CARD_GRADE_SCALES (ID,SYEAR,SCHOOL_ID,TITLE,COMMENT,HR_GPA_VALUE,HHR_GPA_VALUE,SORT_ORDER,ROLLOVER_ID) SELECT " . db_seq_nextval('REPORT_CARD_GRADE_SCALES_SEQ') . ",SYEAR,'{$id}',TITLE,COMMENT,HR_GPA_VALUE,HHR_GPA_VALUE,SORT_ORDER,ID FROM REPORT_CARD_GRADE_SCALES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"); DBQuery("INSERT INTO REPORT_CARD_GRADES (ID,SYEAR,SCHOOL_ID,TITLE,COMMENT,BREAK_OFF,GPA_VALUE,GRADE_SCALE_ID,SORT_ORDER) SELECT " . db_seq_nextval('REPORT_CARD_GRADES_SEQ') . ",SYEAR,'{$id}',TITLE,COMMENT,BREAK_OFF,GPA_VALUE,(SELECT ID FROM REPORT_CARD_GRADE_SCALES WHERE ROLLOVER_ID=report_card_grades.GRADE_SCALE_ID AND SCHOOL_ID='{$id}'),SORT_ORDER FROM REPORT_CARD_GRADES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"); break; case 'REPORT_CARD_COMMENTS': DBQuery("INSERT INTO REPORT_CARD_COMMENTS (ID,SYEAR,SCHOOL_ID,TITLE,SORT_ORDER,CATEGORY_ID,COURSE_ID) SELECT " . db_seq_nextval('REPORT_CARD_COMMENTS_SEQ') . ",SYEAR,'{$id}',TITLE,SORT_ORDER,NULL,NULL FROM REPORT_CARD_COMMENTS WHERE COURSE_ID IS NULL AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"); break; case 'ELIGIBILITY_ACTIVITIES': case 'ATTENDANCE_CODES': $table_properties = db_properties($table); $columns = ''; foreach ($table_properties as $column => $values) { if ($column != 'ID' && $column != 'SYEAR' && $column != 'SCHOOL_ID') { $columns .= ',' . $column; } } DBQuery("INSERT INTO {$table} (ID,SYEAR,SCHOOL_ID" . $columns . ") SELECT nextval('" . $table . "_SEQ'),SYEAR,'{$id}' AS SCHOOL_ID" . $columns . " FROM {$table} WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"); break; } }
function GetSchool($sch, $name = 'TITLE') { global $_CENTRE; if (!$_CENTRE['GetSchool']) { $QI = DBQuery("SELECT ID,TITLE,SCHOOL_NUMBER FROM SCHOOLS WHERE SYEAR='" . UserSyear() . "'"); $_CENTRE['GetSchool'] = DBGet($QI, array(), array('ID')); } if ($name == 'TITLE' || $name == 'SCHOOL_ID') { if ($_CENTRE['GetSchool'][$sch]) { return $_CENTRE['GetSchool'][$sch][1]['TITLE']; } else { return $sch; } } else { return $_CENTRE['GetSchool'][$sch][1][$name]; } }
function GetUserSchools($staff_id, $str = false) { if (User('PROFILE_ID') != 4) { $str_return = ''; $schools = DBGet(DBQuery('SELECT SCHOOL_ID FROM staff_school_relationship WHERE staff_id=' . $staff_id . ' AND syear=' . UserSyear())); foreach ($schools as $school) { $return[] = $school['SCHOOL_ID']; $str_return .= $school['SCHOOL_ID'] . ','; } if ($str == true) { return substr($str_return, 0, -1); } else { return $return; } } else { if (User('PROFILE_ID') == 4) { $schools = DBGet(DBQuery('SELECT SCHOOL_ID FROM student_enrollment WHERE STUDENT_ID=' . UserStudentID() . ' AND SYEAR=' . UserSyear() . ' ORDER BY ID DESC LIMIT 0,1')); return $schools[1]['SCHOOL_ID']; } } }
function UpdateAttendanceDaily($student_id, $date = '', $comment = false) { if (!$date) { $date = DBDate(); } //modif Francois: days numbered //modif Francois: multiple school periods for a course period if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<='{$date}' AND end_date>='{$date}' AND mp='QTR') AND school_date<='{$date}') AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t"; } else { $sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('UMTWHFS' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t"; } $RET = DBGet(DBQuery($sql)); $total = $RET[1]['TOTAL']; if ($total == 0) { return; } $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='A'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL']; $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='H'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL'] * 0.5; if ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES')) { $length = '1.0'; } elseif ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES') / 2) { $length = '.5'; } else { $length = '0.0'; } $current_RET = DBGet(DBQuery("SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'")); if (count($current_RET) && $current_RET[1]['MINUTES_PRESENT'] != $total) { DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='{$total}',STATE_VALUE='{$length}'" . ($comment !== false ? ",COMMENT='" . $comment . "'" : '') . " WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) && $comment !== false && $current_RET[1]['COMMENT'] != $comment) { DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='" . $comment . "' WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) == 0) { DBQuery("INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT) values('" . UserSyear() . "','{$student_id}','{$date}','{$total}','{$length}','" . GetCurrentMP('QTR', $date) . "','" . $comment . "')"); } }
function _makePercentGrade($grade_id, $course_period_id = 0, $staff_id = 0) { global $programconfig, $_openSIS; if (!$course_period_id) { $course_period_id = UserCoursePeriod(); } if (!$staff_id) { $staff_id = User('STAFF_ID'); } if (!$programconfig[$staff_id]) { $config_RET = DBGet(DBQuery('SELECT TITLE,VALUE FROM program_user_config WHERE USER_ID=\'' . $staff_id . '\' AND PROGRAM=\'Gradebook\''), array(), array('TITLE')); if (count($config_RET)) { foreach ($config_RET as $title => $value) { $programconfig[$staff_id][$title] = $value[1]['VALUE']; } } else { $programconfig[$staff_id] = true; } } if (!$_openSIS['_makeLetterGrade']['courses'][$course_period_id]) { $_openSIS['_makeLetterGrade']['courses'][$course_period_id] = DBGet(DBQuery('SELECT DOES_BREAKOFF,GRADE_SCALE_ID FROM course_periods WHERE COURSE_PERIOD_ID=\'' . $course_period_id . '\'')); } $does_breakoff = $_openSIS['_makeLetterGrade']['courses'][$course_period_id][1]['DOES_BREAKOFF']; $grade_scale_id = $_openSIS['_makeLetterGrade']['courses'][$course_period_id][1]['GRADE_SCALE_ID']; if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id]) { $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' AND GRADE_SCALE_ID=\'' . $grade_scale_id . '\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER')); } //$grades = array('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-','F'); foreach ($_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) { $prev = $crnt; $crnt = $does_breakoff == 'Y' ? $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] : $grade['BREAK_OFF']; if (is_numeric($grade_id) ? $grade_id == $grade['ID'] : strtoupper($grade_id) == strtoupper($grade['TITLE'])) { return ($crnt + ($crnt > $prev ? 100 : $prev)) / 2; } } return 0; }
} // if(!$weight) // { // $error[] = "No weight was selectd for ".$courses_RET[$course][1]['TITLE']; // continue; // } // if(!$weights_RET[$course][$weight]) // { // $error[] = $courses_RET[$course][1]['TITLE'].' does not have a weight of '.$weight; // unset($courses[$i]); // continue; // } $sql = "INSERT INTO SCHEDULE_REQUESTS (SYEAR,SCHOOL_ID,STUDENT_ID,SUBJECT_ID,COURSE_ID,MARKING_PERIOD_ID,WITH_TEACHER_ID,NOT_TEACHER_ID,WITH_PERIOD_ID,NOT_PERIOD_ID)\r\n\t\t\t\t\t\tvalues('" . UserSyear() . "','" . UserSchool() . "','" . UserStudentID() . "','" . $courses_RET[$course][1]['SUBJECT_ID'] . "','" . $course . "',NULL,'" . $_REQUEST['with_teacher'][$subject][$i] . "','" . $_REQUEST['without_teacher'][$subject][$i] . "','" . $_REQUEST['with_period'][$subject][$i] . "','" . $_REQUEST['without_period'][$subject][$i] . "')"; DBQuery($sql); } } echo ErrorMessage($error, 'Error'); $_SCHEDULER['student_id'] = UserStudentID(); $_SCHEDULER['dont_run'] = true; include 'modules/Scheduling/Scheduler.php'; $_REQUEST['modfunc'] = 'choose'; } if ($_REQUEST['modfunc'] == 'choose') { $functions = array('WITH_PERIOD_ID' => '_makeWithSelects', 'NOT_PERIOD_ID' => '_makeWithoutSelects'); $requests_RET = DBGet(DBQuery("SELECT sr.COURSE_ID,c.COURSE_TITLE,sr.WITH_PERIOD_ID,sr.NOT_PERIOD_ID,sr.WITH_TEACHER_ID,\r\n\t\t\t\t\t\t\t\t\t\tsr.NOT_TEACHER_ID FROM SCHEDULE_REQUESTS sr,COURSES c\r\n\t\t\t\t\t\t\t\t\tWHERE sr.SYEAR='" . UserSyear() . "' AND sr.STUDENT_ID='" . UserStudentID() . "' AND sr.COURSE_ID=c.COURSE_ID"), $functions); echo "<FORM name=vary id=vary action=Modules.php?modname={$_REQUEST['modname']}&modfunc=verify method=POST>"; DrawHeader('', SubmitButton('Save', '', 'class=btn_medium onclick=\'formload_ajax("vary");\'')); $columns = array(''); ListOutput($requests_RET, $columns, 'Request', 'Requests'); echo '<CENTER>' . SubmitButton('Save', '', 'class=btn_medium onclick=\'formload_ajax("vary");\'') . '</CENTER></FORM>'; }
$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')); } } 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());
$qtr = GetAllMP('QTR', GetCurrentMP('QTR', DBDate(), false)); $extra['SELECT'] .= ',coalesce(s.COMMON_NAME,s.FIRST_NAME) AS NICK_NAME'; if (User('PROFILE') == 'admin') { if ($_REQUEST['w_course_period_id_which'] == 'course_period' && $_REQUEST['w_course_period_id']) { if ($_REQUEST['teacher']) { $extra['SELECT'] .= ',(SELECT CONCAT(st.FIRST_NAME,\'' . ' ' . '\',st.LAST_NAME) FROM staff st,course_periods cp WHERE st.STAFF_ID=cp.TEACHER_ID AND cp.COURSE_PERIOD_ID=\'' . $_REQUEST[w_course_period_id] . '\') AS TEACHER'; } if ($_REQUEST['room']) { $extra['SELECT'] .= ',(SELECT cp.ROOM FROM course_periods cp WHERE cp.COURSE_PERIOD_ID=\'' . $_REQUEST[w_course_period_id] . '\') AS ROOM'; } } else { if ($_REQUEST['teacher']) { $extra['SELECT'] .= ',(SELECT CONCAT(st.FIRST_NAME,\'' . ' ' . '\',st.LAST_NAME) FROM staff st,course_periods cp,school_periods p,schedule ss WHERE st.STAFF_ID=cp.TEACHER_ID AND cp.PERIOD_id=p.PERIOD_ID AND p.ATTENDANCE=\'' . 'Y' . '\' AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND ss.STUDENT_ID=s.STUDENT_ID AND ss.SYEAR=\'' . UserSyear() . '\' AND ss.MARKING_PERIOD_ID IN(' . $qtr . ') AND (ss.START_DATE<=\'' . DBDate() . '\' AND (ss.END_DATE>=\'' . DBDate() . '\' OR ss.END_DATE IS NULL)) ORDER BY p.SORT_ORDER LIMIT 1) AS TEACHER'; } if ($_REQUEST['room']) { $extra['SELECT'] .= ',(SELECT cp.ROOM FROM course_periods cp,school_periods p,schedule ss WHERE cp.PERIOD_id=p.PERIOD_ID AND p.ATTENDANCE=\'' . 'Y' . '\' AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND ss.STUDENT_ID=s.STUDENT_ID AND ss.SYEAR=\'' . UserSyear() . '\' AND ss.MARKING_PERIOD_ID IN(' . $qtr . ') AND (ss.START_DATE<=\'' . DBDate() . '\' AND (ss.END_DATE>=\'' . DBDate() . '\' OR ss.END_DATE IS NULL)) ORDER BY p.SORT_ORDER LIMIT 1) AS ROOM'; } } } else { if ($_REQUEST['teacher']) { $extra['SELECT'] .= ',(SELECT CONCAT(st.FIRST_NAME,\'' . ' ' . '\',st.LAST_NAME) FROM staff st,course_periods cp WHERE st.STAFF_ID=cp.TEACHER_ID AND cp.COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\') AS TEACHER'; } if ($_REQUEST['room']) { $extra['SELECT'] .= ',(SELECT cp.ROOM FROM course_periods cp WHERE cp.COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\') AS ROOM'; } } $RET = GetStuList($extra); if (count($RET)) { $skipRET = array(); for ($i = ($_REQUEST['start_row'] - 1) * $max_cols + $_REQUEST['start_col']; $i > 1; $i--) { $skipRET[-$i] = array('LAST_NAME' => ' ');
ListOutputPrint($courses, $columns, '' . _('Course') . '', '' . _('Courses') . '', array(), array(), array('center' => false, 'print' => false)); echo '<div style="page-break-before: always;"> </div><!-- NEW PAGE -->'; } } PDFStop($handle); } else { BackPrompt(_('No Students were found.')); } } else { BackPrompt(_('You must choose at least one student.')); } } if (!$_REQUEST['modfunc']) { DrawBC("" . _('Scheduling') . " >> " . ProgramTitle()); if ($_REQUEST['search_modfunc'] == 'list') { $mp_RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,TITLE,SORT_ORDER,1 AS TBL FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' UNION SELECT MARKING_PERIOD_ID,TITLE,SORT_ORDER,2 AS TBL FROM school_semesters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' UNION SELECT MARKING_PERIOD_ID,TITLE,SORT_ORDER,3 AS TBL FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY TBL,SORT_ORDER')); $mp_select = '<SELECT name=mp_id><OPTION value="">' . _('N/A') . ''; foreach ($mp_RET as $mp) { $mp_select .= '<OPTION value=' . $mp['MARKING_PERIOD_ID'] . '>' . $mp['TITLE']; } $mp_select .= '</SELECT>'; echo "<meta charset='UTF-8'><FORM name=sch id=sch action=for_export.php?modname={$_REQUEST['modname']}&head_html=Student+Schedules+Report&modfunc=save&include_inactive={$_REQUEST['include_inactive']}&_openSIS_PDF=true method=POST target=_blank>"; #$extra['header_right'] = '<INPUT type=submit value=\'Create Schedules for Selected Students\'>'; PopTable_wo_header('header'); $extra['extra_header_left'] = '<TABLE>'; $extra['extra_header_left'] .= '<TR><TD align=right width=120>' . _('Marking Period') . '</TD><TD>' . $mp_select . '</TD></TR>'; $extra['extra_header_left'] .= '<TR><TD align=right width=120>' . _('Include only courses active as of') . '</TD><TD>' . PrepareDate('', '_include_active_date') . '</TD></TR>'; Widgets('mailing_labels', true); $extra['extra_header_left'] .= $extra['search']; $extra['search'] = ''; $extra['extra_header_left'] .= '</TABLE>';
$qr .= ' AND \'' . $st_date . '\' BETWEEN ea.start_date AND ea.end_date'; } else { $st_date = date('Y-m-d'); $qr .= ' AND \'' . $st_date . '\' BETWEEN ea.start_date AND ea.end_date'; } $qr .= ' AND em.SYEAR=ea.SYEAR AND em.ACTIVITY_ID=ea.ID ORDER BY ea.START_DATE'; $RET = DBGet(DBQuery($qr), array('START_DATE' => 'ProperDate', 'END_DATE' => 'ProperDate')); $activities_RET = DBGet(DBQuery('SELECT ID,TITLE FROM eligibility_activities WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\'')); if (count($activities_RET)) { foreach ($activities_RET as $value) { $activities[$value['ID']] = $value['TITLE']; } } $link['remove']['link'] = "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&start_date={$_REQUEST['start_date']}"; $link['remove']['variables'] = array('activity_id' => 'ACTIVITY_ID'); $link['add']['html']['TITLE'] = '<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD>' . SelectInput('', 'new_activity', '', $activities) . ' </TD><TD> <INPUT type=submit value=Add class=btn_medium onclick=\'formload_ajax("elig_stud");\'></TD></TR></TABLE>'; $link['add']['html']['remove'] = button('add'); echo "<FORM action=Modules.php?modname=" . strip_tags(trim($_REQUEST[modname])) . "&modfunc=add&start_date=" . strip_tags(trim($_REQUEST[start_date])) . " method=POST>"; $columns = array('TITLE' => 'Activity', 'START_DATE' => 'Starts', 'END_DATE' => 'Ends'); ListOutput($RET, $columns, 'Activity', 'Activities', $link); echo '</FORM>'; echo '</TD><TD width=50% valign=top>'; $RET = DBGet(DBQuery('SELECT e.ELIGIBILITY_CODE,c.TITLE as COURSE_TITLE FROM eligibility e,courses c,course_periods cp WHERE e.STUDENT_ID=\'' . UserStudentID() . '\' AND e.SYEAR=\'' . UserSyear() . '\' AND e.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cp.COURSE_ID=c.COURSE_ID AND e.SCHOOL_DATE BETWEEN \'' . date('Y-m-d', strtotime($start_date)) . '\' AND \'' . date('Y-m-d', strtotime($end_date)) . '\''), array('ELIGIBILITY_CODE' => '_makeLower')); $columns = array('COURSE_TITLE' => 'Course', 'ELIGIBILITY_CODE' => 'Grade'); ListOutputNew($RET, $columns, 'Course', 'Courses'); echo '</TD></TR></TABLE>'; } function _makeLower($word) { return ucwords(strtolower($word)); }