$RET = DBGet(DBQuery('SELECT e.DROP_CODE as DC,e.SYEAR, s.FIRST_NAME,s.LAST_NAME,s.GENDER, e.ID,e.GRADE_ID,e.ENROLLMENT_CODE,e.START_DATE,e.DROP_CODE,e.END_DATE,e.END_DATE AS END,e.SCHOOL_ID,e.NEXT_SCHOOL,e.CALENDAR_ID FROM student_enrollment e,students s WHERE e.STUDENT_ID=\'' . UserStudentID() . '\' AND e.SYEAR<=\'' . UserSyear() . '\' AND e.SCHOOL_ID=\'' . UserSchool() . '\' AND e.STUDENT_ID=s.STUDENT_ID ORDER BY e.START_DATE'), $functions); if (count($RET)) { $date_counter = $date_counter + 1; foreach ($RET as $in => $value) { if ($value['DROP_CODE'] == '' || !$value['DROP_CODE']) { $not_add = true; } if ($RET[$in]['DC'] != '') { $get_SEC = DBGet(DBQuery('SELECT TYPE FROM student_enrollment_codes WHERE ID=' . $RET[$in]['DC'])); $get_SEC = $get_SEC[1]['TYPE']; } else { $get_SEC = ''; } $RET[$in]['START_DATE'] = $get_SEC == 'TrnD' ? date('M/d/Y', strtotime($RET[$in]['START_DATE'])) : _makeEnrollmentDates('START_DATE', $date_counter, $value); $date_counter = $date_counter + 1; $RET[$in]['END_DATE'] = $get_SEC == 'TrnD' ? date('M/d/Y', strtotime($RET[$in]['END_DATE'])) : _makeEnrollmentDates('END_DATE', $date_counter, $value); $date_counter = $date_counter + 1; } } $columns = array('START_DATE' => 'Start Date ', 'ENROLLMENT_CODE' => 'Enrollment Code', 'END_DATE' => 'Drop Date', 'DROP_CODE' => 'Drop Code', 'SCHOOL_ID' => 'School'); $schools_RET = DBGet(DBQuery('SELECT ID,TITLE FROM schools WHERE ID!=\'' . UserSchool() . '\'')); $next_school_options = array(UserSchool() => 'Next grade at current school', '0' => 'Retain', '-1' => 'Do not enroll after this school year'); if (count($schools_RET)) { foreach ($schools_RET as $school) { $next_school_options[$school['ID']] = $school['TITLE']; } } if (!UserSchool()) { $user_school_RET = DBGet(DBQuery('SELECT SCHOOL_ID FROM student_enrollment WHERE STUDENT_ID=\'' . UserStudentID() . '\' LIMIT 1')); $_SESSION['UserSchool'] = $user_school_RET[1]['SCHOOL_ID']; }
} $date_counter = 1; if ($not_add == false) { $link['add']['html'] = array('START_DATE' => _makeEnrollmentDates('START_DATE', $date_counter), 'ENROLLMENT_CODE' => _makeStartInputCode('', 'ENROLLMENT_CODE'), 'SCHOOL_ID' => _makeSchoolInput('', 'SCHOOL_ID')); } unset($THIS_RET); $RET = DBGet(DBQuery('SELECT e.SYEAR, s.FIRST_NAME,s.LAST_NAME,s.GENDER, e.ID,e.GRADE_ID,e.ENROLLMENT_CODE,e.START_DATE,e.DROP_CODE,e.END_DATE,e.END_DATE AS END,e.SCHOOL_ID,e.NEXT_SCHOOL,e.CALENDAR_ID FROM student_enrollment e,students s WHERE e.STUDENT_ID=\'' . UserStudentID() . '\' AND e.SYEAR<=\'' . UserSyear() . '\' AND e.SCHOOL_ID=\'' . UserSchool() . '\' AND e.STUDENT_ID=s.STUDENT_ID ORDER BY e.START_DATE'), $functions); if (count($RET)) { $date_counter = $date_counter + 1; foreach ($RET as $in => $value) { if ($value['DROP_CODE'] == '' || !$value['DROP_CODE']) { $not_add = true; } $RET[$in]['START_DATE'] = _makeEnrollmentDates('START_DATE', $date_counter, $value); $date_counter = $date_counter + 1; $RET[$in]['END_DATE'] = _makeEnrollmentDates('END_DATE', $date_counter, $value); $date_counter = $date_counter + 1; } } $columns = array('START_DATE' => 'Start Date ', 'ENROLLMENT_CODE' => 'Enrollment Code', 'END_DATE' => 'Drop Date', 'DROP_CODE' => 'Drop Code', 'SCHOOL_ID' => 'School'); $schools_RET = DBGet(DBQuery('SELECT ID,TITLE FROM schools WHERE ID!=\'' . UserSchool() . '\'')); $next_school_options = array(UserSchool() => 'Next grade at current school', '0' => 'Retain', '-1' => 'Do not enroll after this school year'); if (count($schools_RET)) { foreach ($schools_RET as $school) { $next_school_options[$school['ID']] = $school['TITLE']; } } if (!UserSchool()) { $user_school_RET = DBGet(DBQuery('SELECT SCHOOL_ID FROM student_enrollment WHERE STUDENT_ID=\'' . UserStudentID() . '\' LIMIT 1')); $_SESSION['UserSchool'] = $user_school_RET[1]['SCHOOL_ID']; }