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 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 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 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 Config($item) { global $_ROSARIO, $DefaultSyear; if (empty($_ROSARIO['Config']) || !isset($_ROSARIO['Config'][$item])) { $QI = DBQuery("SELECT TITLE, CONFIG_VALUE FROM CONFIG WHERE " . (UserSchool() < 1 ? '' : "SCHOOL_ID='" . UserSchool() . "' OR") . " SCHOOL_ID='0'"); $_ROSARIO['Config'] = DBGet($QI, array(), array('TITLE')); $_ROSARIO['Config']['SYEAR'][1]['CONFIG_VALUE'] = $DefaultSyear; } return $_ROSARIO['Config'][$item][1]['CONFIG_VALUE']; }
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 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 _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 = '<center><font color=#00FF66>' . _('Refunded') . '</font></center>'; } 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 = '<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 _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 DrawLogo() { $logo_ret = DBGet(DBQuery('SELECT VALUE FROM program_config WHERE school_id=\'' . UserSchool() . '\' AND program=\'SchoolLogo\'')); if ($logo_ret && file_exists($logo_ret[1]['VALUE'])) { $logo = $logo_ret[1]['VALUE']; $size = getimagesize($logo); $width = $size[0]; $height = $size[1]; $image = '<img src="' . $logo . '" ' . ($width > 100 && $height > 100 ? $width > $height ? $height > 100 || $width > 100 ? ' width=100' : '' : ($height > 100 || $width > 100 ? ' height=100' : '') : '') . ' alt="Logo" />'; } else { $image = '<img src="assets/logo.png" alt=" " />'; } return $image; }
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 makeGradeInput($value, $name) { global $THIS_RET, $grades; if ($THIS_RET['ID']) { $id = $THIS_RET['ID']; } else { $id = 'new'; } if (!$grades) { $grades_RET = DBGet(DBQuery("SELECT ID,TITLE FROM SCHOOL_GRADELEVELS WHERE SCHOOL_ID='" . UserSchool() . "' ORDER BY SORT_ORDER")); if (count($grades_RET)) { foreach ($grades_RET as $grade) { $grades[$grade['ID']] = $grade['TITLE']; } } } return SelectInput($value, 'values[' . $id . '][' . $name . ']', '', $grades, 'N/A'); }
function dayToNumber($day_time) { $date = date('Y-m-d', $day_time); //check if the day is attendance day $check_day_RET = DBGet(DBQuery("SELECT school_date AS check_day FROM attendance_calendar WHERE school_date='" . $date . "' AND school_id='" . ($school_id = UserSchool()) . "'")); if (empty($check_day_RET)) { return FALSE; } //quarter start date $begin_quarter_RET = DBGet(DBQuery("SELECT start_date FROM school_marking_periods WHERE start_date<='" . $date . "' AND end_date>='" . $date . "' AND mp='QTR' AND school_id='" . $school_id . "'")); if (empty($begin_quarter_RET)) { return FALSE; } $begin_quarter = $begin_quarter_RET[1]['START_DATE']; //number of school days since the beginning of the quarter $school_days_RET = DBGet(DBQuery("SELECT COUNT(school_date) AS school_days FROM attendance_calendar WHERE school_date>='" . $begin_quarter . "' AND school_date<='" . $date . "' AND school_id='" . $school_id . "'")); $school_days = $school_days_RET[1]['SCHOOL_DAYS']; if ($school_days % SchoolInfo('NUMBER_DAYS_ROTATION') == 0) { return SchoolInfo('NUMBER_DAYS_ROTATION'); } return $school_days % SchoolInfo('NUMBER_DAYS_ROTATION'); }
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; }
//$weight = $_REQUEST['course_weights'][$subject][$i]; if (!$course) { continue; } // 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('');
} else { if (clean_param($_REQUEST['page_display'], PARAM_ALPHAMOD) == 'CLASSRANK') { PopTable('header', _('Class Rank')); if ($_REQUEST['modfunc'] == 'update') { if (isset($_REQUEST['display_rank'])) { $rank_RET = DBGet(DBQuery('SELECT VALUE FROM program_config WHERE school_id=\'' . UserSchool() . '\' AND program=\'class_rank\' AND title=\'display\' LIMIT 0, 1')); if (count($rank_RET) == 0) { DBQuery('INSERT INTO program_config (school_id,program,title,value) VALUES(\'' . UserSchool() . '\',\'class_rank\',\'display\',\'Y\')'); } else { DBQuery('UPDATE program_config SET value=\'' . $_REQUEST['display_rank'] . '\' WHERE school_id=\'' . UserSchool() . '\' AND program=\'class_rank\' AND title=\'display\''); } unset($_REQUEST['display_rank']); unset($_SESSION['_REQUEST_vars']['display_rank']); } } $rank_RET = DBGet(DBQuery('SELECT VALUE FROM program_config WHERE school_id=\'' . UserSchool() . '\' AND program=\'class_rank\' AND title=\'display\' LIMIT 0, 1')); $rank = $rank_RET[1]; echo "<FORM name=failure id=failure action=Modules.php?modname={$_REQUEST['modname']}&modfunc=update&page_display=CLASSRANK method=POST>"; echo '<table width="330px;" cellpadding="4">'; echo '<tr><td width="92%" align="center">' . _('Display Class Rank') . '?</td><td align="left">' . CheckboxInput($rank['VALUE'], 'display_rank', '', 'class=cell_floating') . '</td></tr>'; echo '<tr><td colspan="2"></td></tr>'; echo '<tr><td colspan="2"><CENTER>' . SubmitButton(_('Save'), '', 'class=btn_medium') . '</CENTER></td></tr>'; echo '</table>'; echo '</FORM>'; PopTable('footer'); } else { echo ' <style type="text/css"> .time_schedule { background:url(assets/time_schedule.png) no-repeat 0px 0px; padding:10px 0px 10px 45px; text-align:left; margin:14px 280px; } .login_failure { background:url(assets/login_failure.png) no-repeat 0px 0px; padding:10px 0px 10px 45px; text-align:left; margin:14px 280px; } .user_inactivity { background:url(assets/user_inactivity.png) no-repeat 0px 0px; padding:10px 0px 10px 45px; text-align:left; margin:14px 280px; }
$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['modfunc']=='gradebook') if (optional_param('modfunc', '', PARAM_NOTAGS) == 'gradebook') { $config_RET = DBGet(DBQuery('SELECT TITLE,VALUE FROM program_user_config WHERE USER_ID=\'' . User('STAFF_ID') . '\' AND PROGRAM=\'Gradebook\''), array(), array('TITLE')); if (count($config_RET)) { foreach ($config_RET as $title => $value) { $programconfig[User('STAFF_ID')][$title] = $value[1]['VALUE']; } } else { $programconfig[User('STAFF_ID')] = true; } include_once 'functions/_makeLetterGrade.fnc.php'; $course_period_id = UserCoursePeriod(); $course_id = DBGet(DBQuery('SELECT COURSE_ID FROM course_periods WHERE COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\'')); $course_id = $course_id[1]['COURSE_ID']; $grades_RET = DBGet(DBQuery('SELECT ID,TITLE,GPA_VALUE FROM report_card_grades WHERE SCHOOL_ID=\'' . UserSchool() . '\' AND SYEAR=\'' . UserSyear() . '\''), array(), array('ID')); if ($programconfig[User('STAFF_ID')]['WEIGHT'] == 'Y') { $points_RET = DBGet(DBQuery('SELECT DISTINCT s.STUDENT_ID,gt.ASSIGNMENT_TYPE_ID, gt.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, gt.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),gradebook_assignment_types gt WHERE gt.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID AND gt.COURSE_ID=\'' . $course_id . '\' AND ((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,gt.ASSIGNMENT_TYPE_ID,gt.FINAL_GRADE_PERCENT'), array(), array('STUDENT_ID')); } 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) {
} 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' => ' '); } $handle = PDFstart(); $cols = 0; $rows = 0; echo "<meta charset='UTF-8'><table width=100% border=0 style=\" font-family:Arial; font-size:12px;\" >"; echo "<meta charset='UTF-8'><tr><td width=105>" . DrawLogo() . "</td><td style=\"font-size:15px; font-weight:bold; padding-top:20px;\">" . GetSchool(UserSchool()) . "<div style=\"font-size:12px;\">" . _('Student Labels') . "</div></td><td align=right style=\"padding-top:20px;\">" . ProperDate(DBDate()) . "<br \\>" . _('Powered by openSIS') . "</td></tr><tr><td colspan=3 style=\"border-top:1px solid #333;\"> </td></tr></table>"; echo '<table width="100%" border="0" cellspacing="0" cellpadding="0" style=font-family:Arial; font-size:12px;>'; foreach ($skipRET + $RET as $i => $student) { if ($cols < 1) { echo '<tr>'; } echo '<td width="33.3%" height="86" align="center" valign="middle">'; echo '<table border=0 align=center>'; echo '<tr>'; echo '<td align=center>' . $student['NICK_NAME'] . ' ' . $student['LAST_NAME'] . '</td></tr>'; if ($_REQUEST['teacher']) { echo '<tr><td align=center>' . _('Teacher') . ':'; echo '' . $student['TEACHER'] . '</td></tr>'; } if ($_REQUEST['room']) { echo '<tr><td align=center>' . _('Room No :') . '';
echo '</FORM>'; } if ($_REQUEST['day_start'] && $_REQUEST['month_start'] && $_REQUEST['year_start']) { $start_date = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . substr($_REQUEST['year_start'], 2, 4); $org_start_date = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . $_REQUEST['year_start']; $conv_st_date = con_date($org_start_date); } if ($_REQUEST['day_end'] && $_REQUEST['month_end'] && $_REQUEST['year_end']) { $end_date = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . substr($_REQUEST['year_end'], 2, 4); $org_end_date = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . $_REQUEST['year_end']; $conv_end_date = con_date_end($org_end_date); } if ($_REQUEST['modfunc'] == 'generate') { if (isset($conv_st_date) && isset($conv_end_date)) { #$alllogs_RET = DBGet(DBQuery("SELECT DISTINCT FIRST_NAME,LAST_NAME,LOGIN_TIME,PROFILE,FAILLOG_COUNT,FAILLOG_TIME,USER_NAME,IP_ADDRESS,STATUS FROM login_records WHERE LOGIN_TIME >='".$conv_st_date."' AND LOGIN_TIME <='".$conv_end_date."' AND SCHOOL_ID=".UserSchool()." OR STATUS='Failed' ORDER BY LOGIN_TIME DESC")); $alllogs_RET = DBGet(DBQuery('SELECT DISTINCT FIRST_NAME,LAST_NAME,LOGIN_TIME,PROFILE,FAILLOG_COUNT,FAILLOG_TIME,USER_NAME,IP_ADDRESS,STATUS FROM login_records WHERE LOGIN_TIME >=\'' . $conv_st_date . '\' AND LOGIN_TIME <=\'' . $conv_end_date . '\' AND SCHOOL_ID=' . UserSchool() . ' ORDER BY LOGIN_TIME DESC')); if (count($alllogs_RET)) { echo '<div>'; #ListOutput($alllogs_RET,array('LOGIN_TIME'=>'Login Time','USER_NAME'=>'User Name','FIRST_NAME'=>'First Name','LAST_NAME'=>'Last Name','FAILLOG_COUNT'=>'Failure Count','STATUS'=>'Status','IP_ADDRESS'=>'IP Address'),'login record','login records',array(),array(),array('count'=>true,'save'=>true)); ListOutput($alllogs_RET, array('LOGIN_TIME' => 'Login Time', 'USER_NAME' => 'User Name', 'FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'PROFILE' => 'Profile', 'FAILLOG_COUNT' => 'Failure Count', 'STATUS' => 'Status', 'IP_ADDRESS' => 'IP Address'), 'login record', 'login records', array(), array(), array('count' => true, 'save' => true)); echo '</div>'; } else { echo '<table border=0 width=90%><tr><td class="alert"></td><td class="alert_msg"><b>No login records were found.</b></td></tr></table>'; } } if (!isset($conv_st_date) || !isset($conv_end_date)) { echo '<center><font color="red"><b>You have to select date from the date range</b></font></center>'; } } function con_date($date) {
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>';
} echo "<FORM name=elig_stud id=elig_stud action=Modules.php?modname=" . strip_tags(trim($_REQUEST[modname])) . " method=POST>"; DrawHeaderHome('<SELECT name=start_date>' . $date_select . '</SELECT>', '<INPUT type=submit value=Go class=btn_medium onclick=\'formload_ajax("elig_stud");\' >'); echo '</FORM>'; echo '<TABLE border=0 width=100%><TR><TD width=50% valign=top>'; $qr = 'SELECT em.STUDENT_ID,em.ACTIVITY_ID,ea.TITLE,ea.START_DATE,ea.END_DATE FROM eligibility_activities ea,student_eligibility_activities em WHERE em.SYEAR=\'' . UserSyear() . '\''; if ($_REQUEST['start_date']) { $st_date = date('Y-m-d', $_REQUEST['start_date']); $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'));
# You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # #*************************************************************************************** include '../../Redirect_modules.php'; DrawBC("Gradebook > " . ProgramTitle()); if (!$_REQUEST['mp']) { $_REQUEST['mp'] = UserMP(); } $sem = GetParentMP('SEM', UserMP()); echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>"; $mp_select = "<SELECT name=mp onchange='document.forms[0].submit();'><OPTION value=" . UserMP() . ">" . GetMP(UserMP()) . "</OPTION><OPTION value=" . $sem . ($sem == $_REQUEST['mp'] ? ' SELECTED' : '') . ">" . GetMP($sem) . "</OPTION><OPTION value=E" . $sem . ('E' . $sem == $_REQUEST['mp'] ? ' SELECTED' : '') . ">" . GetMP($sem) . ' Exam</OPTION></SELECT>'; DrawHeaderHome($mp_select); echo '</FORM>'; $sql = "SELECT CONCAT(s.LAST_NAME,', ',s.FIRST_NAME) as FULL_NAME,s.STAFF_ID,g.REPORT_CARD_GRADE_ID FROM STUDENT_REPORT_CARD_GRADES g,STAFF s,COURSE_PERIODS cp WHERE g.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cp.TEACHER_ID=s.STAFF_ID AND cp.SYEAR=s.SYEAR AND cp.SYEAR=g.SYEAR AND cp.SYEAR='" . UserSyear() . "' AND g.MARKING_PERIOD_ID='" . $_REQUEST['mp'] . "'"; $grouped_RET = DBGet(DBQuery($sql), array(), array('STAFF_ID', 'REPORT_CARD_GRADE_ID')); $grades_RET = DBGet(DBQuery("SELECT rg.ID,rg.TITLE FROM REPORT_CARD_GRADES rg,REPORT_CARD_GRADE_SCALES rs WHERE rg.SCHOOL_ID='" . UserSchool() . "' AND rg.SYEAR='" . UserSyear() . "' AND rs.ID=rg.GRADE_SCALE_ID ORDER BY rs.SORT_ORDER,rs.ID,rg.BREAK_OFF IS NOT NULL DESC,rg.BREAK_OFF DESC,rg.SORT_ORDER")); if (count($grouped_RET)) { foreach ($grouped_RET as $staff_id => $grades) { $i++; $teachers_RET[$i]['FULL_NAME'] = $grades[key($grades)][1]['FULL_NAME']; foreach ($grades_RET as $grade) { $teachers_RET[$i][$grade['ID']] = count($grades[$grade['ID']]); } } } $columns = array('FULL_NAME' => 'Teacher'); foreach ($grades_RET as $grade) { $columns[$grade['ID']] = $grade['TITLE']; } ListOutput($teachers_RET, $columns, 'Teacher', 'Teachers');
if ($staff['ACCOUNT_ID'] && $staff['BALANCE'] != '') { echo '<TABLE border=0 width=100%>'; echo '<TR><TD width=100% valign=top>'; $RET = DBGet(DBQuery("SELECT fsti.DESCRIPTION,fsti.AMOUNT FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst,FOOD_SERVICE_STAFF_TRANSACTION_ITEMS fsti WHERE fst.STAFF_ID='" . UserStaffID() . "' AND fst.SYEAR='" . UserSyear() . "' AND fst.SHORT_NAME='" . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . "' AND fst.TIMESTAMP BETWEEN CURRENT_DATE AND CURRENT_DATE+1 AND fsti.TRANSACTION_ID=fst.TRANSACTION_ID")); $columns = array('DESCRIPTION' => _('Item'), 'AMOUNT' => _('Amount')); $singular = sprintf(_('Earlier %s Sale'), $menus_RET[$_REQUEST['menu_id']][1]['TITLE']); $plural = sprintf(_('Earlier %s Sales'), $menus_RET[$_REQUEST['menu_id']][1]['TITLE']); ListOutput($RET, $columns, $singular, $plural, $link, false, array('save' => false, 'search' => false)); // IMAGE if ($file = @fopen($picture = $UserPicturesPath . '/' . UserSyear() . '/' . UserStaffID() . '.JPG', 'r') || ($file = @fopen($picture = $UserPicturesPath . '/' . (UserSyear() - 1) . '/' . UserStaffID() . '.JPG', 'r'))) { fclose($file); echo '<TD rowspan=2 width=150 align=left><IMG SRC="' . $picture . '" width=150></TD>'; } echo '</TD></TR>'; echo '<TR><TD width=100% valign=top>'; $items_RET = DBGet(DBQuery("SELECT fsi.SHORT_NAME,fsi.DESCRIPTION,fsi.PRICE_STAFF,fsi.ICON 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.CATEGORY_ID IS NOT NULL AND fsi.SCHOOL_ID='" . UserSchool() . "' ORDER BY fsi.SORT_ORDER"), array('ICON' => 'makeIcon'), array('SHORT_NAME')); $items = array(); foreach ($items_RET as $sn => $item) { $items += array($sn => $item[1]['DESCRIPTION']); } $LO_ret = array(array()); foreach ($_SESSION['FSA_sale'] as $id => $item_sn) { $price = $items_RET[$item_sn][1]['PRICE_STAFF']; $LO_ret[] = array('SALE_ID' => $id, 'PRICE' => $price, 'DESCRIPTION' => $items_RET[$item_sn][1]['DESCRIPTION'], 'ICON' => $items_RET[$item_sn][1]['ICON']); } unset($LO_ret[0]); $link['remove'] = array('link' => "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&menu_id={$_REQUEST['menu_id']}", 'variables' => array('id' => 'SALE_ID')); $link['add']['html'] = array('DESCRIPTION' => '<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD>' . SelectInput('', 'item_sn', '', $items) . '</TD></TR></TABLE>', 'ICON' => '<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD><INPUT type=submit value=' . _('Add') . '></TD></TR></TABLE>', 'remove' => button('add')); $columns = array('DESCRIPTION' => _('Item'), 'ICON' => _('Icon'), 'PRICE' => _('Price')); $tabs = array(); foreach ($menus_RET as $id => $menu) {
function GetChildrenMP($mp, $marking_period_id = '0') { global $_openSIS; switch ($mp) { case 'FY': if (!$_openSIS['GetChildrenMP']['FY']) { $RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,SEMESTER_ID FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''), array(), array('SEMESTER_ID')); foreach ($RET as $sem => $value) { $_openSIS['GetChildrenMP'][$mp]['0'] .= ",'{$sem}'"; foreach ($value as $qtr) { $_openSIS['GetChildrenMP'][$mp]['0'] .= ",'{$qtr['MARKING_PERIOD_ID']}'"; } } $_openSIS['GetChildrenMP'][$mp]['0'] = substr($_openSIS['GetChildrenMP'][$mp]['0'], 1); } return $_openSIS['GetChildrenMP'][$mp]['0']; break; case 'SEM': if (GetMP($marking_period_id, 'TABLE') == 'school_quarters') { $marking_period_id = GetParentMP('SEM', $marking_period_id); } if (!$_openSIS['GetChildrenMP']['SEM']) { $RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,SEMESTER_ID FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''), array(), array('SEMESTER_ID')); foreach ($RET as $sem => $value) { foreach ($value as $qtr) { $_openSIS['GetChildrenMP'][$mp][$sem] .= ",'{$qtr['MARKING_PERIOD_ID']}'"; } $_openSIS['GetChildrenMP'][$mp][$sem] = substr($_openSIS['GetChildrenMP'][$mp][$sem], 1); } } return $_openSIS['GetChildrenMP'][$mp][$marking_period_id]; break; case 'QTR': return "'" . $marking_period_id . "'"; break; case 'PRO': if (!$_openSIS['GetChildrenMP']['PRO']) { $RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,QUARTER_ID FROM school_progress_periods WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''), array(), array('QUARTER_ID')); foreach ($RET as $qtr => $value) { foreach ($value as $pro) { $_openSIS['GetChildrenMP'][$mp][$qtr] .= ",'{$pro['MARKING_PERIOD_ID']}'"; } $_openSIS['GetChildrenMP'][$mp][$qtr] = substr($_openSIS['GetChildrenMP'][$mp][$qtr], 1); } } return $_openSIS['GetChildrenMP'][$mp][$marking_period_id]; break; } }
function BlockDelete($item) { switch ($item) { case 'school': $find_student = DBGet(DBQuery('SELECT COUNT(STUDENT_ID) AS STUDENT_EXIST FROM student_enrollment WHERE SCHOOL_ID=\'' . UserSchool() . '\'')); $find_student = $find_student[1]['STUDENT_EXIST']; $find_staff = DBGet(DBQuery('SELECT COUNT(STAFF_ID) AS STAFF_EXIST FROM staff WHERE CURRENT_SCHOOL_ID=\'' . UserSchool() . '\'')); $find_staff = $find_staff[1]['STAFF_EXIST']; if ($find_student > 0 && $find_staff > 0) { PopTable('header', 'Unable to Delete'); DrawHeaderHome('<font color=red>This School cannot be deleted. There are Students and Teachers in this School</font>'); echo '<div align=right><a href=Modules.php?modname=School_Setup/Schools.php&school_id=' . UserSchool() . ' style="text-decoration:none">back to School Information</a></div>'; PopTable('footer'); return false; } else { return true; } break; case 'subject': $find_student = DBGet(DBQuery('SELECT COUNT(sch.STUDENT_ID) AS STUDENT_EXIST FROM schedule sch,course_periods cp, courses c WHERE c.SUBJECT_ID=\'' . $_REQUEST['subject_id'] . '\'')); $find_student = $find_student[1]['STUDENT_EXIST']; if ($find_student > 0) { PopTable('header', 'Unable to Delete'); DrawHeaderHome('<font color=red>Subject cannot be deleted. There are <font color=green>' . $find_student . '</font> Students Enrolled</font>'); echo '<div align=right><a href=Modules.php?modname=School_Setup/Courses.php&subject_id=' . $_REQUEST['subject_id'] . ' style="text-decoration:none"><b>back to Subject</b></a></div>'; PopTable('footer'); return false; } else { return true; } break; case 'course': $find_student = DBGet(DBQuery('SELECT COUNT(sch.STUDENT_ID) AS STUDENT_EXIST FROM schedule sch,course_periods cp, courses c WHERE sch.COURSE_ID=\'' . $_REQUEST['course_id'] . '\' AND sch.COURSE_ID=c.COURSE_ID AND c.SUBJECT_ID=\'' . $_REQUEST['subject_id'] . '\'')); $find_student = $find_student[1]['STUDENT_EXIST']; if ($find_student > 0) { PopTable('header', 'Unable to Delete'); DrawHeaderHome('<font color=red>Course cannot be deleted. There are <font color=green>' . $find_student . '</font> Students Enrolled</font>'); echo '<div align=right><a href=Modules.php?modname=School_Setup/Courses.php&subject_id=' . $_REQUEST['subject_id'] . '&course_id=' . $_REQUEST['course_id'] . ' style="text-decoration:none"><b>back to Course</b></a></div>'; PopTable('footer'); return false; } else { return true; } break; case 'course period': $find_student = DBGet(DBQuery('SELECT COUNT(sch.STUDENT_ID) AS STUDENT_EXIST FROM schedule sch,course_periods cp, courses c WHERE sch.COURSE_ID=\'' . $_REQUEST['course_id'] . '\' AND sch.COURSE_ID=c.COURSE_ID AND sch.COURSE_PERIOD_ID=\'' . $_REQUEST['course_period_id'] . '\' AND sch.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND c.SUBJECT_ID=\'' . $_REQUEST['subject_id'] . '\'')); $find_student = $find_student[1]['STUDENT_EXIST']; if ($find_student > 0) { PopTable('header', 'Unable to Delete'); DrawHeaderHome('<font color=red>Period cannot be deleted. There are <font color=green>' . $find_student . '</font> Students Enrolled</font>'); echo '<div align=right><a href=Modules.php?modname=School_Setup/Courses.php&subject_id=' . $_REQUEST['subject_id'] . '&course_id=' . $_REQUEST['course_id'] . '&course_period_id=' . $_REQUEST['course_period_id'] . ' style="text-decoration:none"><b>back to Period</b></a></div>'; PopTable('footer'); return false; } else { return true; } break; case 'calendar': case 'marking_period': case 'grade_level': } }
PopTable_wo_header('header'); echo '<TABLE><TR><TD>Course to Add</TD><TD><DIV id=course_div>'; if ($_SESSION['MassSchedule.php']) { $course_title = DBGet(DBQuery("SELECT TITLE FROM COURSES WHERE COURSE_ID='" . $_SESSION['MassSchedule.php']['course_id'] . "'")); $course_title = $course_title[1]['TITLE']; $period_title = DBGet(DBQuery("SELECT TITLE FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $_SESSION['MassSchedule.php']['course_period_id'] . "'")); $period_title = $period_title[1]['TITLE']; echo "{$course_title} - {$_REQUEST['course_weight']}<BR>{$period_title}"; } echo '</DIV>' . "<A HREF=# onclick='window.open(\"for_window.php?modname={$_REQUEST['modname']}&modfunc=choose_course\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'>Choose a Course</A></TD></TR>"; echo '<TR><TD>Start Date</TD><TD>' . PrepareDate(DBDate(), '') . '</TD></TR>'; echo '<TR><TD>Marking Period</TD><TD>'; //echo '<SELECT name=marking_period_id><OPTION value=0>Full Year</OPTION>'; $years_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE,NULL AS SEMESTER_ID FROM SCHOOL_YEARS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'")); $semesters_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE,NULL AS SEMESTER_ID FROM SCHOOL_SEMESTERS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY SORT_ORDER")); $quarters_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE,SEMESTER_ID FROM SCHOOL_QUARTERS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY SORT_ORDER")); echo '<SELECT name=marking_period_id><OPTION value=' . $years_RET[1]['MARKING_PERIOD_ID'] . '>' . $years_RET[1]['TITLE'] . '</OPTION>'; foreach ($semesters_RET as $mp) { echo "<OPTION value={$mp['MARKING_PERIOD_ID']}>" . $mp['TITLE'] . '</OPTION>'; } foreach ($quarters_RET as $mp) { echo "<OPTION value={$mp['MARKING_PERIOD_ID']}>" . $mp['TITLE'] . '</OPTION>'; } echo '</SELECT>'; echo '</TD></TR>'; echo '</TABLE>'; PopTable('footer'); } if ($note) { DrawHeader('<IMG SRC=assets/check.gif>' . $note); }