コード例 #1
0
ファイル: index.php プロジェクト: RoneilZA/dashboards
function login()
{
    $usermatch = sqlPull(array("table" => "users", "where" => "`username`='" . (string) filter_var($_POST["username"], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "'", "onerow" => "1"));
    $password = (string) substr(md5(SALT . (string) filter_var($_POST["pass_word"], FILTER_SANITIZE_FULL_SPECIAL_CHARS)), 0, 30);
    if (isset($usermatch) && is_array($usermatch) && array_key_exists("username", $usermatch)) {
        if (array_key_exists("password", $usermatch) && $password === $usermatch["password"]) {
            //: Login was successful -- woohoo
            $_SESSION["userid"] = $usermatch["personid"];
            if (array_key_exists("isit", $usermatch) && $usermatch["isit"] == 1) {
                $_SESSION["isit"] = 1;
            }
            if (array_key_exists("isadmin", $usermatch) && $usermatch["isadmin"] == 1) {
                $_SESSION["isadmin"] = 1;
            }
            header("Location: /?personal");
        } else {
            header("Location: /?loginfailed");
        }
    } else {
        header("Location: /?loginfailed");
    }
}
コード例 #2
0
ファイル: displaycase.php プロジェクト: RoneilZA/dashboards
function commitDashInput()
{
    $conf = $_POST["conf"];
    $date = mktime(0, 0, 0, $conf["date"]["month"], 1, $conf["date"]["year"]);
    $conf["details"]["date"] = $date;
    $dashdetails = sqlPull(array("table" => "greenmile_scores", "where" => "date=" . $date, "onerow" => 1));
    if ($dashdetails) {
        updateGreenmileScore($conf["details"]);
    } else {
        createGreenmileScore($conf["details"]);
    }
    goHere("index.php?mode=maxine/index&action=dashinput");
}
コード例 #3
0
ファイル: candidates.php プロジェクト: RoneilZA/dashboards
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>";
    // }
}
コード例 #4
0
 /** EquipFaults::getDriverAction($options)
  * @param $options array
  * @return array data
  * Users the protected variable _faultid, which must be set beforehand.
  */
 public function getDriverAction()
 {
     $data = sqlPull(array("table" => "driver_actions", "where" => "source=1 AND sourceid=" . $this->_faultid, "onerow" => 1));
     return $data;
 }
コード例 #5
0
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>";
    // }
}
コード例 #6
0
 /** UnitFaults::getRowSet($options)
  * @param $options array
  * @return array data on success false otherwise
  */
 public function getRowSet(array $options = array())
 {
     $options["table"] = $this->_name . " as " . $this->_title;
     foreach ($this->_dependantTables as $depkey => $depval) {
         $name = $depval["name"];
         $title = $depval["title"];
         $options["table"] .= " LEFT JOIN " . $name . " AS " . $title . " ON " . $depval["on"];
     }
     $data = sqlPull($options);
     if ($options["children"] == 1 && $data) {
         foreach ($data as $id => $row) {
             foreach ($this->_children as $key => $val) {
                 $child = (array) array();
                 $child["select"] = is_array($val["cols"]) ? implode(",", $val["cols"]) : $val["cols"];
                 $child["table"] = $val["table"];
                 $child["where"] = "faultid=" . $id;
                 $children = sqlPull($child);
                 if ($children) {
                     $data[$id][$val["table"]] = $children;
                 }
             }
         }
     }
     return $data;
 }
コード例 #7
0
        if ($maxwidth < 1300) {
            $factor = 0.9399999999999999;
        } else {
            if ($maxwidth > 1600) {
                $factor = 1.4;
            } else {
                $factor = 1;
            }
        }
    }
} else {
    $factor = 1;
}
// }
$trackfleets = array(22 => array("id" => 22, "name" => "Fleet A"), 23 => array("id" => 23, "name" => "Fleet B"), 55 => array("id" => 55, "name" => "Africa Fleet A"), 56 => array("id" => 56, "name" => "Africa Fleet B"), 78 => array("id" => 78, "name" => "Africa Fleet C"), 74 => array("id" => 74, "name" => "Energy"));
$top5 = sqlPull(array("table" => "position_scores", "where" => "1=1"));
// }
// Presentation {
print "<div style='margin:auto; margin-top:15px;'>";
print "<embed src='" . BASE . "/images/Heading.swf'\n\t\t\tFlashVars='heading=Fleet Positions Updates'\n\t\t\tquality='high'\n\t\t\twidth='" . 1300 * $factor . "px'\n\t\t\theight='" . 85 * $factor . "px'\n\t\t\tname='header'\n\t\t\twmode='transparent'\n\t\t\tallowScriptAccess='sameDomain'\n\t\t\tallowFullScreen='false'\n\t\t\ttype='application/x-shockwave-flash'\n\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer' />";
print "</div>";
print "<table style='width:100%;'>";
print "<tr>";
foreach ($top5 as $top5key => $top5val) {
    $varstring = "heading=" . $trackfleets[$top5val["fleet"]]["name"] . "&percent=" . $top5val["percent"] . $top5val["trucks"] . $top5val["times"] . $top5val["sub"] . $top5val["status"];
    print "<td style='width:20%;'>";
    print "<embed src='" . BASE . "images/positionspeedo.swf'\n\t\t\t\tFlashVars='" . $varstring . "'\n\t\t\t\tquality='high'\n\t\t\t\twidth='" . 220 * $factor . "px'\n\t\t\t\theight='" . 550 * $factor . "px'\n\t\t\t\tname='graph'\n\t\t\t\twmode='transparent'\n\t\t\t\tallowScriptAccess='sameDomain'\n\t\t\t\tallowFullScreen='false'\n\t\t\t\ttype='application/x-shockwave-flash'\n\t\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer' />";
    print "</td>";
}
print "</tr>";
print "</table>";
コード例 #8
0
 public function getFleetScoreMonth($fleet)
 {
     $startdate = mktime(0, 0, 0, date("m"), 1, date("Y"));
     $enddate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
     /*
     print("<div style='color:WHITE;'>");
     print("Start Date: ".date("d m Y", $startdate)." ".$startdate."<br>");
     print("End Date ".date("d m Y", $enddate)." ".$enddate."<br>");
     print("</div>");
     */
     $day = date("d");
     $fleetdays = sqlPull(array("table" => "fleet_scores", "where" => "fleetid=" . $fleet . " AND date>=" . $startdate . " AND date<=" . $enddate, "sort" => "day", "customkey" => "day"));
     //$fleetdays	= $this->useArtificialBudgets($fleet, $fleetdays);
     return $fleetdays;
 }
