Ejemplo n.º 1
0
    $maps = array();
    //$r = ceil(strlen($map)/$width);
    for ($i = 0; $i < strlen($map); $i += 3) {
        $ss = substr($map, $i, 3);
        $maps[] = $ss;
    }
    return $maps;
}
class response
{
    var $map;
    var $moves;
}
if (strlen($map) == $width * $width) {
    $p_row = findRow($map, $width, "p");
    $p_column = findColumn($map, $width, "p");
    $w_row = findRow($map, $width, "w");
    $w_column = findColumn($map, $width, "w");
    $f_row = findRow($map, $width, "f");
    $f_column = findColumn($map, $width, "f");
    $move1 = findDirection($p_row, $p_column, $w_row, $w_column);
    $move2 = findDirection($w_row, $w_column, $f_row, $f_column);
    $all_move = array_merge($move1, $move2);
    //print_r($all_move);
    header('Content-type: application/json');
    $maps = getMaps($map, $width);
    $response = new response();
    $response->map = $maps;
    $response->moves = $all_move;
    echo json_encode($response);
}
Ejemplo n.º 2
0
    $CalcDistance = false;
}
$CalcCoordinates = true;
if (fHideColumn(findColumn(tr('Coordinates')), false) == 1) {
    $CalcCoordinates = false;
}
$CalcSendToGPS = true;
if (fHideColumn(findColumn(tr('srch_Send_to_GPS'), "O"), false) == 1) {
    $CalcSendToGPS = false;
}
$CalcFNC = true;
if (fHideColumn(findColumn(tr('FNC')), false) == 1 && fHideColumn(findColumn(tr('F')), false) == 1 && fHideColumn(findColumn(tr('N')), false) == 1 && fHideColumn(findColumn(tr('C')), false) == 1) {
    $CalcFNC = false;
}
$CalcEntry = true;
if (fHideColumn(findColumn(tr('Entry')), false) == 1) {
    $CalcEntry = false;
}
if ($CalcSendToGPS) {
    $CalcCoordinates = true;
}
if ($CalcDistance) {
    $CalcCoordinates = true;
}
$distance_unit = 'km';
$sql = 'SELECT ';
if (isset($lat_rad) && isset($lon_rad)) {
    if ($CalcDistance) {
        $sql .= getCalcDistanceSqlFormula($usr !== false, $lon_rad * 180 / 3.14159, $lat_rad * 180 / 3.14159, 0, $multiplier[$distance_unit]) . ' `distance`, ';
    }
} else {