} $ret .= "\n\t\t\$(document).ready(function() {"; foreach ($jobsArray as $id) { $ret .= "\n \n\t\t\t\$('input#wbl_" . $id . "_date').datepick({\n\t\t\t\tdateFormat: 'yy-mm-dd',\n\t\t\t\t\tminDate: new Date(" . $sy . ", " . ($sm - 1) . ", " . $sd . "),\n\t\t\t\t\tmaxDate: new Date(" . $ey . ", " . ($em - 1) . ", " . $ed . "),\n\t\t\t\t\tnumberOfMonths: 1\n\t\t\t}),"; } $ret .= "\n\t\t\t\$('#editWBLForm').validationEngine();\n\t\t});\n\t\t</script>\n\t\t"; $ret .= "\n\t\t<table border=0 cellspacing=1 cellpadding3>"; while ($row1 = $result1->fetch_assoc()) { $wbl_id = $row1['wbl_id']; $wbl_minutes = $row1['minutes']; $wbl_date = $row1['date']; $wbl_job = html_entity_decode($row1['job'], ENT_QUOTES); $wbl_contact = html_entity_decode($row1['contact'], ENT_QUOTES); $wbl_location = html_entity_decode($row1['location'], ENT_QUOTES); $wbl_type = html_entity_decode($row1['type'], ENT_QUOTES); $ret .= "\n\t\t\t<tr>\n <td>Type: " . make_wbl_array($wbl_id, $wbl_type) . "</td>\n\t\t\t\t\t<td>Location: <input class=\"validate[required]\" id=\"wbl_" . $wbl_id . "_location\" name=\"wbl_" . $wbl_id . "_location\" value=\"" . $wbl_location . "\" type=text size=30 /></td>\n\t\t\t\t\t<td>Contact: <input class=\"validate[required]\" id=\"wbl_" . $wbl_id . "_contact\" name=wbl_" . $wbl_id . "_contact value=\"" . $wbl_contact . "\" type=text size=15 /></td>\n\t\t\t\t\t<td>Date: <input class=\"validate[required,custom[date]]\" id=\"wbl_" . $iwbl_id . "_date\" name=\"wbl_" . $wbl_id . "_date\" value=\"" . $wbl_date . "\" type=text size=15 /></td>\n </tr>\n <tr>\n <td colspan=3>Job:<input class=\"validate[required]\" type=text size=100 id=\"wbl_" . $wbl_id . "_job\" name=\"wbl_" . $wbl_id . "_job\" value=\"" . $wbl_job . "\" /></td>\n <td>Minutes: <input class=\"validate[required,custom[number]]\" id=\"wbl_" . $wbl_id . "_minutes\" name=\"wbl_" . $wbl_id . "_minutes\" value=\"" . $wbl_minutes . "\" type=text size=5 /></td>\n </tr>"; } $ret .= "\n\t\t</table>"; $assignArray = array('error' => $error, 'message' => $msg, 'editWBL' => $ret); echo json_encode($assignArray); } //end editWBL if (isset($_POST['updateWBL'])) { $msg = "<h2>Updating Jobs</h2>"; $error = false; $wblsArray = array(); foreach ($_POST as $k => $v) { if (substr($k, 0, 4) == "wbl_") { list($j, $id, $key) = preg_split("/_/", $k); $wblsArray[$id][$key] = $v; }
$default = true; $key = 'user_id'; $result = get_students_for_course($cid); $results = make_assoc_array_from_sql($result, $key, 'my'); } else { $default = false; $key = 'user_id'; $result = get_wbl_for_today($cid, $selectedDate); $results = make_assoc_array_from_sql($result, $key, 'my'); $job = $results[$id]['job']; $contact = $results[$id]['contact']; $location = $results[$id]['location']; } $table = "\n <center><div style=\"color:red; font-weight:bold;\">NOTE : You must enter an wbl mark for every student now when taking wbl for the first time. <br />\n After that you only change a student that comes in late etc...<br />\n The minutes are the # of minutes a student spends in your classroom.</div></center><br />"; $table .= "\n <form action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=POST id=\"wblForm\">"; $table .= "\n <center>\n \n <table cellspacing=0 cellpadding=3 border=1 bgcolor=white>\n <thead style=\"background:yellow\">\n <tr>\n <td>WBL Type " . make_wbl_array($wblType) . "</td>\n <td>Minutes <input type=text size=3 class=\"validate[required,custom[number]]\" name=\"minutes\" id=\"minutes\" value=\"" . $minutes . "\" /></td>\n </tr>\n <tr>\n <td colspan=2>Job:<input type=text size=100 name=\"job\" value='" . htmlentities($jobText, ENT_QUOTES) . "' onkeyup=\"\"></td>\n </tr>\n <tr>\n <td>Contact:<input type=text size=40 name=\"contact\" value='" . htmlentities($contactText, ENT_QUOTES) . "' onkeyup=\"\"></td>\n <td>Location:<input type=text size=40 name=\"location\" value='" . htmlentities($locationText, ENT_QUOTES) . "' onkeyup=\"\"></td>\n </tr>\n </thead>\n <tbody class=wblRows>"; foreach ($myStudents_ID as $id => $row) { $job = $contact = $location = ''; if (array_key_exists($id, $results)) { $wblType = $results[$id]['type']; $minutes = $results[$id]['minutes']; } else { $wblType = 'Present'; $minutes = $classMinutes; } $table .= "\n <tr class=\"student wblStudentRow\">\n <td colspan=2>\n <span style=white-space:nowrap><input type=\"CHECKBOX\" id=\"wbl_" . $id . "_student\" name=\"wbl_" . $id . "_student\" value=\"" . $id . "\""; if ($default) { $table .= " checked=true"; } $table .= " />"; $table .= $row['first_name'] . " " . stripslashes($row['last_name']) . " - {" . getSchoolNameForID($row['user_id']) . "}</span></td>\n";