function display_form($assignment_id = -1, $y, $m, $d, $cid, $tid, $sm, $em) { if ($assignment_id > 0) { // retrieve the text from the db $sql = "SELECT assignment from homework where homework_id=" . $assignment_id; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $assignment_text = $row['assignment']; } else { $assignment_text = ""; } $b .= "<form action=" . $_SERVER['PHP_SELF'] . "?lev=" . $_REQUEST['lev'] . "&cat=" . $_REQUEST['cat'] . " method=\"post\" onSubmit=\"return validateForm(this);\">\n"; $b .= "<TABLE bgcolor=white cellspacing=2 cellpadding=3 border=0>\n"; $b .= " <TR>\n"; $b .= "\t<TD align=right>What year is this for?\n"; $b .= "\t<TD align=left>" . make_LOY("year", $y, $sy, $ey) . "</TD>\n"; $b .= " </TR><TR>\n"; $b .= "\t<TD align=right>What month is this for?\n"; $b .= "\t<TD align=left>" . make_LOM("month", $m, $sm, $em) . "</TD>\n"; $b .= " </TR><TR>\n"; $b .= "\t<TD align=right>What Day is this for?\n"; $b .= "\t<TD align=left>" . make_LOD("day", $d) . "</TD>\n"; $b .= " </TR><TR>\n"; $b .= "\t<TD bgcolor=white colspan=2 width=100 align=center>\n"; $b .= "<INPUT type=submit name=preview value=Submit>"; $b .= " </TR><TR>\n"; $b .= "\t<TD bgcolor=white colspan=2 width=100>\n"; $b .= "\t<TEXTAREA rows=20 cols=90 wrap=soft id=assignment_text name=assignment_text \n\t\t\t\tstyle=\"background-color:#ffffcc\" value=\"\">{$assignment_text}</TEXTAREA></TD>\n"; $b .= " </TR><TR>\n"; $b .= "\t<TD align=center colspan=2>"; $b .= "<INPUT type=submit name=preview value=Submit>"; $b .= "<INPUT type=hidden name=assignment_num value={$assignment_id}>"; $b .= "<input type=hidden name=edit />"; $b .= "</TD>\n"; $b .= " </TR>\n"; $b .= "</TABLE>\n"; $b .= "</form>"; return $b; }
function messageForm($data) { global $startYr, $endYr; $t = "Message to Parents/Students"; $b = ""; $b .= "\n <center>\n\t<FORM action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=POST onSubmit=\"return validateForm(this);\">\n\t<table cellspacing=1 cellpadding=3 border=0 bgcolor=black border=0>\n\t\t<tr>\n\t\t<th>Start Date</th><th>End Date</th>\t\n\t\t</tr><tr>\n\t\t<td><span style=white-space:nowrap>" . make_LOM("startMonth", $data['startMonth']) . make_LOD("startDay", $data['startDay']) . make_LOY("startYear", $data['startYear'], $startYr, $endYr) . "</span></td>\n\t\t<td><span style=white-space:nowrap>" . make_LOM("endMonth", $data['endMonth']) . make_LOD("endDay", $data['endDay']) . make_LOY("endYear", $data['endYear'], $startYr, $endYr) . "</span></td>\n\t\t</tr>"; if ($data['lev'] == 3) { /** get_teacher_course_list($tid,$core="") **/ $courses = get_teacher_course_list($data['u_id'], $_SESSION[$_CONF['sess_name'] . '_current_school_year'], $_SESSION[$_CONF['sess_name'] . '_myCenter'], 'Y'); $b .= "\n\t\t\t<tr>\n\t\t\t<td colspan=2>\n\t\t\tThis Message is for :"; foreach ($courses as $id => $name) { $b .= "\n\t\t\t\t<input type=checkbox name=cid_" . $id . " value=" . $id; if (in_array($id, $data['forCourses'])) { $b .= " checked"; } $b .= " />" . $name; } $b .= "\n\t\t\t</td>\n\t\t\t</tr>"; } $b .= "\n\t\t<tr>\n\t\t<th width=200 colspan=2>Message</th>\n\t\t</tr><tr>\n\t\t<td colspan=2><textarea rows=10 cols=70 name=message id=message>" . $data['message'] . "</textarea></td>\n\t\t</tr><tr>\n\t\t<td colspan=2>\n\t\t<center>\n\t\t\t<input type=submit class=" . $data['button']['class'] . " name=update_message value='" . $data['button']['value'] . "'>\n\t\t\t<input type=hidden name=message_id value=" . $data['messageID'] . " />\n\t\t</center>\n\t\t</td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t</center>"; $ret .= make_box($t, $b, "blue"); return $ret; }
$count = 1; if ($result) { while ($row = mysql_fetch_assoc($result)) { list($sy, $sm, $sd) = split("-", $row['term_start_date']); list($ey, $em, $ed) = split("-", $row['term_end_date']); $b .= "<tr>\n\t\t\t\t\t\t\t\t<td><input type=text size=30 name=t_" . $count . "_name value=\"" . $row['term_name'] . "\""; if (isset($_POST['term_id']) && $_POST['term_id'] == $row['term_id']) { $b .= " style=background:yellow"; } $b .= " />\n\t\t\t\t\t\t\t\t\t<input type=hidden name=t_" . $row['term_ord'] . "_ord value=" . $row['term_ord'] . " /></td>\n\t\t\t\t\t\t\t\t<td><input type=text size=5 name=t_" . $count . "_weight value=\"" . $row['term_weight'] . "\" /></td>\n\t\t\t\t\t\t\t\t<td><span style=white-space:nowrap>" . make_LOM("t_" . $count . "_startMonth", $sm) . make_LOD("t_" . $count . "_startDay", $sd) . make_LOY("t_" . $count . "_startYear", $sy, $startYR, $endYR) . "</span></td>\n\t\t\t\t\t\t\t\t<td><span style=white-space:nowrap>" . make_LOM("t_" . $count . "_endMonth", $em) . make_LOD("t_" . $count . "_endDay", $ed) . make_LOY("t_" . $count . "_endYear", $ey, $startYR, $endYR) . "</span></td>\n\t\t\t\t\t\t\t\t</tr>"; $count++; } } $yr = date('Y'); for ($i = $count; $i <= $_POST['numTerms'] + $count - 1; $i++) { $b .= "<tr>\n\t\t\t\t\t\t\t<td><input type=text size=30 name=t_" . $i . "_name />\n\t\t\t\t\t\t\t\t<input type=hidden name=t_" . $i . "_ord value=" . $i . " /></td>\n\t\t\t\t\t\t\t<td><input type=text size=5 name=t_" . $i . "_weight /></td>\n\t\t\t\t\t\t\t<td><span style=white-space:nowrap>" . make_LOM("t_" . $i . "_startMonth") . make_LOD("t_" . $i . "_startDay") . make_LOY("t_" . $i . "_startYear", $yr, $startYR, $endYR) . "</span></td>\n\t\t\t\t\t\t\t<td><span style=white-space:nowrap>" . make_LOM("t_" . $i . "_endMonth") . make_LOD("t_" . $i . "_endDay") . make_LOY("t_" . $i . "_endYear", $yr, $startYR, $endYR) . "</span></td>\n\t\t\t\t\t\t\t</tr>"; } $b .= "\n\t\t\t\t</table><center>\n\t\t\t\t\t\t<input type=hidden name=numTerms value=" . ($i - 1) . " />\n\t\t\t\t\t\t<input type=submit name=insert_term value=Insert>\n\t\t\t\t</center></form>"; $main .= "<br />" . make_box($t, $b, $bc); } if (isset($_POST['insert_term'])) { /** one term record is t_#_name, t_#_weight, t_#_startMonth,t_#_startDay, t_#_startYear , t_#_endMonth, t_#_endDay, t_#_endYear **/ for ($tid = 1; $tid <= $_POST['numTerms']; $tid++) { $ord = $_POST['t_' . $tid . '_ord']; $start_date = $_POST['t_' . $tid . '_startYear'] . "-" . $_POST['t_' . $tid . '_startMonth'] . "-" . $_POST['t_' . $tid . '_startDay']; $end_date = $_POST['t_' . $tid . '_endYear'] . "-" . $_POST['t_' . $tid . '_endMonth'] . "-" . $_POST['t_' . $tid . '_endDay']; $name = mysql_real_escape_string($_POST['t_' . $tid . '_name']); $weight = $_POST['t_' . $tid . '_weight']; $sql = "INSERT into term (teacher_id, school_year_id, term_name, term_weight,term_start_date, term_end_date, term_ord)\t\n\t\t\t\t\tVALUES(" . $_SESSION[$_CONF['sess_name'] . '_myUID'] . "," . $_SESSION[$_CONF['sess_name'] . '_current_school_year'] . ",'" . $name . "'," . $weight . ",'" . $start_date . "','" . $end_date . "'," . $ord . ") \n\t\t\t\t\tON DUPLICATE KEY\n\t\t\t\t\tUPDATE term_name='" . $name . "', term_start_date='" . $start_date . "', term_end_date='" . $end_date . "', term_weight=" . $weight; $result = mysql_query($sql); }
$admin_form .= " checked"; } $admin_form .= " />Out of School\n </div>\n </td>\n <td>"; $date = make_LOM('admin_refer_suspension_end_month', $admin_refer_suspension_end_month, '1', '12') . " " . make_LOD('admin_refer_suspension_end_day', $admin_refer_suspension_end_day) . " " . make_LOY('admin_refer_suspension_end_year', $admin_refer_suspension_end_year, $admin_refer_suspension_end_year - 1, $admin_refer_suspension_end_year); $admin_form .= "<div id=\"admin_refer_suspension_end\" style=\"visibility:" . $visible . "\">End: " . $date . "</div>\n </td> \n </tr> \n <tr>\n <td><input name=\"admin_refer_pconf\" type=\"checkbox\" onClick=\"showHide('admin_refer_pconf_date');\""; $visible = "hidden"; if ($admin_refer_pconf == 'on') { $admin_form .= " checked"; $visible = "visible"; } $admin_form .= " />\n Parent Conference Requested </td>\n <td>"; $date = make_LOM('admin_refer_pconf_month', $admin_refer_pconf_month, '1', '12') . " " . make_LOD('admin_refer_pconf_day', $admin_refer_pconf_day) . " " . make_LOY('admin_refer_pconf_year', $admin_refer_pconf_year, $admin_refer_pconf_year - 1, $admin_refer_pconf_year); $admin_form .= "<div id=\"admin_refer_pconf_date\" style=\"visibility:" . $visible . "\">" . $date . "</div>\n </td>\n </tr> \n <tr>\n <td><input name=\"admin_refer_other\" type=\"checkbox\" onClick=\"showHide('admin_refer_other_date');\""; $visible = "hidden"; if ($admin_refer_other == 'on') { $admin_form .= " checked"; $visible = "visible"; } $admin_form .= " />\n Other</td>\n <td>"; $date = make_LOM('admin_refer_other_month', $admin_refer_other_month, '1', '12') . " " . make_LOD('admin_refer_other_day', $admin_refer_other_day) . " " . make_LOY('admin_refer_other_year', $admin_refer_other_year, $admin_refer_other_year - 1, $admin_refer_other_year); $admin_form .= "<div id=\"admin_refer_other_date\" style=\"visibility:" . $visible . "\">" . $date . "</div>\n </td>\n </tr>\n <tr>\n <td><input name=\"admin_refer_guid\" type=\"checkbox\" onClick=\"showHide('admin_refer_guid_date');\""; $visible = "hidden"; if ($admin_refer_guid == 'on') { $admin_form .= " checked"; $visible = "visible"; } $admin_form .= " />\n Conference/Guidance/Social Worker/Home School </td>\n <td>"; $date = make_LOM('admin_refer_guid_month', $admin_refer_guid_month, '1', '12') . " " . make_LOD('admin_refer_guid_day', $admin_refer_guid_day) . " " . make_LOY('admin_refer_guid_year', $admin_refer_guid_year, $admin_refer_guid_year - 1, $admin_refer_guid_year); $admin_form .= "<div id=\"admin_refer_guid_date\" style=\"visibility:" . $visible . "\">" . $date . "</div>\n </td>\n </tr>\n <tr>\n <td colspan=\"2\"><textarea name=\"admin_refer_conf_notes\" cols=\"90\" rows=\"2\">" . $admin_refer_conf_notes . "</textarea></td>\n </tr>"; /** Add the CLOSED button **/ $admin_form .= " \n </tr>\n <tr>\n <td colspan=\"2\">\n <div class=\"displayTextHeading\">Close this referral? <input name=\"isClosed\" type=checkbox /></div></td>\n </tr>";
} } $table .= "\n <td>\n Minutes: <input type=text size=3 name=attend_" . $myStudents_GUID[$row['STGUID']]['user_id'] . "_minutes id=attend_" . $myStudents_GUID[$row['STGUID']]['user_id'] . "_minutes value=" . $minutes . " />\n </td>\n </tr>"; /** NOTE **/ if ($_SESSION[$_CONF['sess_name'] . '_isOffice'] && $_GET['lev'] == 'office') { $table .= "\n <tr>\n <td align=right>Note:</td>\n <td colspan=6>\n <input type=text size=60 name=\"attend_" . $myStudents_GUID[$row['STGUID']]['user_id'] . "_note\" value='" . htmlentities($row['note'], ENT_QUOTES) . "' onkeyup=\"\"></input>\n </td>\n </tr>"; } else { if ($row['note'] != '') { $table .= "\n <tr>\n <td align=right>Note:</td>\n <td colspan=6><span style=\"white-space:nowrap;color:red;\">\n " . htmlentities($row['note'], ENT_QUOTES) . "</span>\n </td>\n </tr>"; } } } $table .= "\n </tbody>\n <tr align=center>\n <td colspan=7>\n <input type=submit class=submit name=send value=Send>\n <input type=hidden name=default value=" . $default . " />\n <input type=hidden name=year value=" . $yr . " />\n <input type=hidden name=month value=" . $mo . " />\n <input type=hidden name=day value=" . $dy . " />\n </td>\n </tr>\n </table>\n </FORM></center>"; $table .= "</form>"; $date = "<center><FORM action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=POST name=attendDate>"; $date .= "Month:" . make_LOM('month', $mo, '1', '12', 'attendDate', 'on') . " Day:" . make_LOD('day', $dy, 'attendDate', 'on') . " Year:" . make_LOY('year', $yr, $yr - 1, $yr, 'attendDate', 'on') . "<!-- input type=submit name=getDate value=GO /--><br />"; $date .= "<input type=hidden name=course_id value=" . $cid . ">"; $date .= "</form></center>"; $b .= $jscript . $date . $table; } /** end if selected class **/ } /** end if $displayForm **/ $c = "blue"; } else { /** not allowed to change attendance marks from prior years... **/ $b = "<center>You may not change attendance marks from prior years.</center>"; $t = "Warning"; $c = "yellow"; } $main .= make_box($t, $b, $c);
$schools = get_schools_for_center($_SESSION[$_CONF['sess_name'] . "_myCenter"]); $schoolList = make_array_from_mysql($schools, 'school_id', array('school_name'), ""); $schoolSelect = make_selection_list($schoolList, $schoolID, 'school_id', 'attendBySchoolForm', 'School', 'off'); $schoolYears = get_school_years_list(); $currentYear = $schoolYears[$_SESSION[$_CONF['sess_name'] . "_current_school_year"]]; $terms = $_SESSION[$_CONF['sess_name'] . "_terms"]; $firstTerm = $terms[min(array_keys($terms))]; $lastTerm = $terms[max(array_keys($terms))]; $startDate = $firstTerm['term_start_date']; $endDate = $lastTerm['term_end_date']; list($sy, $sm, $sd) = preg_split("/-/", $startDate); list($ey, $em, $ed) = preg_split("/-/", $endDate); $header .= "\n <script type=\"text/javascript\">\n \$(document).ready(function() {\n\n if(\$(\"#school_id\").val() == \"\"){\n \$(\"#attendBySchoolDialog\").hide();\n }\n \$(\"#school_id\").change(function(){\n \$(\"#getAttendBySchoolResults\").hide();\n \$(\".status\").attr('checked', false);\n \$(\".session\").attr('checked',false);\n if(\$(this).val() > 0){\n \$(\"#attendBySchoolDialog\").slideDown();\n } else{\n \$(\"#attendBySchoolDialog\").slideUp();\n }\n });\n\n \$('#a_date').datepick({\n onDate: \$.datepick.noWeekends,\n dateFormat: 'yyyy-mm-dd',\n minDate: new Date(" . $sy . ", " . ($sm - 1) . ", " . $sd . "),\n maxDate: new Date(" . $ey . ", " . ($em - 1) . ", " . $ed . "),\n numberOfMonths: 1\n });\n \$('#attendBySchoolForm').validationEngine({inlineValidation: true, scroll:false});\n });\n </script>"; $t = "Attendance By Date"; $b = "<center><FORM action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=POST name=attendByDate>"; $b .= "Month:" . make_LOM('month', $mo, 1, 12, 'attendByDate', 'off') . " Day:" . make_LOD('day', $da, 'attendByDate', 'off'); $b .= "<input type=\"submit\" name=\"getAttendByDate\" id=\"getAttendByDate\" value=\"Get\" />"; $b .= "</form></center>"; if (isset($_POST['getAttendByDate'])) { $date = $yr . "-" . $mo . "-" . $da; // without leading zeros $date = sprintf("%04d-%02d-%02d", $yr, $mo, $da); // with leading zeros $sql = "SELECT users.first_name, users.last_name, attendance.status, attendance.time, schools.school_name, attendance.date\n FROM users, attendance, schools, user2center\n WHERE attendance.date = '" . $date . "'\n AND attendance.status != 'present'\n AND user2center.user_id=attendance.student_id\n AND user2center.center_id=" . $_SESSION[$_CONF['sess_name'] . '_myCenter'] . "\n AND users.user_id=user2center.user_id\n AND schools.school_id=users.school_id\n ORDER by schools.school_name, users.last_name, users.first_name"; $b .= "<hr />"; $result = $db->query($sql); $current_school = ""; while ($row = $result->fetch_assoc()) { if ($row['school_name'] != $current_school) { $b .= "<span style=font-weight:bold>" . $row['school_name'] . "</span><br />"; }