本文整理汇总了PHP中GetChildrenMP函数的典型用法代码示例。如果您正苦于以下问题:PHP GetChildrenMP函数的具体用法?PHP GetChildrenMP怎么用?PHP GetChildrenMP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetChildrenMP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetAllMP
function GetAllMP($mp, $marking_period_id = '0')
{
global $_openSIS;
if ($marking_period_id == 0) {
// there should be exactly one fy marking period
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
$marking_period_id = $RET[1]['MARKING_PERIOD_ID'];
$mp = 'FY';
} elseif (!$mp) {
$mp = GetMPTable(GetMP($marking_period_id, 'TABLE'));
}
// echo $marking_period_id;
if (!$_openSIS['GetAllMP'][$mp]) {
switch ($mp) {
case 'PRO':
// there should be exactly one fy marking period
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
$fy = $RET[1]['MARKING_PERIOD_ID'];
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,SEMESTER_ID FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
foreach ($RET as $value) {
$_openSIS['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = "'{$fy}','{$value['SEMESTER_ID']}','{$value['MARKING_PERIOD_ID']}'";
$_openSIS['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] .= ',' . GetChildrenMP($mp, $value['MARKING_PERIOD_ID']);
if (substr($_openSIS['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']], -1) == ',') {
$_openSIS['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = substr($_openSIS['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']], 0, -1);
}
}
break;
case 'QTR':
// there should be exactly one fy marking period
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
$fy = $RET[1]['MARKING_PERIOD_ID'];
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,SEMESTER_ID FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
foreach ($RET as $value) {
$_openSIS['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = "'{$fy}','{$value['SEMESTER_ID']}','{$value['MARKING_PERIOD_ID']}'";
}
break;
case 'SEM':
// there should be exactly one fy marking period
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
$fy = $RET[1]['MARKING_PERIOD_ID'];
$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['GetAllMP'][$mp][$sem] = "'{$fy}','{$sem}'";
foreach ($value as $qtr) {
$_openSIS['GetAllMP'][$mp][$sem] .= ",'{$qtr['MARKING_PERIOD_ID']}'";
}
}
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_semesters s WHERE NOT EXISTS (SELECT \'\' FROM school_quarters q WHERE q.SEMESTER_ID=s.MARKING_PERIOD_ID) AND SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
foreach ($RET as $value) {
$_openSIS['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = "'{$fy}','{$value['MARKING_PERIOD_ID']}'";
}
break;
case 'FY':
// there should be exactly one fy marking period which better be $marking_period_id
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,SEMESTER_ID FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''), array(), array('SEMESTER_ID'));
$_openSIS['GetAllMP'][$mp][$marking_period_id] = "'{$marking_period_id}'";
foreach ($RET as $sem => $value) {
$_openSIS['GetAllMP'][$mp][$marking_period_id] .= ",'{$sem}'";
foreach ($value as $qtr) {
$_openSIS['GetAllMP'][$mp][$marking_period_id] .= ",'{$qtr['MARKING_PERIOD_ID']}'";
}
}
$RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_semesters s WHERE NOT EXISTS (SELECT \'\' FROM school_quarters q WHERE q.SEMESTER_ID=s.MARKING_PERIOD_ID) AND SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
foreach ($RET as $value) {
$_openSIS['GetAllMP'][$mp][$marking_period_id] .= ",'{$value['MARKING_PERIOD_ID']}'";
}
break;
}
}
return $_openSIS['GetAllMP'][$mp][$marking_period_id];
}
示例2: foreach
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) {
$total /= $total_percent;
}
$grade = $grades_RET[_makeLetterGrade($total, 0, 0, 'ID')][1];
if ($grade['GPA_VALUE'] == '0' || !$grade['GPA_VALUE']) {
示例3: foreach
foreach ($attendance_codes as $code) {
$extra['extra_header_left'] .= '<OPTION value=' . $code['ID'] . '>' . $code['TITLE'] . '</OPTION>';
}
$extra['extra_header_left'] .= '</SELECT></TD>';
$extra['extra_header_left'] .= '</TR><TR>';
$extra['extra_header_left'] .= '<TD><label><INPUT type="checkbox" name="elements[period_absences]" value="Y"> ' . _('Period-by-period absences') . '</label></TD>';
$extra['extra_header_left'] .= '<TD></TD>';
$extra['extra_header_left'] .= '</TR>';
$extra['extra_header_left'] .= '</TABLE></TD></TR>';
//modif Francois: get the title instead of the short marking period name
$mps_RET = DBGet(DBQuery("SELECT PARENT_ID,MARKING_PERIOD_ID,SHORT_NAME,TITLE FROM SCHOOL_MARKING_PERIODS WHERE MP='QTR' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY SORT_ORDER"), array(), array('PARENT_ID'));
$extra['extra_header_left'] .= '<TR><TD style="text-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><label><INPUT type="checkbox" name="mp_arr[]" value="' . $pro . '"> ' . GetMP($pro, 'TITLE') . '</label></TD>';
}
}
}
$extra['extra_header_left'] .= '<TD><label><INPUT type="checkbox" name="mp_arr[]" value="' . $qtr['MARKING_PERIOD_ID'] . '"> ' . $qtr['TITLE'] . '</label></TD>';
}
if (GetMP($sem, 'DOES_GRADES') == 'Y') {
$extra['extra_header_left'] .= '<TD><label><INPUT type="checkbox" name="mp_arr[]" value="' . $sem . '"> ' . GetMP($sem, 'TITLE') . '</label></TD>';
}
$extra['extra_header_left'] .= '</TR>';
}
示例4: unset
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#**************************************************************************
if (!$_REQUEST['modfunc'] && $_REQUEST['search_modfunc'] != 'list') {
unset($_SESSION['MassSchedule.php']);
}
if ($_REQUEST['modfunc'] == 'save') {
if ($_SESSION['MassSchedule.php']) {
$start_date = $_REQUEST['day'] . '-' . $_REQUEST['month'] . '-' . $_REQUEST['year'];
if (!VerifyDate($start_date)) {
BackPrompt('The date you entered is not valid');
}
$course_mp = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $_SESSION['MassSchedule.php']['course_period_id'] . "'"));
$course_mp = $course_mp[1]['MARKING_PERIOD_ID'];
$course_mp_table = GetMPTable(GetMP($course_mp, 'TABLE'));
if ($course_mp_table != 'FY' && $course_mp != $_REQUEST['marking_period_id'] && strpos(GetChildrenMP($course_mp_table, $course_mp), "'" . $_REQUEST['marking_period_id'] . "'") === false) {
// BackPrompt("You cannot schedule a student into that course during the marking period that you chose. This course meets on ".GetMP($course_mp).'.');
ShowErr("You cannot schedule a student into that course during the marking period that you chose. This course meets on " . GetMP($course_mp) . '.');
for_error();
}
$mp_table = GetMPTable(GetMP($_REQUEST['marking_period_id'], 'TABLE'));
$current_RET = DBGet(DBQuery("SELECT STUDENT_ID FROM SCHEDULE WHERE COURSE_PERIOD_ID='" . $_SESSION['MassSchedule.php']['course_period_id'] . "' AND SYEAR='" . UserSyear() . "' AND (('" . $start_date . "' BETWEEN START_DATE AND END_DATE OR END_DATE IS NULL) AND '" . $start_date . "'>=START_DATE)"), array(), array('STUDENT_ID'));
$request_RET = DBGet(DBQuery("SELECT STUDENT_ID FROM SCHEDULE_REQUESTS WHERE WITH_PERIOD_ID=(SELECT PERIOD_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $_SESSION['MassSchedule.php']['course_period_id'] . "') AND SYEAR='" . UserSyear() . "' AND COURSE_ID='" . $_SESSION['MassSchedule.php']['course_id'] . "'"), array(), array('STUDENT_ID'));
$check_seats = DBGet(DBQuery("SELECT (TOTAL_SEATS - FILLED_SEATS) AS AVAILABLE_SEATS FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $_SESSION['MassSchedule.php']['course_period_id'] . "'"));
$check_seats = $check_seats[1]['AVAILABLE_SEATS'];
$no_seat = 'There is no available seats in this period.<br>Please increase the "Total Seats" from Scheduling>>Setup>Courses';
foreach ($_REQUEST['student'] as $student_id => $yes) {
if (!$current_RET[$student_id]) {
if (!$request_RET[$student_id]) {
$sql = "INSERT INTO SCHEDULE (SYEAR,SCHOOL_ID,STUDENT_ID,COURSE_ID,COURSE_PERIOD_ID,MP,MARKING_PERIOD_ID,START_DATE)\n\t\t\t\t\t\t\t\tvalues('" . UserSyear() . "','" . UserSchool() . "','" . $student_id . "','" . $_SESSION['MassSchedule.php']['course_id'] . "','" . $_SESSION['MassSchedule.php']['course_period_id'] . "','" . $mp_table . "','" . $_REQUEST['marking_period_id'] . "','" . $start_date . "')";
DBQuery($sql);
示例5: foreach
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 'ProgramFunctions/_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 ON (s.STUDENT_ID,gt.ASSIGNMENT_TYPE_ID) s.STUDENT_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 DISTINCT ON (s.STUDENT_ID) 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) {
$total /= $total_percent;
}
$grade = $grades_RET[_makeLetterGrade($total, 0, 0, 'ID')][1];
if ($grade['GPA_VALUE'] == '0' || !$grade['GPA_VALUE']) {
示例6: DBGet
$mp_RET = DBGet(DBQuery('SELECT MP FROM course_periods WHERE course_period_id = \'' . UserCoursePeriod() . '\''));
if ($mp_RET[1]['MP'] == 'SEM') {
$sem = GetParentMP('SEM', UserMP());
$pros = GetChildrenMP('PRO', UserMP());
}
if ($mp_RET[1]['MP'] == 'FY') {
$sem = GetParentMP('SEM', UserMP());
if ($sem) {
$fy = GetParentMP('FY', $sem);
} else {
$fy = GetParentMP('FY', UserMP());
}
$pros = GetChildrenMP('PRO', UserMP());
}
if ($mp_RET[1]['MP'] == 'QTR') {
$pros = GetChildrenMP('PRO', UserMP());
}
// if the UserMP has been changed, the REQUESTed MP may not work
if (!$_REQUEST['mp'] || strpos($str = "'" . UserMP() . "','" . $sem . "','" . $fy . "'," . $pros, "'" . ltrim($_REQUEST['mp'], 'E') . "'") === false) {
$_REQUEST['mp'] = UserMP();
}
$course_period_id = UserCoursePeriod();
if ($course_period_id) {
$course_RET = DBGet(DBQuery('SELECT cp.COURSE_ID,c.TITLE as COURSE_NAME, cp.TITLE, cp.GRADE_SCALE_ID,cp.STANDARD_SCALE_ID,CREDIT(cp.COURSE_PERIOD_ID,\'' . $_REQUEST['mp'] . '\') AS CREDITS,cp.COURSE_WEIGHT,cp.USE_STANDARDS FROM course_periods cp, courses c WHERE cp.COURSE_ID = c.COURSE_ID AND cp.COURSE_PERIOD_ID=\'' . $course_period_id . '\''));
}
//sg
//if(!$course_RET[1]['GRADE_SCALE_ID'])
if (!$course_RET[1]['GRADE_SCALE_ID'] && !$_REQUEST['include_inactive']) {
echo ErrorMessage(array('You cannot enter grades for this course.'), 'error');
$not_graded = true;
$_REQUEST['use_percents'] = true;
示例7: unset
<?php
if (!$_REQUEST['modfunc'] && $_REQUEST['search_modfunc'] != 'list') {
unset($_SESSION['MassDrops.php']);
}
if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc'] == 'save') {
if ($_SESSION['MassDrops.php']) {
if (is_array($_REQUEST['student'])) {
$END_DATE = $_REQUEST['day'] . '-' . $_REQUEST['month'] . '-' . $_REQUEST['year'];
if (VerifyDate($END_DATE)) {
$course_mp = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $_SESSION['MassDrops.php']['course_period_id'] . "'"));
$course_mp = $course_mp[1]['MARKING_PERIOD_ID'];
$course_mp_table = GetMP($course_mp, 'MP');
if ($course_mp_table == 'FY' || $course_mp == $_REQUEST['marking_period_id'] || mb_strpos(GetChildrenMP($course_mp_table, $course_mp), "'" . $_REQUEST['marking_period_id'] . "'") !== false) {
$mp_table = GetMP($_REQUEST['marking_period_id'], 'MP');
//$current_RET = DBGet(DBQuery("SELECT STUDENT_ID FROM SCHEDULE WHERE COURSE_PERIOD_ID='".$_SESSION['MassDrops.php']['course_period_id']."' AND SYEAR='".UserSyear()."' AND (('".$start_date."' BETWEEN START_DATE AND END_DATE OR END_DATE IS NULL) AND '".$start_date."'>=START_DATE)"),array(),array('STUDENT_ID'));
$current_RET = DBGet(DBQuery("SELECT STUDENT_ID FROM SCHEDULE WHERE COURSE_PERIOD_ID='" . $_SESSION['MassDrops.php']['course_period_id'] . "' "));
foreach ($_REQUEST['student'] as $student_id => $yes) {
if ($current_RET[$student_id]) {
DBQuery("UPDATE SCHEDULE SET END_DATE='" . $END_DATE . "' WHERE STUDENT_ID='" . $student_id . "' AND COURSE_PERIOD_ID='" . $_SESSION['MassDrops.php']['course_period_id'] . "'");
//echo "<b>student:</b> $student_id ";
//$start_end_RET = DBGet(DBQuery("SELECT START_DATE,END_DATE FROM SCHEDULE WHERE STUDENT_ID='".UserStudentID()."' AND COURSE_PERIOD_ID='".$course_period_id."' AND END_DATE<START_DATE"));
$start_end_RET = DBGet(DBQuery("SELECT START_DATE,END_DATE FROM SCHEDULE WHERE STUDENT_ID='" . $student_id . "' AND COURSE_PERIOD_ID='" . $_SESSION['MassDrops.php']['course_period_id'] . "' AND END_DATE<START_DATE"));
if (count($start_end_RET)) {
//DBQuery("DELETE FROM SCHEDULE WHERE STUDENT_ID='".UserStudentID()."' AND END_DATE IS NOT NULL AND END_DATE<START_DATE");
DBQuery("DELETE FROM SCHEDULE WHERE STUDENT_ID='" . $student_id . "' AND COURSE_PERIOD_ID='" . $_SESSION['MassDrops.php']['course_period_id'] . "'");
}
//modif Francois: Moodle integrator
$moodleError .= Moodle($_REQUEST['modname'], 'core_role_unassign_roles');
}
}
示例8: str_replace
if ($mps[$mp][1]['GRADE_TITLE']) {
break;
}
}
//if(!$mps[$mp])
$course_periods[$index][$mp][1]['STUDENT_MP_COMMENT'] = str_replace("\r", '`', str_replace('(', '{', str_replace(')', '}', $course_periods[$index][$mp][1]['STUDENT_MP_COMMENT'])));
$course_periods[$index][$mp][1]['STUDENT_MP_COMMENT'] = wordwrap($course_periods[$index][$mp][1]['STUDENT_MP_COMMENT'], 59, "`");
$comments = explode('`', $course_periods[$index][$mp][1]['STUDENT_MP_COMMENT']);
for ($c = 0; $c <= count($comments); $c++) {
$this_PDF = str_replace('/T(values[student_mp_comments][' . GetMP($mp, 'SORT_ORDER') . '][' . ($c + 1) . '])', "/T(values[{$student_count}][student_mp_comments][" . GetMP($mp, 'SORT_ORDER') . '][' . ($c + 1) . '])', $this_PDF);
$this_PDF = str_replace('(default[student_mp_comments][' . GetMP($mp, 'SORT_ORDER') . '][' . ($c + 1) . '])', '(' . $comments[$c] . ')', $this_PDF);
}
for (; $c <= 19; $c++) {
$this_PDF = str_replace('(default[student_mp_comments][' . GetMP($mp, 'SORT_ORDER') . '][' . ($c + 1) . '])', '( )', $this_PDF);
}
$qtr = str_replace("'", '', GetChildrenMP('SEM', $mp));
if (strpos(',', $qtr) !== false) {
$qtr = substr($qtr, strpos(',', $qtr));
}
foreach ($attendance_codes as $attendance_code) {
$attendance_code = $attendance_code['SHORT_NAME'];
$value = $attendance_RET[$student_id][$qtr][$attendance_code];
$this_PDF = str_replace('/T(values[ac][' . $attendance_code . '][' . GetMP($mp, 'SORT_ORDER') . '])', "/T(values[{$student_count}][ac][" . $attendance_code . '][1])', $this_PDF);
$this_PDF = str_replace('(default[ac][' . $attendance_code . '][' . GetMP($mp, 'SORT_ORDER') . '])', '( ' . count($value) . ' )', $this_PDF);
}
$this_PDF = str_replace('/T(values[abs][' . GetMP($mp, 'SORT_ORDER') . '])', "/T(values[{$student_count}][abs][1])", $this_PDF);
$this_PDF = str_replace('(default[abs][' . GetMP($mp, 'SORT_ORDER') . '])', '( ' . count($attendance_day_RET[$student_id][$qtr]) . ' )', $this_PDF);
}
foreach ($_REQUEST['mp_arr'] as $mp) {
$columns[$mp] = GetMP($mp, $mp_TITLE);
}
示例9: Widgets
//.........这里部分代码省略.........
$extra['search'] .= '<TR><TD style="text-align:right; width:120px:">' . _('Course') . "</TD><TD><DIV id=course_div></DIV> <A HREF=# onclick='window.open(\"Modules.php?modname=misc/ChooseCourse.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'>" . _('Choose') . '</A></TD></TR>';
}
break;
case 'request':
if ($RosarioModules['Scheduling'] && User('PROFILE') == 'admin') {
// PART OF THIS IS DUPLICATED IN PrintRequests.php
if ($_REQUEST['request_course_id']) {
$course = DBGet(DBQuery("SELECT c.TITLE FROM COURSES c WHERE c.COURSE_ID='" . $_REQUEST['request_course_id'] . "'"));
if (!$_REQUEST['not_request_course']) {
$extra['FROM'] .= ",SCHEDULE_REQUESTS sr";
$extra['WHERE'] .= " AND sr.STUDENT_ID=s.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.SCHOOL_ID=ssm.SCHOOL_ID AND sr.COURSE_ID='" . $_REQUEST['request_course_id'] . "' ";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<b>' . Localize('colon', _('Request')) . ' </b>' . $course[1]['TITLE'] . '<BR />';
}
} else {
$extra['WHERE'] .= " AND NOT EXISTS (SELECT '' FROM SCHEDULE_REQUESTS sr WHERE sr.STUDENT_ID=ssm.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.COURSE_ID='" . $_REQUEST['request_course_id'] . "' ) ";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<b>' . Localize('colon', _('Missing Request')) . ' </b>' . $course[1]['TITLE'] . '<BR />';
}
}
}
$extra['search'] .= '<TR><TD style="text-align:right; width:120px">' . _('Request') . '</TD><TD><DIV id="request_div"></DIV> <A HREF="#" onclick=\'window.open("Modules.php?modname=misc/ChooseRequest.php","","scrollbars=yes,resizable=yes,width=800,height=400");\'>' . _('Choose') . '</A></TD></TR>';
}
break;
case 'absences':
if ($RosarioModules['Attendance']) {
if (is_numeric($_REQUEST['absences_low']) && is_numeric($_REQUEST['absences_high'])) {
if ($_REQUEST['absences_low'] > $_REQUEST['absences_high']) {
$temp = $_REQUEST['absences_high'];
$_REQUEST['absences_high'] = $_REQUEST['absences_low'];
$_REQUEST['absences_low'] = $temp;
}
if ($_REQUEST['absences_low'] == $_REQUEST['absences_high']) {
$extra['WHERE'] .= " AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM ATTENDANCE_DAY ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (" . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ")) = '{$_REQUEST['absences_low']}'";
} else {
$extra['WHERE'] .= " AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM ATTENDANCE_DAY ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (" . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ")) BETWEEN '{$_REQUEST['absences_low']}' AND '{$_REQUEST['absences_high']}'";
}
switch ($_REQUEST['absences_term']) {
case 'FY':
$term = _('this school year to date');
break;
case 'SEM':
$term = _('this semester to date');
break;
case 'QTR':
$term = _('this marking period to date');
break;
}
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<b>' . _('Days Absent') . ' ' . $term . ' ' . _('Between') . ' </b>' . $_REQUEST['absences_low'] . ' & ' . $_REQUEST['absences_high'] . '<BR />';
}
}
//modif Francois: add <label> on radio
$extra['search'] .= '<TR><TD style="text-align:right; width:120px:">' . _('Days Absent') . '<BR /><label><INPUT type="radio" name="absences_term" value="FY" checked /> ' . _('YTD') . '</label> <label><INPUT type="radio" name="absences_term" value="SEM"> ' . GetMP(GetParentMP('SEM', UserMP()), 'SHORT_NAME') . '</label> <label><INPUT type="radio" name="absences_term" value="QTR"> ' . GetMP(UserMP(), 'SHORT_NAME') . '</label></TD><TD>' . _('Between') . ' <INPUT type="text" name="absences_low" size="3" maxlength="5"> & <INPUT type="text" name="absences_high" size="3" maxlength="5"></TD></TR>';
}
break;
case 'gpa':
if ($RosarioModules['Grades']) {
if (is_numeric($_REQUEST['gpa_low']) && is_numeric($_REQUEST['gpa_high'])) {
if ($_REQUEST['gpa_low'] > $_REQUEST['gpa_high']) {
$temp = $_REQUEST['gpa_high'];
$_REQUEST['gpa_high'] = $_REQUEST['gpa_low'];
$_REQUEST['gpa_low'] = $temp;
}
if ($_REQUEST['list_gpa']) {
//modif Francois: remove STUDENT_GPA_CALCULATED table
示例10: calcSeats1
function calcSeats1($period, &$total_seats, &$filled_seats)
{
if ($_REQUEST['include_child_mps']) {
$mps = GetChildrenMP($period['MP'], $period['MARKING_PERIOD_ID']);
if ($period['MP'] == 'FY' || $period['MP'] == 'SEM') {
$mps = "'{$period['MARKING_PERIOD_ID']}'" . ($mps ? ',' . $mps : '');
}
} else {
$mps = "'" . $period['MARKING_PERIOD_ID'] . "'";
}
foreach (explode(',', $mps) as $mp) {
$mp = trim($mp, "'");
$seats = DBGet(DBQuery("SELECT max((SELECT count(1) FROM SCHEDULE ss JOIN STUDENT_ENROLLMENT sem ON (sem.STUDENT_ID=ss.STUDENT_ID AND sem.SYEAR=ss.SYEAR) WHERE ss.COURSE_PERIOD_ID='{$period['COURSE_PERIOD_ID']}' AND (ss.MARKING_PERIOD_ID='{$mp}' OR ss.MARKING_PERIOD_ID IN (" . GetAllMP(GetMP($mp, 'MP'), $mp) . ")) AND (ac.SCHOOL_DATE>=ss.START_DATE AND (ss.END_DATE IS NULL OR ac.SCHOOL_DATE<=ss.END_DATE)) AND (ac.SCHOOL_DATE>=sem.START_DATE AND (sem.END_DATE IS NULL OR ac.SCHOOL_DATE<=sem.END_DATE)))) AS FILLED_SEATS FROM ATTENDANCE_CALENDAR ac WHERE ac.CALENDAR_ID='{$period['CALENDAR_ID']}' AND ac.SCHOOL_DATE BETWEEN " . db_case(array("(CURRENT_DATE>'" . GetMP($mp, 'END_DATE') . "')", 'TRUE', "'" . GetMP($mp, 'START_DATE') . "'", 'CURRENT_DATE')) . " AND '" . GetMP($mp, 'END_DATE') . "'"));
if ($_REQUEST['include_child_mps']) {
if ($total_seats[$mp] !== false) {
if ($period['TOTAL_SEATS']) {
$total_seats[$mp] += $period['TOTAL_SEATS'];
} else {
$total_seats[$mp] = false;
}
}
if ($filled_seats !== false) {
if ($seats[1]['FILLED_SEATS'] != '') {
$filled_seats[$mp] += $seats[1]['FILLED_SEATS'];
} else {
$filled_seats[$mp] = false;
}
}
} else {
if ($total_seats !== false) {
if ($period['TOTAL_SEATS']) {
$total_seats += $period['TOTAL_SEATS'];
} else {
$total_seats = false;
}
}
if ($filled_seats !== false) {
if ($seats[1]['FILLED_SEATS'] != '') {
$filled_seats += $seats[1]['FILLED_SEATS'];
} else {
$filled_seats = false;
}
}
}
}
}
示例11: GetAllMP
function GetAllMP($mp, $marking_period_id = '0')
{
global $_ROSARIO;
if ($marking_period_id == 0) {
// there should be exactly one fy marking period
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
$marking_period_id = $RET[1]['MARKING_PERIOD_ID'];
$mp = 'FY';
} elseif (!$mp) {
$mp = GetMP($marking_period_id, 'MP');
}
if (!isset($_ROSARIO['GetAllMP'][$mp])) {
switch ($mp) {
case 'PRO':
// there should be exactly one fy marking period
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
$fy = $RET[1]['MARKING_PERIOD_ID'];
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,PARENT_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='QTR' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
foreach ($RET as $value) {
$_ROSARIO['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = "'{$fy}','{$value['PARENT_ID']}','{$value['MARKING_PERIOD_ID']}'";
$_ROSARIO['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] .= ',' . GetChildrenMP($mp, $value['MARKING_PERIOD_ID']);
if (mb_substr($_ROSARIO['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']], -1) == ',') {
$_ROSARIO['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = mb_substr($_ROSARIO['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']], 0, -1);
}
}
break;
case 'QTR':
// there should be exactly one fy marking period
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
$fy = $RET[1]['MARKING_PERIOD_ID'];
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,PARENT_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='QTR' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
foreach ($RET as $value) {
$_ROSARIO['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = "'{$fy}','{$value['PARENT_ID']}','{$value['MARKING_PERIOD_ID']}'";
}
break;
case 'SEM':
// there should be exactly one fy marking period
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
$fy = $RET[1]['MARKING_PERIOD_ID'];
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,PARENT_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='QTR' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"), array(), array('PARENT_ID'));
foreach ($RET as $sem => $value) {
$_ROSARIO['GetAllMP'][$mp][$sem] = "'{$fy}','{$sem}'";
foreach ($value as $qtr) {
$_ROSARIO['GetAllMP'][$mp][$sem] .= ",'{$qtr['MARKING_PERIOD_ID']}'";
}
}
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS s WHERE MP='SEM' AND NOT EXISTS (SELECT '' FROM SCHOOL_MARKING_PERIODS q WHERE q.MP='QTR' AND q.PARENT_ID=s.MARKING_PERIOD_ID) AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
foreach ($RET as $value) {
$_ROSARIO['GetAllMP'][$mp][$value['MARKING_PERIOD_ID']] = "'{$fy}','{$value['MARKING_PERIOD_ID']}'";
}
break;
case 'FY':
// there should be exactly one fy marking period which better be $marking_period_id
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,PARENT_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='QTR' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"), array(), array('PARENT_ID'));
$_ROSARIO['GetAllMP'][$mp][$marking_period_id] = "'{$marking_period_id}'";
foreach ($RET as $sem => $value) {
$_ROSARIO['GetAllMP'][$mp][$marking_period_id] .= ",'{$sem}'";
foreach ($value as $qtr) {
$_ROSARIO['GetAllMP'][$mp][$marking_period_id] .= ",'{$qtr['MARKING_PERIOD_ID']}'";
}
}
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS s WHERE MP='SEM' AND NOT EXISTS (SELECT '' FROM SCHOOL_MARKING_PERIODS q WHERE q.MP='QTR' AND q.PARENT_ID=s.MARKING_PERIOD_ID) AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
foreach ($RET as $value) {
$_ROSARIO['GetAllMP'][$mp][$marking_period_id] .= ",'{$value['MARKING_PERIOD_ID']}'";
}
break;
}
}
return $_ROSARIO['GetAllMP'][$mp][$marking_period_id];
}
示例12: Widgets
function Widgets($item, $allow_widget = false)
{
global $extra, $_openSIS;
if (!is_array($extra['functions'])) {
$extra['functions'] = array();
}
if (User('PROFILE') == 'admin' || User('PROFILE') == 'teacher' || $allow_widget) {
switch ($item) {
case 'course':
if (User('PROFILE') == 'admin' || $allow_widget) {
if ($_REQUEST['w_course_period_id']) {
if ($_REQUEST['w_course_period_id_which'] == 'course') {
$course = DBGet(DBQuery('SELECT c.TITLE AS COURSE_TITLE,cp.TITLE,cp.COURSE_ID FROM course_periods cp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.COURSE_PERIOD_ID=\'' . $_REQUEST['w_course_period_id'] . '\''));
$extra['FROM'] .= ',schedule w_ss';
$extra['WHERE'] .= ' AND w_ss.STUDENT_ID=s.STUDENT_ID AND w_ss.SYEAR=ssm.SYEAR AND w_ss.SCHOOL_ID=ssm.SCHOOL_ID AND w_ss.COURSE_ID=\'' . $course[1]['COURSE_ID'] . '\' AND (\'' . DBDate() . '\' BETWEEN w_ss.START_DATE AND w_ss.END_DATE OR w_ss.END_DATE IS NULL)';
$_openSIS['SearchTerms'] .= '<font color=gray><b>Course: </b></font>' . $course[1]['COURSE_TITLE'] . '<BR>';
} else {
$extra['FROM'] .= ',schedule w_ss';
$extra['WHERE'] .= ' AND w_ss.STUDENT_ID=s.STUDENT_ID AND w_ss.SYEAR=ssm.SYEAR AND w_ss.SCHOOL_ID=ssm.SCHOOL_ID AND w_ss.COURSE_PERIOD_ID=\'' . $_REQUEST['w_course_period_id'] . '\' AND (\'' . DBDate() . '\' BETWEEN w_ss.START_DATE AND w_ss.END_DATE OR w_ss.END_DATE IS NULL)';
$course = DBGet(DBQuery('SELECT c.TITLE AS COURSE_TITLE,cp.TITLE,cp.COURSE_ID FROM course_periods cp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.COURSE_PERIOD_ID=\'' . $_REQUEST['w_course_period_id'] . '\''));
$_openSIS['SearchTerms'] .= '<font color=gray><b>Course Period: </b></font>' . $course[1]['COURSE_TITLE'] . ': ' . $course[1]['TITLE'] . '<BR>';
}
}
$extra['search'] .= "<TR><TD align=right width=120>Course</TD><TD><DIV id=course_div></DIV> <A HREF=# onclick='window.open(\"ForWindow.php?modname=miscellaneous/ChooseCourse.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>Choose</SMALL></A></TD></TR>";
}
break;
case 'request':
if (User('PROFILE') == 'admin' || $allow_widget) {
// PART OF THIS IS DUPLICATED IN PrintRequests.php
if ($_REQUEST['request_course_id']) {
$course = DBGet(DBQuery('SELECT c.TITLE FROM courses c WHERE c.COURSE_ID=\'' . $_REQUEST['request_course_id'] . '\''));
if (!$_REQUEST['not_request_course']) {
$extra['FROM'] .= ',schedule_requests sr';
$extra['WHERE'] .= ' AND sr.STUDENT_ID=s.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.SCHOOL_ID=ssm.SCHOOL_ID AND sr.COURSE_ID=\'' . $_REQUEST['request_course_id'] . '\'';
$_openSIS['SearchTerms'] .= '<font color=gray><b>Request: </b></font>' . $course[1]['TITLE'] . '<BR>';
} else {
$extra['WHERE'] .= ' AND NOT EXISTS (SELECT \'\' FROM schedule_requests sr WHERE sr.STUDENT_ID=ssm.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.COURSE_ID=\'' . $_REQUEST['request_course_id'] . '\') ';
$_openSIS['SearchTerms'] .= '<font color=gray><b>Missing Request: </b></font>' . $course[1]['TITLE'] . '<BR>';
}
}
$extra['search'] .= "<TR><TD align=right width=120>Request</TD><TD><DIV id=request_div></DIV> <A HREF=# onclick='window.open(\"ForWindow.php?modname=miscellaneous/ChooseRequest.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>Choose</SMALL></A></TD></TR>";
}
break;
case 'absences':
if (is_numeric($_REQUEST['absences_low']) && is_numeric($_REQUEST['absences_high'])) {
if ($_REQUEST['absences_low'] > $_REQUEST['absences_high']) {
$temp = $_REQUEST['absences_high'];
$_REQUEST['absences_high'] = $_REQUEST['absences_low'];
$_REQUEST['absences_low'] = $temp;
}
if ($_REQUEST['absences_low'] == $_REQUEST['absences_high']) {
$extra['WHERE'] .= ' AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM attendance_day ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (' . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ')) = \'' . $_REQUEST[absences_low] . '\'';
} else {
$extra['WHERE'] .= ' AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM attendance_day ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (' . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ')) BETWEEN \'' . $_REQUEST[absences_low] . '\' AND \'' . $_REQUEST[absences_high] . '\'';
}
switch ($_REQUEST['absences_term']) {
case 'FY':
$term = 'this school year to date';
break;
case 'SEM':
$term = 'this semester to date';
break;
case 'QTR':
$term = 'this marking period to date';
break;
}
$_openSIS['SearchTerms'] .= '<font color=gray><b>Days Absent ' . $term . ' between: </b></font>' . $_REQUEST['absences_low'] . ' & ' . $_REQUEST['absences_high'] . '<BR>';
}
$extra['search'] .= "<TR><TD align=right width=120>Days Absent<BR><INPUT type=radio name=absences_term value=FY checked>YTD<INPUT type=radio name=absences_term value=SEM>" . GetMP(GetParentMP('SEM', UserMP()), 'SHORT_NAME') . "<INPUT type=radio name=absences_term value=QTR>" . GetMP(UserMP(), 'SHORT_NAME') . "</TD><TD>Between <INPUT type=text name=absences_low size=3 class=cell_small maxlength=5> & <INPUT type=text name=absences_high size=3 maxlength=5 class=cell_small></TD></TR>";
break;
case 'gpa':
if (is_numeric($_REQUEST['gpa_low']) && is_numeric($_REQUEST['gpa_high'])) {
if ($_REQUEST['gpa_low'] > $_REQUEST['gpa_high']) {
$temp = $_REQUEST['gpa_high'];
$_REQUEST['gpa_high'] = $_REQUEST['gpa_low'];
$_REQUEST['gpa_low'] = $temp;
}
if ($_REQUEST['list_gpa']) {
$extra['SELECT'] .= ',sgc.GPA,sgc.weighted_gpa, sgc.unweighted_gpa';
$extra['columns_after']['GPA'] = 'GPA';
}
if (strpos($extra['FROM'], 'student_gpa_calculated sgc') === false) {
$extra['FROM'] .= ',student_gpa_calculated sgc';
$extra['WHERE'] .= ' AND sgc.STUDENT_ID=s.STUDENT_ID AND sgc.MARKING_PERIOD_ID=\'' . $_REQUEST['gpa_term'] . '\'';
}
$extra['WHERE'] .= ' AND sgc.GPA BETWEEN \'' . $_REQUEST[gpa_low] . '\' AND \'' . $_REQUEST[gpa_high] . '\' AND sgc.MARKING_PERIOD_ID=\'' . $_REQUEST['gpa_term'] . '\'';
$_openSIS['SearchTerms'] .= '<font color=gray><b>' . ($_REQUEST['gpa_weighted'] == 'Y' ? 'Weighted ' : '') . 'GPA between: </b></font>' . $_REQUEST['gpa_low'] . ' & ' . $_REQUEST['gpa_high'] . '<BR>';
}
if (is_numeric($_REQUEST['cgpa_low']) && is_numeric($_REQUEST['cgpa_high'])) {
if ($_REQUEST['cgpa_low'] > $_REQUEST['cgpa_high']) {
$temp = $_REQUEST['cgpa_high'];
$_REQUEST['cgpa_high'] = $_REQUEST['cgpa_low'];
$_REQUEST['cgpa_low'] = $temp;
}
if ($_REQUEST['cgpa']) {
$extra['SELECT'] .= ',sgr.CGPA';
$extra['columns_after']['CGPA'] = 'CGPA';
}
//
if (strpos($extra['FROM'], 'student_gpa_runnings sgr') === false) {
//.........这里部分代码省略.........
示例13: Widgets
function Widgets($item, $allow_widget = false)
{
global $extra, $_openSIS;
if (!is_array($extra['functions'])) {
$extra['functions'] = array();
}
if (User('PROFILE') == 'admin' || User('PROFILE') == 'teacher' || $allow_widget) {
switch ($item) {
case 'course':
if (User('PROFILE') == 'admin' || $allow_widget) {
if ($_REQUEST['w_course_period_id']) {
if ($_REQUEST['w_course_period_id_which'] == 'course') {
$course = DBGet(DBQuery("SELECT c.TITLE AS COURSE_TITLE,cp.TITLE,cp.COURSE_ID FROM COURSE_PERIODS cp,COURSES c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.COURSE_PERIOD_ID='" . $_REQUEST['w_course_period_id'] . "'"));
$extra['FROM'] .= ",SCHEDULE w_ss";
$extra['WHERE'] .= " AND w_ss.STUDENT_ID=s.STUDENT_ID AND w_ss.SYEAR=ssm.SYEAR AND w_ss.SCHOOL_ID=ssm.SCHOOL_ID AND w_ss.COURSE_ID='" . $course[1]['COURSE_ID'] . "' AND ('" . DBDate() . "' BETWEEN w_ss.START_DATE AND w_ss.END_DATE OR w_ss.END_DATE IS NULL)";
$_openSIS['SearchTerms'] .= '<font color=gray><b>Course: </b></font>' . $course[1]['COURSE_TITLE'] . '<BR>';
} else {
$extra['FROM'] .= ",SCHEDULE w_ss";
$extra['WHERE'] .= " AND w_ss.STUDENT_ID=s.STUDENT_ID AND w_ss.SYEAR=ssm.SYEAR AND w_ss.SCHOOL_ID=ssm.SCHOOL_ID AND w_ss.COURSE_PERIOD_ID='" . $_REQUEST['w_course_period_id'] . "' AND ('" . DBDate() . "' BETWEEN w_ss.START_DATE AND w_ss.END_DATE OR w_ss.END_DATE IS NULL)";
$course = DBGet(DBQuery("SELECT c.TITLE AS COURSE_TITLE,cp.TITLE,cp.COURSE_ID FROM COURSE_PERIODS cp,COURSES c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.COURSE_PERIOD_ID='" . $_REQUEST['w_course_period_id'] . "'"));
$_openSIS['SearchTerms'] .= '<font color=gray><b>Course Period: </b></font>' . $course[1]['COURSE_TITLE'] . ': ' . $course[1]['TITLE'] . '<BR>';
}
}
# $extra['search'] .= "<TR><TD align=right width=120>Course</TD><TD><DIV id=course_div></DIV> <A HREF=# onclick='window.open(\"Modules.php?modname=misc/ChooseCourse.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>Choose</SMALL></A></TD></TR>";
$extra['search'] .= "<TR><TD align=right width=120>Course</TD><TD><DIV id=course_div></DIV> <A HREF=# onclick='window.open(\"for_window.php?modname=misc/ChooseCourse.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>Choose</SMALL></A></TD></TR>";
}
break;
case 'request':
if (User('PROFILE') == 'admin' || $allow_widget) {
// PART OF THIS IS DUPLICATED IN PrintRequests.php
if ($_REQUEST['request_course_id']) {
$course = DBGet(DBQuery("SELECT c.TITLE FROM COURSES c WHERE c.COURSE_ID='" . $_REQUEST['request_course_id'] . "'"));
if (!$_REQUEST['not_request_course']) {
$extra['FROM'] .= ",SCHEDULE_REQUESTS sr";
$extra['WHERE'] .= " AND sr.STUDENT_ID=s.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.SCHOOL_ID=ssm.SCHOOL_ID AND sr.COURSE_ID='" . $_REQUEST['request_course_id'] . "'";
//"' AND sr.COURSE_WEIGHT='".$_REQUEST['request_course_weight']."'";
$_openSIS['SearchTerms'] .= '<font color=gray><b>Request: </b></font>' . $course[1]['TITLE'] . '<BR>';
//.' - '.$_REQUEST['request_course_weight'].'<BR>';
} else {
$extra['WHERE'] .= " AND NOT EXISTS (SELECT '' FROM SCHEDULE_REQUESTS sr WHERE sr.STUDENT_ID=ssm.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.COURSE_ID='" . $_REQUEST['request_course_id'] . "') ";
//."' AND sr.COURSE_WEIGHT='".$_REQUEST['request_course_weight']."') ";
$_openSIS['SearchTerms'] .= '<font color=gray><b>Missing Request: </b></font>' . $course[1]['TITLE'] . '<BR>';
//.' - '.$_REQUEST['request_course_weight'].'<BR>';
}
}
# $extra['search'] .= "<TR><TD align=right width=120>Request</TD><TD><DIV id=request_div></DIV> <A HREF=# onclick='window.open(\"Modules.php?modname=misc/ChooseRequest.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>Choose</SMALL></A></TD></TR>";
$extra['search'] .= "<TR><TD align=right width=120>Request</TD><TD><DIV id=request_div></DIV> <A HREF=# onclick='window.open(\"for_window.php?modname=misc/ChooseRequest.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>Choose</SMALL></A></TD></TR>";
}
break;
case 'absences':
if (is_numeric($_REQUEST['absences_low']) && is_numeric($_REQUEST['absences_high'])) {
if ($_REQUEST['absences_low'] > $_REQUEST['absences_high']) {
$temp = $_REQUEST['absences_high'];
$_REQUEST['absences_high'] = $_REQUEST['absences_low'];
$_REQUEST['absences_low'] = $temp;
}
if ($_REQUEST['absences_low'] == $_REQUEST['absences_high']) {
$extra['WHERE'] .= " AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM ATTENDANCE_DAY ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (" . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ")) = '{$_REQUEST['absences_low']}'";
} else {
$extra['WHERE'] .= " AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM ATTENDANCE_DAY ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (" . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ")) BETWEEN '{$_REQUEST['absences_low']}' AND '{$_REQUEST['absences_high']}'";
}
switch ($_REQUEST['absences_term']) {
case 'FY':
$term = 'this school year to date';
break;
case 'SEM':
$term = 'this semester to date';
break;
case 'QTR':
$term = 'this marking period to date';
break;
}
$_openSIS['SearchTerms'] .= '<font color=gray><b>Days Absent ' . $term . ' between: </b></font>' . $_REQUEST['absences_low'] . ' & ' . $_REQUEST['absences_high'] . '<BR>';
}
$extra['search'] .= "<TR><TD align=right width=120>Days Absent<BR><INPUT type=radio name=absences_term value=FY checked>YTD<INPUT type=radio name=absences_term value=SEM>" . GetMP(GetParentMP('SEM', UserMP()), 'SHORT_NAME') . "<INPUT type=radio name=absences_term value=QTR>" . GetMP(UserMP(), 'SHORT_NAME') . "</TD><TD>Between <INPUT type=text name=absences_low size=3 class=cell_small maxlength=5> & <INPUT type=text name=absences_high size=3 maxlength=5 class=cell_small></TD></TR>";
break;
case 'gpa':
if (is_numeric($_REQUEST['gpa_low']) && is_numeric($_REQUEST['gpa_high'])) {
if ($_REQUEST['gpa_low'] > $_REQUEST['gpa_high']) {
$temp = $_REQUEST['gpa_high'];
$_REQUEST['gpa_high'] = $_REQUEST['gpa_low'];
$_REQUEST['gpa_low'] = $temp;
}
if ($_REQUEST['list_gpa']) {
$extra['SELECT'] .= ',sgc.WEIGHTED_GPA,sgc.UNWEIGHTED_GPA';
$extra['columns_after']['WEIGHTED_GPA'] = 'Weighted GPA';
$extra['columns_after']['UNWEIGHTED_GPA'] = 'Unweighted GPA';
}
if (strpos($extra['FROM'], 'STUDENT_GPA_CALCULATED sgc') === false) {
$extra['FROM'] .= ",STUDENT_GPA_CALCULATED sgc";
$extra['WHERE'] .= " AND sgc.STUDENT_ID=s.STUDENT_ID AND sgc.MARKING_PERIOD_ID='" . $_REQUEST['gpa_term'] . "'";
}
$extra['WHERE'] .= " AND sgc." . ($_REQUEST['weighted'] == 'Y' ? 'WEIGHTED_' : '') . "GPA BETWEEN '{$_REQUEST['gpa_low']}' AND '{$_REQUEST['gpa_high']}' AND sgc.MARKING_PERIOD_ID='" . $_REQUEST['gpa_term'] . "'";
$_openSIS['SearchTerms'] .= '<font color=gray><b>' . ($_REQUEST['gpa_weighted'] == 'Y' ? 'Weighted ' : '') . 'GPA between: </b></font>' . $_REQUEST['gpa_low'] . ' & ' . $_REQUEST['gpa_high'] . '<BR>';
}
$extra['search'] .= "<TR><TD align=right width=120>GPA<BR><INPUT type=checkbox name=gpa_weighted value=Y>Weighted<BR><INPUT type=radio name=gpa_term value=CUM checked>Cumulative<INPUT type=radio name=gpa_term value=" . GetParentMP('SEM', UserMP()) . ">" . GetMP(GetParentMP('SEM', UserMP()), 'SHORT_NAME') . "<INPUT type=radio name=gpa_term value=" . UserMP() . ">" . GetMP(UserMP(), 'SHORT_NAME') . "</TD><TD>Between<INPUT type=text name=gpa_low class=cell_small size=3 maxlength=5> & <INPUT type=text name=gpa_high size=3 maxlength=5 class=cell_small></TD></TR>";
break;
case 'class_rank':
if (is_numeric($_REQUEST['class_rank_low']) && is_numeric($_REQUEST['class_rank_high'])) {
if ($_REQUEST['class_rank_low'] > $_REQUEST['class_rank_high']) {
//.........这里部分代码省略.........
示例14: Widgets
//.........这里部分代码省略.........
$extra['search'] .= "<TR><TD align=right width=120>" . _('Course') . "</TD><TD><DIV id=course_div></DIV> <A HREF=# onclick='window.open(\"Modules.php?modname=misc/ChooseCourse.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>" . _('Choose') . "</SMALL></A></TD></TR>";
}
break;
case 'request':
if ($CentreModules['Scheduling'] && User('PROFILE') == 'admin') {
// PART OF THIS IS DUPLICATED IN PrintRequests.php
if ($_REQUEST['request_course_id']) {
$course = DBGet(DBQuery("SELECT c.TITLE FROM COURSES c WHERE c.COURSE_ID='" . $_REQUEST['request_course_id'] . "'"));
if (!$_REQUEST['not_request_course']) {
$extra['FROM'] .= ",SCHEDULE_REQUESTS sr";
$extra['WHERE'] .= " AND sr.STUDENT_ID=s.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.SCHOOL_ID=ssm.SCHOOL_ID AND sr.COURSE_ID='" . $_REQUEST['request_course_id'] . "' ";
if (!$extra['NoSearchTerms']) {
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('Request')) . ' </b></font>' . $course[1]['TITLE'] . '<BR>';
}
} else {
$extra['WHERE'] .= " AND NOT EXISTS (SELECT '' FROM SCHEDULE_REQUESTS sr WHERE sr.STUDENT_ID=ssm.STUDENT_ID AND sr.SYEAR=ssm.SYEAR AND sr.COURSE_ID='" . $_REQUEST['request_course_id'] . "' ) ";
if (!$extra['NoSearchTerms']) {
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('Missing Request')) . ' </b></font>' . $course[1]['TITLE'] . '<BR>';
}
}
}
$extra['search'] .= "<TR><TD align=right width=120>" . _('Request') . "</TD><TD><DIV id=request_div></DIV> <A HREF=# onclick='window.open(\"Modules.php?modname=misc/ChooseRequest.php\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'><SMALL>" . _('Choose') . "</SMALL></A></TD></TR>";
}
break;
case 'absences':
if ($CentreModules['Attendance']) {
if (is_numeric($_REQUEST['absences_low']) && is_numeric($_REQUEST['absences_high'])) {
if ($_REQUEST['absences_low'] > $_REQUEST['absences_high']) {
$temp = $_REQUEST['absences_high'];
$_REQUEST['absences_high'] = $_REQUEST['absences_low'];
$_REQUEST['absences_low'] = $temp;
}
if ($_REQUEST['absences_low'] == $_REQUEST['absences_high']) {
$extra['WHERE'] .= " AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM ATTENDANCE_DAY ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (" . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ")) = '{$_REQUEST['absences_low']}'";
} else {
$extra['WHERE'] .= " AND (SELECT sum(1-STATE_VALUE) AS STATE_VALUE FROM ATTENDANCE_DAY ad WHERE ssm.STUDENT_ID=ad.STUDENT_ID AND ad.SYEAR=ssm.SYEAR AND ad.MARKING_PERIOD_ID IN (" . GetChildrenMP($_REQUEST['absences_term'], UserMP()) . ")) BETWEEN '{$_REQUEST['absences_low']}' AND '{$_REQUEST['absences_high']}'";
}
switch ($_REQUEST['absences_term']) {
case 'FY':
$term = _('this school year to date');
break;
case 'SEM':
$term = _('this semester to date');
break;
case 'QTR':
$term = _('this marking period to date');
break;
}
if (!$extra['NoSearchTerms']) {
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . _('Days Absent') . ' ' . $term . ' ' . _('Between') . ' </b></font>' . $_REQUEST['absences_low'] . ' & ' . $_REQUEST['absences_high'] . '<BR>';
}
}
$extra['search'] .= "<TR><TD align=right width=120>" . _('Days Absent') . "<BR><INPUT type=radio name=absences_term value=FY checked><small>YTD</small><INPUT type=radio name=absences_term value=SEM><small>" . GetMP(GetParentMP('SEM', UserMP()), 'SHORT_NAME') . "</small><INPUT type=radio name=absences_term value=QTR><small>" . GetMP(UserMP(), 'SHORT_NAME') . "</small></TD><TD><small>" . _('Between') . "</small> <INPUT type=text name=absences_low size=3 maxlength=5> <small>&</small> <INPUT type=text name=absences_high size=3 maxlength=5></TD></TR>";
}
break;
case 'gpa':
if ($CentreModules['Grades']) {
if (is_numeric($_REQUEST['gpa_low']) && is_numeric($_REQUEST['gpa_high'])) {
if ($_REQUEST['gpa_low'] > $_REQUEST['gpa_high']) {
$temp = $_REQUEST['gpa_high'];
$_REQUEST['gpa_high'] = $_REQUEST['gpa_low'];
$_REQUEST['gpa_low'] = $temp;
}
if ($_REQUEST['list_gpa']) {
$extra['SELECT'] .= ',sgc.WEIGHTED_GPA,sgc.UNWEIGHTED_GPA';
$extra['columns_after']['WEIGHTED_GPA'] = _('Weighted GPA');
示例15: calcSeats1
function calcSeats1(&$periods, $date)
{
$date_time = strtotime($date);
foreach ($periods as $key => $period) {
if ($_REQUEST['include_child_mps']) {
$mps = GetChildrenMP($period['MP'], $period['MARKING_PERIOD_ID']);
if ($period['MP'] == 'FY' || $period['MP'] == 'SEM') {
$mps = "'{$period['MARKING_PERIOD_ID']}'" . ($mps ? ',' . $mps : '');
}
} else {
$mps = "'" . $period['MARKING_PERIOD_ID'] . "'";
}
$periods[$key]['AVAILABLE_SEATS'] = '';
foreach (explode(',', $mps) as $mp) {
$mp = trim($mp, "'");
if (strtotime(GetMP($mp, 'END_DATE')) >= $date_time) {
$link = "Modules.php?modname={$_REQUEST['modname']}&modfunc={$_REQUEST['modfunc']}&subject_id={$period['SUBJECT_ID']}&course_id={$period['COURSE_ID']}";
$link .= "&last_year={$_REQUEST['last_year']}&year_date={$_REQUEST['year_date']}&month_date={$_REQUEST['month_date']}&day_date={$_REQUEST['day_date']}";
$link .= "&course_period_id={$period['COURSE_PERIOD_ID']}&course_marking_period_id={$mp}";
if ($period['AVAILABLE_SEATS']) {
$seats = DBGet(DBQuery("SELECT max((SELECT count(1) FROM SCHEDULE ss JOIN STUDENT_ENROLLMENT sem ON (sem.STUDENT_ID=ss.STUDENT_ID AND sem.SYEAR=ss.SYEAR) WHERE ss.COURSE_PERIOD_ID='{$period['COURSE_PERIOD_ID']}' AND (ss.MARKING_PERIOD_ID='{$mp}' OR ss.MARKING_PERIOD_ID IN (" . GetAllMP(GetMP($mp, 'MP'), $mp) . ")) AND (ac.SCHOOL_DATE>=ss.START_DATE AND (ss.END_DATE IS NULL OR ac.SCHOOL_DATE<=ss.END_DATE)) AND (ac.SCHOOL_DATE>=sem.START_DATE AND (sem.END_DATE IS NULL OR ac.SCHOOL_DATE<=sem.END_DATE)))) AS FILLED_SEATS FROM ATTENDANCE_CALENDAR ac WHERE ac.CALENDAR_ID='{$period['CALENDAR_ID']}' AND ac.SCHOOL_DATE BETWEEN '{$date}' AND '" . GetMP($mp, 'END_DATE') . "'"));
if ($seats[1]['FILLED_SEATS'] != '') {
if ($_REQUEST['include_child_mps']) {
$periods[$key]['AVAILABLE_SEATS'] .= '<A href=' . $link . '>' . (GetMP($mp, 'SHORT_NAME') ? GetMP($mp, 'SHORT_NAME') : GetMP($mp)) . '<small>(' . ($period['AVAILABLE_SEATS'] - $seats[1]['FILLED_SEATS']) . ')</small></A> | ';
} else {
$periods[$key]['AVAILABLE_SEATS'] = $period['AVAILABLE_SEATS'] - $seats[1]['FILLED_SEATS'];
}
}
} else {
if ($_REQUEST['include_child_mps']) {
$periods[$key]['AVAILABLE_SEATS'] .= '<A href=' . $link . '>' . (GetMP($mp, 'SHORT_NAME') ? GetMP($mp, 'SHORT_NAME') : GetMP($mp)) . '</A> | ';
} else {
$periods[$key]['AVAILABLE_SEATS'] = 'n/a';
}
}
}
}
if ($_REQUEST['include_child_mps']) {
$periods[$key]['AVAILABLE_SEATS'] = substr($periods[$key]['AVAILABLE_SEATS'], 0, -3);
}
}
}