コード例 #1
0
ファイル: order.php プロジェクト: TeamAlberto/AlbertoApp
<?php

header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf-8');
require 'vendor/autoload.php';
require 'WebfleetConnect.php';
$orderparams = array("objectno" => "1", "orderid" => "Alberto " . time(), "ordertext" => isset($_POST['order']) ? $_POST['order'] : "Alberto order", "ordertype" => "3", "contact" => isset($_POST['customer']) ? $_POST['customer'] : "Justin Halsall", "contacttel" => isset($_POST['phone']) ? $_POST['phone'] : "06-12345678", "latitude" => isset($_POST['lat']) ? intval($_POST['lat'] * 1000000) : intval(52.3778803 * 1000000), "longitude" => isset($_POST['lng']) ? intval($_POST['lng'] * 1000000) : intval(4.9163712 * 1000000), "city" => isset($_POST['city']) ? $_POST['city'] : "Pietheinkade 55", "street" => isset($_POST['address']) ? $_POST['address'] : "Amsterdam");
$wf = new WebfleetConnect("TTTDEMO-NL", "ddbgroup", "puntNL", "5eda59c2-091d-4816-a848-3c09c9f5626b");
$response = $wf->request("sendDestinationOrderExtern", "get", $orderparams);
print_r(count($response) == 0 ? "place order success" : $response);
print_r($_POST);
コード例 #2
0
    $secfloat = ($minfloat - $m) * 60;
    $s = round($secfloat);
    // After rounding, the seconds might become 60. These two
    // if-tests are not necessary if no rounding is done.
    if ($s == 60) {
        $m++;
        $s = 0;
    }
    if ($m == 60) {
        $d++;
        $m = 0;
    }
    return array($d, $m, $s);
}
if (USE_API) {
    $wf = new WebfleetConnect("TTTDEMO-NL", "ddbgroup", "puntNL", "5eda59c2-091d-4816-a848-3c09c9f5626b");
    $vehicles = $wf->request("showNearestVehicles", "get", array("latitude" => intval($_REQUEST['lat'] * 1000000), "longitude" => intval($_REQUEST['lng'] * 1000000)));
} else {
    include "stub-vehicles.php";
}
$couriers = array();
foreach ($vehicles as $vehicle) {
    $courier = new stdclass();
    $courier->details = $_GLOBALS['COURIERS'][$vehicle['objectno']];
    $courier->lat = $vehicle['latitude'] / 1000000;
    $courier->lng = $vehicle['longitude'] / 1000000;
    $courier->routetime = $vehicle['routetime'];
    $couriers[$vehicle['routetime']] = $courier;
}
ksort($couriers);
$i = 0;
コード例 #3
0
<?php

header('Content-Type: text/html; charset=utf-8');
require 'vendor/autoload.php';
require 'WebfleetConnect.php';
require "config.php";
function dms_to_deg($degrees, $minutes, $seconds)
{
    //Decimal degrees =
    //   whole number of degrees,
    //   plus minutes divided by 60,
    //   plus seconds divided by 3600
    return $degrees + $minutes / 60 + $seconds / 3600;
}
$wf = new WebfleetConnect("TTTDEMO-NL", "ddbgroup", "puntNL", "5eda59c2-091d-4816-a848-3c09c9f5626b");
$vehicles = $wf->request("showObjectReportExtern");
$couriers = array();
foreach ($vehicles as $vehicle) {
    $courier = new stdclass();
    $courier->details = $_GLOBALS['COURIERS'][$vehicle['objectno']];
    preg_match_all("/[0-9\\.]+/", $vehicle['latitude'], $matches);
    $courier->lat = dms_to_deg($matches[0][0], $matches[0][1], $matches[0][2]);
    preg_match_all("/[0-9\\.]+/", $vehicle['longitude'], $matches);
    $courier->lng = dms_to_deg($matches[0][0], $matches[0][1], $matches[0][2]);
    $couriers[] = $courier;
}
echo json_encode($couriers);
//Apikey=5eda59c2-091d-4816-a848-3c09c9f5626b
/*
#!/usr/bin/env python