コード例 #9
0
ファイル: rightscontrol.php プロジェクト: RoneilZA/dashboards
function pageRights()
{
    // Preparation {
    $code = $_GET["code"];
    $groups = sqlPull(array("table" => "rights_groups", "where" => "1=1"));
    // }
    print "<form id=pagerightsform action='index.php?mode=maxine/index&action=updatepagerights' method='post'>";
    maxineHeader("top");
    // Buttons {
    print "<img src='" . TOPBUTTONS . "/buttonupdate.png' onClick='pagerightsform.submit();'>";
    print "<img src='" . TOPBUTTONS . "/buttonback.png' onClick=goTo('index.php?mode=maxine/index&action=firstmenu');>";
    print "</td></tr>";
    // }
    print "<tr><td align='center'>";
    print "<table class=tray width=60%>";
    print "<tr><td class=toprow align='center' colspan=2>";
    print "<font class=heading>" . $code . "</font>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "<font class=colheading>Group</font>";
    print "</td><td align='center'>";
    print "<font class=colheading>Access</font>";
    print "</td></tr>";
    print "<input type='hidden' name=conf[pagecode] value='" . $code . "'>";
    $count = 0;
    foreach ($groups as $grpkey => $grpval) {
        // Individual Preparation {
        $pagerights = sqlPull(array("table" => "rights_pages", "where" => "pagecode LIKE '" . $code . "' AND groupid = " . $grpval["id"], "onerow" => 1));
        // }
        print "<input type='hidden' name=conf[groups][" . $count . "][groupid] value=" . $grpval["id"] . ">";
        print "<tr><td align='center' width=90%>";
        print "<font class=standard>" . $grpval["name"] . "</font>";
        print "</td><td align='center' width=10%>";
        print "<input type='checkbox' name=conf[groups][" . $count . "][access] value=1 " . ($pagerights["level"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        $count++;
    }
    print "</table>";
    maxineFoot();
    print "</form>";
}
コード例 #10
0
} else {
    createGreenmileScore($righttimes);
}
// }
// Get right times for current month
$startdate = mktime(0, 0, 0, date("m"), 1, date("Y"));
$stopdate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$startstring = date("Y-m-d", $startdate);
$stopstring = date("Y-m-d", $stopdate);
print "Current Month : " . $startstring . " to " . $stopstring . "<br>";
$righttimes = getRightTimes($startstring, $stopstring);
$righttimes["date"] = $startdate;
print "<pre style='font-family:verdana;font-size:13'>";
print_r($righttimes);
print "</pre>";
$dashdetails = sqlPull(array("table" => "greenmile_scores", "where" => "date=" . $startdate, "onerow" => 1));
if ($dashdetails) {
    updateGreenmileScore($righttimes);
} else {
    createGreenmileScore($righttimes);
}
// }
$endtimer = date("U");
$totaltimer = $endtimer - $starttimer;
print "That took " . $totaltimer . " seconds.";
function getRightTimes($startstring, $stopstring)
{
    // Fetch the report and it's results {
    $reporturl = "http://login.max.manline.co.za/m4/2/api_request/Report/export?report=26&responseFormat=csv&Start_Date=" . $startstring . "&Stop_Date=" . $stopstring . "&numberOfRowsPerPage=10000";
    $fileParser = new FileParser($reporturl);
    $fileParser->setCurlFile("greenmiledays.csv");
コード例 #11
0
ファイル: drivers.php プロジェクト: RoneilZA/dashboards
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>";
    // }
}
コード例 #12
0
$deptlist = sqlPull(array("table" => "greenmile_depts", "where" => "deleted=0"));
$count = 0;
$currentoverall = 0;
$prevoverall = 0;
foreach ($deptlist as $deptkey => $deptval) {
    $currenttotalscore = 0;
    $prevtotalscore = 0;
    $currentscore = 0;
    $prevscore = 0;
    $catcount = 0;
    $difference = 0;
    //print($deptval["name"]."<br>");
    $catlist = sqlPull(array("table" => "greenmile_categories", "where" => "deptid=" . $deptval["id"] . " AND deleted=0"));
    foreach ($catlist as $catkey => $catval) {
        $currentcatscore = sqlPull(array("table" => "greenmile_scores", "where" => "date=" . $currentmonth . " AND catid=" . $catval["id"], "onerow" => 1));
        $prevcatscore = sqlPull(array("table" => "greenmile_scores", "where" => "date=" . $prevmonth . " AND catid=" . $catval["id"], "onerow" => 1));
        $currenttotalscore += $currentcatscore["score"];
        $prevtotalscore += $prevcatscore["score"];
        $catcount++;
        //print("Current Category Score: ".$currentcatscore["score"]."<br>");
        //print("Previous Category Score: ".$prevcatscore["score"]."<br>");
    }
    //print("Current Total Score: ".$currenttotalscore."<br>");
    //print("Previous Total Score: ".$prevtotalscore."<br>");
    $currentscore = round($currenttotalscore / $catcount, 2);
    $prevscore = round($prevtotalscore / $catcount, 2);
    if ($currentscore > $prevscore) {
        $difference = round($currentscore - $prevscore, 2);
        $direction = "up";
    } else {
        if ($currentscore < $prevscore) {
コード例 #13
0
        $factor = 0.8;
    } else {
        if ($maxwidth < 1300) {
            $factor = 0.9399999999999999;
        } else {
            if ($maxwidth > 1600) {
                $factor = 1.4;
            } else {
                $factor = 1;
            }
        }
    }
} else {
    $factor = 1;
}
$greenscores = sqlPull(array("table" => "greenmile_scores", "where" => "date>" . $mindate . " AND date<" . $maxdate, "sort" => "date ASC", "customkey" => "date"));
$monthstr = "";
$inputstr = "";
// Set up the trend images {
$display["invoicefull"] = "title1=Invoice&title2=In Full&score=" . $greenscores[$currentmonth]["invoicefull"] . "%25";
$display["invoicefull"] .= "&difference=" . ($greenscores[$currentmonth]["invoicefull"] - $greenscores[$prevmonth]["invoicefull"]) . "%25&sign=";
if ($greenscores[$currentmonth]["invoicefull"] > $greenscores[$prevmonth]["invoicefull"]) {
    $display["invoicefull"] .= "up";
} else {
    if ($greenscores[$currentmonth]["invoicefull"] < $greenscores[$prevmonth]["invoicefull"]) {
        $display["invoicefull"] .= "down";
    } else {
        $display["invoicefull"] .= "unchanged";
    }
}
$display["pods"] = "title1=P.O.D.&title2=On Time&score=" . $greenscores[$currentmonth]["pods"] . "%25";
コード例 #14
0
ファイル: Table.class.php プロジェクト: RoneilZA/dashboards
 /** Table::update($where, $data, $options)
 		* @param $where string standar sql where statement
 		* @param $data array array data to be inserted into the database
 		* @param $options array array options to be passed to sqlCreate
 		* @return true|array data on success false otherwise
 		* @example $users = new Users();
 							 $users->update('firstname like "%john%"', array('name'=>'sdf'), array('record'=>true));
 	*/
 public function update($where, array $data, array $options = array())
 {
     foreach ($data as $key => $val) {
         if (!in_array($key, $this->_cols)) {
             unset($data[$key]);
         }
     }
     $opts = (array) array();
     $opts['table'] = $this->_name;
     $opts['fields'] = $data;
     $opts['where'] = $where;
     if (sqlCommit($opts) === false) {
         return false;
     } else {
         if ($options['record']) {
             return sqlPull(array('table' => $this->_name, 'where' => $where));
         }
         return true;
     }
 }
コード例 #15
0
if ($maincounter == 0) {
    $today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    $fleetscores = sqlPull(array("table" => "fleet_scores", "where" => "date=" . $today, "customkey" => "fleetid"));
    print "<embed src='" . BASE . "/images/Heading.swf'\n\t\t\tFlashVars='heading=Daily Fleet Expected Tonnage Comparison'\n\t\t\tquality='high'\n\t\t\tname='number'\n\t\t\twidth='1880px'\n\t\t\theight='150px'\n\t\t\twmode='transparent'\n\t\t\tallowScriptAccess='sameDomain'\n\t\t\tallowFullScreen='false'\n\t\t\ttype='application/x-shockwave-flash'\n\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer' / >";
    foreach ($t24fleets as $fleetkey => $fleetval) {
        $fleetid = $fleetval["id"];
        if ($fleetscores[$fleetid]["tonnage"] && $fleetval["budget"]) {
            print "<embed src='" . BASE . "/images/Rasta.swf'\n\t\t\t\t\tFlashVars='fleet=" . $fleetval["name"] . "&income=" . $fleetscores[$fleetid]["tonnage"] . "&target=" . $fleetval["budget"] . "'\n\t\t\t\t\tquality='high'\n\t\t\t\t\tname='number'\n\t\t\t\t\twidth='1880px'\n\t\t\t\t\theight='150px'\n\t\t\t\t\twmode='transparent'\n\t\t\t\t\tallowScriptAccess='sameDomain'\n\t\t\t\t\tallowFullScreen='false'\n\t\t\t\t\ttype='application/x-shockwave-flash'\n\t\t\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer' / >";
        }
    }
} else {
    $overweights = 0;
    $fleetid = $t24fleets[$fleetcounter]["id"];
    $startdate = mktime(0, 0, 0, date("m"), 1, date("Y"));
    $stopdate = mktime(0, 0, 0, date("m") + 1, 1, date("Y"));
    $fleetscores = sqlPull(array("table" => "fleet_scores", "where" => "fleetid=" . $fleetid . " AND date >= " . $startdate . " AND date <= " . $stopdate, "sort" => "date"));
    $flashstring = "green=Great&yellow=Average&orange=Bad&red=Extremely Bad&count=" . count($fleetscores);
    if ($fleetscores) {
        $daycount = 1;
        foreach ($fleetscores as $daykey => $dayval) {
            $averagetons = round($dayval["tonnage"] / $dayval["tripcount"], 2);
            $flashstring .= "&ginput" . $daycount . "=" . $averagetons;
            $overweights += $dayval["overweightcount"];
            $daycount++;
        }
    }
    print "<div style='margin-top:40px; margin-bottom:20px;'>";
    print "<embed src='" . BASE . "/images/t24tonnageheading.swf'\n\t\t\tFlashVars='heading=" . $t24fleets[$fleetcounter]["name"] . "&overloads=" . $overweights . "'\n\t\t\tquality='high'\n\t\t\tname='number'\n\t\t\twidth='1880px'\n\t\t\theight='150px'\n\t\t\twmode='transparent'\n\t\t\tallowScriptAccess='sameDomain'\n\t\t\tallowFullScreen='false'\n\t\t\ttype='application/x-shockwave-flash'\n\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer' / >";
    print "</div>";
    print "<div style=''>";
    print "<embed src='" . BASE . "/images/t24dailytonnage.swf'\n\t\t\tFlashVars='" . $flashstring . "'\n\t\t\tquality='high'\n\t\t\tname='number'\n\t\t\twidth='1880px'\n\t\t\theight='860px'\n\t\t\twmode='transparent'\n\t\t\tallowScriptAccess='sameDomain'\n\t\t\tallowFullScreen='false'\n\t\t\ttype='application/x-shockwave-flash'\n\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer' / >";
コード例 #16
0
ファイル: learner.php プロジェクト: RoneilZA/dashboards
function learnerList()
{
    $learners = new Learners();
    // Preparation {
    $editrights = "";
    $access = testRights($_SESSION["userid"], "lea001");
    if ($_SESSION["isit"] == 1) {
        $access = 10;
        $editrights = "onclick=goTo('index.php?mode=maxine/index&action=pagerights&code=lea001')";
    }
    $conf = $_POST["conf"];
    if (!$conf["searchtype"]) {
        $conf["searchtype"] = 1;
    }
    // Where {
    $learnerwhere = "l.deleted = 0";
    // Learner Details Search {
    if ($conf["search"]["firstname"]) {
        $learnerwhere .= " AND l.firstname LIKE '%" . $conf["search"]["firstname"] . "%'";
    }
    if ($conf["search"]["lastname"]) {
        $learnerwhere .= " AND l.lastname LIKE '%" . $conf["search"]["lastname"] . "%'";
    }
    if ($conf["search"]["idno"]) {
        $learnerwhere .= " AND idno LIKE '%" . $conf["search"]["idno"] . "%'";
    }
    if ($conf["search"]["contactno"]) {
        $learnerwhere .= " AND contactno LIKE '%" . $conf["search"]["contactno"] . "%'";
    }
    if ($conf["search"]["statusid"] > 0) {
        $learnerwhere .= " AND statusid = " . $conf["search"]["statusid"];
    }
    // }
    // Note Search {
    if ($conf["notesearch"]) {
        $notewhere = "note LIKE '%" . $conf["notesearch"] . "%' AND learnerid > 0";
        $notelist = sqlPull(array("table" => "candidate_notes", "where" => $notewhere, "group" => "learnerid"));
        if ($notelist) {
            $learnerwhere .= " AND id in (0";
            foreach ($notelist as $notekey => $noteval) {
                $learnerwhere .= "," . $noteval["learnerid"];
            }
            $learnerwhere .= ")";
        } else {
            $learnerwhere = "0 = 1";
            // Deliberately set the learner search to fail, as no notes match search.
        }
    }
    // }
    // }
    // Sort {
    if ($conf["sortvar"] == 1 || $conf["sortvar"] == 2) {
        $sort = "firstname";
    } else {
        if ($conf["sortvar"] == 3 || $conf["sortvar"] == 4) {
            $sort = "lastname";
        } else {
            if ($conf["sortvar"] == 5 || $conf["sortvar"] == 6) {
                $sort = "idno";
            } else {
                if ($conf["sortvar"] == 7 || $conf["sortvar"] == 8) {
                    $sort = "contactno";
                } else {
                    if ($conf["sortvar"] == 9 || $conf["sortvar"] == 10) {
                        $sort = "statusid";
                    } else {
                        $sort = "firstname";
                    }
                }
            }
        }
    }
    if ($conf["sortvar"]) {
        if (fmod($conf["sortvar"], 2) == 1) {
            $sort .= " ASC";
        } else {
            $sort .= " DESC";
        }
    } else {
        $sort .= " ASC";
    }
    // }
    $learnerlist = $learners->getRowSet(array("where" => $learnerwhere, "sort" => $sort, 'children' => true));
    $statuslist = array(1 => "", 2 => "Failed", 3 => "Passed");
    // }
    maxineTop("Learner List");
    print "<form id='listform' name='listform' action='index.php?mode=maxine/index&action=learnerlist' method=post>";
    // Buttons {
    openHeader();
    if ($access > 0) {
        maxineButton("Add", "goTo(\"index.php?mode=maxine/index&action=editlearner\");", 2);
        maxineButton("Search", "toggle(\"searchdiv\");", 2);
    }
    maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=peoplemenu\");", 2);
    closeHeader();
    // }
    print "<div class='tray'>";
    // Search Box {
    print "<div id='searchdiv' style='display: none;'>";
    openSubbar(400);
    print "Search Box";
    closeSubbar();
    print "<table class='standard' style='width:400px;'>";
    // Standard search {
    print "<tr class='content1'><td align='center' width=40%>";
    print "First Name";
    print "</td><td width=60%>";
    print "<input name=conf[search][firstname] value='" . $conf["search"]["firstname"] . "' style='width:200px;'>";
    print "</td></tr>";
    print "<tr class='content1'><td align='center'>";
    print "Last Name";
    print "</td><td>";
    print "<input name=conf[search][lastname] value='" . $conf["search"]["lastname"] . "' style='width:200px;'>";
    print "</td></tr>";
    print "<tr class='content1'><td align='center'>";
    print "ID Number";
    print "</td><td>";
    print "<input name=conf[search][idno] value='" . $conf["search"]["idno"] . "' style='width:200px;'>";
    print "</td></tr>";
    print "<tr class='content1'><td align='center'>";
    print "Contact Number";
    print "</td><td>";
    print "<input name=conf[search][contactno] value='" . $conf["search"]["contactno"] . "' style='width:200px;'>";
    print "</td></tr>";
    print "<tr class='content1'><td align='center'>";
    print "Status";
    print "</td><td>";
    print "<select name=conf[search][statusid] style='width:200px; color:BLACK;'>";
    print "<option value=0 " . ($conf["search"]["statusid"] == 0 ? "selected" : "") . ">- Select -</option>";
    print "<option value=1 " . ($conf["search"]["statusid"] == 1 ? "selected" : "") . ">No Status</option>";
    print "<option value=2 " . ($conf["search"]["statusid"] == 2 ? "selected" : "") . ">Failed</option>";
    print "<option value=3 " . ($conf["search"]["statusid"] == 3 ? "selected" : "") . ">Passed</option>";
    print "</select>";
    print "</td></tr>";
    // }
    // Note search {
    print "<tr class='content1'><td align='center' width=40%>";
    print "Note Text";
    print "</td><td width=60%>";
    print "<input name=conf[notesearch] value='" . $conf["notesearch"] . "' style='width:200px;'>";
    print "</td></tr>";
    // }
    print "<tr class='content1'><td align='center' colspan=2>";
    maxineButton("Submit", "listform.submit();", 0);
    print "</td></tr>";
    print "</table>";
    print "</div";
    // }
    // Results {
    if ($access > 0) {
        if ($conf["search"]["firstname"] == "Mickey" && $conf["search"]["lastname"] == "Mouse") {
            print "<img src='" . BASE . "/images/mickey.png'>";
        } else {
            openSubbar(800);
            print "<span " . $editrights . ">Details</span>";
            closeSubbar();
            print "<table class='standard' style='width:800px; margin-bottom:20px;'>";
            if ($learnerlist) {
                // Headers {
                print "<input type='hidden' id=sorttype name=conf[sortvar] value=" . $conf["sortvar"] . ">";
                print "<tr class='heading'><td align='center' width=5%>";
                print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 1 ? "2" : "1") . "; listform.submit();' width=40%>";
                print "Learner Name";
                if ($conf["sortvar"] == 1) {
                    print "<img src='" . BASE . "/images/downarrow.png'>";
                } else {
                    if ($conf["sortvar"] == 2) {
                        print "<img src='" . BASE . "/images/uparrow.png'>";
                    }
                }
                print "<img src='" . BASE . "/images/miniclickable.png' onClick='sorttype.value=" . ($conf["sortvar"] == 3 ? "4" : "3") . "; listform.submit();'>";
                if ($conf["sortvar"] == 3) {
                    print "<img src='" . BASE . "/images/downarrow.png'>";
                } else {
                    if ($conf["sortvar"] == 4) {
                        print "<img src='" . BASE . "/images/uparrow.png'>";
                    }
                }
                print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 5 ? "6" : "5") . "; listform.submit();' width=20%>";
                print "ID Number";
                if ($conf["sortvar"] == 5) {
                    print "<img src='" . BASE . "/images/downarrow.png'>";
                } else {
                    if ($conf["sortvar"] == 6) {
                        print "<img src='" . BASE . "/images/uparrow.png'>";
                    }
                }
                print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 7 ? "8" : "7") . "; listform.submit();' width=20%>";
                print "Contact Number";
                if ($conf["sortvar"] == 7) {
                    print "<img src='" . BASE . "/images/downarrow.png'>";
                } else {
                    if ($conf["sortvar"] == 8) {
                        print "<img src='" . BASE . "/images/uparrow.png'>";
                    }
                }
                print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 9 ? "10" : "9") . "; listform.submit();' width=15%>";
                print "Status";
                if ($conf["sortvar"] == 9) {
                    print "<img src='" . BASE . "/images/downarrow.png'>";
                } else {
                    if ($conf["sortvar"] == 10) {
                        print "<img src='" . BASE . "/images/uparrow.png'>";
                    }
                }
                print "</td></tr>";
                // }
                foreach ($learnerlist as $learnerkey => $learnerval) {
                    // Note Title Creation {
                    $notelist = $learnerval['candidate_notes'];
                    $notesummary = "";
                    $innertext = "";
                    $popup = "";
                    if ($notelist) {
                        $innertext = "<table>";
                        $innertext .= "<tr><td align=\"center\">";
                        $innertext .= "Notes";
                        $innertext .= "</td></tr>";
                        $notecount = 1;
                        foreach ($notelist as $notekey => $note) {
                            $innertext .= "<tr><td>";
                            $textnote = str_replace("'", "", $note["note"]);
                            $innertext .= $notecount . " : " . $textnote;
                            $innertext .= "</td></tr>";
                            $notecount++;
                        }
                        $innertext .= "</table>";
                    } else {
                        $innertext = "<table>";
                        $innertext .= "<tr><td align=\"center\">";
                        $innertext .= "No notes";
                        $innertext .= "</td></tr>";
                        $innertext .= "</table>";
                    }
                    $popup = "cavtitle='" . $innertext . "' onmousemove='setCavTimer(event);' onmouseout='CancelCavTimer(event);'";
                    // }
                    print "<tr class='content1' style=\"cursor:pointer;\" onClick=\"goTo('index.php?mode=maxine/index&action=&action=editlearner&learnerid=" . $learnerval["id"] . "');\"><td align='center'>\n";
                    print "<img src='" . BASE . "/images/note.png' " . $popup . ">";
                    print "</td><td align='center'>";
                    if ($conf["sortvar"] == 3 || $conf["sortvar"] == 4) {
                        print $learnerval["lastname"] . ", " . $learnerval["firstname"] . " " . $learnerval["middlename"];
                    } else {
                        print $learnerval["firstname"] . " " . $learnerval["middlename"] . " " . $learnerval["lastname"];
                    }
                    print "</td><td align='center'>";
                    print $learnerval["idno"];
                    print "</td><td align='center'>";
                    print $learnerval["contactno"];
                    print "</td><td align='center'>";
                    print $statuslist[$learnerval["statusid"]];
                    print "</td></tr>";
                }
            } else {
                print "<tr><td align='center' colspan=2>";
                print "No Learners match search";
                print "</td></tr>";
            }
            print "</table>";
        }
    } else {
        print "You do not have access to this page.";
    }
    // }
    print "</div>";
    print "</form>";
    maxineBottom();
}
コード例 #17
0
ファイル: maxineapi.php プロジェクト: RoneilZA/dashboards
function importFaults()
{
    $rawusers = fopen(FIRSTBASE . "/import/hdusers.csv", "r");
    $baka = sqlPull(array("table" => "users", "where" => "personid=" . $_SESSION["userid"], "onerow" => 1));
    print "I know who you are, " . $baka["firstname"] . "...";
    exit;
    $where = "1=1";
    sqlDelete(array("table" => "fs_faults", "where" => $where));
    $userlist = array();
    while (!feof($rawusers)) {
        $rawline = fgets($rawusers, 4096);
        $rawarray = explode(";", $rawline);
        $id = str_replace("\"", "", $rawarray[0]);
        $firstname = str_replace("\"", "", $rawarray[2]);
        $firstname = str_replace("-", "", $firstname);
        $firstname = str_replace(" ", "", $firstname);
        $lastname = str_replace("\"", "", $rawarray[1]);
        if ($firstname && $lastname) {
            $where = "firstname LIKE '" . $firstname . "' AND lastname LIKE '" . $lastname . "'";
            $username = strtolower("del" . $lastname . $firstname[0]);
            $username = str_replace(" ", "", $username);
            $userlist[$id]["username"] = $username;
            $userlist[$id]["firstname"] = $firstname;
            $userlist[$id]["lastname"] = $lastname;
        }
    }
    fclose($rawusers);
    //importUsers();
    $rawdata = fopen(FIRSTBASE . "/import/helpdesk.csv", "r");
    while (!feof($rawdata)) {
        $rawline = fgets($rawdata, 4096);
        $rawline = str_replace("\"", "", $rawline);
        $rawarray = explode(";", $rawline);
        $source = sqlPull(array("table" => "users", "where" => "firstname LIKE '" . $firstsource . "'"));
        $firstsource = $userlist[$rawarray[3]]["firstname"];
        $lastsource = $userlist[$rawarray[3]]["lastname"];
        $source = sqlPull(array("table" => "users", "where" => "firstname LIKE '" . $firstsource . "' AND lastname LIKE '" . $lastsource . "'", "onerow" => 1));
        $comment = str_replace("'", "", $rawarray[2]);
        $firstit = $userlist[$rawarray[5]]["firstname"];
        $lastit = $userlist[$rawarray[5]]["lastname"];
        $it = sqlPull(array("table" => "users", "where" => "firstname LIKE '" . $firstit . "' AND lastname LIKE '" . $lastit . "'", "onerow" => 1));
        $startdate = strtotime($rawarray[1]);
        $enddate = strtotime($rawarray[7]);
        $data["itid"] = $it["personid"];
        $data["sourceid"] = $source["personid"];
        $data["typeid"] = -1;
        $data["comment"] = $comment;
        $data["date"] = $startdate;
        $data["complete"] = $enddate;
        if ($enddate) {
            sqlCreate(array("table" => "fs_faults", "fields" => $data));
        }
    }
    fclose($rawdata);
}
コード例 #18
0
 /** refuel($test = FALSE)
  * get open and missing refuel data
  * @param BOOL $test is this a request for test platform?
  * @return TRUE on success. FALSE otherwise
  */
 public function refuel($test = FALSE)
 {
     $fleets = $this->_incomefleets;
     $data = (array) array();
     foreach ($fleets as $val) {
         $data[$val['maxid']]['fleet_id'] = $val['maxid'];
         if (array_key_exists('fleets', $val)) {
             $sql = (string) 'SELECT SUM(`fleet_count`) AS `fleet_count`, SUM(`missing_count`) AS `missing_count`, SUM(`open_count`) AS `open_count`, SUM(`total_open_count`) AS `total_open_count` ';
             $sql .= 'FROM `refuels` ';
             $fleetsToLoop = (array) array();
             foreach ($val['fleets'] as $ook) {
                 $fleetsToLoop[] = $ook[0];
             }
             $sql .= 'WHERE `fleet_id` IN(' . implode($fleetsToLoop, ',') . ')';
             $row = sqlQuery($sql);
             if ($row === FALSE) {
                 continue;
             }
             $data[$val['maxid']]['fleet_count'] = $row[0]['fleet_count'];
             $data[$val['maxid']]['missing_count'] = $row[0]['missing_count'];
             $data[$val['maxid']]['open_count'] = $row[0]['open_count'];
             $data[$val['maxid']]['total_open_count'] = $row[0]['total_open_count'];
         } else {
             //: Get fleet count
             $trucks = $this->_apiurl . "report=145&responseFormat=csv&Fleet=" . $val['maxid'] . "&Start%20Date=" . date("Y-m-d") . "&Stop%20Date=" . date("Y-m-d", strtotime("+1 day"));
             if ($test === TRUE) {
                 $trucks = preg_replace('/https\\:\\/\\/login\\.max\\.bwtsgroup\\.com/', 'http://max.mobilize.biz', $trucks);
             }
             $fileParser = new FileParser($trucks);
             $fileParser->setCurlFile("trucks." . $val['maxid'] . ".csv");
             $trucks = $fileParser->parseFile();
             if ($trucks === FALSE) {
                 print "<pre style='font-family:verdana;font-size:13'>";
                 print_r($fileParser->getErrors());
                 print "</pre>";
                 return FALSE;
             }
             if (is_array($trucks) === FALSE) {
                 return FALSE;
             }
             $data[$val['maxid']]['fleet_count'] = count($trucks);
             //: End
             $refuels = $this->_apiurl . "report=175&responseFormat=csv&Fleet=" . $val['maxid'] . "&Start%20Date=" . date("Y-m-d", strtotime('-30 days')) . "&Stop%20Date=" . date("Y-m-01", strtotime("+1 month"));
             if ($test === TRUE) {
                 $refuels = preg_replace('/https\\:\\/\\/login\\.max\\.bwtsgroup\\.com/', 'http://max.mobilize.biz', $refuels);
             }
             print $refuels . PHP_EOL;
             $fileParser = new FileParser($refuels);
             $fileParser->setCurlFile("missingrefuels" . $val['maxid'] . ".csv");
             $missingrefuels = $fileParser->parseFile();
             if ($missingrefuels === FALSE) {
                 print "<pre style='font-family:verdana;font-size:13'>";
                 print_r($fileParser->getErrors());
                 print "</pre>";
                 return FALSE;
             }
             if (is_array($missingrefuels) === FALSE) {
                 return FALSE;
             }
             // print_r($missingrefuels);
             $i = (int) 0;
             //: Missing Refuels
             foreach ($missingrefuels as $key => $value) {
                 //: Checks
                 if ($val['maxid'] == 73) {
                     print_r($value);
                 }
                 if ($value['Odometer'] === '(none)' || $value['Odometer'] === '') {
                     continue;
                 }
                 if (substr($value['Variance'], 0, 1) !== '-') {
                     continue;
                 }
                 //: End
                 if ($value['Variance'] * -1 >= $val['kms_limit']) {
                     $i++;
                 }
             }
             $data[$val['maxid']]['missing_count'] = $i;
             //: End
             //: Open Refuels
             $refuels = $this->_apiurl . "report=174&responseFormat=csv&Fleet=" . $val['maxid'] . "&Start%20Date=" . date("Y-m-d", strtotime('-30 days')) . "&Stop%20Date=" . date("Y-m-01", strtotime("+1 month"));
             if ($test === TRUE) {
                 $refuels = preg_replace('/https\\:\\/\\/login\\.max\\.bwtsgroup\\.com/', 'http://max.mobilize.biz', $refuels);
             }
             print $refuels . PHP_EOL;
             $fileParser = new FileParser($refuels);
             $fileParser->setCurlFile("openrefuels" . $val['maxid'] . ".csv");
             $openrefuels = $fileParser->parseFile();
             if ($openrefuels === FALSE) {
                 print "<pre style='font-family:verdana;font-size:13'>";
                 print_r($fileParser->getErrors());
                 print "</pre>";
                 return FALSE;
             }
             if (is_array($openrefuels) === FALSE) {
                 return FALSE;
             }
             // print_r($openrefuels);
             $cnt = (int) 0;
             foreach ($openrefuels as $key => $value) {
                 //: Convert the refuel time difference into seconds
                 $refuel_time = (int) 0;
                 $split = preg_split('/\\s/', $value['Duration Open (Refuel Time)']);
                 if (array_key_exists(0, $split)) {
                     if (substr($split[0], -1, 1) === 'd') {
                         //: Days
                         $refuel_time += 24 * 60 * 60 * (int) $split[0];
                     } else {
                         //: Hours
                         $refuel_time += 60 * 60 * (int) $split[0];
                     }
                 }
                 if (array_key_exists(1, $split)) {
                     //: Hours
                     $refuel_time += 60 * 60 * (int) $split[0];
                 }
                 // print('refuel time: '.$refuel_time.PHP_EOL);
                 if ($refuel_time >= $val['open_time']) {
                     $cnt++;
                 }
                 //: End
             }
             $data[$val['maxid']]['total_open_count'] = count($openrefuels);
             $data[$val['maxid']]['open_count'] = $cnt;
             //: End
         }
     }
     foreach ($data as $key => $val) {
         $record = sqlPull(array("table" => "refuels", "where" => "fleet_id=" . $key, "customkey" => "fleet_id"));
         if (array_key_exists($key, $record) && $record[$key]) {
             sqlCommit(array("table" => "refuels", "where" => "fleet_id=" . $key, "fields" => $val));
         } else {
             sqlCreate(array("table" => "refuels", "fields" => $val));
         }
         print '|';
     }
 }
