本文整理汇总了PHP中GetCurrentMP函数的典型用法代码示例。如果您正苦于以下问题:PHP GetCurrentMP函数的具体用法?PHP GetCurrentMP怎么用?PHP GetCurrentMP使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCurrentMP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateAttendanceDaily
function UpdateAttendanceDaily($student_id, $date = '', $comment = false)
{
$daysWeek = _('SuMoTuWeThFrSa');
/// Days of the week
if (!$date) {
$date = DBDate();
}
$sql = "SELECT\n\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac\n\t\t\tWHERE\n\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cp.PERIOD_ID\n\t\t\t\tAND position(substring('{$daysWeek}' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)*2+1 FOR 2) IN cp.DAYS)>0\n\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t";
$RET = DBGet(DBQuery($sql));
$total = $RET[1]['TOTAL'];
if ($total == 0) {
return;
}
$sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='A'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
$RET = DBGet(DBQuery($sql));
$total -= $RET[1]['TOTAL'];
$sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='H'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
$RET = DBGet(DBQuery($sql));
$total -= $RET[1]['TOTAL'] * 0.5;
if ($total >= 300) {
$length = '1.0';
} elseif ($total >= 150) {
$length = '.5';
} else {
$length = '0.0';
}
$current_RET = DBGet(DBQuery("SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"));
if (count($current_RET) && $current_RET[1]['MINUTES_PRESENT'] != $total) {
DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='{$total}',STATE_VALUE='{$length}'" . ($comment !== false ? ",COMMENT='" . str_replace("\\'", "''", $comment) . "'" : '') . " WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'");
} elseif (count($current_RET) && $comment !== false && $current_RET[1]['COMMENT'] != $comment) {
DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='" . str_replace("\\'", "''", $comment) . "' WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'");
} elseif (count($current_RET) == 0) {
DBQuery("INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT) values('" . UserSyear() . "','{$student_id}','{$date}','{$total}','{$length}','" . GetCurrentMP('QTR', $date) . "','" . str_replace("\\'", "''", $comment) . "')");
}
}
示例2: UpdateAttendanceDaily
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) . "')");
}
}
示例3: UpdateAttendanceDaily
function UpdateAttendanceDaily($student_id, $date = '', $comment = false)
{
if (!$date) {
$date = DBDate();
}
//modif Francois: days numbered
//modif Francois: multiple school periods for a course period
if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) {
$sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<='{$date}' AND end_date>='{$date}' AND mp='QTR') AND school_date<='{$date}') AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t";
} else {
$sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('UMTWHFS' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t";
}
$RET = DBGet(DBQuery($sql));
$total = $RET[1]['TOTAL'];
if ($total == 0) {
return;
}
$sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='A'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
$RET = DBGet(DBQuery($sql));
$total -= $RET[1]['TOTAL'];
$sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='H'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
$RET = DBGet(DBQuery($sql));
$total -= $RET[1]['TOTAL'] * 0.5;
if ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES')) {
$length = '1.0';
} elseif ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES') / 2) {
$length = '.5';
} else {
$length = '0.0';
}
$current_RET = DBGet(DBQuery("SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"));
if (count($current_RET) && $current_RET[1]['MINUTES_PRESENT'] != $total) {
DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='{$total}',STATE_VALUE='{$length}'" . ($comment !== false ? ",COMMENT='" . $comment . "'" : '') . " WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'");
} elseif (count($current_RET) && $comment !== false && $current_RET[1]['COMMENT'] != $comment) {
DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='" . $comment . "' WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'");
} elseif (count($current_RET) == 0) {
DBQuery("INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT) values('" . UserSyear() . "','{$student_id}','{$date}','{$total}','{$length}','" . GetCurrentMP('QTR', $date) . "','" . $comment . "')");
}
}
示例4: DBGet
$RET = DBGet(DBQuery("SELECT sju.STUDENT_ID, CONCAT(s.LAST_NAME,', ',s.FIRST_NAME) AS FULL_NAME,se.SCHOOL_ID FROM students s,students_join_users sju, student_enrollment se WHERE s.STUDENT_ID=sju.STUDENT_ID AND sju.STAFF_ID='" . User('STAFF_ID') . "' AND se.SYEAR=" . UserSyear() . " AND se.STUDENT_ID=sju.STUDENT_ID AND (('" . DBDate() . "' BETWEEN se.START_DATE AND se.END_DATE OR se.END_DATE IS NULL) AND '" . DBDate() . "'>=se.START_DATE)"));
if (!UserStudentID()) {
$_SESSION['student_id'] = $RET[1]['STUDENT_ID'];
}
echo "<SELECT name=student_id onChange='document.forms[0].submit();'>";
if (count($RET)) {
foreach ($RET as $student) {
echo "<OPTION value={$student['STUDENT_ID']}" . (UserStudentID() == $student['STUDENT_ID'] ? ' SELECTED' : '') . ">" . $student['FULL_NAME'] . "</OPTION>";
if (UserStudentID() == $student['STUDENT_ID']) {
$_SESSION['UserSchool'] = $student['SCHOOL_ID'];
}
}
}
echo "</SELECT><BR>";
if (!UserMP()) {
$_SESSION['UserMP'] = GetCurrentMP('QTR', DBDate());
}
}
if (User('PROFILE') == 'teacher') {
/*
//if(UserMP())
// $QI = DBQuery("SELECT DISTINCT cp.PERIOD_ID,cp.COURSE_PERIOD_ID,sp.TITLE,sp.SHORT_NAME,cp.MARKING_PERIOD_ID,cp.DAYS,cp.SCHOOL_ID,sp.SORT_ORDER,c.TITLE AS COURSE_TITLE FROM course_periods cp, school_periods sp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR='".UserSyear()."' AND cp.TEACHER_ID='".User('STAFF_ID')."' AND cp.MARKING_PERIOD_ID IN (".GetAllMP('QTR',UserMP()).") ORDER BY sp.SORT_ORDER ");
//else
$QI = DBQuery("SELECT DISTINCT cp.PERIOD_ID,cp.COURSE_PERIOD_ID,sp.TITLE,sp.SHORT_NAME,cp.MARKING_PERIOD_ID,cp.DAYS,cp.SCHOOL_ID,sp.SORT_ORDER,c.TITLE AS COURSE_TITLE FROM course_periods cp, school_periods sp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR='".UserSyear()."' AND cp.TEACHER_ID='".User('STAFF_ID')."' ORDER BY sp.SORT_ORDER");
$RET = DBGet($QI);
// get the fy marking period id's, there should be exactly one fy marking period per school
$fy_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,SCHOOL_ID FROM school_years WHERE SYEAR='".UserSyear()."'"),array(),array('SCHOOL_ID'));
// only need quarters and semesters since years are suppressed and progress_periods aren't used
$mp_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE,SHORT_NAME FROM school_quarters WHERE SYEAR='".UserSyear()."'
UNION SELECT MARKING_PERIOD_ID,TITLE,SHORT_NAME FROM school_semesters WHERE SYEAR='".UserSyear()."'"),array(),array('MARKING_PERIOD_ID'));
示例5: GetStuList
function GetStuList(&$extra = array())
{
global $contacts_RET, $view_other_RET, $_ROSARIO;
if ((empty($extra['SELECT_ONLY']) || mb_strpos($extra['SELECT_ONLY'], 'GRADE_ID') !== false) && !isset($extra['functions']['GRADE_ID'])) {
$functions = array('GRADE_ID' => 'GetGrade');
} else {
$functions = array();
}
if (isset($extra['functions'])) {
$functions += $extra['functions'];
}
if (!isset($extra['MP']) && !isset($extra['DATE'])) {
$extra['MP'] = UserMP();
$extra['DATE'] = DBDate();
} elseif (!$extra['MP']) {
$extra['MP'] = GetCurrentMP('QTR', $extra['DATE'], false);
} elseif (!$extra['DATE']) {
$extra['DATE'] = DBDate();
}
if (isset($_REQUEST['expanded_view']) && $_REQUEST['expanded_view'] == 'true') {
if (!$extra['columns_after']) {
$extra['columns_after'] = array();
}
$view_fields_RET = DBGet(DBQuery("SELECT cf.ID,cf.TYPE,cf.TITLE FROM CUSTOM_FIELDS cf WHERE ((SELECT VALUE FROM PROGRAM_USER_CONFIG WHERE TITLE=cast(cf.ID AS TEXT) AND PROGRAM='StudentFieldsView' AND USER_ID='" . User('STAFF_ID') . "')='Y'" . ($extra['student_fields']['view'] ? " OR cf.ID IN (" . $extra['student_fields']['view'] . ")" : '') . ") ORDER BY cf.SORT_ORDER,cf.TITLE"));
$view_address_RET = DBGet(DBQuery("SELECT VALUE FROM PROGRAM_USER_CONFIG WHERE PROGRAM='StudentFieldsView' AND TITLE='ADDRESS' AND USER_ID='" . User('STAFF_ID') . "'"));
$view_address_RET = $view_address_RET[1]['VALUE'];
$view_other_RET = DBGet(DBQuery("SELECT TITLE,VALUE FROM PROGRAM_USER_CONFIG WHERE PROGRAM='StudentFieldsView' AND TITLE IN ('CONTACT_INFO','HOME_PHONE','GUARDIANS','ALL_CONTACTS') AND USER_ID='" . User('STAFF_ID') . "'"), array(), array('TITLE'));
if (!count($view_fields_RET) && !isset($view_address_RET) && !isset($view_other_RET['CONTACT_INFO'])) {
//modif Francois: add translation
$extra['columns_after'] = array('CONTACT_INFO' => '<IMG SRC="assets/down_phone_button.png" width="24">', 'CUSTOM_200000000' => _('Gender'), 'CUSTOM_200000001' => _('Ethnicity'), 'ADDRESS' => _('Mailing Address'), 'CITY' => _('City'), 'STATE' => _('State'), 'ZIPCODE' => _('Zipcode')) + $extra['columns_after'];
$select = ',ssm.STUDENT_ID AS CONTACT_INFO,s.CUSTOM_200000000,s.CUSTOM_200000001,coalesce(a.MAIL_ADDRESS,a.ADDRESS) AS ADDRESS,coalesce(a.MAIL_CITY,a.CITY) AS CITY,coalesce(a.MAIL_STATE,a.STATE) AS STATE,coalesce(a.MAIL_ZIPCODE,a.ZIPCODE) AS ZIPCODE ';
$extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID AND sam.RESIDENCE='Y') LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
$functions['CONTACT_INFO'] = 'makeContactInfo';
$RET = DBGet(DBQuery("SELECT ID,TYPE FROM CUSTOM_FIELDS WHERE ID IN ('200000000','200000001')"), array(), array('ID'));
// if gender and ethnicity are converted to codeds or exports type
if ($RET['200000000'][1]['TYPE'] == 'codeds' || $RET['200000000'][1]['TYPE'] == 'exports') {
$functions['CUSTOM_200000000'] = 'DeCodeds';
}
if ($RET['200000001'][1]['TYPE'] == 'codeds' || $RET['200000001'][1]['TYPE'] == 'exports') {
$functions['CUSTOM_200000001'] = 'DeCodeds';
}
$extra['singular'] = 'Student Address';
$extra['plural'] = 'Student Addresses';
$extra2['NoSearchTerms'] = true;
$extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.STUDENT_RELATION,pjc.TITLE,pjc.VALUE,a.PHONE,sjp.ADDRESS_ID ';
$extra2['FROM'] .= ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
$extra2['WHERE'] .= ' AND a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID=ssm.STUDENT_ID ';
$extra2['ORDER_BY'] .= 'sjp.CUSTODY';
$extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
// EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
if (!isset($_REQUEST['_ROSARIO_PDF'])) {
$expanded_view = $_REQUEST['expanded_view'];
$_REQUEST['expanded_view'] = false;
$addr = $_REQUEST['addr'];
unset($_REQUEST['addr']);
$contacts_RET = GetStuList($extra2);
$_REQUEST['expanded_view'] = $expanded_view;
$_REQUEST['addr'] = $addr;
} else {
unset($extra2['columns_after']['CONTACT_INFO']);
}
} else {
if ($view_other_RET['CONTACT_INFO'][1]['VALUE'] == 'Y' && !isset($_REQUEST['_ROSARIO_PDF'])) {
$select .= ',ssm.STUDENT_ID AS CONTACT_INFO ';
$extra['columns_after']['CONTACT_INFO'] = '<IMG SRC="assets/down_phone_button.png" width="24">';
$functions['CONTACT_INFO'] = 'makeContactInfo';
$extra2 = $extra;
$extra2['NoSearchTerms'] = true;
$extra2['SELECT'] = '';
$extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.STUDENT_RELATION,pjc.TITLE,pjc.VALUE,a.PHONE,sjp.ADDRESS_ID ';
$extra2['FROM'] .= ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
$extra2['WHERE'] .= ' AND a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID=ssm.STUDENT_ID ';
$extra2['ORDER_BY'] .= 'sjp.CUSTODY';
$extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
$extra2['functions'] = array();
$extra2['link'] = array();
// EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
$expanded_view = $_REQUEST['expanded_view'];
$_REQUEST['expanded_view'] = false;
$addr = $_REQUEST['addr'];
unset($_REQUEST['addr']);
$contacts_RET = GetStuList($extra2);
$_REQUEST['expanded_view'] = $expanded_view;
$_REQUEST['addr'] = $addr;
}
foreach ($view_fields_RET as $field) {
$extra['columns_after']['CUSTOM_' . $field['ID']] = $field['TITLE'];
if ($field['TYPE'] == 'date') {
$functions['CUSTOM_' . $field['ID']] = 'ProperDate';
} elseif ($field['TYPE'] == 'numeric') {
$functions['CUSTOM_' . $field['ID']] = 'removeDot00';
} elseif ($field['TYPE'] == 'codeds') {
$functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
} elseif ($field['TYPE'] == 'exports') {
$functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
}
$select .= ',s.CUSTOM_' . $field['ID'];
}
if ($view_address_RET) {
$extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID AND sam." . $view_address_RET . "='Y') LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
//.........这里部分代码省略.........
示例6: DBQuery
$category_select .= "<OPTION value={$category['ID']}" . ($_REQUEST['table'] == $category['ID'] ? ' SELECTED' : '') . ">" . $category['TITLE'] . "</OPTION>";
}
$category_select .= "</SELECT>";
$QI = DBQuery("SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp WHERE sp.SCHOOL_ID='" . UserSchool() . "' AND sp.SYEAR='" . UserSyear() . "' AND EXISTS (SELECT '' FROM COURSE_PERIODS WHERE SYEAR=sp.SYEAR AND PERIOD_ID=sp.PERIOD_ID AND position(',{$_REQUEST['table']},' IN DOES_ATTENDANCE)>0) ORDER BY sp.SORT_ORDER");
$periods_RET = DBGet($QI, array(), array('PERIOD_ID'));
$period_select = "<SELECT name=period onChange='this.form.submit();'><OPTION value=''>" > _('All') . "</OPTION>";
foreach ($periods_RET as $id => $period) {
$period_select .= "<OPTION value={$id}" . ($_REQUEST['period'] == $id ? ' SELECTED' : '') . ">" . $period[1]['TITLE'] . "</OPTION>";
}
$period_select .= "</SELECT>";
echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>";
DrawHeader(PrepareDate($date, '_date', false, array('submit' => true)) . ' - ' . $period_select, $category_select);
echo '</FORM>';
$daysWeek = _('SuMoTuWeThFrSa');
/// Days of the week
$sql = "SELECT s.STAFF_ID,s.LAST_NAME||', '||s.FIRST_NAME AS FULL_NAME,sp.TITLE,cp.PERIOD_ID,cp.TITLE AS COURSE_TITLE,\n\t\t(SELECT 'Y' FROM ATTENDANCE_COMPLETED ac WHERE ac.STAFF_ID=cp.TEACHER_ID AND ac.SCHOOL_DATE=acc.SCHOOL_DATE AND ac.PERIOD_ID=sp.PERIOD_ID AND TABLE_NAME='{$_REQUEST['table']}') AS COMPLETED\n\t\tFROM STAFF s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR acc\n\t\tWHERE\n\t\t\tsp.PERIOD_ID = cp.PERIOD_ID AND position(',{$_REQUEST['table']},' IN cp.DOES_ATTENDANCE)>0\n\t\t\tAND cp.TEACHER_ID=s.STAFF_ID AND cp.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\tAND cp.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID='" . UserSchool() . "' AND s.PROFILE='teacher'\n\t\t\t" . ($_REQUEST['period'] ? " AND cp.PERIOD_ID='{$_REQUEST['period']}'" : '') . " AND acc.CALENDAR_ID=cp.CALENDAR_ID AND acc.SCHOOL_DATE='{$date}'\n\t\t\tAND acc.SYEAR='" . UserSyear() . "' AND (acc.MINUTES IS NOT NULL AND acc.MINUTES>0)\n\t\t\tAND (sp.BLOCK IS NULL AND position(substring('{$daysWeek}' FROM cast(extract(DOW FROM acc.SCHOOL_DATE) AS INT)*2+1 FOR 2) IN cp.DAYS)>0\n\t\t\tOR sp.BLOCK IS NOT NULL AND acc.BLOCK IS NOT NULL AND sp.BLOCK=acc.BLOCK)\n\t\tORDER BY FULL_NAME";
$RET = DBGet(DBQuery($sql), array(), array('STAFF_ID'));
if (!$_REQUEST['period']) {
foreach ($RET as $staff_id => $periods) {
$i++;
$staff_RET[$i]['FULL_NAME'] = $periods[1]['FULL_NAME'];
foreach ($periods as $period) {
if (!$_REQUEST['_CENTRE_PDF']) {
$staff_RET[$i][$period['PERIOD_ID']] .= button($period['COMPLETED'] == 'Y' ? 'check' : 'x', '', '# onMouseOver=\'stm(["Course Title","' . $period['COURSE_TITLE'] . '"],["white","#006699","","","",,"black","#e8e8ff","","","",,,,2,"#006699",2,,,,,"",,,,]);\' onMouseOut=\'htm()\'') . ' ';
} else {
$staff_RET[$i][$period['PERIOD_ID']] = ($period['COMPLETED'] == 'Y' ? _('Yes') : _('No')) . " ";
}
}
}
$columns = array('FULL_NAME' => _('Teacher'));
foreach ($periods_RET as $id => $period) {
示例7: UpdateAttendanceDaily
function UpdateAttendanceDaily($student_id, $date = '', $comment = false)
{
if (!$date) {
$date = DBDate();
}
$current_mp = GetCurrentMP('QTR', $date);
$MP_TYPE = 'QTR';
if (!$current_mp) {
$current_mp = GetCurrentMP('SEM', $date);
$MP_TYPE = 'SEM';
}
if (!$current_mp) {
$current_mp = GetCurrentMP('FY', $date);
$MP_TYPE = 'FY';
}
$sql = 'SELECT
SUM(sp.LENGTH) AS TOTAL
FROM schedule s,course_periods cp,course_period_var cpv,school_periods sp,attendance_calendar ac
WHERE
s.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND cpv.DOES_ATTENDANCE=\'Y\'
AND ac.SCHOOL_DATE=\'' . $date . '\' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)
AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID
AND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR
AND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpv.PERIOD_ID
AND position(substring(\'UMTWHFS\' FROM DAYOFWEEK(\'' . $date . '\') FOR 1) IN cpv.DAYS)>0
AND s.STUDENT_ID=\'' . $student_id . '\'
AND s.SYEAR=\'' . UserSyear() . '\'
AND (\'' . $date . '\' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND \'' . $date . '\'>=s.START_DATE))
AND s.MARKING_PERIOD_ID IN (' . GetAllMP($MP_TYPE, $current_mp) . ')
';
$RET = DBGet(DBQuery($sql));
$total = $RET[1]['TOTAL'];
if ($total == 0) {
return;
}
$current_RET = DBGet(DBQuery('SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM attendance_day WHERE STUDENT_ID=' . $student_id . ' AND SCHOOL_DATE=\'' . $date . '\''));
$total = $current_RET['MINUTES_PRESENT'];
$sql = 'SELECT SUM(sp.LENGTH) AS TOTAL
FROM attendance_period ap,school_periods sp,attendance_codes ac
WHERE 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=\'P\'
AND sp.SYEAR=\'' . UserSyear() . '\'';
$RET = DBGet(DBQuery($sql));
$total += $RET[1]['TOTAL'];
$sql = 'SELECT SUM(sp.LENGTH) AS TOTAL
FROM attendance_period ap,school_periods sp,attendance_codes ac
WHERE 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\'
AND sp.SYEAR=\'' . UserSyear() . '\'';
$RET = DBGet(DBQuery($sql));
$total += $RET[1]['TOTAL'] * 0.5;
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 && $length != $current_RET[1]['STATE_VALUE']) {
DBQuery('UPDATE attendance_day SET STATE_VALUE=\'' . $length . '\' 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) {
$check_assoc = DBGet(DBQuery('SELECT COUNT(*) as REC_EX FROM attendance_period ap,course_periods cp WHERE ap.STUDENT_ID=' . $student_id . ' AND ap.SCHOOL_DATE=\'' . $date . '\' AND cp.COURSE_PERIOD_ID=ap.COURSE_PERIOD_ID AND cp.SCHOOL_ID=' . UserSchool() . ' AND cp.SYEAR=' . UserSyear()));
if ($check_assoc[1]['REC_EX'] > 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 . '\',\'' . $current_mp . '\',\'' . str_replace("", "", $comment) . '\')');
}
}
}
示例8: DBGet
$mps_RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,SHORT_NAME FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'), array(), array('MARKING_PERIOD_ID'));
}
$extra['extra_header_left'] .= '<TR><TD align=right>Marking Periods</TD><TD><TABLE><TR><TD><TABLE>';
foreach ($mps_RET as $sem => $quarters) {
$extra['extra_header_left'] .= '<TR>';
foreach ($quarters as $qtr) {
$pro = GetChildrenMP('PRO', $qtr['MARKING_PERIOD_ID']);
if ($pro) {
$pros = explode(',', str_replace("'", '', $pro));
foreach ($pros as $pro) {
if (GetMP($pro, 'DOES_GRADES') == 'Y') {
$extra['extra_header_left'] .= '<TD><INPUT type=checkbox name=mp_arr[] value=' . $pro . '>' . GetMP($pro, 'SHORT_NAME') . '</TD>';
}
}
}
$extra['extra_header_left'] .= '<TD><INPUT type=checkbox name=mp_arr[] value=' . $qtr['MARKING_PERIOD_ID'] . ' ' . ($qtr['MARKING_PERIOD_ID'] == GetCurrentMP($MP_TYPE, DBDate()) ? 'checked' : '') . '>' . $qtr['SHORT_NAME'] . '</TD>';
}
if (GetMP($sem, 'DOES_EXAM') == 'Y') {
if (GetMP($sem, 'DOES_EXAM') == 'Y') {
$extra['extra_header_left'] .= '<TD><INPUT type=checkbox name=mp_arr[] value=E' . $sem . '>' . GetMP($sem, 'SHORT_NAME') . ' Exam</TD>';
}
}
if (GetMP($sem, 'DOES_GRADES') == 'Y' && $sem != $quarters[1]['MARKING_PERIOD_ID']) {
$extra['extra_header_left'] .= '<TD><INPUT type=checkbox name=mp_arr[] value=' . $sem . '>' . GetMP($sem, 'SHORT_NAME') . '</TD>';
}
$extra['extra_header_left'] .= '</TR>';
}
$extra['extra_header_left'] .= '</TABLE></TD>';
if ($sem) {
$fy = GetParentMP('FY', $sem);
$extra['extra_header_left'] .= '<TD><TABLE><TR>';
示例9: AND
AND sp.PERIOD_ID=cpv.PERIOD_ID
AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID
AND (sp.BLOCK IS NULL AND position(substring(\'UMTWHFS\' FROM DAYOFWEEK(acc.SCHOOL_DATE) FOR 1) IN cpv.DAYS)>0
OR sp.BLOCK IS NOT NULL
AND acc.BLOCK IS NOT NULL
AND sp.BLOCK=acc.BLOCK)
' . ($_REQUEST['table'] == '0' ? 'AND cpv.DOES_ATTENDANCE=\'Y\'' : '');
if ($mps != '') {
$course_RET = DBGET(DBQuery($sql));
}
$mp_id = GetCurrentMP('QTR', $date, false);
if (!$mp_id) {
$mp_id = GetCurrentMP('SEM', $date, false);
}
if (!$mp_id) {
$mp_id = GetCurrentMP('FY', $date, false);
}
// if running as a teacher program then openSIS[allow_edit] will already be set according to admin permissions
if (!isset($_openSIS['allow_edit'])) {
// allow teacher edit if selected date is in the current quarter or in the corresponding grade posting period
$current_qtr_id = $mp_id;
$time = strtotime(DBDate('postgres'));
if (($current_qtr_id || GetMP($mp_id, 'POST_START_DATE') && $time <= strtotime(GetMP($mp_id, 'POST_END_DATE'))) && ($edit_days_before == '' || strtotime($date) <= $time + $edit_days_before * 86400) && ($edit_days_after == '' || strtotime($date) >= $time - $edit_days_after * 86400)) {
$_openSIS['allow_edit'] = true;
}
}
if ($_SESSION['PROFILE'] == 'teacher') {
if ($_REQUEST['cpv_id'] != '') {
$_SESSION['CpvId'] = $_REQUEST['cpv_id'];
}
}
示例10: CONCAT
}
}
echo "</SELECT></TD></TR></TABLE>";
###################################################################################################################
$sql = "SELECT CONCAT(s.LAST_NAME,', ',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,s.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,s.ALT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ,c.TITLE AS COURSE_TITLE,p_cp.TITLE AS PERIOD_TITLE,sr.MARKING_PERIOD_ID,cpv.DAYS, CONCAT(sp.START_TIME, ' to ', sp.END_TIME) AS DURATION,r.TITLE AS ROOM FROM students s,student_enrollment ssm LEFT OUTER JOIN schedule sr ON (sr.STUDENT_ID=ssm.STUDENT_ID),courses c,course_periods p_cp,course_period_var cpv,rooms r,school_periods sp WHERE ssm.STUDENT_ID=s.STUDENT_ID AND p_cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND r.ROOM_ID=cpv.ROOM_ID AND ssm.SYEAR='" . UserSyear() . "' AND ssm.SCHOOL_ID='" . UserSchool() . "' AND ('" . DBDate() . "' BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND '" . DBDate() . "'>ssm.START_DATE)) AND ssm.STUDENT_ID='" . UserStudentID() . "' AND s.STUDENT_ID = '" . UserStudentID() . "' AND cpv.PERIOD_ID=sp.PERIOD_ID AND ssm.SYEAR=sr.SYEAR AND sr.COURSE_ID=c.COURSE_ID AND sr.COURSE_PERIOD_ID=p_cp.COURSE_PERIOD_ID AND cpv.PERIOD_ID=sp.PERIOD_ID AND ('" . DBDate() . "' BETWEEN sr.START_DATE AND sr.END_DATE OR sr.END_DATE IS NULL) ORDER BY FULL_NAME,sp.SORT_ORDER";
echo "<br>";
echo "<br>";
$stu_id = UserStudentID();
$RET_show[$stu_id] = DBGet(DBQuery($sql));
$date = date(Y . "-" . m . "-" . d);
if (!$_REQUEST['sel_mp']) {
$sel_mp = GetCurrentMP('QTR', $date);
if (!$sel_mp) {
$sel_mp = GetCurrentMP('SEM', $date);
if (!$sel_mp) {
$sel_mp = GetCurrentMP('FY', $date);
}
}
} else {
$sel_mp = $_REQUEST['sel_mp'];
}
$sql_mp_detail = 'SELECT title, start_date, end_date, parent_id, grandparent_id from marking_periods WHERE marking_period_id = \'' . $sel_mp . '\'';
$res_mp_detail = mysql_query($sql_mp_detail);
$row_mp_detail = mysql_fetch_array($res_mp_detail);
$mp_string = '(s.marking_period_id=' . $sel_mp . '';
if ($row_mp_detail['parent_id'] != -1) {
$mp_string .= ' or s.marking_period_id=' . $row_mp_detail['parent_id'] . '';
}
if ($row_mp_detail['grandparent_id'] != -1) {
$mp_string .= ' or s.marking_period_id=' . $row_mp_detail['grandparent_id'] . '';
}
示例11: DBDate
}
if ($_REQUEST['month_include_active_date']) {
$date = $_REQUEST['day_include_active_date'] . '-' . $_REQUEST['month_include_active_date'] . '-' . $_REQUEST['year_include_active_date'];
} else {
$date = DBDate();
}
if ($_REQUEST['fields']['PERIOD_ATTENDANCE']) {
//modif Francois: multiple school periods for a course period
//$extra['SELECT'] .= ',(SELECT st.FIRST_NAME||\' \'||st.LAST_NAME||\' - \'||coalesce(cp.ROOM,\' \') FROM STAFF st,SCHEDULE ss,COURSE_PERIODS cp,SCHOOL_PERIODS p WHERE ss.STUDENT_ID=ssm.STUDENT_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND cp.TEACHER_ID=st.STAFF_ID AND cp.PERIOD_ID=p.PERIOD_ID AND (\''.$date.'\' BETWEEN ss.START_DATE AND ss.END_DATE OR \''.$date.'\'>=ss.START_DATE AND ss.END_DATE IS NULL) AND ss.MARKING_PERIOD_ID IN ('.GetAllMP('QTR',GetCurrentMP('QTR',$date)).') AND p.ATTENDANCE=\'Y\') AS PERIOD_ATTENDANCE';
$extra['SELECT'] .= ',(SELECT st.FIRST_NAME||\' \'||st.LAST_NAME||\' - \'||coalesce(cp.ROOM,\' \') FROM STAFF st,SCHEDULE ss,COURSE_PERIODS cp,SCHOOL_PERIODS p,COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND ss.STUDENT_ID=ssm.STUDENT_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND cp.TEACHER_ID=st.STAFF_ID AND cpsp.PERIOD_ID=p.PERIOD_ID AND (\'' . $date . '\' BETWEEN ss.START_DATE AND ss.END_DATE OR \'' . $date . '\'>=ss.START_DATE AND ss.END_DATE IS NULL) AND ss.MARKING_PERIOD_ID IN (' . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ') AND p.ATTENDANCE=\'Y\') AS PERIOD_ATTENDANCE';
}
foreach ($periods_RET as $period) {
if ($_REQUEST['fields']['PERIOD_' . $period['PERIOD_ID']] == 'Y') {
//modif Francois: multiple school periods for a course period
//$extra['SELECT'] .= ',array(SELECT st.FIRST_NAME||\' \'||st.LAST_NAME||\' - \'||coalesce(cp.ROOM,\' \') FROM STAFF st,SCHEDULE ss,COURSE_PERIODS cp WHERE ss.STUDENT_ID=ssm.STUDENT_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND cp.TEACHER_ID=st.STAFF_ID AND cp.PERIOD_ID=\''.$period['PERIOD_ID'].'\' AND (\''.$date.'\' BETWEEN ss.START_DATE AND ss.END_DATE OR \''.$date.'\'>=ss.START_DATE AND ss.END_DATE IS NULL) AND ss.MARKING_PERIOD_ID IN ('.GetAllMP('QTR',GetCurrentMP('QTR',$date)).')) AS PERIOD_'.$period['PERIOD_ID'];
$extra['SELECT'] .= ',array(SELECT st.FIRST_NAME||\' \'||st.LAST_NAME||\' - \'||coalesce(cp.ROOM,\' \') FROM STAFF st,SCHEDULE ss,COURSE_PERIODS cp,COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND ss.STUDENT_ID=ssm.STUDENT_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND cp.TEACHER_ID=st.STAFF_ID AND cpsp.PERIOD_ID=\'' . $period['PERIOD_ID'] . '\' AND (\'' . $date . '\' BETWEEN ss.START_DATE AND ss.END_DATE OR \'' . $date . '\'>=ss.START_DATE AND ss.END_DATE IS NULL) AND ss.MARKING_PERIOD_ID IN (' . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ')) AS PERIOD_' . $period['PERIOD_ID'];
$extra['functions']['PERIOD_' . $period['PERIOD_ID']] = '_makeTeachers';
}
}
if ($RosarioModules['Food_Service'] && ($_REQUEST['fields']['FS_ACCOUNT_ID'] == 'Y' || $_REQUEST['fields']['FS_DISCOUNT'] == 'Y' || $_REQUEST['fields']['FS_STATUS'] == 'Y' || $_REQUEST['fields']['FS_BARCODE'] == 'Y' || $_REQUEST['fields']['FS_BALANCE'] == 'Y')) {
$extra['FROM'] .= ',FOOD_SERVICE_STUDENT_ACCOUNTS fssa';
$extra['WHERE'] .= ' AND fssa.STUDENT_ID=ssm.STUDENT_ID';
if ($_REQUEST['fields']['FS_ACCOUNT_ID'] == 'Y') {
$extra['SELECT'] .= ',fssa.ACCOUNT_ID AS FS_ACCOUNT_ID';
}
if ($_REQUEST['fields']['FS_DISCOUNT'] == 'Y') {
$extra['SELECT'] .= ',coalesce(fssa.DISCOUNT,\'Full\') AS FS_DISCOUNT';
}
if ($_REQUEST['fields']['FS_STATUS'] == 'Y') {
$extra['SELECT'] .= ',coalesce(fssa.STATUS,\'Active\') AS FS_STATUS';
}
示例12: PDFStart
$handle = PDFStart();
foreach ($RET as $student) {
$student_points = $total_points = $percent_weights = array();
unset($_CENTRE['DrawHeader']);
echo "<table width=100% style=\" font-family:Arial; font-size:12px;\" >";
echo "<tr><td style=\"font-size:15px; font-weight:bold; padding-top:20px;\">" . GetSchool(UserSchool()) . "<div style=\"font-size:12px;\">Student Progress Report</div></td><td align=right style=\"padding-top:20px;\">" . ProperDate(DBDate()) . "<br/>Powered by openSIS</td></tr><tr><td colspan=2 style=\"border-top:1px solid #333;\"> </td></tr></table>";
echo '<table border=0 style=\\"font-size:12px;\\">';
echo "<tr><td>Student Name:</td>";
echo "<td>" . $student['FULL_NAME'] . "</td></tr>";
echo "<tr><td>ID:</td>";
echo "<td>" . $student['STUDENT_ID'] . " </td></tr>";
echo "<tr><td>Grade:</td>";
echo "<td>" . $student['GRADE_ID'] . " </td></tr>";
echo "<tr><td>Course</td><td>" . $course_title . "</td></tr>";
echo "<tr><td>Marking Period:</td>";
echo "<td>" . GetMP(GetCurrentMP('QTR', DBDate())) . " </td></tr>";
#echo '</table>';
#if($_REQUEST['mailing_labels']=='Y')
if ($_REQUEST['mailing_labels'] == 'Y') {
echo '<tr><TD colspan=2>' . $student['MAILING_LABEL'] . '</TD></TR>';
}
unset($student_points);
unset($total_points);
unset($percent_weights);
if ($programconfig[User('STAFF_ID')]['WEIGHT'] == 'Y') {
$sql = "SELECT a.TITLE,a.ASSIGNED_DATE,a.DUE_DATE, t.ASSIGNMENT_TYPE_ID, t.FINAL_GRADE_PERCENT,g.POINTS,a.POINTS AS TOTAL_POINTS,g.COMMENT,g.POINTS AS LETTER_GRADE,CASE WHEN (a.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=a.ASSIGNED_DATE) AND (a.DUE_DATE IS NULL OR CURRENT_DATE>=a.DUE_DATE) THEN 'Y' ELSE NULL END AS DUE FROM GRADEBOOK_ASSIGNMENT_TYPES t,GRADEBOOK_ASSIGNMENTS a LEFT OUTER JOIN GRADEBOOK_GRADES g ON (a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND g.STUDENT_ID='{$student['STUDENT_ID']}' AND g.COURSE_PERIOD_ID='" . UserCoursePeriod() . "') WHERE a.ASSIGNMENT_TYPE_ID=t.ASSIGNMENT_TYPE_ID AND (a.COURSE_PERIOD_ID='" . UserCoursePeriod() . "' OR a.COURSE_ID='{$course_id}' AND a.STAFF_ID='" . User('STAFF_ID') . "') AND t.COURSE_ID='{$course_id}' AND a.MARKING_PERIOD_ID='" . UserMP() . "'";
} else {
$sql = "SELECT a.TITLE,a.ASSIGNED_DATE,a.DUE_DATE,'-1' AS ASSIGNMENT_TYPE_ID,'1' AS FINAL_GRADE_PERCENT,g.POINTS,a.POINTS AS TOTAL_POINTS,g.COMMENT,g.POINTS AS LETTER_GRADE,CASE WHEN (a.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=a.ASSIGNED_DATE) AND (a.DUE_DATE IS NULL OR CURRENT_DATE>=a.DUE_DATE) THEN 'Y' ELSE NULL END AS DUE FROM GRADEBOOK_ASSIGNMENTS a LEFT OUTER JOIN GRADEBOOK_GRADES g ON (a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND g.STUDENT_ID='{$student['STUDENT_ID']}' AND g.COURSE_PERIOD_ID='" . UserCoursePeriod() . "') WHERE (a.COURSE_PERIOD_ID='" . UserCoursePeriod() . "' OR a.COURSE_ID='{$course_id}' AND a.STAFF_ID='" . User('STAFF_ID') . "') AND a.MARKING_PERIOD_ID='" . UserMP() . "'";
}
if ($_REQUEST['exclude_notdue'] == 'Y') {
$sql .= " AND ((a.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=a.ASSIGNED_DATE) AND (a.DUE_DATE IS NULL OR CURRENT_DATE>=DUE_DATE) OR g.POINTS IS NOT NULL)";
示例13: array
} else {
$LO_group = array();
$singular = _('Assignment');
$plural = _('Assignments');
}
$extra2['functions'] = array('ASSIGNED_DATE' => '_removeSpaces', 'DUE_DATE' => '_removeSpaces', 'TITLE' => '_removeSpaces', 'POINTS' => '_makeExtra', 'PERCENT_GRADE' => '_makeExtra', 'LETTER_GRADE' => '_makeExtra');
$handle = PDFStart();
foreach ($RET as $student) {
unset($_CENTRE['DrawHeader']);
if ($_REQUEST['mailing_labels'] == 'Y') {
echo '<BR><BR><BR>';
}
DrawHeader(Config('TITLE') . ' ' . _('Progress Report'));
DrawHeader('</font>' . $student['FULL_NAME'] . '<font>', $student['STUDENT_ID']);
DrawHeader($student['GRADE_ID'], GetSchool(UserSchool()));
DrawHeader($course_title, GetMP(GetCurrentMP('QTR', DBDate())));
DrawHeader(ProperDate(DBDate()));
if ($_REQUEST['mailing_labels'] == 'Y') {
echo '<BR><BR><TABLE width=100%><TR><TD width=50> </TD><TD>' . $student['MAILING_LABEL'] . '</TD></TR></TABLE><BR>';
}
$extra = $extra2;
$extra['WHERE'] .= " AND s.STUDENT_ID='{$student['STUDENT_ID']}'";
$student_points = $total_points = $percent_weights = array();
$grades_RET = GetStuList($extra);
$sum_student_points = $sum_total_points = 0;
$sum_points = $sum_percent = 0;
foreach ($percent_weights as $assignment_type_id => $percent) {
$sum_student_points += $student_points[$assignment_type_id];
$sum_total_points += $total_points[$assignment_type_id];
$sum_points += $student_points[$assignment_type_id] * ($programconfig[User('STAFF_ID')]['WEIGHT'] == 'Y' ? $percent / $total_points[$assignment_type_id] : 1);
$sum_percent += $programconfig[User('STAFF_ID')]['WEIGHT'] == 'Y' ? $percent : $total_points[$assignment_type_id];
示例14: GetStuList
function GetStuList(&$extra)
{
global $contacts_RET, $view_other_RET, $_openSIS;
$offset = 'GRADE_ID';
if ((!$extra['SELECT_ONLY'] || strpos($extra['SELECT_ONLY'], $offset) !== false) && !$extra['functions']['GRADE_ID']) {
$functions = array('GRADE_ID' => 'GetGrade');
} else {
$functions = array();
}
if ($extra['functions']) {
$functions += $extra['functions'];
}
if (!$extra['DATE']) {
$queryMP = UserMP();
$extra['DATE'] = DBDate();
} else {
$queryMP = GetCurrentMP('QTR', $extra['DATE'], false);
}
if ($_REQUEST['expanded_view'] == 'true') {
if (!$extra['columns_after']) {
$extra['columns_after'] = array();
}
#############################################################################################
//Commented as it crashing for Linux due to Blank Database tables
//$view_fields_RET = DBGet(DBQuery("SELECT cf.ID,cf.TYPE,cf.TITLE FROM PROGRAM_USER_CONFIG puc,CUSTOM_FIELDS cf WHERE puc.TITLE=cf.ID AND puc.PROGRAM='StudentFieldsView' AND puc.USER_ID='".User('STAFF_ID')."' AND puc.VALUE='Y'"));
#############################################################################################
$view_address_RET = DBGet(DBQuery("SELECT VALUE FROM PROGRAM_USER_CONFIG WHERE PROGRAM='StudentFieldsView' AND TITLE='ADDRESS' AND USER_ID='" . User('STAFF_ID') . "'"));
$view_address_RET = $view_address_RET[1]['VALUE'];
$view_other_RET = DBGet(DBQuery("SELECT TITLE,VALUE FROM PROGRAM_USER_CONFIG WHERE PROGRAM='StudentFieldsView' AND TITLE IN ('PHONE','HOME_PHONE','GUARDIANS','ALL_CONTACTS') AND USER_ID='" . User('STAFF_ID') . "'"), array(), array('TITLE'));
if (!count($view_fields_RET) && !isset($view_address_RET) && !isset($view_other_RET['CONTACT_INFO'])) {
$extra['columns_after'] = array('PHONE' => 'Phone', 'GENDER' => 'Gender', 'ETHNICITY' => 'Ethnicity', 'ADDRESS' => 'Mailing Address', 'CITY' => 'City', 'STATE' => 'State', 'ZIPCODE' => 'Zipcode') + $extra['columns_after'];
$select = ',s.PHONE,s.GENDER,s.ETHNICITY,COALESCE(a.MAIL_ADDRESS,a.ADDRESS) AS ADDRESS,COALESCE(a.MAIL_CITY,a.CITY) AS CITY,COALESCE(a.MAIL_STATE,a.STATE) AS STATE,COALESCE(a.MAIL_ZIPCODE,a.ZIPCODE) AS ZIPCODE ';
#$extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID AND sam.MAILING='Y') LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) ".$extra['FROM'];
$extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID ) LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
$functions['CONTACT_INFO'] = 'makeContactInfo';
// if gender is converted to codeds type
//$functions['CUSTOM_200000000'] = 'DeCodeds';
$extra['singular'] = 'Student Address';
$extra['plural'] = 'Student Addresses';
$extra2['NoSearchTerms'] = true;
$extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.STUDENT_RELATION,pjc.TITLE,pjc.VALUE,a.PHONE,sjp.ADDRESS_ID ';
$extra2['FROM'] .= ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
$extra2['WHERE'] .= ' AND a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID=ssm.STUDENT_ID ';
$extra2['ORDER_BY'] .= 'COALESCE(sjp.CUSTODY,\'N\') DESC';
$extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
// EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
if (!$_REQUEST['_openSIS_PDF']) {
$expanded_view = $_REQUEST['expanded_view'];
$_REQUEST['expanded_view'] = false;
$addr = $_REQUEST['addr'];
unset($_REQUEST['addr']);
$contacts_RET = GetStuList($extra2);
$_REQUEST['expanded_view'] = $expanded_view;
$_REQUEST['addr'] = $addr;
} else {
unset($extra2['columns_after']['CONTACT_INFO']);
}
} else {
if ($view_other_RET['CONTACT_INFO'][1]['VALUE'] == 'Y' && !$_REQUEST['_openSIS_PDF']) {
$select .= ',NULL AS CONTACT_INFO ';
$extra['columns_after']['CONTACT_INFO'] = '<IMG SRC=assets/down_phone_button.gif border=0>';
$functions['CONTACT_INFO'] = 'makeContactInfo';
$extra2 = $extra;
$extra2['NoSearchTerms'] = true;
$extra2['SELECT'] = '';
$extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.STUDENT_RELATION,pjc.TITLE,pjc.VALUE,a.PHONE,sjp.ADDRESS_ID,COALESCE(sjp.CUSTODY,\'N\') ';
$extra2['FROM'] .= ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
$extra2['WHERE'] .= ' AND a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID=ssm.STUDENT_ID ';
$extra2['ORDER_BY'] .= 'COALESCE(sjp.CUSTODY,\'N\') DESC';
$extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
$extra2['functions'] = array();
$extra2['link'] = array();
// EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
$expanded_view = $_REQUEST['expanded_view'];
$_REQUEST['expanded_view'] = false;
$addr = $_REQUEST['addr'];
unset($_REQUEST['addr']);
$contacts_RET = GetStuList($extra2);
$_REQUEST['expanded_view'] = $expanded_view;
$_REQUEST['addr'] = $addr;
}
foreach ($view_fields_RET as $field) {
$extra['columns_after']['CUSTOM_' . $field['ID']] = $field['TITLE'];
if ($field['TYPE'] == 'date') {
$functions['CUSTOM_' . $field['ID']] = 'ProperDate';
} elseif ($field['TYPE'] == 'numeric') {
$functions['CUSTOM_' . $field['ID']] = 'removeDot00';
} elseif ($field['TYPE'] == 'codeds') {
$functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
}
$select .= ',s.CUSTOM_' . $field['ID'];
}
if ($view_address_RET) {
$extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID AND sam." . $view_address_RET . "='Y') LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
$extra['columns_after'] += array('ADDRESS' => ucwords(strtolower(str_replace('_', ' ', $view_address_RET))) . ' Address', 'CITY' => 'City', 'STATE' => 'State', 'ZIPCODE' => 'Zipcode');
if ($view_address_RET != 'MAILING') {
$select .= ",a.ADDRESS_ID,a.ADDRESS,a.CITY,a.STATE,a.ZIPCODE,a.PHONE,ssm.STUDENT_ID AS PARENTS";
} else {
$select .= ",a.ADDRESS_ID,COALESCE(a.MAIL_ADDRESS,a.ADDRESS) AS ADDRESS,COALESCE(a.MAIL_CITY,a.CITY) AS CITY,COALESCE(a.MAIL_STATE,a.STATE) AS STATE,COALESCE(a.MAIL_ZIPCODE,a.ZIPCODE) AS ZIPCODE,a.PHONE,ssm.STUDENT_ID AS PARENTS ";
}
//.........这里部分代码省略.........
示例15: IN
$extra['WHERE'] = " AND s.STUDENT_ID IN ({$st_list})";
$extra['SELECT'] .= ",coalesce(s.CUSTOM_200000002,s.FIRST_NAME) AS NICK_NAME";
if (User('PROFILE') == 'admin') {
if ($_REQUEST['w_course_period_id_which'] == 'course_period' && $_REQUEST['w_course_period_id']) {
if ($_REQUEST['teacher']) {
$extra['SELECT'] .= ",(SELECT st.FIRST_NAME||' '||st.LAST_NAME FROM STAFF st,COURSE_PERIODS cp WHERE st.STAFF_ID=cp.TEACHER_ID AND cp.COURSE_PERIOD_ID='{$_REQUEST['w_course_period_id']}') AS TEACHER";
}
if ($_REQUEST['room']) {
$extra['SELECT'] .= ",(SELECT cp.ROOM FROM COURSE_PERIODS cp WHERE cp.COURSE_PERIOD_ID='{$_REQUEST['w_course_period_id']}') AS ROOM";
}
} else {
if ($_REQUEST['teacher']) {
$extra['SELECT'] .= ",(SELECT st.FIRST_NAME||' '||st.LAST_NAME FROM STAFF st,COURSE_PERIODS cp,SCHOOL_PERIODS p,SCHEDULE ss WHERE st.STAFF_ID=cp.TEACHER_ID AND cp.PERIOD_id=p.PERIOD_ID AND p.ATTENDANCE='Y' AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND ss.STUDENT_ID=s.STUDENT_ID AND ss.SYEAR='" . UserSyear() . "' AND ss.MARKING_PERIOD_ID IN(" . GetAllMP('QTR', GetCurrentMP('QTR', DBDate(), false)) . ") AND (ss.START_DATE<='" . DBDate() . "' AND (ss.END_DATE>='" . DBDate() . "' OR ss.END_DATE IS NULL)) ORDER BY p.SORT_ORDER LIMIT 1) AS TEACHER";
}
if ($_REQUEST['room']) {
$extra['SELECT'] .= ",(SELECT cp.ROOM FROM COURSE_PERIODS cp,SCHOOL_PERIODS p,SCHEDULE ss WHERE cp.PERIOD_id=p.PERIOD_ID AND p.ATTENDANCE='Y' AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND ss.STUDENT_ID=s.STUDENT_ID AND ss.SYEAR='" . UserSyear() . "' AND ss.MARKING_PERIOD_ID IN(" . GetAllMP('QTR', GetCurrentMP('QTR', DBDate(), false)) . ") AND (ss.START_DATE<='" . DBDate() . "' AND (ss.END_DATE>='" . DBDate() . "' OR ss.END_DATE IS NULL)) ORDER BY p.SORT_ORDER LIMIT 1) AS ROOM";
}
}
} else {
if ($_REQUEST['teacher']) {
$extra['SELECT'] .= ",(SELECT st.FIRST_NAME||' '||st.LAST_NAME FROM STAFF st,COURSE_PERIODS cp WHERE st.STAFF_ID=cp.TEACHER_ID AND cp.COURSE_PERIOD_ID='" . UserCoursePeriod() . "') AS TEACHER";
}
if ($_REQUEST['room']) {
$extra['SELECT'] .= ",(SELECT cp.ROOM FROM COURSE_PERIODS cp WHERE cp.COURSE_PERIOD_ID='" . UserCoursePeriod() . "') AS ROOM";
}
}
$RET = GetStuList($extra);
if (count($RET)) {
$skipRET = array();
for ($i = ($_REQUEST['start_row'] - 1) * $max_cols + $_REQUEST['start_col']; $i > 1; $i--) {
$skipRET[-$i] = array('LAST_NAME' => ' ');