function DateInputAY($value, $name, $counter = 1) { $show = ""; $date_sep = ""; $monthVal = ""; $yearVal = ""; $dayVal = ""; $display = ""; if ($value != '') { return '<table><tr><td><div id="date_div_' . $counter . '" style="display: inline" >' . ProperDateAY($value) . ' </div></td><td><input type=text id="date_' . $counter . '" ' . $show . ' style="display:none" readonly></td><td><a onClick="init(' . $counter . ',2);"><img src="assets/calendar.gif" /></a></td><td><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>'; } else { if ($counter == 2) { return '<input type=text id="date_' . $counter . '" class="login_txt" disabled=disabled readonly> <a onClick="init(' . $counter . ',1);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" disabled=disabled><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '" disabled=disabled><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" disabled=disabled>'; } else { return '<input type=text id="date_' . $counter . '" class="login_txt" readonly> <a onClick="init(' . $counter . ',1);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" >'; } } }
function PrepareDateSchedule($date = '', $title = '', $allow_na = true, $options = '') { global $_openSIS; static $counter = 0; if ($options == '') { $options = array(); } if (!$options['Y'] && !$options['M'] && !$options['D'] && !$options['C']) { $options += array('Y' => true, 'M' => true, 'D' => true, 'C' => true); } if ($options['short'] == true) { $extraM = "style='width:60;' "; } if ($options['submit'] == true) { $tmp_REQUEST['M'] = $tmp_REQUEST['D'] = $tmp_REQUEST['Y'] = $_REQUEST; unset($tmp_REQUEST['M']['month' . $title]); unset($tmp_REQUEST['D']['day' . $title]); unset($tmp_REQUEST['Y']['year' . $title]); $extraM .= "onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST['M']) . "&month{$title}=\"+this.form.month{$title}.value;'"; $extraD .= "onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST['D']) . "&day{$title}=\"+this.form.day{$title}.value;'"; $extraY .= "onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST['Y']) . "&year{$title}=\"+this.form.year{$title}.value;'"; } if ($options['C']) { $_openSIS['PrepareDate']++; } if ($options['C']) { $return .= '<div style="margin-top:-3px; float:left">' . DateInputAY($date, $title, $counter) . '</div>'; $counter++; } if ($_REQUEST['_openSIS_PDF']) { $return = ProperDateAY($date); } return $return; }
function _makeMPSelect($mp_id, $name = '') { global $THIS_RET; if ($mp_id != '') { return GetMP($mp_id); } else { $check_custom = DBGet(DBQuery('SELECT BEGIN_DATE,END_DATE FROM course_periods WHERE COURSE_PERIOD_ID=' . $THIS_RET['COURSE_PERIOD_ID'] . ' AND BEGIN_DATE IS NOT NULL AND END_DATE IS NOT NULL AND BEGIN_DATE!=\'0000-00-00\' AND END_DATE!=\'0000-00-00\' ')); if (count($check_custom) > 0) { return '<div style="white-space: nowrap;">' . ProperDateAY($check_custom[1]['BEGIN_DATE']) . ' to ' . ProperDateAY($check_custom[1]['END_DATE']) . '</div>'; } } // }
function PrepareDate($date = '', $title = '', $allow_na = true, $options = '', $cal_img = 'Y') { global $_openSIS; if ($options == '') { $options = array(); } if (!$options['Y'] && !$options['M'] && !$options['D'] && !$options['C']) { $options += array('Y' => true, 'M' => true, 'D' => true, 'C' => true); } if ($options['disabled'] == true) { $extraM = ' DISABLED '; $extraD = ' DISABLED '; $extraY = ' DISABLED '; } if ($options['short'] == true) { $extraM = "style='width:60;' "; } if ($options['submit'] == true) { $tmp_REQUEST['M'] = $tmp_REQUEST['D'] = $tmp_REQUEST['Y'] = $_REQUEST; unset($tmp_REQUEST['M']['month' . $title]); unset($tmp_REQUEST['D']['day' . $title]); unset($tmp_REQUEST['Y']['year' . $title]); $extraM .= "onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST['M']) . "&month{$title}=\"+this.form.month{$title}.value;'"; $extraD .= "onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST['D']) . "&day{$title}=\"+this.form.day{$title}.value;'"; $extraY .= "onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST['Y']) . "&year{$title}=\"+this.form.year{$title}.value;'"; } if ($options['C']) { $_openSIS['PrepareDate']++; } if (strlen($date) == 9) { $day = substr($date, 0, 2); $month = substr($date, 3, 3); $year = substr($date, 7, 2); } else { if ($date != '') { $day = substr($date, 8, 2); $month = MonthNWSwitch(substr($date, 5, 2), 'tochar'); $year = substr($date, 2, 2); } if ($allow_na == false && $date == '') { $day = date('d'); $month = date('m'); $year = date('y'); } } // MONTH --------------- if ($options['M']) { $return .= "<div style=white-space:nowrap ><SELECT style=width:90px; NAME=month" . $title . " id=monthSelect" . $_openSIS['PrepareDate'] . " SIZE=1 {$extraM}>"; // -------------------------------------------------------------------------- // if ($month == 'JAN') { $month = 1; } elseif ($month == 'FEB') { $month = 2; } elseif ($month == 'MAR') { $month = 3; } elseif ($month == 'APR') { $month = 4; } elseif ($month == 'MAY') { $month = 5; } elseif ($month == 'JUN') { $month = 6; } elseif ($month == 'JUL') { $month = 7; } elseif ($month == 'AUG') { $month = 8; } elseif ($month == 'SEP') { $month = 9; } elseif ($month == 'OCT') { $month = 10; } elseif ($month == 'NOV') { $month = 11; } elseif ($month == 'DEC') { $month = 12; } // -------------------------------------------------------------------------- // if ($allow_na) { if ($month == '000') { $return .= "<OPTION value=\"\" SELECTED>N/A"; } else { $return .= "<OPTION value=\"\">N/A"; } } if ($month == '1') { $return .= "<OPTION VALUE=JAN SELECTED>January"; } else { $return .= "<OPTION VALUE=JAN>January"; } if ($month == '2') { $return .= "<OPTION VALUE=FEB SELECTED>February"; } else { $return .= "<OPTION VALUE=FEB>February"; } if ($month == '3') { $return .= "<OPTION VALUE=MAR SELECTED>March"; } else { $return .= "<OPTION VALUE=MAR>March"; } if ($month == '4') { $return .= "<OPTION VALUE=APR SELECTED>April"; } else { $return .= "<OPTION VALUE=APR>April"; } if ($month == '5') { $return .= "<OPTION VALUE=MAY SELECTED>May"; } else { $return .= "<OPTION VALUE=MAY>May"; } if ($month == '6') { $return .= "<OPTION VALUE=JUN SELECTED>June"; } else { $return .= "<OPTION VALUE=JUN>June"; } if ($month == '7') { $return .= "<OPTION VALUE=JUL SELECTED>July"; } else { $return .= "<OPTION VALUE=JUL>July"; } if ($month == '8') { $return .= "<OPTION VALUE=AUG SELECTED>August"; } else { $return .= "<OPTION VALUE=AUG>August"; } if ($month == '9') { $return .= "<OPTION VALUE=SEP SELECTED>September"; } else { $return .= "<OPTION VALUE=SEP>September"; } if ($month == '10') { $return .= "<OPTION VALUE=OCT SELECTED>October"; } else { $return .= "<OPTION VALUE=OCT>October"; } if ($month == '11') { $return .= "<OPTION VALUE=NOV SELECTED>November"; } else { $return .= "<OPTION VALUE=NOV>November"; } if ($month == '12') { $return .= "<OPTION VALUE=DEC SELECTED>December"; } else { $return .= "<OPTION VALUE=DEC>December"; } $return .= "</SELECT> "; } // DAY --------------- if ($options['D']) { $return .= "<SELECT NAME=day" . $title . " id=daySelect" . $_openSIS['PrepareDate'] . " SIZE=1 {$extraD}>"; if ($allow_na) { if ($day == '00') { $return .= "<OPTION value=\"\" SELECTED>N/A"; } else { $return .= "<OPTION value=\"\">N/A"; } } for ($i = 1; $i <= 31; $i++) { if (strlen($i) == 1) { $print = '0' . $i; } else { $print = $i; } $return .= "<OPTION VALUE=" . $print; if ($day == $print) { $return .= " SELECTED"; } $return .= ">{$i} "; } $return .= "</SELECT> "; } // YEAR --------------- if ($options['Y']) { if (!$year) { $begin = date('Y') - 60; $end = date('Y') + 20; } else { if ($year < 50) { $year = '20' . $year; } else { $year = '19' . $year; } $begin = $year - 59; $end = $year + 21; } $return .= "<SELECT NAME=year" . $title . " id=yearSelect" . $_openSIS['PrepareDate'] . " SIZE=1 {$extraY}>"; if ($allow_na) { if ($year == '00') { $return .= "<OPTION value=\"\" SELECTED>N/A"; } else { $return .= "<OPTION value=\"\">N/A"; } } for ($i = $begin; $i <= $end; $i++) { $return .= "<OPTION VALUE=" . substr($i, 0); if ($year == $i) { $return .= " SELECTED"; } $return .= ">" . $i; } $return .= "</SELECT> "; } if ($options['C']) { if ($cal_img != 'N') { $return .= '<span style="padding-top:4px"><img src="assets/calendar.gif" id="trigger' . $_openSIS['PrepareDate'] . '" style="cursor: pointer;" onmouseover=this.style.background=""; onmouseout=this.style.background=""; onClick=' . "MakeDate('" . $_openSIS['PrepareDate'] . "',this);" . ' /></span></div>'; } } if ($_REQUEST['_openSIS_PDF']) { $return = ProperDateAY($date); } return $return; }
function DateInputAY($value, $name, $counter = 1) { if (AllowEdit() && !$_REQUEST['_openSIS_PDF']) { if ($value != '') { $month_names = array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'); $show = "value='{$value}'"; $date_sep = explode('-', $value); $monthVal = "value='" . $month_names[$date_sep[1] - 1] . "'"; $yearVal = "value='{$date_sep['0']}'"; $dayVal = "value='{$date_sep['2']}'"; $display = ""; } else { $show = ""; $date_sep = ""; $monthVal = ""; $yearVal = ""; $dayVal = ""; $display = ""; } if ($value != '') { return '<table cellspacing="0" cellpadding="0"><tr><td><div id="date_div_' . $counter . '" style="display: inline" >' . ProperDateAY($value) . '</div><input type=text id="date_' . $counter . '" ' . $show . ' style="display:none" readonly></td><td> </td><td><a onClick="init(' . $counter . ',2);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>'; } else { return '<table cellspacing="0" cellpadding="0"><tr><td><input type=text id="date_' . $counter . '" ' . $show . ' readonly></td><td> </td><td><a onClick="init(' . $counter . ',1);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>'; } } else { return ProperDateAY($value); } }
function DateInputAY_red($value, $name, $counter = 1, $cp_id) { if (AllowEdit() && !$_REQUEST['_openSIS_PDF']) { if ($value != '') { $month_names = array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'); $show = "value='{$value}'"; $date_sep = explode('-', $value); $monthVal = "value='" . $month_names[$date_sep[1] - 1] . "'"; $yearVal = "value='{$date_sep['0']}'"; $dayVal = "value='{$date_sep['2']}'"; $display = ""; } else { $show = ""; $date_sep = ""; $monthVal = ""; $yearVal = ""; $dayVal = ""; $display = ""; } if ($value != '') { $student_id = UserStudentID(); $qr = DBGet(DBQuery('select end_date from student_enrollment where student_id=' . $student_id . ' order by id desc limit 0,1')); $stu_end_date = $qr[1]['END_DATE']; $qr1 = DBGet(DBQuery('select end_date from course_periods where COURSE_PERIOD_ID=' . $cp_id . '')); $cr_end_date = $qr1[1]['END_DATE']; if (strtotime($cr_end_date) > strtotime($stu_end_date) && $stu_end_date != '') { return '<table cellspacing="0" cellpadding="0"><tr><td><div id="date_div_' . $counter . '" style="display: inline" ><FONT color=red>' . ProperDateAY($value) . '</FONT></div><input type=text id="date_' . $counter . '" ' . $show . ' style="display:none" readonly></td><td> </td><td><a onClick="init(' . $counter . ',2);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>'; } else { return '<table cellspacing="0" cellpadding="0"><tr><td><div id="date_div_' . $counter . '" style="display: inline" >' . ProperDateAY($value) . '</div><input type=text id="date_' . $counter . '" ' . $show . ' style="display:none" readonly></td><td> </td><td><a onClick="init(' . $counter . ',2);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>'; } return '<table cellspacing="0" cellpadding="0"><tr><td><div id="date_div_' . $counter . '" style="display: inline" >' . ProperDateAY($value) . '</div><input type=text id="date_' . $counter . '" ' . $show . ' style="display:none" readonly></td><td> </td><td><a onClick="init(' . $counter . ',2);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>'; } else { return '<table cellspacing="0" cellpadding="0"><tr><td><input type=text id="date_' . $counter . '" ' . $show . ' readonly></td><td> </td><td><a onClick="init(' . $counter . ',1);"><img src="assets/calendar.gif" /></a><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>'; } } else { return ProperDateAY($value); } }
function _makeMPA($value, $column) { global $THIS_RET; if ($value != '' && $THIS_RET['MARKING_PERIOD_ID'] == $THIS_RET['MPA_ID']) { return GetMP($value); } elseif ($value != '' && $THIS_RET['MARKING_PERIOD_ID'] != $THIS_RET['MPA_ID']) { return '*' . GetMP($value); } else { $check_custom = DBGet(DBQuery('SELECT BEGIN_DATE,END_DATE FROM course_periods WHERE COURSE_PERIOD_ID=' . $THIS_RET['COURSE_PERIOD_ID'] . ' AND BEGIN_DATE IS NOT NULL AND END_DATE IS NOT NULL AND BEGIN_DATE!=\'0000-00-00\' AND END_DATE!=\'0000-00-00\' ')); if (count($check_custom) > 0) { return '<div style="white-space: nowrap;">' . ProperDateAY($check_custom[1]['BEGIN_DATE']) . ' to ' . ProperDateAY($check_custom[1]['END_DATE']) . '</div>'; } } }