function dashInput() { // Preparation { if ($_POST["conf"]["date"]) { $pulldate = $_POST["conf"]["date"]; $month = $pulldate["month"]; $year = $pulldate["year"]; } else { $month = date("m"); $year = date("Y"); } $currentyear = date("Y"); $pulldate = mktime(0, 0, 0, $month, 1, $year); $greenmilescore = sqlPull(array("table" => "greenmile_scores", "where" => "date=" . $pulldate, "onerow" => 1)); $onchange = "onchange='dashinputform.action=\"index.php?mode=maxine/index&action=dashinput\"; dashinputform.submit();'"; // } maxineTop("Greenmile Inputs"); print "<form name='dashinputform' action='index.php?mode=maxine/index&action=commitdashinput' method='post'>"; openHeader(); maxineButton("Submit", "dashinputform.submit()"); maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=firstmenu\");"); closeHeader(); print "<div class='tray'>"; // Date Select { openSubbar(400); print "Date"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; print "<tr class='content1'><td align='center'>"; print "<select name=conf[date][month] " . $onchange . " style='width:50%;'>"; for ($i = 1; $i < 13; $i++) { print "<option value=" . $i . " " . ($month == $i ? "selected" : "") . ">"; print date("F", mktime(0, 0, 0, $i, 1, $year)); print "</option>"; } print "</select>"; print "<select name=conf[date][year] " . $onchange . " style='width:50%;'>"; for ($i = 0; $i < 6; $i++) { $displayyear = $currentyear - $i; print "<option " . ($displayyear == $year ? "selected" : "") . ">" . $displayyear . "</option>"; } print "</select>"; print "</td></tr>"; print "</table>"; // } // Misc { openSubbar(600); print "Miscellaneous"; closeSubbar(); print "<table class='standard' style='width:600px;'>"; print "<tr class='content1'><td align='center'>"; print "Invoice in full"; print "</td><td width=25%>"; print "<input name=conf[details][invoicefull] value='" . $greenmilescore["invoicefull"] . "' style='text-align:right;'>"; print "</td>"; print "<td align='center' width=25%>"; print "POD"; print "</td><td width=25%>"; print "<input name=conf[details][pods] value='" . $greenmilescore["pods"] . "' style='text-align:right;'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Invoice Error"; print "</td><td>"; print "<input name=conf[details][invoiceerrors] value='" . $greenmilescore["invoiceerrors"] . "' style='text-align:right;'>"; print "</td>"; print "<td align='center'>"; print "Shortages"; print "</td><td>"; print "<input name=conf[details][shortages] value='" . $greenmilescore["shortages"] . "' style='text-align:right;'>"; print "</td>"; print "<tr class='content1'><td align='center'>"; print "Complaints"; print "</td><td>"; print "<input name=conf[details][complaints] value='" . $greenmilescore["complaints"] . "' style='text-align:right;'>"; print "</td>"; print "<td colspan=2>"; print "</td></tr>"; print "</table>"; // } // Defects & Opportunities { openSubbar(600); print "Defects & Opportunities"; closeSubbar(); print "<table class='standard' style='width:600px;'>"; print "<tr class='content1'><td align='center' width=25%>"; print "Defect"; print "</td><td width=25%>"; print "<input name=conf[details][defects] value='" . $greenmilescore["defects"] . "' style='text-align:right;'>"; print "</td>"; print "<td align='center' width=25%>"; print "Opportunities"; print "</td><td width=25%>"; print "<input name=conf[details][opportunities] value='" . $greenmilescore["opportunities"] . "' style='text-align:right;'>"; print "</td></tr>"; print "</table>"; // } print "</div>"; closeTrayDiv(); print "</form>"; maxineBottom(); }
/** displayMessage($message, $type = "Notice", $class = "notice") * Display a message to the user * @param string $message what message do you want displayed? * @param string $type what type of message are you trying to display: Error, Information, Notice * @param string $class css class attached to this message: error, information, notice by default */ function displayMessage($message, $type = "Notice", $class = "notice") { openSubbar(850); echo "<p class=\"standard\" style=\"font-weight:bold;font-size:1em;\">" . PHP_EOL; echo "Profile Data Saved" . PHP_EOL; echo "</p>" . PHP_EOL; closeSubbar(); echo "<div class=\"" . $class . "\">" . PHP_EOL; switch ($type) { case "Error": echo "<img alt=\"" . $type . "\" src=\"" . BASE . "images/error.jpg\" />" . PHP_EOL; break; case "Notice": case "Information": break; } echo $message . PHP_EOL; echo "<br class=\"clear\" />" . PHP_EOL; echo "</div>" . PHP_EOL; }
function statusTypeList() { // Preparation { $statuslist = sqlPull(array("table" => "candidate_status", "where" => "1=1")); // } maxineTop("Status Types"); print "<form name='statusform' action='index.php?mode=maxine/index&action=commitstatustypes' method='post'>"; // Buttons { openHeader(); maxineButton("Add", "addStatusType();", 2); maxineButton("Save", "statusform.submit();", 2); maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=candmenu\");", 2); closeHeader(); // } print "<div class='tray'>"; // Details { $count = 1; openSubbar(500); print "Status List"; closeSubbar(); print "<table id='statustable' class='standard' style='width:500px; margin-bottom:20px;'>"; // Header { print "<tr class='heading'><td align='center' width=40%>"; print "Code"; print "</td><td align='center' width=50%>"; print "Name"; print "</td><td width=10%>"; print "Delete"; print "</td></tr>"; // } if ($statuslist) { foreach ($statuslist as $statkey => $statval) { print "<input type=hidden name='conf[" . $count . "][id]' value='" . $statval["id"] . "'>"; print "<tr class='content1'><td>"; print "<input name='conf[" . $count . "][statuscode]' value='" . $statval["code"] . "'>"; print "</td><td>"; print "<input name='conf[" . $count . "][statusname]' value='" . $statval["name"] . "'>"; print "</td><td>"; print "<input type=checkbox name='conf[" . $count . "][delete]'>"; print "</td></tr>"; $count++; } } else { print "<tr class='content1'><td align='center' colspan=3>"; print "There are no Status Types"; print "</td></tr>"; } print "</table>"; // } print "</div>"; print "</form>"; maxineBottom(); // Javascript { print "<script type='text/javascript'>\n\t\t\t\tvar rowCnt = " . $count . ";\n\t\t\t\t\n\t\t\t\tfunction addStatusType() {\n\t\t\t\t\ttblref = document.getElementById('statustable');\n\t\t\t\t\trow = tblref.insertRow(-1);\n\t\t\t\t\trow.className\t= 'content1';\n\t\t\t\t\t\n\t\t\t\t\tcell = row.insertCell(-1);\n\t\t\t\t\tstr = '<input name=conf['+rowCnt+'][statuscode] value=\"Code\">';\n\t\t\t\t\tcell.innerHTML = str;\n\t\t\t\t\t\n\t\t\t\t\tcell = row.insertCell(-1);\n\t\t\t\t\tstr = '<input name=conf['+rowCnt+'][statusname] value=\"Status Name\">';\n\t\t\t\t\tcell.innerHTML = str;\n\t\t\t\t\t\n\t\t\t\t\tcell = row.insertCell(-1);\n\t\t\t\t\tstr = '<input type=checkbox name=conf['+rowCnt+'][delete]>';\n\t\t\t\t\tcell.innerHTML = str;\n\t\t\t\t\t\n\t\t\t\t\trowCnt++;\n\t\t\t\t}\n\t\t\t\t</script>"; // } }
function editM3Depts() { // Preparation { $deptlist = sqlPull(array("table" => "m3_departments", "where" => "1=1")); $count = 0; // } maxineTop("Departments"); print "<title>Manline M3</title>"; print "<form name='departmentsform' id='departmentsform' action='index.php?mode=maxine/index&action=commitm3depts' method='post'>"; // Buttons { openHeader(); maxineButton("Add", "addRow();", 2); maxineButton("Submit", "departmentsform.submit();", 2); maxineButton("Back", "onclick=goTo(\"index.php?mode=maxine/index&action=m3sys\");", 2); closeHeader(); // } print "<div class='tray'>"; // List of Departments { openSubbar(500); print "Details"; closeSubbar(); print "<table id='depttable' class='standard' style='width:500px; margin-bottom:25px;'>"; // Headers { print "<tr class='heading'><td align='center' width=90%>"; print "Description"; print "</td><td align='center' width=10%>"; print "Show"; print "</td></tr>"; // } foreach ($deptlist as $deptkey => $deptval) { print "<input type='hidden' name='conf[depts][" . $count . "][id]' value=" . $deptval["id"] . ">"; print "<tr class='content1'><td align='center'>"; print "<input name='conf[depts][" . $count . "][name]' value='" . $deptval["name"] . "' style='width:400px;'>"; print "</td><td align='center'>"; print "<input type='checkbox' name='conf[depts][" . $count . "][display]' " . ($deptval["display"] == 1 ? "checked" : "") . ">"; print "</td></tr>"; $count++; } print "</table>"; // } print "</div>"; print "</form>"; maxineBottom(); // Javascript { print "<script>\n\t\t\t\t\tvar rowCnt = " . $count . ";\n\t\t\t\t\t\n\t\t\t\t\tfunction addRow() {\n\t\t\t\t\t\ttblref = document.getElementById('depttable');\n\t\t\t\t\t\trow = tblref.insertRow(rowCnt+1);\n\t\t\t\t\t\trow.className = 'content1';\n\t\t\t\t\t\t\n\t\t\t\t\t\tcell = row.insertCell(0);\n\t\t\t\t\t\tstr = '<input name=\"conf[depts]['+rowCnt+'][name]\" style=\"width:400px;\" value=\"Department Name '+(rowCnt + 1)+'\">';\n\t\t\t\t\t\tcell.innerHTML = str;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcell = row.insertCell(1);\n\t\t\t\t\t\tstr = '<input type=\"checkbox\" name=\"conf[depts]['+rowCnt+'][display]\" checked>';\n\t\t\t\t\t\tcell.innerHTML = str;\n\t\t\t\t\t\t\n\t\t\t\t\t\trowCnt++;\n\t\t\t\t\t}\n\t\t\t\t</script>"; // } }
function editLearner() { $learners = new Learners(); $users = new Users(); // Preparation { if ($_GET["learnerid"]) { $learnerid = $_GET["learnerid"]; $learner = $learners->getRow(array("where" => "l.id=" . $learnerid, "children" => true)); $interviewdate = date("d/m/Y", $learner["interview"]); $birthday = date("d", $learner["birthdate"]); $birthmonth = date("m", $learner["birthdate"]); $birthyear = date("Y", $learner["birthdate"]); $notes = $learner['candidate_notes']; // This is because earlier, the value was set to 0 and now the range is 1-4 if ($learner["dover"] == 0) { $learner["dover"] = 1; } } else { $birthday = 1; $birthmonth = 1; $birthyear = date("Y") - 22; $learner["dover"] = 1; } $userlist = $users->getRowSet(array('where' => '`u`.`deleted`=0')); $style = "style='width: 200px;'"; // } maxineTop("Learner List"); print "<form id='learnerform' action='index.php?mode=maxine/index&action=commitlearner' method='post'>"; // Buttons { openHeader(); maxineButton("Save", "postForm(\"learnerform\");", 2); if ($learnerid) { if (!$learner["driverid"]) { maxineButton("Convert", "postForm(\"learnerform\", \"index.php?mode=maxine/index&action=converttodriver\");", 2); } maxineButton("Delete", "goTo(\"index.php?mode=maxine/index&action=deletelearner&learnerid=" . $learnerid . "\");", 2); } maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=learnerlist\");", 2); closeHeader(); // } print "<div class='tray' style='height:500px;'>"; // Details { print "<input type=hidden name=conf[learnerid] value=" . $learnerid . ">"; print "<input type=hidden name='conf[id]' value='" . $learnerid . "' />"; print "<input type=hidden name='conf[type]' value='learners' />"; // Left table of Candidate Details { print "<div style='width:400px; float:left; margin-left:20px;'>"; // Personal Details { openSubbar(400); print "Personal Details"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; print "<tr class='content1'><td width=30% align='center'>"; print "First Name"; print "</td><td width=70%>"; print "<input name=conf[firstname] value='" . $learner["firstname"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Middle Name"; print "</td><td>"; print "<input name=conf[middlename] value='" . $learner["middlename"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Last Name"; print "</td><td>"; print "<input name=conf[lastname] value='" . $learner["lastname"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "ID Number"; print "</td><td>"; print "<input name=conf[idno] value='" . $learner["idno"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Contact Number"; print "</td><td>"; print "<input name=conf[contactno] value='" . $learner["contactno"] . "' " . $style . ">"; print "</td></tr>"; // Birthdate selector { print "<tr class='content1'><td align='center'>"; print "Date of Birth"; print "</td><td align='center'>"; // Day { print "<select id='dayselect' name=conf[birthdate][day] style='width:50px; color:BLACK; z-index:500;'>"; for ($i = 1; $i < 32; $i++) { print "<option " . ($i == $birthday ? "selected" : "") . ">"; print $i; print "</option>"; } print "</select>"; // } // Month { print "<select id='monthselect' name=conf[birthdate][month] style='width:80px; color:BLACK; z-index:500;'>"; for ($i = 1; $i < 13; $i++) { print "<option value=" . $i . " " . ($i == $birthmonth ? "selected" : "") . ">"; print date("F", mktime(0, 0, 0, $i, 1, 2000)); print "</option>"; } print "</select>"; // } // Year { $startyear = 1940; $endyear = date("Y") - 18; print "<select id='yearselect' name=conf[birthdate][year] style='width:60px; color:BLACK; z-index:500;'>"; for ($i = $startyear; $i < $endyear; $i++) { print "<option " . ($i == $birthyear ? "selected" : "") . ">"; print $i; print "</option>"; } print "</select>"; // } print "</td></tr>"; // } print "</table>"; // } // Address { openSubbar(400); print "Address"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; print "<tr class='content1'><td align='center'>"; print "Address"; print "</td><td>"; print "<input name=conf[address][street] value='" . $learner["street"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "City"; print "</td><td>"; print "<input name=conf[address][city] value='" . $learner["city"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Province"; print "</td><td>"; print "<input name=conf[address][province] value='" . $learner["province"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Postal Code"; print "</td><td>"; print "<input name=conf[address][postalcode] value='" . $learner["postalcode"] . "' " . $style . ">"; print "</td></tr>"; print "</table>"; // } print "</div>"; // } // Right table of Candidate Details { print "<div style='float:right; margin-right:20px; width:400px;'>"; // Requirements { openSubbar(400); print "Requirements"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; print "<tr class='content1'><td align='center'>"; print "Grade Completed"; print "</td><td>"; print "<input name=conf[gradecode] value='" . $learner["gradecode"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Licence Code"; print "</td><td>"; print "<input name=conf[licencecode] value='" . $learner["licencecode"] . "' " . $style . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Interview"; print "</td><td align='center'>"; print "<input name=conf[interview] value='" . $interviewdate . "' readonly style='width: 60%;'>"; print "<img src='" . BASE . "/images/calendar.png' onClick='displayDatePicker(\"conf[interview]\", this, \"dmy\", \"\");'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Dover"; print "</td><td align='center'>"; //print("<input type='checkbox' name=conf[dover] ".($learner["dover"]>0?"checked":"").">"); print "<table width=100%>"; print "<tr><td align='right' width=50%>"; print "A"; print "<input type='radio' name=conf[dover] value=4 " . ($learner["dover"] == 4 ? "checked" : "") . ">"; print "</td><td align='right' width=50%>"; print "B"; print "<input type='radio' name=conf[dover] value=3 " . ($learner["dover"] == 3 ? "checked" : "") . ">"; print "</td></tr>"; print "<tr><td align='right'>"; print "C"; print "<input type='radio' name=conf[dover] value=2 " . ($learner["dover"] == 2 ? "checked" : "") . ">"; print "</td><td align='right'>"; print "Not Taken"; print "<input type='radio' name=conf[dover] value=1 " . ($learner["dover"] == 1 ? "checked" : "") . ">"; print "</td></tr>"; print "</table>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Medical"; print "</td><td align='center'>"; print "<input type='checkbox' name=conf[medical] " . ($learner["medical"] > 0 ? "checked" : "") . ">"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Fingerprint"; print "</td><td align='center'>"; print "<input type='checkbox' name=conf[fingerprint] " . ($learner["fingerprint"] > 0 ? "checked" : "") . ">"; print "</td></tr>"; print "</table>"; print "</td></tr>"; // } // Status { openSubbar(400); print "Status"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; print "<tr class='content1'><td align='center'>"; print "<div style='margin:auto; width:308px; height:32px;'>"; print "<select id='statusselect' name='conf[status]' style='width:280px; color:BLACK; z-index:500;'>"; foreach ($learners->getStatuses() as $key => $val) { print "<option value=\"" . $key . "\" " . ($learner["statusid"] == $key ? "selected=\"selected\"" : "") . ">" . $val . "</option>\n"; } print "</select>"; print "</div>"; print "</td></tr>"; print "</table>"; // } // General Notes { openSubbar(400); print "General Notes"; closeSubbar(); print "<table class='standard content1' style='width:400px;'>"; if ($notes) { foreach ($notes as $notekey => $noteval) { print "<tr><td>"; print "<b>" . date("d/m/Y", $noteval["date"]) . " : </b>" . $noteval["note"] . " (" . $userlist[$noteval["userid"]]["username"] . ")"; print "</td></tr>"; } } print "<tr><td>"; print "<textarea name=conf[note] style='width:100%; height:100%; border:0px;'></textarea>"; print "</td></tr>"; print "</table>"; // } print "</div>"; // } // } print "</div>"; print "</form>"; maxineBottom(); }
function editRightsGroup() { // Preparation { if ($_POST["conf"]) { $conf = $_POST["conf"]; } if ($conf["groupid"] > 0) { $group = sqlPull(array("table" => "rights_groups", "where" => "id=" . $conf["groupid"], "onerow" => 1)); } // } maxineTop("Access Control"); print "<form name='editgroupform' action='index.php?mode=maxine/index&action=updaterightsgroup' method='post'>"; // Buttons { openHeader(); maxineButton("Update", "editgroupform.submit();", 2); maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=rightsgroups\");", 2); closeHeader(); // } print "<div class='tray'>"; // Details { openSubbar(600); if ($group) { print "'" . $group["name"] . "' Rights Group"; print "<input type='hidden' name=conf[groupid] value=" . $group["id"] . ">"; } else { print "New Right Groups"; } closeSubbar(); print "<table class='standard' style='width:600px;'>"; print "<tr class='content1'><td width=30% align='center'>"; print "Name"; print "</td><td width=70%>"; print "<input name=conf[name] value='" . $group["name"] . "' style='width: 100%;'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Description"; print "</td><td>"; print "<textarea name=conf[desc] style='width: 100%;'>" . $group["description"]; print "</textarea>"; print "</td></tr>"; print "</table>"; // } print "</div>"; closeTrayDiv(); print "</form>"; maxineBottom(); }
function editFleets() { // Preparation { $equipfaults = sqlPull(array("table" => "fleets", "where" => "deleted=0")); $count = 1; // } maxineTop("Fleets List"); print "<form method=post id='fleetsform' name='fleetsform' action='index.php?mode=maxine/index&action=commitfleets'>"; // Buttons { openHeader(); maxineButton("Add", "addRow();", 2); maxineButton("Submit", "fleetsform.submit();", 2); maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=driverslist\");", 2); closeHeader(); // } print "<div class='tray'>"; openSubbar(400); print "Details"; closeSubbar(); print "<table id='fleetstable' class='standard content1' style='width:400px; margin-bottom:20px;'>"; if ($equipfaults) { foreach ($equipfaults as $faultkey => $faultval) { print "<input type=hidden name=conf[" . $count . "][faultid] value=" . $faultval["id"] . ">"; print "<input id='deletecontrol" . $count . "' type=hidden name=conf[" . $count . "][deleted] value=0>"; print "<tr id='fleetrow" . $count . "'><td width=90%>"; print "<input name=conf[" . $count . "][name] value='" . $faultval["name"] . "' style='width:250px;'>"; print "</td><td align='center' width=10%>"; print "<img src='" . BASE . "/images/deleteclickable.png' onClick='removeRow(" . $count . ");' title='Delete'>"; print "</td></tr>"; $count++; } } print "</table>"; print "</div>"; print "</form>"; maxineBottom(); // Javascript { print "<script type='text/javascript'>\n\t\t\t\tvar rowCnt = " . $count . ";\n\t\t\t\t\n\t\t\t\tfunction addRow() {\t\n\t\t\t\t\ttblref\t\t\t= document.getElementById('fleetstable');\n\t\t\t\t\trow\t\t\t\t\t= tblref.insertRow(-1);\n\t\t\t\t\trow.id\t\t\t= 'fleetrow'+rowCnt;\n\t\t\t\t\t\n\t\t\t\t\tcell\t\t\t\t= row.insertCell(-1);\n\t\t\t\t\tstr\t\t\t\t\t= '<input id=\"deletecontrol'+rowCnt+'\" type=hidden name=conf['+rowCnt+'][deleted] value=0>';\n\t\t\t\t\tstr\t\t\t\t\t+= '<input name=conf['+rowCnt+'][name] value=\"Fleet\" style=\"width:250px;\">';\n\t\t\t\t\tcell.innerHTML = str;\n\t\t\t\t\t\n\t\t\t\t\tcell\t\t\t\t= row.insertCell(-1);\n\t\t\t\t\tcell.align\t= 'center';\n\t\t\t\t\tstr\t\t\t\t\t= '<img src=\\'" . BASE . "/images/deleteclickable.png\\' onClick=\\'removeRow('+rowCnt+');\\' title=\\'Delete\\'>';\n\t\t\t\t\tcell.innerHTML = str;\n\t\t\t\t\t\n\t\t\t\t\trowCnt++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfunction removeRow(rowCnt) {\n\t\t\t\t\tdocument.getElementById('fleetrow'+rowCnt).style.display\t= 'none';\n\t\t\t\t\tdocument.getElementById('deletecontrol'+rowCnt).value\t\t\t= 1;\n\t\t\t\t}\n\t\t\t\t</script>"; // } }