function appendSQL($sql, $extra = array()) { global $_ROSARIO; if ($_REQUEST['stuid']) { //modif Francois: allow comma separated list of student IDs $stuid_array = explode(',', $_REQUEST['stuid']); $stuids = array(); foreach ($stuid_array as $stuid) { if (is_numeric($stuid)) { $stuids[] = $stuid; } } if (!empty($stuids)) { $stuids = implode(',', $stuids); //$sql .= " AND ssm.STUDENT_ID IN '".$_REQUEST['stuid']."'"; $sql .= " AND ssm.STUDENT_ID IN (" . $stuids . ")"; if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . Localize('colon', _('RosarioSIS ID')) . ' </b></span>' . $stuids . '<BR />'; } } } if ($_REQUEST['last']) { $sql .= " AND LOWER(s.LAST_NAME) LIKE '" . mb_strtolower($_REQUEST['last']) . "%'"; if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . Localize('colon', _('Last Name starts with')) . ' </b></span>' . str_replace("''", "'", $_REQUEST['last']) . '<BR />'; } } if ($_REQUEST['first']) { $sql .= " AND LOWER(s.FIRST_NAME) LIKE '" . mb_strtolower($_REQUEST['first']) . "%'"; if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . Localize('colon', _('First Name starts with')) . ' </b></span>' . str_replace("''", "'", $_REQUEST['first']) . '<BR />'; } } if ($_REQUEST['grade']) { $sql .= " AND ssm.GRADE_ID = '{$_REQUEST['grade']}'"; if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . Localize('colon', _('Grade Level')) . ' </b></span>' . GetGrade($_REQUEST['grade']) . '<BR />'; } } if (count($_REQUEST['grades'])) { if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . Localize('colon', ngettext('Grade', 'Grades', sizeof($_REQUEST['grades']))) . ' </b></span>' . ($_REQUEST['grades_not'] == 'Y' ? _('Excluded') . ' ' : ''); } $list = $sep = ''; foreach ($_REQUEST['grades'] as $id => $y) { $list .= "{$sep}'{$id}'"; if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= $sep . GetGrade($id); } $sep = ','; } if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= '<BR />'; } $sql .= " AND ssm.GRADE_ID " . ($_REQUEST['grades_not'] == 'Y' ? 'NOT ' : '') . " IN ({$list})"; } if ($_REQUEST['addr']) { $sql .= " AND (LOWER(a.ADDRESS) LIKE '%" . mb_strtolower($_REQUEST['addr']) . "%' OR LOWER(a.CITY) LIKE '" . mb_strtolower($_REQUEST['addr']) . "%' OR LOWER(a.STATE)='" . mb_strtolower($_REQUEST['addr']) . "' OR ZIPCODE LIKE '" . $_REQUEST['addr'] . "%')"; if (!$extra['NoSearchTerms']) { $_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . Localize('colon', _('Address contains')) . ' </b></span>' . str_replace("''", "'", $_REQUEST['addr']) . '<BR />'; } } return $sql; }
function _make($value, $column) { global $THIS_RET, $student_days_absent, $cal_days, $sum, $calendars_RET; switch ($column) { case 'STUDENTS': $sum['STUDENTS'] += $value; return $value; break; case 'DAYS_POSSIBLE': return $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT']; break; case 'PRESENT': $sum['PRESENT'] += $THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']; return $THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']; break; case 'ABSENT': $sum['ABSENT'] += $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']; return $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']; break; case 'ADA': return Percent(($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']) / $THIS_RET['STUDENTS']); break; case 'AVERAGE_ATTENDANCE': $sum['AVERAGE_ATTENDANCE'] += ($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']) / $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT']; return round(($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']) / $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT'], 1); break; case 'AVERAGE_ABSENT': $sum['AVERAGE_ABSENT'] += $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE'] / $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT']; return round($student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE'] / $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT'], 1); break; case 'GRADE_ID': return GetGrade($value) . (count($cal_days) > 1 ? ' - ' . $calendars_RET[$THIS_RET['CALENDAR_ID']][1]['TITLE'] : ''); } }
function _make($value, $column) { global $THIS_RET, $student_days_absent, $student_not_taken, $cal_days, $sum, $calendars_RET, $student_days_present, $attpossible; switch ($column) { case 'STUDENTS': $sum['STUDENTS'] += $value; return $value; break; case 'DAYS_POSSIBLE': return $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT']; break; case 'TOTAL_ATTENDANCE': $dayespossible = $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT']; $students = $value; $total_attn = $dayespossible * $students; $sum['TOTAL_ATTENDANCE'] += $total_attn; return $total_attn; break; case 'PRESENT': $present_by_gread = 0; $present_by_gread = $student_days_present[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['PRESENT_BY_GREAD']; $sum['PRESENT'] += $present_by_gread; return $present_by_gread; break; case 'ABSENT': $absent = 0; $absent = $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE']; $absent = round($absent); $sum['ABSENT'] += $absent; return $absent; break; case 'NOT_TAKEN': $not_taken = 0; $not_taken = $student_not_taken[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['NOT_TAKEN']; $not_taken = round($not_taken); $sum['NOT_TAKEN'] += $not_taken; return $not_taken; break; case 'ATTENDANCE_POSSIBLE': $attpossible = $value; $sum['ATTENDANCE_POSSIBLE'] += $attpossible; return $attpossible; break; case 'ADA': $present_by_gread = $student_days_present[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['PRESENT_BY_GREAD']; $ada = round($present_by_gread * 100 / $attpossible, 2) . '%'; return $ada; break; case 'AVERAGE_ATTENDANCE': $present_by_gread = 0; $present_by_gread = $student_days_present[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['PRESENT_BY_GREAD']; $present = $present_by_gread; $dayespossible = $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT']; $avg_attn = $present / $dayespossible; $sum['AVERAGE_ATTENDANCE'] += $avg_attn; return $avg_attn = round($avg_attn, 1); break; case 'AVERAGE_ABSENT': $sum['AVERAGE_ABSENT'] += $student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE'] / $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT']; return round($student_days_absent[$THIS_RET['GRADE_ID']][$THIS_RET['CALENDAR_ID']][1]['STATE_VALUE'] / $cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT'], 1); break; case 'GRADE_ID': return GetGrade($value) . (count($cal_days) > 1 ? ' - ' . $calendars_RET[$THIS_RET['CALENDAR_ID']][1]['TITLE'] : ''); break; } }
function appendSQL_Absence_Summary($sql, &$extra) { global $_openSIS; if ($_REQUEST['stuid']) { $sql .= ' AND ssm.STUDENT_ID = \'' . str_replace("'", "\\'", $_REQUEST[stuid]) . '\' '; $_SESSION['newsql1'] .= ' AND ssm.STUDENT_ID = \'' . str_replace("'", "\\'", $_REQUEST[stuid]) . '\' '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Student ID: </b></font>' . $_REQUEST['stuid'] . '<BR>'; } } if ($_REQUEST['altid']) { //$sql .= " AND s.ALT_ID = '$_REQUEST[altid]' "; $sql .= ' AND LOWER(s.ALT_ID) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['altid']))) . '%\' '; $_SESSION['newsql1'] .= ' AND LOWER(s.ALT_ID) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['altid']))) . '%\' '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Student ID: </b></font>' . $_REQUEST['stuid'] . '<BR>'; } } if ($_REQUEST['last']) { $sql .= ' AND LOWER(s.LAST_NAME) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['last']))) . '%\' '; $_SESSION['newsql1'] .= ' AND LOWER(s.LAST_NAME) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['last']))) . '%\' '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Last Name starts with: </b></font>' . trim($_REQUEST['last']) . '<BR>'; } } if ($_REQUEST['first']) { $sql .= ' AND LOWER(s.FIRST_NAME) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['first']))) . '%\' '; $_SESSION['newsql1'] .= ' AND LOWER(s.FIRST_NAME) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['first']))) . '%\' '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>First Name starts with: </b></font>' . trim($_REQUEST['first']) . '<BR>'; } } if ($_REQUEST['grade']) { $sql .= ' AND ssm.GRADE_ID = \'' . str_replace("'", "\\'", $_REQUEST[grade]) . '\' '; $_SESSION['newsql1'] .= ' AND ssm.GRADE_ID = \'' . str_replace("'", "\\'", $_REQUEST[grade]) . '\' '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Grade: </b></font>' . GetGrade($_REQUEST['grade']) . '<BR>'; } } if ($_REQUEST['addr']) { $sql .= ' AND (LOWER(a.ADDRESS) LIKE \'%' . str_replace("'", "\\'", strtolower(trim($_REQUEST['addr']))) . '%\' OR LOWER(a.CITY) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['addr']))) . '%\' OR LOWER(a.STATE)=\'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['addr']))) . '\' OR ZIPCODE LIKE \'' . trim(str_replace("'", "\\'", $_REQUEST['addr'])) . '%\')'; $_SESSION['newsql1'] .= ' AND (LOWER(a.ADDRESS) LIKE \'%' . str_replace("'", "\\'", strtolower(trim($_REQUEST['addr']))) . '%\' OR LOWER(a.CITY) LIKE \'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['addr']))) . '%\' OR LOWER(a.STATE)=\'' . str_replace("'", "\\'", strtolower(trim($_REQUEST['addr']))) . '\' OR ZIPCODE LIKE \'' . trim(str_replace("'", "\\'", $_REQUEST['addr'])) . '%\')'; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Address contains: </b></font>' . trim($_REQUEST['addr']) . '<BR>'; } } if ($_REQUEST['preferred_hospital']) { $sql .= ' AND LOWER(s.PREFERRED_HOSPITAL) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['preferred_hospital'])) . '%\' '; $_SESSION['newsql1'] .= ' AND LOWER(s.PREFERRED_HOSPITAL) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['preferred_hospital'])) . '%\' '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Preferred Medical Facility starts with: </b></font>' . $_REQUEST['preferred_hospital'] . '<BR>'; } } if ($_REQUEST['mp_comment']) { $sql .= ' AND LOWER(smc.COMMENT) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['mp_comment'])) . '%\' AND s.STUDENT_ID=smc.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(smc.COMMENT) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['mp_comment'])) . '%\' AND s.STUDENT_ID=smc.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Comments starts with: </b></font>' . $_REQUEST['mp_comment'] . '<BR>'; } } if ($_REQUEST['goal_title']) { $sql .= ' AND LOWER(g.GOAL_TITLE) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['goal_title'])) . '%\' AND s.STUDENT_ID=g.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(g.GOAL_TITLE) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['goal_title'])) . '%\' AND s.STUDENT_ID=g.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Goal Title starts with: </b></font>' . $_REQUEST['goal_title'] . '<BR>'; } } if ($_REQUEST['goal_description']) { $sql .= ' AND LOWER(g.GOAL_DESCRIPTION) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['goal_description'])) . '%\' AND s.STUDENT_ID=g.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(g.GOAL_DESCRIPTION) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['goal_description'])) . '%\' AND s.STUDENT_ID=g.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Goal Description starts with: </b></font>' . $_REQUEST['goal_description'] . '<BR>'; } } if ($_REQUEST['progress_name']) { $sql .= ' AND LOWER(p.PROGRESS_NAME) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['progress_name'])) . '%\' AND s.STUDENT_ID=p.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(p.PROGRESS_NAME) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['progress_name'])) . '%\' AND s.STUDENT_ID=p.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Progress Period Name starts with: </b></font>' . $_REQUEST['progress_name'] . '<BR>'; } } if ($_REQUEST['progress_description']) { $sql .= ' AND LOWER(p.PROGRESS_DESCRIPTION) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['progress_description'])) . '%\' AND s.STUDENT_ID=p.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(p.PROGRESS_DESCRIPTION) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['progress_description'])) . '%\' AND s.STUDENT_ID=p.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Progress Assessment starts with: </b></font>' . $_REQUEST['progress_description'] . '<BR>'; } } if ($_REQUEST['doctors_note_comments']) { $sql .= ' AND LOWER(smn.DOCTORS_NOTE_COMMENTS) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['doctors_note_comments'])) . '%\' AND s.STUDENT_ID=smn.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(smn.DOCTORS_NOTE_COMMENTS) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['doctors_note_comments'])) . '%\' AND s.STUDENT_ID=smn.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Doctor\'s Note starts with: </b></font>' . $_REQUEST['doctors_note_comments'] . '<BR>'; } } if ($_REQUEST['type']) { $sql .= ' AND LOWER(sm.TYPE) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['type'])) . '%\' AND s.STUDENT_ID=sm.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(sm.TYPE) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['type'])) . '%\' AND s.STUDENT_ID=sm.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Type starts with: </b></font>' . $_REQUEST['type'] . '<BR>'; } } if ($_REQUEST['imm_comments']) { $sql .= ' AND LOWER(sm.COMMENTS) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['imm_comments'])) . '%\' AND s.STUDENT_ID=sm.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(sm.COMMENTS) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['imm_comments'])) . '%\' AND s.STUDENT_ID=sm.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Comments starts with: </b></font>' . $_REQUEST['imm_comments'] . '<BR>'; } } if ($_REQUEST['imm_day'] && $_REQUEST['imm_month'] && $_REQUEST['imm_year']) { $imm_date = $_REQUEST['imm_year'] . '-' . $_REQUEST['imm_month'] . '-' . $_REQUEST['imm_day']; $sql .= ' AND sm.MEDICAL_DATE =\'' . date('Y-m-d', strtotime($imm_date)) . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND sm.MEDICAL_DATE =\'' . date('Y-m-d', strtotime($imm_date)) . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Immunization Date: </b></font>' . $imm_date . '<BR>'; } } elseif ($_REQUEST['imm_day'] || $_REQUEST['imm_month'] || $_REQUEST['imm_year']) { if ($_REQUEST['imm_day']) { $sql .= ' AND SUBSTR(sm.MEDICAL_DATE,9,2) =\'' . $_REQUEST['imm_day'] . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(sm.MEDICAL_DATE,9,2) =\'' . $_REQUEST['imm_day'] . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; $imm_date .= " Day :" . $_REQUEST['imm_day']; } if ($_REQUEST['imm_month']) { $sql .= ' AND SUBSTR(sm.MEDICAL_DATE,6,2) =\'' . $_REQUEST['imm_month'] . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(sm.MEDICAL_DATE,6,2) =\'' . $_REQUEST['imm_month'] . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; $imm_date .= " Month :" . $_REQUEST['imm_month']; } if ($_REQUEST['imm_year']) { $sql .= ' AND SUBSTR(sm.MEDICAL_DATE,1,4) =\'' . $_REQUEST['imm_year'] . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(sm.MEDICAL_DATE,1,4) =\'' . $_REQUEST['imm_year'] . '\' AND s.STUDENT_ID=sm.STUDENT_ID '; $imm_date .= " Year :" . $_REQUEST['imm_year']; } if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Immunization Date: </b></font>' . $imm_date . '<BR>'; } } if ($_REQUEST['med_day'] && $_REQUEST['med_month'] && $_REQUEST['med_year']) { $med_date = $_REQUEST['med_year'] . '-' . $_REQUEST['med_month'] . '-' . $_REQUEST['med_day']; $sql .= ' AND smn.DOCTORS_NOTE_DATE =\'' . date('Y-m-d', strtotime($med_date)) . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND smn.DOCTORS_NOTE_DATE =\'' . date('Y-m-d', strtotime($med_date)) . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Medical Date: </b></font>' . $med_date . '<BR>'; } } elseif ($_REQUEST['med_day'] || $_REQUEST['med_month'] || $_REQUEST['med_year']) { if ($_REQUEST['med_day']) { $sql .= ' AND SUBSTR(smn.DOCTORS_NOTE_DATE,9,2) =\'' . $_REQUEST['med_day'] . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(smn.DOCTORS_NOTE_DATE,9,2) =\'' . $_REQUEST['med_day'] . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; $med_date .= " Day :" . $_REQUEST['med_day']; } if ($_REQUEST['med_month']) { $sql .= ' AND SUBSTR(smn.DOCTORS_NOTE_DATE,6,2) =\'' . $_REQUEST['med_month'] . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(smn.DOCTORS_NOTE_DATE,6,2) =\'' . $_REQUEST['med_month'] . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; $med_date .= " Month :" . $_REQUEST['med_month']; } if ($_REQUEST['med_year']) { $sql .= ' AND SUBSTR(smn.DOCTORS_NOTE_DATE,1,4) =\'' . $_REQUEST['med_year'] . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(smn.DOCTORS_NOTE_DATE,1,4) =\'' . $_REQUEST['med_year'] . '\' AND s.STUDENT_ID=smn.STUDENT_ID '; $med_date .= " Year :" . $_REQUEST['med_year']; } if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Medical Date: </b></font>' . $med_date . '<BR>'; } } if ($_REQUEST['ma_day'] && $_REQUEST['ma_month'] && $_REQUEST['ma_year']) { $ma_date = $_REQUEST['ma_year'] . '-' . $_REQUEST['ma_month'] . '-' . $_REQUEST['ma_day']; $sql .= ' AND sma.ALERT_DATE =\'' . date('Y-m-d', strtotime($ma_date)) . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND sma.ALERT_DATE =\'' . date('Y-m-d', strtotime($ma_date)) . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Medical Alert Date: </b></font>' . $ma_date . '<BR>'; } } elseif ($_REQUEST['ma_day'] || $_REQUEST['ma_month'] || $_REQUEST['ma_year']) { if ($_REQUEST['ma_day']) { $sql .= ' AND SUBSTR(sma.ALERT_DATE,9,2) =\'' . $_REQUEST['ma_day'] . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(sma.ALERT_DATE,9,2) =\'' . $_REQUEST['ma_day'] . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; $ma_date .= " Day :" . $_REQUEST['ma_day']; } if ($_REQUEST['ma_month']) { $sql .= ' AND SUBSTR(sma.ALERT_DATE,6,2) =\'' . $_REQUEST['ma_month'] . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(sma.ALERT_DATE,6,2) =\'' . $_REQUEST['ma_month'] . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; $ma_date .= " Month :" . $_REQUEST['ma_month']; } if ($_REQUEST['ma_year']) { $sql .= ' AND SUBSTR(sma.ALERT_DATE,1,4) =\'' . $_REQUEST['ma_year'] . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(sma.ALERT_DATE,1,4) =\'' . $_REQUEST['ma_year'] . '\' AND s.STUDENT_ID=sma.STUDENT_ID '; $ma_date .= " Year :" . $_REQUEST['ma_year']; } if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Medical Alert Date: </b></font>' . $ma_date . '<BR>'; } } if ($_REQUEST['nv_day'] && $_REQUEST['nv_month'] && $_REQUEST['nv_year']) { $nv_date = $_REQUEST['nv_year'] . '-' . $_REQUEST['nv_month'] . '-' . $_REQUEST['nv_day']; $sql .= ' AND smv.SCHOOL_DATE =\'' . date('Y-m-d', strtotime($nv_date)) . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND smv.SCHOOL_DATE =\'' . date('Y-m-d', strtotime($nv_date)) . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Nurse Visit Date: </b></font>' . $nv_date . '<BR>'; } } elseif ($_REQUEST['nv_day'] || $_REQUEST['nv_month'] || $_REQUEST['nv_year']) { if ($_REQUEST['nv_day']) { $sql .= ' AND SUBSTR(smv.SCHOOL_DATE,9,2) =\'' . $_REQUEST['nv_day'] . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(smv.SCHOOL_DATE,9,2) =\'' . $_REQUEST['nv_day'] . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; $nv_date .= " Day :" . $_REQUEST['nv_day']; } if ($_REQUEST['nv_month']) { $sql .= ' AND SUBSTR(smv.SCHOOL_DATE,6,2) =\'' . $_REQUEST['nv_month'] . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(smv.SCHOOL_DATE,6,2) =\'' . $_REQUEST['nv_month'] . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; $nv_date .= " Month :" . $_REQUEST['nv_month']; } if ($_REQUEST['nv_year']) { $sql .= ' AND SUBSTR(smv.SCHOOL_DATE,1,4) =\'' . $_REQUEST['nv_year'] . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND SUBSTR(smv.SCHOOL_DATE,1,4) =\'' . $_REQUEST['nv_year'] . '\' AND s.STUDENT_ID=smv.STUDENT_ID '; $nv_date .= " Year :" . $_REQUEST['nv_year']; } if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Nurse Visit Date: </b></font>' . $nv_date . '<BR>'; } } if ($_REQUEST['med_alrt_title']) { $sql .= ' AND LOWER(sma.TITLE) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['med_alrt_title'])) . '%\' AND s.STUDENT_ID=sma.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(sma.TITLE) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['med_alrt_title'])) . '%\' AND s.STUDENT_ID=sma.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Alert starts with: </b></font>' . $_REQUEST['med_alrt_title'] . '<BR>'; } } if ($_REQUEST['reason']) { $sql .= ' AND LOWER(smv.REASON) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['reason'])) . '%\' AND s.STUDENT_ID=smv.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Reason starts with: </b></font>' . $_REQUEST['reason'] . '<BR>'; } } if ($_REQUEST['result']) { $sql .= ' AND LOWER(smv.RESULT) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['result'])) . '%\' AND s.STUDENT_ID=smv.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(smv.RESULT) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['result'])) . '%\' AND s.STUDENT_ID=smv.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Result starts with: </b></font>' . $_REQUEST['result'] . '<BR>'; } } if ($_REQUEST['med_vist_comments']) { $sql .= ' AND LOWER(smv.COMMENTS) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['med_vist_comments'])) . '%\' AND s.STUDENT_ID=smv.STUDENT_ID '; $_SESSION['newsql1'] .= ' AND LOWER(smv.COMMENTS) LIKE \'' . str_replace("'", "\\'", strtolower($_REQUEST['med_vist_comments'])) . '%\' AND s.STUDENT_ID=smv.STUDENT_ID '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Nurse Visit Comments starts with: </b></font>' . $_REQUEST['med_vist_comments'] . '<BR>'; } } if ($_REQUEST['day_to_birthdate'] && $_REQUEST['month_to_birthdate'] && $_REQUEST['day_from_birthdate'] && $_REQUEST['month_from_birthdate']) { $date_to = $_REQUEST['month_to_birthdate'] . '-' . $_REQUEST['day_to_birthdate']; $date_from = $_REQUEST['month_from_birthdate'] . '-' . $_REQUEST['day_from_birthdate']; $sql .= ' AND (SUBSTR(s.BIRTHDATE,6,2) BETWEEN ' . $_REQUEST['month_from_birthdate'] . ' AND ' . $_REQUEST['month_to_birthdate'] . ') '; $sql .= ' AND (SUBSTR(s.BIRTHDATE,9,2) BETWEEN ' . $_REQUEST['day_from_birthdate'] . ' AND ' . $_REQUEST['day_to_birthdate'] . ') '; $_SESSION['newsql1'] .= ' AND (SUBSTR(s.BIRTHDATE,6,2) BETWEEN ' . $_REQUEST['month_from_birthdate'] . ' AND ' . $_REQUEST['month_to_birthdate'] . ') '; $_SESSION['newsql1'] .= ' AND (SUBSTR(s.BIRTHDATE,9,2) BETWEEN ' . $_REQUEST['day_from_birthdate'] . ' AND ' . $_REQUEST['day_to_birthdate'] . ') '; if (!$extra['NoSearchTerms']) { $_openSIS['SearchTerms'] .= '<font color=gray><b>Birthday Starts from ' . $date_from . ' to ' . $date_to . '</b></font>'; } } // test cases start // test cases end if ($_SESSION['stu_search']['sql'] && $_REQUEST['return_session']) { if (($_REQUEST['absence_go'] || $_REQUEST['chk']) && (User('PROFILE') == 'teacher' || User('PROFILE') == 'admin') && $_REQUEST['return_session']) { $new_sql = $_SESSION['new_sql'] . $_SESSION['newsql1']; unset($_SESSION['inactive_stu_filter']); return $new_sql; } else { unset($_SESSION['inactive_stu_filter']); return $_SESSION['stu_search']['sql']; } } else { if ($_REQUEST['sql_save_session'] && !$_SESSION['stu_search']['search_from_grade']) { $_SESSION['stu_search']['sql'] = $sql; } else { if ($_SESSION['stu_search']['search_from_grade']) { unset($_SESSION['stu_search']['search_from_grade']); } } return $sql; } }
/** * Make Screens * * Local function * * @see _makeURL() * * @static $fields_RET * * @param string $equation Equation * * @return string Equation */ function _makeScreens($equation) { static $fields_RET; $equation = mb_strtolower(stripslashes($equation)); $screen_count = 0; while ($pos = mb_strpos($equation, '<b>)</b>')) { $screen_count++; if (isset($_REQUEST['screen'][$screen_count])) { $screen = $_REQUEST['screen'][$screen_count]; } else { $screen = false; } $extra = ''; // Grade Level. if (isset($screen['grade'])) { $extra .= _('Grade Level') . ': ' . GetGrade($screen['grade']) . '; '; } // All Schools. if (isset($screen['_search_all_schools'])) { $extra .= _('All Schools') . '; '; } // Student ID. if (isset($screen['stuid'])) { $extra .= _('Student ID') . ': ' . $screen['stuid'] . '; '; } // Last name (starts with, case insensitive). if (isset($screen['last'])) { $extra .= _('Last Name starts with') . ': ' . $screen['last'] . '; '; } // First name (starts with, case insensitive). if (isset($screen['first'])) { $extra .= _('First Name starts with') . ': ' . $screen['first'] . '; '; } // Date. if (isset($screen['month_start']) && isset($screen['month_end'])) { $extra .= '<i class="size-1">' . _('Between') . ProperDate($screen['day_start'] . '-' . $screen['month_start'] . '-' . $screen['year_start'], 'short') . ' & ' . ProperDate($screen['day_end'] . '-' . $screen['month_end'] . '-' . $screen['year_end'], 'short') . '</i>; '; } else { // Test No. /*if ( isset( $screen[ $screen_count ]['test_no'] ) && in_array( '0', $screen[ $screen_count ]['test_no'] ) ) { $extra .= '<i class="size-1">' . _( 'Final Test' ) . '</i>; '; } elseif ( isset( $screen[ $screen_count ]['test_no'] ) ) { foreach ( (array)$screen[ $screen_count ]['test_no'] as $test_no ) { $extra .= '<span class="size-1"><i>' . _( 'Test No.' ) . '</i>: ' . $test_no . '</span>; '; } }*/ // Custom if (isset($screen['cust'])) { if (!$fields_RET) { $fields_RET = DBGet(DBQuery("SELECT ID,TITLE\n\t\t\t\t\tFROM CUSTOM_FIELDS\n\t\t\t\t\tWHERE TYPE='select'\n\t\t\t\t\tORDER BY TITLE")); } //foreach ($_REQUEST['screen'][$screen_count]['cust'] as $field=>$value) foreach ((array) $fields_RET as $field) { if (isset($screen['cust']['CUSTOM_' . $field['ID']])) { $extra .= $field['TITLE'] . ': ' . $screen['cust']['CUSTOM_' . $field['ID']] . '; '; } } } } if (!empty($extra)) { $extra = mb_substr($extra, 0, -2); } $equation = mb_substr($equation, 0, $pos) . $extra . ' <strong>)</strong>' . mb_substr($equation, $pos + 8); } return $equation; }
$_REQUEST['syear'] = $defined[SYEAR]; $_REQUEST['title'] = $defined[TITLE]; $_REQUEST['account_id'] = $defined[ACCOUNT_ID]; $_REQUEST['amount'] = $defined[AMOUNT]; $_REQUEST['date'] = $defined[DUE_DATE]; } $sql = "INSERT INTO STU_BILLING_FEES \n\t\t\t\t\t(ID,GLOBAL_ID,ACCOUNT_ID,STUDENT_ID,TITLE,AMOUNT,EFFECTIVE_DATE,DUE_DATE,SYEAR,SCHOOL,GRADE) \n\t\t\t\t\t(SELECT " . db_seq_nextval('STU_BILLING_FEES_SEQ') . "," . $global_id[1][GLOBAL_ID] . ",'" . $_REQUEST['account_id'] . "',ssm.STUDENT_ID,\n\t\t\t\t\t\t'" . $_REQUEST['title'] . "','" . $_REQUEST['amount'] . "','{$effective_date}',\n\t\t\t\t\t\t'" . $_REQUEST['date'] . "','" . $_REQUEST['syear'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['school'] . "','" . $_REQUEST['grade'] . "'\n\t\t\t\t\tFROM STU_SCHOOL_MEETS ssm \n\t\t\t\t\tWHERE\n\t\t\t\t\t\tssm.SYEAR='{$_REQUEST['syear']}' AND ssm.ACTIVE='A' "; if ($_REQUEST[grade]) { $sql .= "AND ssm.GRADE='{$_REQUEST['grade']}' "; } if ($_REQUEST[school]) { $sql .= "AND ssm.SCHOOL='{$_REQUEST['school']}' "; } $sql .= ')'; DBQuery($sql); $note[] = 'The Student Billing Fee ' . $title . ' has been Applied to all students ' . ($_REQUEST[grade] ? 'in ' . GetGrade($_REQUEST[grade]) : '') . ' ' . ($_REQUEST[school] ? 'at ' . GetSchool($_REQUEST[school]) : ''); unset($_REQUEST[modfunc]); } } if ($_REQUEST[modfunc] == 'delete') { if (DeletePrompt('fee for all applicable students')) { DBQuery("DELETE FROM STU_BILLING_FEES WHERE GLOBAL_ID={$_REQUEST['id']}"); $note[] = "That Fee has been Deleted for All Applicable Students"; unset($_REQUEST[modfunc]); } } if (!$_REQUEST[modfunc]) { // LIST if ($note) { echo '<TABLE width=100%><TR><TD bgcolor=#E8E8E9><font size=-1>'; ErrorMessage($note, 'note');
function appendSQL($sql, $extra) { global $_CENTRE; if ($_REQUEST['stuid']) { $sql .= " AND ssm.STUDENT_ID = '" . $_REQUEST['stuid'] . "'"; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('Centre ID')) . ' </b></font>' . $_REQUEST['stuid'] . '<BR>'; } } if ($_REQUEST['last']) { $sql .= " AND LOWER(s.LAST_NAME) LIKE '" . strtolower($_REQUEST['last']) . "%'"; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('Last Name starts with')) . ' </b></font>' . $_REQUEST['last'] . '<BR>'; } } if ($_REQUEST['first']) { $sql .= " AND LOWER(s.FIRST_NAME) LIKE '" . strtolower($_REQUEST['first']) . "%'"; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('First Name starts with')) . ' </b></font>' . $_REQUEST['first'] . '<BR>'; } } if ($_REQUEST['grade']) { $sql .= " AND ssm.GRADE_ID = '{$_REQUEST['grade']}'"; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('Grade')) . ' </b></font>' . GetGrade($_REQUEST['grade']) . '<BR>'; } } if (count($_REQUEST['grades'])) { if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', ngettext('Grade', 'Grades', sizeof($_REQUEST['grades']))) . ' </b></font>' . ($_REQUEST['grades_not'] == 'Y' ? _('Excluded') . ' ' : ''); } $list = $sep = ''; foreach ($_REQUEST['grades'] as $id => $y) { $list .= "{$sep}'{$id}'"; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= $sep . GetGrade($id); } $sep = ','; } if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<BR>'; } $sql .= " AND ssm.GRADE_ID " . ($_REQUEST['grades_not'] == 'Y' ? 'NOT ' : '') . " IN ({$list})"; } if ($_REQUEST['addr']) { $sql .= " AND (LOWER(a.ADDRESS) LIKE '%" . strtolower($_REQUEST['addr']) . "%' OR LOWER(a.CITY) LIKE '" . strtolower($_REQUEST['addr']) . "%' OR LOWER(a.STATE)='" . strtolower($_REQUEST['addr']) . "' OR ZIPCODE LIKE '" . $_REQUEST['addr'] . "%')"; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('Address contains')) . ' </b></font>' . $_REQUEST['addr'] . '<BR>'; } } return $sql; }
// get the address and contacts custom fields, create the select lists and expand select and codeds options $address_categories_RET = DBGet(DBQuery("SELECT c.ID AS CATEGORY_ID,c.TITLE AS CATEGORY_TITLE,c.RESIDENCE,c.MAILING,c.BUS,f.ID,f.TITLE,f.TYPE,f.SELECT_OPTIONS,f.DEFAULT_SELECTION,f.REQUIRED FROM ADDRESS_FIELD_CATEGORIES c,ADDRESS_FIELDS f WHERE f.CATEGORY_ID=c.ID ORDER BY c.SORT_ORDER,c.TITLE,f.SORT_ORDER,f.TITLE"), array(), array('CATEGORY_ID')); $people_categories_RET = DBGet(DBQuery("SELECT c.ID AS CATEGORY_ID,c.TITLE AS CATEGORY_TITLE,c.CUSTODY,c.EMERGENCY,f.ID,f.TITLE,f.TYPE,f.SELECT_OPTIONS,f.DEFAULT_SELECTION,f.REQUIRED FROM PEOPLE_FIELD_CATEGORIES c,PEOPLE_FIELDS f WHERE f.CATEGORY_ID=c.ID ORDER BY c.SORT_ORDER,c.TITLE,f.SORT_ORDER,f.TITLE"), array(), array('CATEGORY_ID')); explodeCustom($address_categories_RET, $address_custom, 'a'); explodeCustom($people_categories_RET, $people_custom, 'p'); unset($_REQUEST['modfunc']); $handle = PDFStart(); foreach ($RET as $student) { $_SESSION['student_id'] = $student['STUDENT_ID']; unset($_ROSARIO['DrawHeader']); if ($_REQUEST['mailing_labels'] == 'Y') { echo '<BR /><BR /><BR />'; } DrawHeader(_('Student Info'), '<img src="assets/school_logo.jpg" height="100" />'); DrawHeader($student['FULL_NAME'], GetSchool(UserSchool())); DrawHeader($student['STUDENT_ID'], GetGrade($student['GRADE_ID'])); DrawHeader(ProperDate(DBDate())); if ($_REQUEST['mailing_labels'] == 'Y') { echo '<BR /><BR /><TABLE class="width-100p"><TR><TD style="width:50px;"> </TD><TD>' . $student['MAILING_LABEL'] . '</TD></TR></TABLE><BR />'; } if ($_REQUEST['category']['1']) { include 'modules/Students/includes/General_Info.inc.php'; echo '<div style="page-break-after: always;"></div>'; } if ($_REQUEST['category']['3']) { $_ROSARIO['DrawHeader'] = ''; DrawHeader(ParseMLField($categories_RET['3'][1]['TITLE'])); echo '<BR />'; $addresses_RET = DBGet(DBQuery("SELECT a.ADDRESS_ID, sjp.STUDENT_RELATION,a.ADDRESS,a.CITY,a.STATE,a.ZIPCODE,a.PHONE,a.MAIL_ADDRESS,a.MAIL_CITY,a.MAIL_STATE,A.MAIL_ZIPCODE, sjp.CUSTODY,sja.MAILING,sja.RESIDENCE,sja.BUS_PICKUP,sja.BUS_DROPOFF," . db_case(array('a.ADDRESS_ID', "'0'", '1', '0')) . "AS SORT_ORDER{$address_custom} FROM ADDRESS a,STUDENTS_JOIN_ADDRESS sja,STUDENTS_JOIN_PEOPLE sjp WHERE a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID='" . UserStudentID() . "' AND a.ADDRESS_ID=sjp.ADDRESS_ID AND sjp.STUDENT_ID=sja.STUDENT_ID\n\t\t\t\t\t\t\t UNION SELECT a.ADDRESS_ID,'No Contacts' AS STUDENT_RELATION,a.ADDRESS,a.CITY,a.STATE,a.ZIPCODE,a.PHONE,a.MAIL_ADDRESS,a.MAIL_CITY,a.MAIL_STATE,A.MAIL_ZIPCODE,'' AS CUSTODY,sja.MAILING,sja.RESIDENCE,sja.BUS_PICKUP,sja.BUS_DROPOFF," . db_case(array('a.ADDRESS_ID', "'0'", '1', '0')) . "AS SORT_ORDER{$address_custom} FROM ADDRESS a,STUDENTS_JOIN_ADDRESS sja WHERE a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID='" . UserStudentID() . "' AND NOT EXISTS (SELECT '' FROM STUDENTS_JOIN_PEOPLE sjp WHERE sjp.STUDENT_ID=sja.STUDENT_ID AND sjp.ADDRESS_ID=a.ADDRESS_ID) ORDER BY SORT_ORDER,RESIDENCE,CUSTODY,STUDENT_RELATION")); $address_previous = "x"; foreach ($addresses_RET as $address) {
function appendSQL($sql, &$extra) { global $_CENTRE; if ($_REQUEST['stuid']) { $sql .= " AND ssm.STUDENT_ID = '{$_REQUEST['stuid']}' "; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>Student ID: </b></font>' . $_REQUEST['stuid'] . '<BR>'; } } if ($_REQUEST['last']) { $sql .= " AND LOWER(s.LAST_NAME) LIKE '" . strtolower($_REQUEST['last']) . "%' "; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>Last Name starts with: </b></font>' . $_REQUEST['last'] . '<BR>'; } } if ($_REQUEST['first']) { $sql .= " AND LOWER(s.FIRST_NAME) LIKE '" . strtolower($_REQUEST['first']) . "%' "; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>First Name starts with: </b></font>' . $_REQUEST['first'] . '<BR>'; } } if ($_REQUEST['grade']) { $sql .= " AND ssm.GRADE_ID = '{$_REQUEST['grade']}' "; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>Grade: </b></font>' . GetGrade($_REQUEST['grade']) . '<BR>'; } } if ($_REQUEST['addr']) { $sql .= " AND (LOWER(a.ADDRESS) LIKE '%" . strtolower($_REQUEST['addr']) . "%' OR LOWER(a.CITY) LIKE '" . strtolower($_REQUEST['addr']) . "%' OR LOWER(a.STATE)='" . strtolower($_REQUEST['addr']) . "' OR ZIPCODE LIKE '" . $_REQUEST['addr'] . "%')"; if (!$extra['NoSearchTerms']) { $_CENTRE['SearchTerms'] .= '<font color=gray><b>Address contains: </b></font>' . $_REQUEST['addr'] . '<BR>'; } } return $sql; }
<?php if (isset($_SESSION["UName"]) && $_SESSION["UName"]) { ?> <h2 class="colorize-h2">用户信息</h2> <div class="colorize-content"> <div class="title"><strong>我的关键字</strong></div> <div class="list"> 我叫<?php echo $_SESSION["UName"]; ?> ,是个<?php echo GetGenderName(GetGenderByName($_SESSION["UName"])); ?> 生,来自<?php echo GetGrade(GetIDByName($_SESSION["UName"])); ?> 届的<?php echo GetClass(GetIDByName($_SESSION["UName"])); ?> 班,我的学号是<?php echo GetNumber(GetIDByName($_SESSION["UName"])); ?> 号。 </div> <div class="title"><strong>我能干什么</strong></div> <div class="list"> <a href="./index.php?key=<?php echo 1 - (isset($_GET["key"]) ? $_GET["key"] : 0); ?>