public function setHtml($html = null) { if ($html === null) { $records = self::getRecords(); $html = (string) "<form method=\"post\" id=\"deleteForm\">" . PHP_EOL; $html .= "<div style=\"text-align:center;\">" . PHP_EOL; $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL; $html .= "</div>" . PHP_EOL; $html .= "<table class=\"standard\" style=\"background-color:transparent;\">" . PHP_EOL; $html .= "<thead>" . PHP_EOL; $html .= "<tr><td class=\"standard\" colspan=\"100%\" class=\"toprow\">" . PHP_EOL; $html .= "<input type=\"checkbox\" name=\"deleteAll\" id=\"deleteAll\" value=\"1\" onclick=\"formManipulators.checkCheckBoxes('deleteForm', this);\" />" . PHP_EOL; $html .= "<label for=\"deleteAll\">Delete all records</label>" . PHP_EOL; $html .= "</td></tr>" . PHP_EOL; $html .= "<tr>" . PHP_EOL; $html .= "<td rowspan=\"2\" style=\"color:#FFF;vertical-align:top;\">Delete?</td>" . PHP_EOL; $html .= "<td colspan=\"" . count($records[0]) . "\" style=\"color:#FFF;\">Table Data</td>" . PHP_EOL; $html .= "</tr>" . PHP_EOL; $html .= "<tr class=\"heading\">" . PHP_EOL; foreach ($records[0] as $col => $data) { if ($col == "id" || $col == "personid" || $col == "deleted") { continue; } $html .= "<td class=\"standard\">" . ($col == "id" ? "" : shortenWord(ucwords(str_replace("_", " ", $col)), 5)) . "</td>" . PHP_EOL; } $html .= "</tr>" . PHP_EOL; $html .= "</thead>" . PHP_EOL; $html .= "<tbody>" . PHP_EOL; foreach ($records as $key => $row) { $class = (string) ($key % 2 == 1 ? "content1" : "content2"); $html .= "<tr class=\"" . $class . "\">" . PHP_EOL; $html .= "<td class=\"standard\"><input type=\"checkbox\" name=\"record[]\" value=\"" . $row["id"] . "\" /></td>" . PHP_EOL; foreach ($row as $col => $val) { if ($col == "id" || $col == "personid" || $col == "deleted") { continue; } $html .= "<td class=\"standard\">" . shortenWord(strip_tags(urldecode($val)), 9) . "</td>" . PHP_EOL; } $html .= "</tr>" . PHP_EOL; } $html .= "</tbody>" . PHP_EOL; $html .= "</table>" . PHP_EOL; $html .= "<div style=\"text-align:center;\">" . PHP_EOL; $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL; $html .= "</div>" . PHP_EOL; $html .= "</form>" . PHP_EOL; //$html .= "".PHP_EOL; } $this->_html = $html; }
print "</td><td width=5%>"; print shortenWord('Subbie Income', 8); print "</td><td width=5%>"; print shortenWord('Subbie Kms', 8); print "</td><td width=8%>"; print "Budget Contrib"; print "</td><td width=8%>"; print "Contrib"; print "</td><td width=8%>"; print shortenWord("Contrib Updated", 8); print "</td><td width=5%>"; print "Kms"; print "</td><td width=9%>"; print shortenWord("Ave. Kms per truck", 4); print "</td><td width=9%>"; print shortenWord("Budget Ave. Kms per truck", 6); print "</td></tr>"; // } $totkmspertruck = (int) 0; $totbudgetkmspertruck = (int) 0; foreach ($updatelist as $updatekey => $updateval) { $difference = date("U") - $updateval["updated"]; $diffhours = $difference / 60 / 60; $diffhours = floor($diffhours); $diffmins = $difference - $diffhours * 60 * 60; $diffmins = $diffmins / 60; $diffmins = floor($diffmins); $day = date("d", $updateval["date"]); print "<tr class='" . $background . "'><td>"; print $updateval["id"]; print "</td><td>";
/** displayUserProfile($profile) * @param array $profile which profile are we displaying? */ function displayUserProfile($profile) { $departments = new TableManager("m3_departments"); $departments->setCustomIndex("id"); $alldepts = $departments->selectMultiple(); if ((!isset($profile["department"]) || !$profile["department"]) && $profile["department_id"]) { $profile["department"] = $alldepts[$profile["department_id"]]["name"]; } echo "<div class=\"userProfile\">" . PHP_EOL; if ($profile["staffno"] && $profile["location"] && date("Y-m-d", strtotime($profile["createDate"])) != "2011-02-01" && $profile["createDate"] > date("Y-m-d H:i:s", strtotime("-2 weeks"))) { echo "<img alt=\"New Staff Member\" src=\"" . BASE . "images/new/profile-new.png\" style=\"border:none;height:37px;left:5px;position:absolute;top:4px;width:38px;z-index:1;\" />"; } ## Image $staffno = $profile["staffno"]; if (strlen($staffno) < 4) { $staffno = str_pad($staffno, 4, "0", STR_PAD_LEFT); } if (file_exists(BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg")) { $size = getimagesize(BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg"); echo "<img alt=\"" . $profile["firstname"] . " " . $profile["lastname"] . "\" src=\"" . BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg\" style=\"height:" . $size[1] . "px;width:" . $size[0] . "px;z-index:0;\" />" . PHP_EOL; } else { $size = getimagesize(BASE . "images" . DS . "profiles" . DS . "0.jpg"); echo "<img alt=\"" . $profile["firstname"] . " " . $profile["lastname"] . "\" src=\"" . BASE . "images" . DS . "profiles" . DS . "0.jpg\" style=\"height:" . $size[1] . "px;width:" . $size[0] . "px;z-index:0;\" />" . PHP_EOL; } $abbrs = (array) array("Human Resources" => "H.R", "Information Technology" => "I.T", "Isando Operations" => "Isando Ops", "Operations Distribution" => "Ops Distribution", "Operations Africa" => "Ops Africa", "Operations Freight" => "Ops Freight"); ## Data echo "<div class=\"userProfileBasicData\">" . PHP_EOL; echo "<h3>" . $profile["firstname"] . " " . $profile["lastname"] . "</h3>" . PHP_EOL; echo "<h4>" . shortenWord(urldecode($profile["jobtitle"]), 23) . "</h5><br />" . PHP_EOL; echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Department:</label><label style=\"margin-bottom:2px;width:98px;\">" . (isset($profile["department"]) ? in_array($profile["department"], array_keys($abbrs)) ? $abbrs[$profile["department"]] : $profile["department"] : "") . "</label><br class=\"clear\" />" . PHP_EOL; echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Location:</label><label style=\"margin-bottom:2px;width:98px;\">" . $profile["location"] . "</label><br class=\"clear\" />" . PHP_EOL; echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Staff No.:</label><label style=\"margin-bottom:2px;width:98px;\">" . $profile["staffno"] . "</label><br class=\"clear\" />" . PHP_EOL; echo "</div>" . PHP_EOL; ## More|Less echo "<div class=\"userProfileMoreLess\" id=\"profile_" . $profile["id"] . "\" onclick=\"events.cancelBubble(event);profiles.show(this);\">more</div>" . PHP_EOL; ## Collapsible div echo "<div class=\"userProfileMoreInformation\" id=\"profileData[" . $profile["id"] . "]\" style=\"display:none;\">" . PHP_EOL; echo "<div>" . PHP_EOL; echo "<label style=\"font-weight:bold;margin-bottom:2px;width:75px;\">Birthday:</label><label style=\"margin-bottom:2px;width:205px;\">" . date("d F", $profile["birthday"]) . "</label><br class=\"clear\" />" . PHP_EOL; if ($profile["interests"]) { echo "<label style=\"font-weight:bold;width:80px;\">Interests:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["interests"]) . "</label><br class=\"clear\" />" . PHP_EOL; } if ($profile["family"]) { echo "<label style=\"font-weight:bold;width:80px;\">Family:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["family"]) . "</label><br class=\"clear\" />" . PHP_EOL; } if ($profile["aspirations"]) { echo "<label style=\"font-weight:bold;width:80px;\">Aspirations:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["aspirations"]) . "</label><br class=\"clear\" />" . PHP_EOL; } if ($profile["goals"]) { echo "<label style=\"font-weight:bold;width:80px;\">Goal:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["goals"]) . "</label><br class=\"clear\" />" . PHP_EOL; } if ($profile["quote"]) { echo "<label style=\"font-weight:bold;width:80px;\">Quote:</label><br /><label style=\"width:100%;\">" . urldecode($profile["quote"]) . "</label><br class=\"clear\" />" . PHP_EOL; } echo "</div>" . PHP_EOL; echo "</div>" . PHP_EOL; echo "</div>" . PHP_EOL; }
function checkFleetScoreUpdates() { // Prep { $rows = returnFleetTruckCount(); if (array_key_exists('conf', $_POST) && $_POST["conf"]) { $conf = $_POST["conf"]; } if (isset($conf) && $conf) { $startdate = unixDate($conf["startdate"]); $stopdate = unixDate($conf["stopdate"]); } else { $startdate = mktime(0, 0, 0, date("m"), 1, date("Y")); $stopdate = mktime(0, 0, 0, date("m") + 1, 1, date("Y")); } $where = "date >= " . $startdate . " AND date <= " . $stopdate; if (isset($conf) && $conf["fleetid"] > 0) { $fleetid = $conf["fleetid"]; $where .= " AND fleetid=" . $conf["fleetid"]; } else { $fleetid = 0; } $updatelist = sqlPull(array("table" => "fleet_scores", "where" => $where, "sort" => "date")); $fleetdayobj = new fleetDayHandler(); $fleetlist = (array) array(); $tmp = $fleetdayobj->getIncomeFleets(); foreach ($tmp as $key => $val) { $sorted[$val['id']] = $val["name"]; } asort($sorted, SORT_STRING); foreach ($sorted as $key => $val) { $fleetlist[$key] = $sorted[$key]; } unset($sorted); unset($tmp); $totincome = 0; $totbudget = 0; $totcontrib = 0; $background = "content1"; // } print '<!DOCTYPE html>'; print '<head>'; print '<meta charset="utf-8">'; print '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">'; print '<title>Dashboards - Barloworld Transport</title>'; print '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />'; print '<link href="favicon.ico" rel="shortcut icon" />'; print '<link rel="stylesheet" href="' . BASE . 'basefunctions/scripts/bootstrap.min.css">'; print '<link href="' . BASE . 'basefunctions/scripts/font-awesome.min.css" rel="stylesheet">'; print '<link rel="stylesheet" href="' . BASE . 'Maxine/displaycase/content/site/css/fonts.css">'; print '<link rel="stylesheet" href="' . BASE . 'Maxine/displaycase/content/site/css/main.css">'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/vendor/modernizr-2.6.2.min.js"></script>'; print '<script src="' . BASE . 'basefunctions/scripts/jquery.min.js"></script>'; print '<script src="' . BASE . 'basefunctions/scripts/jquery.ui.touch-punch.min.js"></script>'; print '<!--[if lt IE 9]>'; print '<script src="' . BASE . 'basefunctions/scripts/html5shiv.min.js"></script>'; print '<script src="' . BASE . 'basefunctions/scripts/respond.js"></script>'; print '<![endif]-->'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/vendor/jcircle.js"></script>'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/vendor/jquery.flot/jquery.flot.js"></script>'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/vendor/jquery.flot/jquery.flot.time.js"></script>'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/vendor/jquery.flot/jquery.flot.tooltip.js"></script>'; print '</head>' . PHP_EOL; print '<body>'; print '<div id="root"></div>'; print '<div id="page" style="overflow-y:auto;">'; print '<header>'; print '<div class="controlsWrapper">'; print '<a href="#" class="menu"></a>'; print '</div><!-- controlsWrapper -->'; print '</header>'; print '<nav>'; print '<ul>'; print '<li><a href="/?personal">Dashboard</a></li>'; print '<li><a href="/?mydashdetails">Dashboard Builder</a></li>'; print '<li><a href="/?importfleetday">Import Day</a></li>'; print '<li><a href="/?checkfleetscoreupdates">Fleet Scores</a></li>'; print '<li><a href="/?ocddata">OCD Data</a></li>'; print '<li><a href="/?logout">Logout</a></li>'; print '</ul>'; print '</nav>'; //: Page Content print '<div id="blackouts">'; //: Form print '<div class="fleetWrapper" style="height:10%;">'; print '<form method="POST">'; print '<table><tbody><tr>'; print '<td>'; //: Col 1 print '<label for="conf[fleetid]">Fleet:</label>'; print '<select id="conf[fleetid]" name="conf[fleetid]" value="' . $fleetid . '">'; print '<option value="0" ' . ($fleetid == 0 ? "selected" : "") . '>All</option>'; foreach ($fleetlist as $fleetkey => $fleetval) { if (!$fleetval) { continue; } print '<option value="' . $fleetkey . '"' . ($fleetid == $fleetkey ? ' selected="selected"' : '') . '>' . $fleetval . '</option>'; } print '</select>'; print '</td>'; print '<td>'; //: Col 2 print '<label for="conf[startdate]">Start Date:</label>'; print '<input id="conf[startdate]" name="conf[startdate]" value="' . date("d/m/Y", $startdate) . '" readonly style="width: 160px; text-align: center;">'; print '<img src="' . BASE . '/images/calendar.png" style="cursor:pointer" onClick="displayDatePicker(\'conf[startdate]\', this, \'dmy\', \'\');">'; print '</td>'; print '<td>'; //: Col 3 print '<label for="conf[stopdate]">Stop Date:</label>'; print '<input id="conf[stopdate]" name="conf[stopdate]" value="' . date("d/m/Y", $stopdate) . '" readonly style="width: 160px; text-align: center;">'; print '<img src="' . BASE . '/images/calendar.png" style="cursor:pointer" onClick="displayDatePicker(\'conf[stopdate]\', this, \'dmy\', \'\');">'; print '</td>'; print '<td>'; //: Col 4 print '<input type="Submit" value="Search" />'; print '</td>'; print '</tr></tbody></table>'; print '</form>'; print '</div>'; //: End //: Table print '<div class="fleetWrapper" style="height:90%;">'; if ($updatelist) { print "<table style='margin-bottom:20px;'>"; //: Headers print "<thead><tr><td width=5%>"; print "ID"; print "</td><td width=11%>"; print "Fleet"; print "</td><td width=7%>"; print "Date"; print "</td><td width=12%>"; print "Updated"; print "</td><td width=6%>"; print "Difference"; print "</td><td width=9%>"; print "Income"; print "</td><td width=8%>"; print "Budget"; print "</td><td width=5%>"; print shortenWord('Subbie Income', 8); print "</td><td width=5%>"; print shortenWord('Subbie Kms', 8); print "</td><td width=8%>"; print "Budget Contrib"; print "</td><td width=8%>"; print "Contrib"; print "</td><td width=8%>"; print shortenWord("Contrib Updated", 8); print "</td><td width=5%>"; print "Kms"; print "</td><td width=9%>"; print shortenWord("Ave. Kms per truck", 4); print "</td><td width=9%>"; print shortenWord("Budget Ave. Kms per truck", 6); print "</td></tr></thead>"; //: End $totkmspertruck = (int) 0; $totbudgetkmspertruck = (int) 0; $totbudgetcontrib = (double) 0.0; $totkms = (double) 0.0; print '<tbody>'; foreach ($updatelist as $updatekey => $updateval) { $difference = date("U") - $updateval["updated"]; $diffhours = $difference / 60 / 60; $diffhours = floor($diffhours); $diffmins = $difference - $diffhours * 60 * 60; $diffmins = $diffmins / 60; $diffmins = floor($diffmins); $day = date("d", $updateval["date"]); print "<tr><td>"; print $updateval["id"]; print "</td><td>"; print $fleetlist[$updateval["fleetid"]]; print "</td><td>"; print date("d m Y", $updateval["date"]); print "</td><td>"; if ($updateval["updated"] != 0) { print date("H:i d-m-Y", $updateval["updated"]); } else { print "Empty"; } print "</td><td>"; print $diffhours . "h " . $diffmins . "m"; print "</td><td>"; print $updateval["income"]; print "</td><td>"; print $updateval["budget"]; print "</td><td>"; print $updateval["subbie_income"]; print "</td><td>"; print $updateval["subbie_kms"]; print "</td><td>"; print $updateval["budgetcontrib"]; print "</td><td>"; print $updateval["contrib"]; print "</td><td>"; if ($updateval["contribupdated"] != 0) { print date("H:i d-m-Y", $updateval["contribupdated"]); } else { print "Empty"; } print "</td><td>"; print $updateval["kms"]; print "</td><td>"; print round($updateval["kms"] / (isset($rows[$updateval["fleetid"]]) && isset($rows[$updateval["fleetid"]]["count"]) ? $rows[$updateval["fleetid"]]["count"] : 1), 2); print "</td><td>"; print round($updateval["budkms"] / (isset($rows[$updateval["fleetid"]]) && isset($rows[$updateval["fleetid"]]["count"]) ? $rows[$updateval["fleetid"]]["count"] : 1), 2); print "</td></tr>"; $totincome += $updateval["income"]; $totbudget += $updateval["budget"]; $totcontrib += $updateval["contrib"]; $totbudgetcontrib += $updateval["budgetcontrib"]; $totkms += $updateval["kms"]; $totkmspertruck += $updateval["kms"] / (isset($rows[$updateval["fleetid"]]) && isset($rows[$updateval["fleetid"]]["count"]) && $rows[$updateval["fleetid"]]["count"] ? $rows[$updateval["fleetid"]]["count"] : 1); $totbudgetkmspertruck += $updateval["budkms"] / (isset($rows[$updateval["fleetid"]]) && isset($rows[$updateval["fleetid"]]["count"]) && $rows[$updateval["fleetid"]]["count"] ? $rows[$updateval["fleetid"]]["count"] : 1); } print "<tr><td colspan=5>"; print "</td><td>"; print $totincome; print "</td><td>"; print $totbudget; print "</td><td>"; print "</td><td>"; print "</td><td>"; print $totbudgetcontrib; print "</td><td>"; print $totcontrib; print "</td><td>"; print "</td><td>"; print round($totkms, 2); print "</td><td>"; print round($totkmspertruck, 2); print "</td><td>"; print round($totbudgetkmspertruck, 2); print "</td></tr>"; print '<tbody>'; print "</table>"; } print '</div>'; //: End print '</div>'; //: End //: End Page print '<script>window.jQuery || document.write("<script src=\\"' . BASE . 'Maxine/displaycase/content/site/js/vendor/jquery-1.9.1.min.js\\"><\\/script>")</script>'; print '<script src="' . BASE . 'basefunctions/scripts/jquery.color.min.js"></script>'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/plugins.js"></script>'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/styling.js"></script>'; print '<script src="' . BASE . 'Maxine/displaycase/content/site/js/main.js"></script>'; print '<script type="text/javascript" language="javascript" src="' . BASE . '/basefunctions/scripts/manline.js"></script>'; print '</body>' . PHP_EOL; print '</html>'; }