echo "<div class=break></div>"; if (AllowEdit()) { unset($_REQUEST); $_REQUEST['modname'] = 'scheduling/Schedule.php'; $_REQUEST['search_modfunc'] = 'list'; $extra['link']['FULL_NAME']['link'] = 'Modules.php?modname=scheduling/Requests.php'; $extra['link']['FULL_NAME']['variables'] = array('subject_id' => 'SUBJECT_ID', 'course_id' => 'COURSE_ID'); include 'modules/scheduling/UnfilledRequests.php'; } } if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'choose_course') { if (!isset($_REQUEST['confirm_cid']) || !$_REQUEST['sel_course_period']) { include "modules/scheduling/MultiCoursesforWindow.php"; } else { foreach ($_REQUEST['sel_course_period'] as $ses_cpid => $select_cpid) { DBQuery("INSERT INTO schedule (SYEAR,SCHOOL_ID,STUDENT_ID,START_DATE,MODIFIED_DATE,MODIFIED_BY,COURSE_ID,COURSE_PERIOD_ID,MP,MARKING_PERIOD_ID) values('" . UserSyear() . "','" . UserSchool() . "','" . UserStudentID() . "','" . $date . "','" . $date . "','" . User('STAFF_ID') . "','" . clean_param($_SESSION['crs_id'][$ses_cpid], PARAM_INT) . "','" . clean_param($select_cpid, PARAM_INT) . "','" . clean_param($_SESSION['mp'][$ses_cpid], PARAM_ALPHA) . "','" . clean_param(GetCpDet($ses_cpid, 'MARKING_PERIOD_ID') != '' ? $_SESSION['marking_period_id'][$ses_cpid] : GetMPId('FY'), PARAM_INT) . "')"); DBQuery('UPDATE course_periods SET FILLED_SEATS=FILLED_SEATS+1 WHERE COURSE_PERIOD_ID=\'' . clean_param($select_cpid, PARAM_INT) . '\''); } unset($_SESSION['course_period']); unset($_SESSION['crs_id']); unset($_SESSION['marking_period_id']); unset($_SESSION['mp']); echo "<script language=javascript>opener.document.location = 'Modules.php?modname=" . clean_param($_REQUEST['modname'], PARAM_NOTAGS) . "&time=" . time() . "';window.close();</script>"; } } if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'more_info') { $sql = 'SELECT s.COURSE_ID,s.COURSE_PERIOD_ID, s.MARKING_PERIOD_ID,s.START_DATE,s.END_DATE,s.MODIFIED_DATE,s.MODIFIED_BY, UNIX_TIMESTAMP(s.START_DATE) AS START_EPOCH,UNIX_TIMESTAMP(s.END_DATE) AS END_EPOCH,sp.PERIOD_ID, cpv.PERIOD_ID,cp.MARKING_PERIOD_ID as COURSE_MARKING_PERIOD_ID,cp.MP,sp.SORT_ORDER,
} echo "</FORM>"; } } if ($_REQUEST['modfunc'] == 'choose_course') { if (!$_REQUEST['course_period_id']) { include 'modules/scheduling/CoursesforWindow.php'; } else { $_SESSION['MassSchedule.php']['subject_id'] = $_REQUEST['subject_id']; $_SESSION['MassSchedule.php']['course_id'] = $_REQUEST['course_id']; $_SESSION['MassSchedule.php']['course_period_id'] = $_REQUEST['course_period_id']; $course_title = DBGet(DBQuery('SELECT TITLE FROM courses WHERE COURSE_ID=\'' . $_SESSION['MassSchedule.php']['course_id'] . '\'')); $course_title = $course_title[1]['TITLE']; $period_title_RET = DBGet(DBQuery('SELECT TITLE,MARKING_PERIOD_ID,GENDER_RESTRICTION,BEGIN_DATE,END_DATE FROM course_periods WHERE COURSE_PERIOD_ID=\'' . $_SESSION['MassSchedule.php']['course_period_id'] . '\'')); $period_title = $period_title_RET[1]['TITLE']; $mperiod = $period_title_RET[1]['MARKING_PERIOD_ID'] != '' ? $period_title_RET[1]['MARKING_PERIOD_ID'] : GetMPId('FY'); // if ($period_title_RET[1]['MARKING_PERIOD_ID'] == NULL) { $true = 'true'; } else { $true = ''; } $gender_res = $period_title_RET[1]['GENDER_RESTRICTION']; $_SESSION['MassSchedule.php']['gender'] = $gender_res; $period_title = str_replace('"', '\\"', $period_title); if ($gender_res == 'N') { echo "<script language=javascript>opener.document.getElementById(\"course_div\").innerHTML = \"{$course_title}<BR>{$period_title}\";opener.document.getElementById(\"marking_period\").value=\"{$mperiod}\";opener.document.getElementById(\"marking_period\").disabled=\"{$true}\"; window.close();</script>"; } else { echo "<script language=javascript>opener.document.getElementById(\"course_div\").innerHTML = \"{$course_title} <BR>{$period_title} <br>Gender : " . ($gender_res == 'M' ? 'Male' : 'Female') . " \";opener.document.getElementById(\"marking_period\").value=\"{$mperiod}\"; window.close();</script>"; } }
if ($flag == 0 && $seats_availabe[$cpd['COURSE_PERIOD_ID']] > 0) { $schedule[$rd[1]['STUDENT_ID']]['COURSE_PERIOD_ID'] = $cpd['COURSE_PERIOD_ID']; $schedule[$rd[1]['STUDENT_ID']]['COURSE_ID'] = $cpd['COURSE_ID']; $schedule[$rd[1]['STUDENT_ID']]['MP'] = $cpd['MP']; $schedule[$rd[1]['STUDENT_ID']]['MARKING_PERIOD_ID'] = $cpd['MARKING_PERIOD_ID']; $schedule[$rd[1]['STUDENT_ID']]['CALENDAR_ID'] = $cpd['CALENDAR_ID']; $schedule[$rd[1]['STUDENT_ID']]['TEACHER_ID'] = $cpd['TEACHER_ID']; $schedule[$rd[1]['STUDENT_ID']]['REQUEST_ID'] = $rd[1]['REQUEST_ID']; $seats_availabe[$cpd['COURSE_PERIOD_ID']] = $cpd['TOTAL_SEATS'] - ($cpd['FILLED_SEATS'] + 1); break 1; } } } } foreach ($schedule as $stu_id => $cp_id) { DBQuery('INSERT INTO schedule (SYEAR,SCHOOL_ID,STUDENT_ID,START_DATE,MODIFIED_BY,COURSE_ID,COURSE_PERIOD_ID,MP,MARKING_PERIOD_ID,DROPPED) VALUES (' . UserSyear() . ',' . UserSchool() . ',' . $stu_id . ',\'' . $s_date . '\',' . UserID() . ',\'' . $cp_id['COURSE_ID'] . '\',\'' . $cp_id['COURSE_PERIOD_ID'] . '\',\'' . ($cp_id['MARKING_PERIOD_ID'] != '' ? $cp_id['MP'] : 'FY') . '\',\'' . ($cp_id['MARKING_PERIOD_ID'] != '' ? $cp_id['MARKING_PERIOD_ID'] : GetMPId('FY')) . '\',\'N\')'); DBQuery('DELETE FROM schedule_requests WHERE REQUEST_ID=' . $cp_id['REQUEST_ID']); if (strtotime($s_date) <= strtotime(date('Y-m-d'))) { $check_d_att = DBGet(DBQuery('SELECT * FROM course_period_var WHERE COURSE_PERIOD_ID=' . $cp_id['COURSE_PERIOD_ID'] . ' AND DOES_ATTENDANCE=\'Y\'')); if (count($check_d_att) > 0) { for ($j = strtotime($s_date); $j < strtotime(date('Y-m-d')); $j = $j + 86400) { $chk_date = DBGet(DBQuery('SELECT COUNT(*) as REC_EX FROM attendance_calendar WHERE SCHOOL_ID=' . UserSchool() . ' AND SYEAR=' . UserSyear() . ' AND SCHOOL_DATE=\'' . date('Y-m-d', $j) . '\' AND CALENDAR_ID=' . $cp_id['CALENDAR_ID'])); if ($chk_date[1]['REC_EX'] != 0) { foreach ($check_d_att as $catt) { DBQuery('INSERT INTO missing_attendance (SCHOOL_ID,SYEAR,SCHOOL_DATE,COURSE_PERIOD_ID,PERIOD_ID,TEACHER_ID) VALUES (' . UserSchool() . ',' . UserSyear() . ',' . date('Y-m-d', $j) . ',' . $cp_id['COURSE_PERIOD_ID'] . ',' . $catt['PERIOD_ID'] . ',' . $cp_id['TEACHER_ID'] . ')'); } } } } } }
} } } echo '<TD valign=top>'; $columns = array('TITLE' => 'Assignment Type'); $link = array(); $link['TITLE']['link'] = "Modules.php?modname={$_REQUEST['modname']}&modfunc={$_REQUEST['modfunc']}"; $link['TITLE']['variables'] = array('assignment_type_id' => 'ASSIGNMENT_TYPE_ID'); $link['add']['link'] = "Modules.php?modname={$_REQUEST['modname']}&assignment_type_id=new"; $link['add']['first'] = 50000; // number before add link moves to top ListOutput($types_RET, $columns, 'Assignment Type', 'Assignment Types', $link, array(), $LO_options); echo '</TD>'; // ASSIGNMENTS if ($_REQUEST['assignment_type_id'] && $_REQUEST['assignment_type_id'] != 'new' && count($types_RET)) { $sql = 'SELECT ASSIGNMENT_ID,TITLE FROM gradebook_assignments WHERE (COURSE_ID=\'' . $course_id . '\' OR COURSE_PERIOD_ID=\'' . $course_period_id . '\') AND ASSIGNMENT_TYPE_ID=\'' . $_REQUEST['assignment_type_id'] . '\' AND (MARKING_PERIOD_ID=\'' . (GetCpDet($course_period_id, 'MARKING_PERIOD_ID') != '' ? UserMP() : GetMPId('FY')) . '\' OR MARKING_PERIOD_ID=' . GetMPId('FY') . ' ) ORDER BY ' . Preferences('ASSIGNMENT_SORTING', 'Gradebook') . ' DESC'; $QI = DBQuery($sql); $assn_RET = DBGet($QI); if (count($assn_RET)) { if ($_REQUEST['assignment_id'] && $_REQUEST['assignment_id'] != 'new') { foreach ($assn_RET as $key => $value) { if ($value['ASSIGNMENT_ID'] == $_REQUEST['assignment_id']) { $assn_RET[$key]['row_color'] = Preferences('HIGHLIGHT'); } } } } echo '<TD valign=top>'; $columns = array('TITLE' => 'Assignment'); $link = array(); $link['TITLE']['link'] = "Modules.php?modname={$_REQUEST['modname']}&assignment_type_id={$_REQUEST['assignment_type_id']}";
} $sql = substr($sql, 0, -1) . " WHERE STUDENT_ID='{$student_id}' AND ASSIGNMENT_ID='{$assignment_id}' AND COURSE_PERIOD_ID='{$course_period_id}'"; } elseif ($columns['POINTS'] != '' || $columns['COMMENT']) { $columns['COMMENT'] = str_replace("'", "\\'", $columns['COMMENT']); $sql = 'INSERT INTO gradebook_grades (STUDENT_ID,PERIOD_ID,COURSE_PERIOD_ID,ASSIGNMENT_ID,POINTS,COMMENT) values(\'' . clean_param($student_id, PARAM_INT) . '\',\'' . clean_param(UserPeriod(), PARAM_INT) . '\',\'' . clean_param($course_period_id, PARAM_INT) . '\',\'' . clean_param($assignment_id, PARAM_INT) . '\',\'' . $columns['POINTS'] . '\',\'' . clean_param($columns['COMMENT'], PARAM_NOTAGS) . '\')'; } if ($sql) { DBQuery($sql); DBQuery('UPDATE gradebook_assignments SET UNGRADED=2 WHERE ASSIGNMENT_ID IN (SELECT ASSIGNMENT_ID FROM gradebook_grades WHERE POINTS IS NULL OR POINTS=\'\') OR ASSIGNMENT_ID NOT IN (SELECT ASSIGNMENT_ID FROM gradebook_grades WHERE POINTS IS NOT NULL OR POINTS!=\'\')'); } } } if ($_REQUEST['student_id']) { $current_RET[$_REQUEST['student_id']] = DBGet(DBQuery('SELECT g.ASSIGNMENT_ID FROM gradebook_grades g,gradebook_assignments a WHERE a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND a.MARKING_PERIOD_ID=\'' . (GetCpDet($course_period_id, 'MARKING_PERIOD_ID') != '' ? UserMP() : GetMPId('FY')) . '\' AND g.STUDENT_ID=\'' . $_REQUEST[student_id] . '\' AND g.COURSE_PERIOD_ID=\'' . $course_period_id . '\'' . ($_REQUEST['assignment_id'] == 'all' ? '' : ' AND g.ASSIGNMENT_ID=\'' . $_REQUEST[assignment_id] . '\'')), array(), array('ASSIGNMENT_ID')); } elseif ($_REQUEST['assignment_id'] == 'all') { $current_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.ASSIGNMENT_ID,g.POINTS FROM gradebook_grades g,gradebook_assignments a WHERE a.ASSIGNMENT_ID=g.ASSIGNMENT_ID AND a.MARKING_PERIOD_ID=\'' . (GetCpDet($course_period_id, 'MARKING_PERIOD_ID') != '' ? UserMP() : GetMPId('FY')) . '\' AND g.COURSE_PERIOD_ID=\'' . $course_period_id . '\''), array(), array('STUDENT_ID', 'ASSIGNMENT_ID')); } else { $current_RET = DBGet(DBQuery('SELECT STUDENT_ID,POINTS,COMMENT,ASSIGNMENT_ID FROM gradebook_grades WHERE ASSIGNMENT_ID=\'' . $_REQUEST[assignment_id] . '\' AND COURSE_PERIOD_ID=\'' . $course_period_id . '\''), array(), array('STUDENT_ID', 'ASSIGNMENT_ID')); } unset($_REQUEST['values']); unset($_SESSION['_REQUEST_vars']['values']); } $_SESSION['assignment_id'] = $_REQUEST['assignment_id']; $stu_RET = GetStuList($extra); $assignment_select = '<SELECT name=assignment_id onchange="document.location.href=\'Modules.php?modname=' . $_REQUEST['modname'] . '&include_inactive=' . $_REQUEST['include_inactive'] . '&assignment_id=\'+this.options[selectedIndex].value"><OPTION value="">Totals</OPTION><OPTION value="all"' . ($_REQUEST['assignment_id'] == 'all' && !$_REQUEST['student_id'] ? ' SELECTED' : '') . '>All</OPTION>'; if ($_REQUEST['student_id']) { $assignment_select .= '<OPTION value=' . $_REQUEST['assignment_id'] . ' SELECTED>' . $stu_RET[1]['FULL_NAME'] . '</OPTION>'; } foreach ($assignments_RET as $id => $assignment) { $assignment_select .= '<OPTION value=' . $id . ($_REQUEST['assignment_id'] == $id && !$_REQUEST['student_id'] ? ' SELECTED' : '') . '>' . $assignment[1]['TYPE_TITLE'] . ' - ' . $assignment[1]['TITLE'] . '</OPTION>'; }
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # #*************************************************************************************** include '../../RedirectRootInc.php'; include '../../Warehouse.php'; $course_period_id = $_REQUEST['cp_id']; $insert = $_REQUEST['insert']; $date = DBDate(); if ($insert == 'true') { $course_RET = DBGet(DBQuery("SELECT *,cp.title AS CP_TITLE FROM course_periods cp,course_period_var cpv,school_periods sp WHERE cp.course_period_id=cpv.course_period_id AND cpv.period_id=sp.period_id AND cp.course_period_id={$course_period_id}")); $course = $course_RET[1]; $varified = VerifyStudentSchedule($course_RET); if ($varified === true) { $course[MP] = $course[MARKING_PERIOD_ID] != '' ? $course[MP] : 'FY'; $course[MARKING_PERIOD_ID] = $course[MARKING_PERIOD_ID] != '' ? $course[MARKING_PERIOD_ID] : GetMPId('FY'); DBQuery("INSERT INTO temp_schedule(SYEAR,SCHOOL_ID,STUDENT_ID,START_DATE,MODIFIED_BY,COURSE_ID,COURSE_PERIOD_ID,MP,MARKING_PERIOD_ID) values('" . UserSyear() . "','" . UserSchool() . "','" . UserStudentID() . "','" . $date . "','" . User('STAFF_ID') . "','{$course['COURSE_ID']}','" . $course_period_id . "','{$course['MP']}','{$course['MARKING_PERIOD_ID']}')"); $html = 'resp'; $html .= '<tr id="selected_course_tr_' . $course["COURSE_PERIOD_ID"] . '"><td align=left><INPUT type="checkbox" id="selected_course_' . $course["COURSE_PERIOD_ID"] . '" name="selected_course_periods[]" checked="checked" value="' . $course["COURSE_PERIOD_ID"] . '"></td><td><b> ' . $course["CP_TITLE"] . '</b></td></tr>'; $_SESSION['course_periods'][$course_period_id] = $course['CP_TITLE']; } else { $html = 'conf<strong>' . $varified . '</strong>'; $html .= '<input type=hidden id=conflicted_cp value=' . $course_period_id . '>'; } } elseif ($insert == 'false') { DBQuery("DELETE FROM temp_schedule WHERE course_period_id={$course_period_id}"); unset($_SESSION['course_periods'][$course_period_id]); } echo $html;