Beispiel #1
0
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");
}
}
// }
// 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");
    $reportresults = $fileParser->parseFile();
    if ($reportresults === false) {