コード例 #19
0
 /** Logging::getRowSet($options)
  * @param $options array
  * @return array data on success false otherwise
  */
 public function getRowSet(array $options = array())
 {
     $options['select'] = substr($this->_name, 0, 1) . '.*';
     $options['table'] = $this->_name . ' as ' . substr($this->_name, 0, 1);
     foreach ($this->_dependantTables as $key => $val) {
         $alias = array_keys($val['table']);
         $name = array_values($val['table']);
         $options['select'] .= ', ' . $val['cols'];
         $options['table'] .= ' left join ' . $name[0] . ' as ' . $alias[0] . ' on ' . $val['on'];
     }
     $data = sqlPull($options);
     if ($options['children']) {
         foreach ($data as $id => $row) {
             foreach ($this->_children as $key => $val) {
                 $child = (array) array();
                 $child['select'] = is_array($val['cols']) ? implode(',', $val['cols']) : $val['cols'];
                 $child['table'] = $val['table'];
                 $child['where'] = 'log_typeid=' . $id;
                 $child['customkey'] = $val['customkey'];
                 $chilren = sqlPull($child);
                 $data[$id][$val['table']] = $chilren;
             }
         }
     }
     return $data;
 }
コード例 #20
0
    $top5[$fleetval["id"]]["percent"] = $percentontime;
    for ($i = 0; $i < 6; $i++) {
        $description = $poslist[$i]["Desc"];
        $activity = $poslist[$i]["Activity"];
        $top5[$fleetval["id"]]["trucks"] .= "&fleet" . ($i + 1) . "=" . $poslist[$i]["Truck"];
        $top5[$fleetval["id"]]["times"] .= "&minutes" . ($i + 1) . "=" . $poslist[$i]["age"] . " mins";
        $top5[$fleetval["id"]]["sub"] .= "&detail" . ($i + 1) . "=" . $description . " - " . $activity;
        if ($poslist[$i]["age"] > 120) {
            $top5[$fleetval["id"]]["status"] .= "&status" . ($i + 1) . "=0";
        } else {
            $top5[$fleetval["id"]]["status"] .= "&status" . ($i + 1) . "=1";
        }
    }
}
// }
foreach ($top5 as $fleetkey => $fleetval) {
    $positiondetails = sqlPull(array("table" => "position_scores", "where" => "fleet=" . $fleetval["fleet"], "onerow" => 1));
    if ($positiondetails) {
        commitPositionScore($fleetval, $positiondetails["id"]);
    } else {
        commitPositionScore($fleetval, 0);
    }
}
print "Done.";
function cmpLoadingDates($a, $b)
{
    if ($a["Edited"] == $b["Edited"]) {
        return 0;
    }
    return $a["Edited"] < $b["Edited"] ? -1 : 1;
}