本文整理汇总了PHP中GetMPTable函数的典型用法代码示例。如果您正苦于以下问题:PHP GetMPTable函数的具体用法?PHP GetMPTable怎么用?PHP GetMPTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMPTable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBDate
} else {
$date = DBDate();
$date_extra = 'OR sr.END_DATE IS NULL';
}
$columns = array('PERIOD_TITLE' => '' . _('Period - Teacher') . '', 'MARKING_PERIOD_ID' => '' . _('Term') . '', 'DAYS' => '' . _('Days') . '', 'DURATION' => '' . _('Time') . '', 'ROOM' => '' . _('Room') . '', 'COURSE_TITLE' => '' . _('Course') . '');
$extra['SELECT'] .= ',c.TITLE AS COURSE_TITLE,p_cp.TITLE AS PERIOD_TITLE,sr.MARKING_PERIOD_ID,p_cp.DAYS, CONCAT(sp.START_TIME,\'' . ' to ' . '\', sp.END_TIME) AS DURATION,p_cp.ROOM';
$extra['FROM'] .= ' LEFT OUTER JOIN schedule sr ON (sr.STUDENT_ID=ssm.STUDENT_ID),courses c,course_periods p_cp,school_periods sp ';
// $extra['WHERE'] .= " AND p_cp.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 p_cp.PERIOD_ID=sp.PERIOD_ID AND ('$date' BETWEEN sr.START_DATE AND sr.END_DATE $date_extra)";
$extra['WHERE'] .= ' AND p_cp.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 p_cp.PERIOD_ID=sp.PERIOD_ID';
if ($_REQUEST['include_inactive'] != 'Y') {
$extra['WHERE'] .= ' AND (\'' . date('Y-m-d', strtotime($date)) . '\' BETWEEN sr.START_DATE AND sr.END_DATE OR (sr.END_DATE IS NULL AND sr.START_DATE<=\'' . date('Y-m-d', strtotime($date)) . '\')) ';
}
if ($_REQUEST['mp_id'] && (User('PROFILE_ID') != 0 && User('PROFILE_ID') != 3)) {
$extra['WHERE'] .= ' AND sr.MARKING_PERIOD_ID=' . $_REQUEST['mp_id'] . '';
} else {
$extra['WHERE'] .= ' AND sr.MARKING_PERIOD_ID IN (' . GetAllMP(GetMPTable(GetMP($_REQUEST['mp_id'], 'TABLE')), $_REQUEST['mp_id']) . ')';
}
$extra['functions'] = array('MARKING_PERIOD_ID' => 'GetMP', 'DAYS' => '_makeDays');
$extra['group'] = array('STUDENT_ID');
$extra['ORDER'] = ',sp.SORT_ORDER';
if ($_REQUEST['mailing_labels'] == 'Y') {
$extra['group'][] = 'ADDRESS_ID';
}
Widgets('mailing_labels');
$RET = GetStuList($extra);
if (count($RET)) {
$handle = PDFStart();
foreach ($RET as $student_id => $courses) {
echo "<meta charset='UTF-8'><table width=100% style=\" font-family:Arial; font-size:12px;\" >";
echo "<tr><td width=105>" . DrawLogo() . "</td><td style=\"font-size:15px; font-weight:bold; padding-top:20px;\">" . GetSchool(UserSchool()) . "<div style=\"font-size:12px;\">" . _('Student Schedules Report') . "</div></td><td align=right style=\"padding-top:20px;\">" . ProperDate(DBDate()) . "<br />" . _('Powered by openSIS') . "</td></tr><tr><td colspan=3 style=\"border-top:1px solid #333;\"> </td></tr></table>";
if ($_REQUEST['mailing_labels'] == 'Y') {
示例2: BackPrompt
}
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);
DBQuery("UPDATE COURSE_PERIODS SET FILLED_SEATS=FILLED_SEATS+1 WHERE COURSE_PERIOD_ID='" . $_SESSION['MassSchedule.php']['course_period_id'] . "'");
$request_exists = false;
$note = "That course has been added to the selected students' schedules.";
} else {
$select_stu = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME FROM STUDENTS WHERE STUDENT_ID='" . $student_id . "'"));
示例3: 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];
}
示例4: Preferences
$courses_RET[$key]['row_color'] = Preferences('HIGHLIGHT');
}
}
}
}
echo '<TD valign=top>';
$columns = array('GRADE_COURSE' => 'Course');
$link = array();
$link['GRADE_COURSE']['link'] = "Modules.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}";
//$link['TITLE']['link'] = "#"." onclick='check_content(\"ajax.php?modname=$_REQUEST[modname]&subject_id=$_REQUEST[subject_id]\");'";
$link['GRADE_COURSE']['variables'] = array('course_id' => 'COURSE_ID');
$link['add']['link'] = "Modules.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}&course_id=new";
ListOutput($courses_RET, $columns, 'Course', 'Courses', $link, array(), $LO_options);
echo '</TD>';
if (clean_param($_REQUEST['course_id'], PARAM_ALPHANUM) && $_REQUEST['course_id'] != 'new') {
$sql = "SELECT COURSE_PERIOD_ID,TITLE,COALESCE(TOTAL_SEATS-FILLED_SEATS,0) AS AVAILABLE_SEATS FROM course_periods WHERE COURSE_ID='{$_REQUEST['course_id']}' AND (marking_period_id IN(" . GetAllMP(GetMPTable(GetMP(UserMP(), 'TABLE')), UserMP()) . ") OR (CURDATE() <= end_date AND marking_period_id IS NULL)) ORDER BY TITLE";
$QI = DBQuery($sql);
$periods_RET = DBGet($QI);
if (count($periods_RET)) {
if (clean_param($_REQUEST['course_period_id'], PARAM_ALPHANUM)) {
foreach ($periods_RET as $key => $value) {
if ($value['COURSE_PERIOD_ID'] == $_REQUEST['course_period_id']) {
$periods_RET[$key]['row_color'] = Preferences('HIGHLIGHT');
}
}
}
}
echo '<TD valign=top>';
$columns = array('TITLE' => 'Period');
if ($_REQUEST['modname'] == 'Schdeuling/Schedule.php') {
$columns += array('AVAILABLE_SEATS' => 'Available Seats');
示例5: DBQuery
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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 '../../Redirect_modules.php';
echo '<div id="calculating" style="display: none; padding-top:20px; padding-bottom:15px;"><img src="assets/missing_attn_loader.gif" /><br/><br/><br/><span style="color:#c90000;"><span style=" font-size:15px; font-weight:bold;">Please wait.</span><br /><span style=" font-size:12px;">Calculating GPA . Do not click anywhere.</span></span></div>
<div id="resp" style="font-size:14px"></div>';
$QI = DBQuery("SELECT PERIOD_ID,TITLE FROM school_periods WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' ORDER BY SORT_ORDER ");
$RET = DBGet($QI);
$SCALE_RET = DBGet(DBQuery('SELECT * from schools where ID = \'' . UserSchool() . '\''));
DrawBC("Gradebook > " . ProgramTitle());
$mps = GetAllMP(GetMPTable(GetMP(UserMP(), 'TABLE')), UserMP());
$mps = explode(',', str_replace("'", '', $mps));
$table = '<TABLE><TR><TD valign=top><TABLE>
</TR>
<TD align=right valign=top><font color=gray>Calculate GPA for</font></TD>
<TD>';
foreach ($mps as $mp) {
if ($mp != '0') {
$table .= '<INPUT type=radio name=marking_period_id value=' . $mp . ($mp == UserMP() ? ' CHECKED' : '') . '>' . GetMP($mp) . '<BR>';
}
}
$table .= '</TD>
</TR>
<TR>
<TD colspan = 2 align=center><font color=gray>GPA based on a scale of ' . $SCALE_RET[1]['REPORTING_GP_SCALE'] . '</TD>
</TR>' . '</TABLE></TD><TD width=350><small>GPA calculation modifies existing records.<BR><BR>Weighted and unweighted GPA is calculated by dividing the weighted and unweighted grade points configured for each letter grade (assigned in the Report Card Codes setup program) by the base grading scale specified in the school setup. </small></TD></TR></TABLE>';
示例6: VerifySchedule
function VerifySchedule(&$schedule)
{
$conflicts = array();
$ij = count($schedule);
for ($i = 1; $i < $ij; $i++) {
for ($j = $i + 1; $j <= $ij; $j++) {
if (!$conflicts[$i] || !$conflicts[$j]) {
if (strpos(GetAllMP(GetMPTable(GetMP($schedule[$i]['MARKING_PERIOD_ID'], 'TABLE')), $schedule[$i]['MARKING_PERIOD_ID']), "'" . $schedule[$j]['MARKING_PERIOD_ID'] . "'") !== false && (!$schedule[$i]['END_EPOCH'] || $schedule[$j]['START_EPOCH'] <= $schedule[$i]['END_EPOCH']) && (!$schedule[$j]['END_EPOCH'] || $schedule[$i]['START_EPOCH'] <= $schedule[$j]['END_EPOCH'])) {
if ($schedule[$i]['COURSE_ID'] == $schedule[$j]['COURSE_ID']) {
//&& $schedule[$i]['COURSE_WEIGHT']==$schedule[$j]['COURSE_WEIGHT'])
$conflicts[$i] = $conflicts[$j] = true;
} else {
if ($schedule[$i]['PERIOD_ID'] == $schedule[$j]['PERIOD_ID']) {
if (strlen($schedule[$i]['DAYS']) + strlen($schedule[$j]['DAYS']) > 7) {
$conflicts[$i] = $conflicts[$j] = true;
} else {
foreach (veriry_str_split($schedule[$i]['DAYS']) as $k) {
if (strpos($schedule[$j]['DAYS'], $k) !== false) {
$conflicts[$i] = $conflicts[$j] = true;
break;
}
}
}
}
}
}
}
}
}
foreach ($conflicts as $i => $true) {
$schedule[$i]['TITLE'] = '<FONT color=red>' . $schedule[$i]['TITLE'] . '</FONT>';
}
}
示例7: POSITION
cpv.PERIOD_ID,cp.MARKING_PERIOD_ID as COURSE_MARKING_PERIOD_ID,cp.MP,sp.SORT_ORDER,
c.TITLE ,cp.COURSE_PERIOD_ID AS PERIOD_PULLDOWN,
s.STUDENT_ID,r.TITLE AS ROOM,cpv.DAYS,SCHEDULER_LOCK
FROM schedule s,courses c,course_periods cp,school_periods sp,course_period_var cpv,rooms r
WHERE
s.COURSE_ID = c.COURSE_ID AND s.COURSE_ID = cp.COURSE_ID
AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID
AND s.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID
AND r.ROOM_ID=cpv.ROOM_ID
AND s.SCHOOL_ID = sp.SCHOOL_ID AND s.SYEAR = c.SYEAR AND sp.PERIOD_ID = cpv.PERIOD_ID
AND POSITION(\'' . $day . '\' IN cpv.days)>0
AND sp.PERIOD_ID=\'' . $_REQUEST[period] . '\'
AND s.STUDENT_ID=\'' . UserStudentID() . '\'
AND s.SYEAR=\'' . UserSyear() . '\' AND s.SCHOOL_ID = \'' . UserSchool() . '\' AND (cpv.COURSE_PERIOD_DATE=\'' . date('Y-m-d', strtotime($date)) . '\' OR cpv.COURSE_PERIOD_DATE IS NULL)
AND (\'' . date('Y-m-d', strtotime($date)) . '\' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND s.START_DATE<=\'' . date('Y-m-d', strtotime($date)) . '\'))
AND s.MARKING_PERIOD_ID IN (' . GetAllMP(GetMPTable(GetMP($mp_id, 'TABLE')), $mp_id) . ')
ORDER BY sp.SORT_ORDER,s.MARKING_PERIOD_ID';
$QI = DBQuery($sql);
$schedule_RET = DBGet($QI, array('TIME_PERIOD' => '_makeTimePeriod', 'TITLE' => '_makeTitle', 'PERIOD_PULLDOWN' => '_makePeriodSelect', 'COURSE_MARKING_PERIOD_ID' => '_makeMPSelect'));
$columns = array('TIME_PERIOD' => 'Period', 'TITLE' => 'Course', 'PERIOD_PULLDOWN' => 'Period - Teacher', 'ROOM' => 'Room', 'DAYS' => 'Days of Week', 'COURSE_MARKING_PERIOD_ID' => 'Term');
}
if ($_REQUEST['view_mode'] != 'month_view') {
ListOutput($schedule_RET, $columns, 'Course', 'Courses', $link);
if ($_REQUEST['modfunc'] == 'detail') {
echo '<br /><div align="center"><input type="button" class=btn_medium value="Close" onclick="window.close();"></div>';
}
}
if ($schedule_RET && $_REQUEST['view_mode'] == 'day_view') {
DrawHeader("<table><tr><td> </td><td>" . ProgramLinkforExport('scheduling/PrintSchedules.php', '<img src=assets/print.png>', '&modfunc=save&st_arr[]=' . UserStudentID() . '&mp_id=' . $mp_id . '&date1=' . $date1 . '&include_inactive=' . $_REQUEST['include_inactive'] . '&_openSIS_PDF=true target=_blank') . "</td><td>" . ProgramLinkforExport('scheduling/PrintSchedules.php', 'Print Schedule', '&modfunc=save&st_arr[]=' . UserStudentID() . '&mp_id=' . $mp_id . '&include_inactive=' . $_REQUEST['include_inactive'] . '&date1=' . $date1 . '&_openSIS_PDF=true target=_blank') . "</td></tr></table>");
}
echo '</FORM>';
示例8: DBGet
continue;
}
}
# ------------------------------------ PARENT RESTRICTION ENDS----------------------------------------- #
if ($_SESSION['MassSchedule.php']['gender'] != 'N') {
$select_stu_RET = DBGet(DBQuery('SELECT FIRST_NAME,LAST_NAME,LEFT(GENDER,1) AS GENDER FROM students WHERE STUDENT_ID=\'' . $student_id . '\''));
if ($_SESSION['MassSchedule.php']['gender'] != $select_stu_RET[1]['GENDER']) {
$select_stu = $select_stu_RET[1]['FIRST_NAME'] . " " . $select_stu_RET[1]['LAST_NAME'];
$gender_conflict .= $select_stu . "<br>";
continue;
}
#$clash = true;
}
# ------------------------------------ Same Days Conflict Start ------------------------------------------ #
$mp_RET = DBGet(DBQuery('SELECT cp.MP,cp.MARKING_PERIOD_ID,cpv.DAYS,cpv.PERIOD_ID,cp.MARKING_PERIOD_ID,cp.TOTAL_SEATS,COALESCE(cp.FILLED_SEATS,0) AS FILLED_SEATS FROM course_periods cp,course_period_var cpv WHERE cp.COURSE_PERIOD_ID=\'' . $_SESSION['MassSchedule.php']['course_period_id'] . '\' AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID'));
$mps = GetAllMP(GetMPTable(GetMP($mp_RET[1]['MARKING_PERIOD_ID'], 'TABLE')), $mp_RET[1]['MARKING_PERIOD_ID']);
$period_RET = DBGet(DBQuery('SELECT cpv.DAYS FROM schedule s,course_periods cp,course_period_var cpv WHERE cp.COURSE_PERIOD_ID=s.COURSE_PERIOD_ID AND s.STUDENT_ID=\'' . $student_id . '\' AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND cpv.PERIOD_ID=\'' . $mp_RET[1]['PERIOD_ID'] . '\' AND s.MARKING_PERIOD_ID IN (' . $mps . ') AND (s.END_DATE IS NULL OR \'' . $convdate . '\'<=s.END_DATE)'));
$ig_scheld = DBGet(DBQuery('SELECT IGNORE_SCHEDULING FROM school_periods WHERE PERIOD_ID=\'' . $mp_RET[1]['PERIOD_ID'] . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
$sql_dupl = 'SELECT COURSE_PERIOD_ID FROM schedule WHERE STUDENT_ID = \'' . $student_id . '\' AND COURSE_PERIOD_ID = \'' . $_SESSION['MassSchedule.php']['course_period_id'] . '\' AND (END_DATE IS NULL OR (\'' . $convdate . '\' BETWEEN START_DATE AND END_DATE)) AND SCHOOL_ID=\'' . UserSchool() . '\'';
$rit_dupl = DBQuery($sql_dupl);
$count_entry = mysql_num_rows($rit_dupl);
$days_conflict = false;
if ($count_entry < 1 && $ig_scheld[1]['IGNORE_SCHEDULING'] != 'Y') {
foreach ($period_RET as $existing) {
if (strlen($mp_RET[1]['DAYS']) + strlen($existing['DAYS']) > 7) {
$days_conflict = true;
break;
} else {
foreach (_str_split($mp_RET[1]['DAYS']) as $i) {
if (strpos($existing['DAYS'], $i) !== false) {
$days_conflict = true;
示例9: substr
$periods_list = '(' . substr($periods_list, 1) . ')';
foreach ($_REQUEST['student'] as $student_id => $yes) {
$students_list .= ",'" . $student_id . "'";
}
$students_list = '(' . substr($students_list, 1) . ')';
$current_RET = DBGet(DBQuery('SELECT STUDENT_ID,PERIOD_ID,SCHOOL_DATE,ATTENDANCE_CODE FROM attendance_period WHERE EXTRACT(MONTH FROM SCHOOL_DATE)=\'' . $_REQUEST['month'] * 1 . '\' AND EXTRACT(YEAR FROM SCHOOL_DATE)=\'' . $_REQUEST[year] . '\' AND PERIOD_ID IN ' . $periods_list . ' AND STUDENT_ID IN ' . $students_list . ''), array(), array('STUDENT_ID', 'SCHOOL_DATE', 'PERIOD_ID'));
foreach ($_REQUEST['student'] as $student_id => $yes) {
foreach ($_REQUEST['dates'] as $date => $yes) {
$current_mp = GetCurrentMP('QTR', $date);
if (!$current_mp) {
$current_mp = GetCurrentMP('SEM', $date);
}
if (!$current_mp) {
$current_mp = GetCurrentMP('FY', $date);
}
$all_mp = GetAllMP(GetMPTable(GetMP($current_mp, 'TABLE')), $current_mp);
/*$course_periods_RET = DBGet(DBQuery("SELECT s.COURSE_PERIOD_ID,cp.PERIOD_ID FROM schedule s,course_periods cp,attendance_calendar ac,school_periods sp WHERE sp.PERIOD_ID=cp.PERIOD_ID AND ac.SCHOOL_DATE='".date('Y-m-d',strtotime($date))."' AND ac.CALENDAR_ID=cp.CALENDAR_ID AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL) AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='$student_id' AND cp.PERIOD_ID IN $periods_list AND cp.DOES_ATTENDANCE='Y' AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE)) AND position(substring('UMTWHFS' FROM DAYOFWEEK(ac.SCHOOL_DATE) FOR 1) IN cp.DAYS)>0 AND cp.MARKING_PERIOD_ID IN ($all_mp) AND s.MARKING_PERIOD_ID IN ($all_mp) AND NOT (cp.HALF_DAY='Y' AND (SELECT STATE_CODE FROM attendance_codes WHERE ID='$_REQUEST[absence_code]')='H')"),array(),array('PERIOD_ID'));*/
$course_periods_RET = DBGet(DBQuery('SELECT s.COURSE_PERIOD_ID,cpv.PERIOD_ID FROM schedule s,course_periods cp,course_period_var cpv,attendance_calendar ac,school_periods sp WHERE sp.PERIOD_ID=cpv.PERIOD_ID AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND ac.SCHOOL_DATE=\'' . date('Y-m-d', strtotime($date)) . '\' AND ac.CALENDAR_ID=cp.CALENDAR_ID AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL) AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID=' . $student_id . ' AND cpv.PERIOD_ID IN ' . $periods_list . ' AND cpv.DOES_ATTENDANCE=\'Y\' AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE)) AND position(substring(\'UMTWHFS\' FROM DAYOFWEEK(ac.SCHOOL_DATE) FOR 1) IN cpv.DAYS)>0 AND cp.MARKING_PERIOD_ID IN (' . $all_mp . ') AND s.MARKING_PERIOD_ID IN (' . $all_mp . ') AND NOT (cp.HALF_DAY=\'Y\' AND (SELECT STATE_CODE FROM attendance_codes WHERE ID=\'' . optional_param('absence_code', '', PARAM_NUMBER) . '\')=\'H\')'), array(), array('PERIOD_ID'));
foreach ($_REQUEST['period'] as $period_id => $yes) {
if (!$current_RET[$student_id][$date][$period_id]) {
$course_period_id = $course_periods_RET[$period_id][1]['COURSE_PERIOD_ID'];
if ($course_period_id) {
/*$sql = "INSERT INTO attendance_period (STUDENT_ID,SCHOOL_DATE,PERIOD_ID,MARKING_PERIOD_ID,COURSE_PERIOD_ID,ATTENDANCE_CODE,ATTENDANCE_TEACHER_CODE,ATTENDANCE_REASON,ADMIN)
values('$student_id','$date','$period_id','$current_mp','$course_period_id','$_REQUEST[absence_code]','$_REQUEST[absence_code]','$_REQUEST[absence_reason]','Y')";*/
$sql = 'INSERT INTO attendance_period (STUDENT_ID,SCHOOL_DATE,PERIOD_ID,MARKING_PERIOD_ID,COURSE_PERIOD_ID,ATTENDANCE_CODE,ATTENDANCE_TEACHER_CODE,ATTENDANCE_REASON,ADMIN)values(\'' . $student_id . '\',\'' . $date . '\',\'' . $period_id . '\',\'' . $current_mp . '\',\'' . $course_period_id . '\',\'' . optional_param('absence_code', '', PARAM_NUMBER) . '\',\'' . optional_param('absence_code', '', PARAM_NUMBER) . '\',\'' . optional_param('absence_reason', '', PARAM_SPCL) . '\',\'Y\')';
DBQuery($sql);
}
} else {
/*$sql = "UPDATE attendance_period SET ATTENDANCE_CODE='$_REQUEST[absence_code]',ATTENDANCE_TEACHER_CODE='$_REQUEST[absence_code]',ATTENDANCE_REASON='$_REQUEST[absence_reason]',ADMIN='Y'
WHERE STUDENT_ID='$student_id' AND SCHOOL_DATE='$date' AND PERIOD_ID='$period_id'";
*/
示例10: _makeCodePulldown
function _makeCodePulldown($value, $title)
{
global $THIS_RET, $codes_RET, $current_RET, $current_schedule_RET, $date;
if (!is_array($current_schedule_RET[$THIS_RET['STUDENT_ID']])) {
$current_mp = GetCurrentMP('QTR', $date);
$all_mp = GetAllMP(GetMPTable(GetMP($current_mp, 'TABLE')), $current_mp);
$current_schedule_RET[$THIS_RET['STUDENT_ID']] = DBGet(DBQuery("SELECT cp.PERIOD_ID,cp.COURSE_PERIOD_ID,cp.HALF_DAY FROM SCHEDULE s,COURSE_PERIODS cp WHERE s.STUDENT_ID='" . $THIS_RET['STUDENT_ID'] . "' AND s.SYEAR='" . UserSyear() . "' AND s.SCHOOL_ID='" . UserSchool() . "' AND cp.COURSE_PERIOD_ID = s.COURSE_PERIOD_ID AND cp.DOES_ATTENDANCE='Y' 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 ({$all_mp}) ORDER BY s.START_DATE ASC"), array(), array('PERIOD_ID'));
if (!$current_schedule_RET[$THIS_RET['STUDENT_ID']]) {
$current_schedule_RET[$THIS_RET['STUDENT_ID']] = array();
}
}
if ($THIS_RET['COURSE']) {
$period = $THIS_RET['COURSE_PERIOD_ID'];
$period_id = $THIS_RET['PERIOD_ID'];
$code_title = 'TITLE';
} else {
$period_id = substr($title, 7);
$period = $current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id][1]['COURSE_PERIOD_ID'];
#$code_title = 'SHORT_NAME';
$code_title = 'TITLE';
}
if ($current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id]) {
foreach ($codes_RET as $code) {
if ($current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id][1]['HALF_DAY'] != 'Y' || $code['STATE_CODE'] != 'H') {
// prune half day codes for half day courses
$options[$code['ID']] = $code[$code_title];
}
}
$val = $current_RET[$THIS_RET['STUDENT_ID']][$period][1]['ATTENDANCE_CODE'];
return SelectInput($val, 'attendance[' . $THIS_RET['STUDENT_ID'] . '][' . $period . '][ATTENDANCE_CODE]', '', $options);
} else {
return false;
}
}
示例11: DBGet
#
#***************************************************************************************
include '../../../RedirectIncludes.php';
if (GetTeacher(UserStaffID(), '', 'PROFILE', false) == 'teacher') {
$mp_select_RET = DBGet(DBQuery('SELECT DISTINCT cp.MARKING_PERIOD_ID, (SELECT TITLE FROM marking_periods WHERE MARKING_PERIOD_ID=cp.MARKING_PERIOD_ID) AS TITLE FROM course_periods cp,courses c, school_periods sp,course_period_var cpv WHERE cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND cp.COURSE_ID=c.COURSE_ID AND (cp.TEACHER_ID=\'' . UserStaffID() . '\' OR cp.SECONDARY_TEACHER_ID=\'' . UserStaffID() . '\') AND cpv.PERIOD_ID=sp.PERIOD_ID AND cp.MARKING_PERIOD_ID IS NOT NULL AND cp.SYEAR=\'' . UserSyear() . '\' AND cp.SCHOOL_ID=\'' . UserSchool() . '\''));
$print_mp = CreateSelect($mp_select_RET, 'marking_period_id', 'Show All', 'Modules.php?modname=' . $_REQUEST['modname'] . '&include=' . $_REQUEST['include'] . '&category_id=' . $_REQUEST['category_id'] . '&marking_period_id=');
echo '<div style="padding:10px 0px 0px 25px;"><strong>Marking Periods :</strong> ' . $print_mp . '</div>';
if (!$_REQUEST['marking_period_id']) {
$schedule_RET = DBGet(DBQuery('SELECT cp.SCHEDULE_TYPE,cp.course_period_id,\'\' as ROOM,c.TITLE AS COURSE,\'\' as PERIOD,cp.COURSE_WEIGHT,IF(cp.MARKING_PERIOD_ID IS NULL ,\'Custom\',cp.MARKING_PERIOD_ID) AS MARKING_PERIOD_ID, \'\' as DAYS,\'\' AS DURATION from
course_periods cp , courses c WHERE cp.course_id=c.COURSE_ID AND (cp.TEACHER_ID=\'' . UserStaffID() . '\' OR cp.SECONDARY_TEACHER_ID=\'' . UserStaffID() . '\') AND cp.SYEAR=\'' . UserSyear() . '\' AND cp.SCHOOL_ID=' . UserSchool()), array('PERIOD_ID' => 'GetPeriod', 'MARKING_PERIOD_ID' => 'GetMP_teacherschedule'));
} else {
if ($_REQUEST['marking_period_id']) {
$sel_mp_info = DBGet(DBQuery('SELECT * FROM marking_periods WHERE MARKING_PERIOD_ID=' . $_REQUEST['marking_period_id']));
$sel_mp_info = $sel_mp_info[1];
$schedule_RET = DBGet(DBQuery('SELECT cp.SCHEDULE_TYPE,cp.course_period_id,\'\' as ROOM,\'\' as PERIOD,c.TITLE AS COURSE,cp.COURSE_WEIGHT,IF(cp.MARKING_PERIOD_ID IS NULL ,\'Custom\',cp.MARKING_PERIOD_ID) AS MARKING_PERIOD_ID, \'\' as DAYS,\'\' AS DURATION from
course_periods cp , courses c WHERE cp.course_id=c.COURSE_ID AND (cp.MARKING_PERIOD_ID IN (' . GetAllMP(GetMPTable(GetMP($_REQUEST['marking_period_id'], 'TABLE')), $_REQUEST['marking_period_id']) . ') OR (cp.MARKING_PERIOD_ID IS NULL AND (cp.BEGIN_DATE BETWEEN \'' . $sel_mp_info['START_DATE'] . '\' AND \'' . $sel_mp_info['END_DATE'] . '\'))) AND (cp.TEACHER_ID=\'' . UserStaffID() . '\' OR cp.SECONDARY_TEACHER_ID=\'' . UserStaffID() . '\') AND cp.SCHOOL_ID=\'' . UserSchool() . '\' AND cp.SYEAR=' . UserSyear()), array('PERIOD_ID' => 'GetPeriod', 'MARKING_PERIOD_ID' => 'GetMP_teacherschedule'));
}
}
foreach ($schedule_RET as $rdi => $rdd) {
$get_det = DBGet(DBQuery('SELECT cpv.DAYS,cpv.COURSE_PERIOD_DATE,CONCAT(sp.START_TIME,\'' . ' to ' . '\', sp.END_TIME) AS DURATION,r.TITLE as ROOM,sp.TITLE AS PERIOD FROM course_period_var cpv,school_periods sp,rooms r WHERE sp.PERIOD_ID=cpv.PERIOD_ID AND cpv.ROOM_ID=r.ROOM_ID AND cpv.COURSE_PERIOD_ID=' . $rdd['COURSE_PERIOD_ID']));
$cp_info = DBGet(DBQuery('SELECT * FROM course_periods WHERE COURSE_PERIOD_ID=' . $rdd['COURSE_PERIOD_ID']));
if ($rdd['SCHEDULE_TYPE'] == 'FIXED') {
$schedule_RET[$rdi]['DAYS'] = _makeDays($get_det[1]['DAYS']);
$schedule_RET[$rdi]['DURATION'] = $get_det[1]['DURATION'];
$schedule_RET[$rdi]['ROOM'] = $get_det[1]['ROOM'];
$schedule_RET[$rdi]['PERIOD'] = $get_det[1]['PERIOD'];
if ($schedule_RET[$rdi]['MARKING_PERIOD_ID'] == 'Custom') {
$schedule_RET[$rdi]['MARKING_PERIOD_ID'] = date('M/d/Y', strtotime($cp_info[1]['BEGIN_DATE'])) . ' to ' . date('M/d/Y', strtotime($cp_info[1]['END_DATE']));
}
} else {
$temp_days = array();
示例12: array
}
}
echo '<TD valign=top>';
$columns = array('GRADE_COURSE' => 'Course');
$link = array();
$link['GRADE_COURSE']['link'] = "ForWindow.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}";
$link['GRADE_COURSE']['variables'] = array('course_id' => 'COURSE_ID');
if ($_REQUEST['modfunc'] != 'choose_course') {
$link['add']['link'] = "ForWindow.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}&course_id=new";
} else {
$link['GRADE_COURSE']['link'] .= "&modfunc={$_REQUEST['modfunc']}";
}
ListOutput($courses_RET, $columns, 'Course', 'Courses', $link, array(), $LO_options, 'ForWindow');
echo '</TD>';
if ($_REQUEST['course_id'] && $_REQUEST['course_id'] != 'new') {
$sql = "SELECT COURSE_PERIOD_ID AS CHECKBOX,COURSE_PERIOD_ID,TITLE,COALESCE(TOTAL_SEATS-FILLED_SEATS,0) AS AVAILABLE_SEATS FROM course_periods WHERE COURSE_ID='{$_REQUEST['course_id']}'AND (marking_period_id IS NOT NULL AND marking_period_id IN(" . GetAllMP(GetMPTable(GetMP(UserMP(), 'TABLE')), UserMP()) . ") OR marking_period_id IS NULL AND '" . date('Y-m-d') . "' <= end_date) ORDER BY TITLE";
$QI = DBQuery($sql);
$functions = array('CHECKBOX' => '_makeChooseCheckbox');
$periods_RET = DBGet($QI, $functions);
if (count($periods_RET)) {
if ($_REQUEST['course_period_id']) {
foreach ($periods_RET as $key => $value) {
if ($value['COURSE_PERIOD_ID'] == $_REQUEST['course_period_id']) {
$periods_RET[$key]['row_color'] = Preferences('HIGHLIGHT');
}
}
}
}
echo '<TD valign=top>';
$columns = array('CHECKBOX' => '</A><A>', 'TITLE' => 'Course Period');
if ($_REQUEST['modname'] == 'scheduling/Schedule.php') {
示例13: VerifySchedule
function VerifySchedule(&$schedule)
{
$conflicts = array();
$ij = count($schedule);
for ($i = 1; $i < $ij; $i++) {
for ($j = $i + 1; $j <= $ij; $j++) {
if (!$conflicts[$i] || !$conflicts[$j]) {
// the following two if's are equivalent, the second matches the 'Add a Course' logic, the first is the demorgan equivalent and easier to follow
// if -not- marking periods don't overlap -or- dates don't overlap (i ends and j starts after i -or- j ends and i starts after j) then check further
//if(! (strpos(GetAllMP(GetMPTable(GetMP($schedule[$i]['MARKING_PERIOD_ID'],'TABLE')),$schedule[$i]['MARKING_PERIOD_ID']),"'".$schedule[$j]['MARKING_PERIOD_ID']."'")===false
//|| $schedule[$i]['END_EPOCH'] && $schedule[$j]['START_EPOCH']>$schedule[$i]['END_EPOCH'] || $schedule[$j]['END_EPOCH'] && $schedule[$i]['START_EPOCH']>$schedule[$j]['END_EPOCH']))
// if marking periods overlap -and- dates overlap (i doesn't end or j starts before i ends -and- j doesn't end or i starts before j ends) check further
if (strpos(GetAllMP(GetMPTable(GetMP($schedule[$i]['MARKING_PERIOD_ID'], 'TABLE')), $schedule[$i]['MARKING_PERIOD_ID']), "'" . $schedule[$j]['MARKING_PERIOD_ID'] . "'") !== false && (!$schedule[$i]['END_EPOCH'] || $schedule[$j]['START_EPOCH'] <= $schedule[$i]['END_EPOCH']) && (!$schedule[$j]['END_EPOCH'] || $schedule[$i]['START_EPOCH'] <= $schedule[$j]['END_EPOCH'])) {
// should not be enrolled in the same course with overlapping marking periods and dates
if ($schedule[$i]['COURSE_ID'] == $schedule[$j]['COURSE_ID']) {
//&& $schedule[$i]['COURSE_WEIGHT']==$schedule[$j]['COURSE_WEIGHT'])
$conflicts[$i] = $conflicts[$j] = true;
} else {
// if different periods then okay
if ($schedule[$i]['PERIOD_ID'] == $schedule[$j]['PERIOD_ID']) {
// should not be enrolled in the same period on the same day
if (strlen($schedule[$i]['DAYS']) + strlen($schedule[$j]['DAYS']) > 7) {
$conflicts[$i] = $conflicts[$j] = true;
} else {
foreach (_str_split($schedule[$i]['DAYS']) as $k) {
if (strpos($schedule[$j]['DAYS'], $k) !== false) {
$conflicts[$i] = $conflicts[$j] = true;
break;
}
}
}
}
}
}
}
}
}
foreach ($conflicts as $i => $true) {
$schedule[$i]['TITLE'] = '<FONT color=red>' . $schedule[$i]['TITLE'] . '</FONT>';
}
}
示例14: DBQuery
$day = 'U';
}
}
$period_select .= "<OPTION value={$period['ID']}" . (CpvId() == $period['ID'] ? ' SELECTED' : '') . ">" . $period['CPSHORT'] . "-" . $day . "</OPTION>";
if (CpvId() == $period['ID']) {
$_SESSION['UserPeriod'] = $period['PERIOD_ID'];
}
}
$period_select .= "</SELECT>";
}
}
}
if ($incl_page != 'attendance/MissingAttendance.php' && $incl_page != 'attendance/TakeAttendance.php') {
if (!$_SESSION['take_mssn_attn']) {
if (!isset($_REQUEST['process'])) {
$QI = DBQuery('SELECT DISTINCT cpv.ID,cpv.PERIOD_ID,cp.COURSE_PERIOD_ID,sp.TITLE,cp.SHORT_NAME as CPSHORT, cpv.DAYS,cpv.COURSE_PERIOD_DATE,sp.SHORT_NAME,cp.MARKING_PERIOD_ID,cpv.DAYS,sp.SORT_ORDER,c.TITLE AS COURSE_TITLE,cp.TITLE as COURSE_PERIOD_TITLE FROM course_periods cp,course_period_var cpv, school_periods sp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cpv.PERIOD_ID=sp.PERIOD_ID AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND cp.SYEAR=\'' . UserSyear() . '\' AND cp.SCHOOL_ID=\'' . UserSchool() . '\' AND (cp.TEACHER_ID=\'' . UserStaffID() . '\' OR cp.SECONDARY_TEACHER_ID=\'' . UserStaffID() . '\') AND (cp.MARKING_PERIOD_ID IN (' . GetAllMP_mod(GetMPTable(GetMP(UserMP(), 'TABLE')), UserMP()) . ') OR cp.MARKING_PERIOD_ID IS NULL) GROUP BY cp.COURSE_PERIOD_ID ORDER BY sp.SORT_ORDER ');
$RET = DBGet($QI);
$period_select = "Choose Period: <SELECT name=period onChange='this.form.submit();'>";
$period_select .= "<OPTION value='na' selected>N/A</OPTION>";
foreach ($RET as $period) {
$period_select .= "<OPTION value={$period['ID']}" . (CpvId() == $period['ID'] ? ' SELECTED' : '') . ">" . $period['COURSE_PERIOD_TITLE'] . "</OPTION>";
if (CpvId() == $period['ID']) {
$_SESSION['UserPeriod'] = $period['PERIOD_ID'];
}
}
$period_select .= "</SELECT>";
}
}
}
$profile = DBGet(DBQuery('SELECT PROFILE FROM staff WHERE STAFF_ID=' . UserID()));
if ($profile[1]['PROFILE'] == "admin") {
示例15: _makeCodePulldown
function _makeCodePulldown($value, $title)
{
global $THIS_RET, $codes_RET, $current_RET, $current_schedule_RET, $date;
if (!is_array($current_schedule_RET[$THIS_RET['STUDENT_ID']])) {
$current_mp = GetCurrentMP('QTR', $date);
if (!$current_mp) {
$current_mp = GetCurrentMP('SEM', $date);
}
if (!$current_mp) {
$current_mp = GetCurrentMP('FY', $date);
}
$all_mp = GetAllMP(GetMPTable(GetMP($current_mp, 'TABLE')), $current_mp);
$current_schedule_RET[$THIS_RET['STUDENT_ID']] = DBGet(DBQuery('SELECT cpv.PERIOD_ID,cp.COURSE_PERIOD_ID,cp.HALF_DAY FROM schedule s,course_periods cp,course_period_var cpv WHERE s.STUDENT_ID=\'' . $THIS_RET['STUDENT_ID'] . '\' AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND s.SYEAR=\'' . UserSyear() . '\' AND s.SCHOOL_ID=\'' . UserSchool() . '\' AND cp.COURSE_PERIOD_ID = s.COURSE_PERIOD_ID AND cpv.DOES_ATTENDANCE=\'Y\' 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 (' . $all_mp . ') or s.MARKING_PERIOD_ID IS NULL) ORDER BY s.START_DATE ASC'), array(), array('PERIOD_ID'));
if (!$current_schedule_RET[$THIS_RET['STUDENT_ID']]) {
$current_schedule_RET[$THIS_RET['STUDENT_ID']] = array();
}
}
if ($THIS_RET['COURSE']) {
$period = $THIS_RET['PERIOD_ID'] . '_' . $THIS_RET['COURSE_PERIOD_ID'];
$period_id = $THIS_RET['PERIOD_ID'];
$code_title = 'TITLE';
} else {
$period_id = substr($title, 7);
$period = $current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id][1]['PERIOD_ID'] . '_' . $current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id][1]['COURSE_PERIOD_ID'];
$code_title = 'TITLE';
}
if ($current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id]) {
foreach ($codes_RET as $code) {
if ($current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id][1]['HALF_DAY'] != 'Y' || $code['STATE_CODE'] != 'H') {
// prune half day codes for half day courses
$options[$code['ID']] = $code[$code_title];
}
}
$crp_id = $current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id][1]['COURSE_PERIOD_ID'];
$val = $current_RET[$THIS_RET['STUDENT_ID']][$crp_id][1]['ATTENDANCE_CODE'];
return SelectInput($val, 'attendance[' . $THIS_RET['STUDENT_ID'] . '][' . $crp_id . '][ATTENDANCE_CODE]', '', $options);
} else {
return false;
}
}