示例#1
0
function geofenceChk($date_offline, $deviceIMEI)
{
    $path1 = $GLOBALS[dataPath] . "src/data/" . date('d-m-Y', strtotime($date_offline)) . "/" . $deviceIMEI . ".txt";
    if (chk_folder($path1)) {
        $file1 = @fopen($path1, "r");
        if ($file1) {
            $i = 0;
            while (!feof($file1)) {
                $data1 = fgets($file1);
            }
            $data1 = getSortedData($data1);
            fclose($file1);
        }
        return $data1;
    }
}
示例#2
0
function gpspathFunAll($date_offline, $deviceIMEI)
{
    $path1 = $GLOBALS[dataPath] . "src/data/" . date('d-m-Y', strtotime($date_offline)) . "/" . $deviceIMEI . ".txt";
    //$path1="http://localhost/gpsapp/data/".date('d-m-Y',strtotime($date_offline))."/352848025507217.txt";
    if (chk_folder($path1)) {
        $file1 = @fopen($path1, "r");
        if ($file1) {
            $i = 0;
            while (!feof($file1)) {
                $data1 = fgets($file1);
            }
            $data1 = getSortedData($data1);
            fclose($file1);
        }
        return $data1;
    }
}
示例#3
0
function gpspathFun($source)
{
    $path1 = $source;
    if (chk_folder($path1)) {
        $file1 = @fopen($path1, "r");
        if ($file1) {
            while (!feof($file1)) {
                $data = fgets($file1);
                //$i++;
            }
            $data = getSortedData($data);
            return $data;
            fclose($file1);
        } else {
            $data = 0;
            return $data;
        }
    }
}
function gpspathFun($clientId, $date_offline, $phoneNumber)
{
    $dataPath = $GLOBALS["dataPath"];
    $path1 = $dataPath . "client_" . $clientId . "/" . date('d-m-Y', strtotime($date_offline)) . "/" . $phoneNumber . ".txt";
    if (chk_folder($path1)) {
        $file1 = @fopen($path1, "r");
        if ($file1) {
            $i = 0;
            while (!feof($file1)) {
                $data = fgets($file1);
                //$i++;
            }
            storeData1($data);
            fclose($file1);
        } else {
            $data = 0;
            storeData1($data);
        }
    }
}
示例#5
0
function getOverAllTripReport($sdate, $vehId, $dest)
{
    $cnt = 1;
    $tmp = -1;
    $t1 = 0.0;
    $t2 = 0.0;
    $timeArr = array();
    $timediff = array();
    $strTime = '';
    $endTime = '';
    $tmpId = 0;
    $srcArr = array();
    $destArr = array();
    $stCunt = 0;
    $stChk = 0;
    $geocheck = 0;
    //print_r($dest);
    $file = $GLOBALS[dataPath] . "client_" . $_SESSION[clientID] . "/" . date("d-m-Y", strtotime($sdate)) . "/" . $vehId . ".txt";
    if (chk_folder($file)) {
        $file1 = @fopen($file, "r");
        if ($file1) {
            while (!feof($file1)) {
                $data = fgets($file1);
            }
            $data = getSortedData($data);
        }
        if (count($data) > 0) {
            $data1 = explode("#", $data);
            for ($j1 = 0; $j1 < count($data1); $j1++) {
                $data2 = explode("\$", $data1[$j1]);
                if (count($data2) > 1) {
                    $data3 = explode(",", $data2[1]);
                    //echo date("d-m-Y", strtotime($sdate))."==".date("d-m-Y",@mktime(($data3[4]+5),($data3[5]+30),$data3[6],$data3[2],$data3[1],$data3[3]));
                    $vehi = $data3[0];
                    $geodate = date("d-m-Y", @mktime($data3[4] + 5, $data3[5] + 30, $data3[6], $data3[2], $data3[1], $data3[3]));
                    $geoTime = date("H:i:s A", @mktime($data3[4] + 5, $data3[5] + 30, $data3[6], $data3[2], $data3[1], $data3[3]));
                    $pos1 = convertLat(calLat($data3[7]));
                    $pos2 = convertLong(calLong($data3[8]));
                    $vehi = $data3[0];
                    /*$getLL=drawCircle("17.98264333","79.601965","0.16");
                    		print_r($getLL);
                    		echo $resLL=getGeofenceStatus($getLL,"17.9809383333","79.6004683333");
                    		exit;*/
                    if ($pos1 > 0 && $pos2 > 0) {
                        $sel_pts = "SELECT * FROM gps_geopoints_info WHERE gpi_clientID=" . $_SESSION[clientID] . " AND gpi_id=" . $dest;
                        $rs_sel_pts = mysql_query($sel_pts);
                        if (@mysql_affected_rows() > 0) {
                            while ($fetch_sel_pts = @mysql_fetch_assoc($rs_sel_pts)) {
                                $gcdLatLng = drawCircle($fetch_sel_pts[gpi_latVal], $fetch_sel_pts[gpi_longVal], $fetch_sel_pts[gpi_miles]);
                                //print_r($fetch_sel_pts);
                                $geocheck = getGeofenceStatus($gcdLatLng, $pos1, $pos2);
                                if ($geocheck == 1) {
                                    //print_r($gcdLatLng);
                                    /*$getLL=drawCircle("17.97905965","79.59972382","0.10");
                                    		print_r($getLL);
                                    		$resLL=getGeofenceStatus($getLL,$pos1,$pos2);*/
                                    //print_r($getLL);
                                    $result_pt = $fetch_sel_pts[gpi_stopName] . "#" . $geoTime;
                                    //echo $k." ".$j1." ".$result_pt." ".$pos1."&&".$pos2."";
                                    if ($tmpId != $fetch_sel_pts[gpi_id]) {
                                        $tmpId = $fetch_sel_pts[gpi_id];
                                        //echo $fetch_sel_pts[gpi_id]." ".$dest;
                                        //echo "pos ".in_array($fetch_sel_pts[gpi_id],$dest);
                                        //if(in_array($fetch_sel_pts[gpi_id],$dest))
                                        //{
                                        if ($destArr[$tmpId] == "") {
                                            //echo "ss".count($destArr[$tmpId])." ".$tmpId." ".$result_pt."<br>";
                                            //$destArr = array_push_assoc($destArr, $tmpId, $result_pt);
                                            $destArr[$tmpId] = $result_pt;
                                            //print_r($destArr);
                                        } else {
                                            //echo $result_pt."<br>";
                                            foreach ($destArr as $key => $value) {
                                                // echo "Key: $key; Value: $value<br />\n";
                                                if ($key == $tmpId) {
                                                    //echo $key ."==". $tmpId;
                                                    $tmpVal = $value;
                                                    //unset($destArr[$key]);
                                                    $destArr[$key] = $value . ',' . $result_pt;
                                                    //print_r($destArr);
                                                    //echo "<br>";
                                                    //echo "<br>";
                                                } else {
                                                    //	$destArr[$tmpId]=$result_pt;
                                                    //$destArr = array_push_assoc($destArr, $tmpId, $result_pt);
                                                    //print_r($destArr);
                                                    //echo "<br>";
                                                }
                                            }
                                            // foreach end
                                        }
                                        // else end
                                        //}
                                        //print_r($destArr);
                                    }
                                } else {
                                    $tmpId = 0;
                                }
                            }
                        }
                        //echo "<br>";
                    }
                }
            }
            fclose($file1);
        }
    }
    $result = $destArr;
    //print_r($destArr);
    //exit;
    //echo $timediff;
    return $result;
}
示例#6
0
function gpspathFunAll($clientId, $date_offline, $deviceIMEI)
{
    $date_offline = $_GET[date_offline];
    $path1 = $GLOBALS[dataPath] . "src/data/" . date('d-m-Y', strtotime($date_offline)) . "/" . $deviceIMEI . ".txt";
    if (chk_folder($path1)) {
        $file1 = @fopen($path1, "r");
        if ($file1) {
            $i = 0;
            while (!feof($file1)) {
                $data1 = fgets($file1);
            }
            $data1 = getSortedData($data1);
            $km = liveKmsAllPerDay($data1);
            //exit;
            //$data = $data1;
            $devName = getDeviceName($_GET["deviceIMEI"]);
            storeData($data1, $km, $devName, '', '');
            fclose($file1);
        } else {
            $data = 0;
            storeData($data);
        }
    }
}
 while ($fuel_info_fetch = @mysql_fetch_assoc($fuel_info_resp)) {
     $total_tank_size = $fuel_info_fetch[di_tankSize];
     $analog_full_tank_signal = $fuel_info_fetch[di_fullTanksignal];
     $analog_full_tank_signal_meas = $fuel_info_fetch[di_fullTanksignalmeasure];
     if ($analog_full_tank_signal_meas == 'mv') {
         $analog_full_tank_signal = $analog_full_tank_signal / 1000;
     }
     $analog_empty_tank_signal = $fuel_info_fetch[di_emptyTanksignal];
     $analog_empty_tank_signal_meas = $fuel_info_fetch[di_emptyTanksignalmeasure];
     if ($analog_empty_tank_signal_meas == 'mv') {
         $analog_empty_tank_signal = $analog_empty_tank_signal / 1000;
     }
     $fuel_port = $fuel_info_fetch[di_Fuelport];
 }
 $file = $GLOBALS[dataPath] . "src/data/" . date("d-m-Y", strtotime($sdate)) . "/" . $srcData[1] . ".txt";
 if (chk_folder($file)) {
     $file1 = @fopen($file, "r");
     if ($file1) {
         while (!feof($file1)) {
             $data = fgets($file1);
         }
         $data = getSortedData($data);
     }
     /*echo $data;
     		exit;*/
     if (count($data) > 0) {
         $data1 = explode("#", $data);
         $j1 = 0;
         //echo count($data1);
         for ($j1 = 0; $j1 < count($data1); $j1++) {
             $intervals = count($data1) * 0.1;
示例#8
0
function gpspathAll($source, $vehicle)
{
    $path1 = $source . $vehicle;
    if (chk_folder($path1)) {
        $file1 = @fopen($path1, "r");
        if ($file1) {
            $i = 0;
            while (!feof($file1)) {
                $data = fgets($file1);
                //$i++;
            }
            return $data;
            fclose($file1);
        } else {
            $data = 0;
            return $data;
        }
    }
}
示例#9
0
function getStopReport($sdate, $devName, $devId, $st_time, $en_time)
{
    $cnt = 1;
    $tmp = -1;
    $t1 = 0.0;
    $t2 = 0.0;
    $timeArr = array();
    $timediff = array();
    $strTime = '';
    $endTime = '';
    $totTime = 0;
    $k1 = 0;
    $totDist = 0;
    $file = $GLOBALS[dataPath] . "src/data/" . date("d-m-Y", strtotime($sdate)) . "/" . $devId . ".txt";
    if (chk_folder($file)) {
        $file1 = @fopen($file, "r");
        if ($file1) {
            while (!feof($file1)) {
                $data = fgets($file1);
            }
            $data = getSortedData($data);
        }
        if (count($data) > 0) {
            $data1 = explode("#", $data);
            for ($j1 = 0; $j1 < count($data1); $j1++) {
                $data2 = explode("@", $data1[$j1]);
                if (count($data2) > 1) {
                    $data3 = explode(",", $data2[1]);
                    //echo date("d-m-Y", strtotime($sdate))."==".date("d-m-Y",@mktime(($data3[4]+5),($data3[5]+30),$data3[6],$data3[2],$data3[1],$data3[3]));
                    $device = $data3[0];
                    $geodate = $data3[8] . " " . $data3[9];
                    $geoTime = $data3[9];
                    $pos1 = calLat($data3[2]);
                    $pos2 = calLong($data3[1]);
                    $curTime = explode(":", $data3[9]);
                    $curTime = $curTime[0] * 60;
                    if ($curTime >= $st_time && $curTime <= $en_time) {
                        if ($pos1 > 0 && $pos2 > 0) {
                            if (!in_array($geoTime, $timeArr)) {
                                //echo $geoTime."	sss ".$data3[3];
                                //echo "<BR>";
                                if ($data3[3] == 0 && $strTime == '') {
                                    $strTime = $geoTime;
                                    //$res2=simpleGeocode($pos1,$pos2);
                                    //$res2=str_replace('"',"",$res2);
                                    $pits1 = $pos1;
                                    $pits2 = $pos2;
                                } else {
                                    if ($data3[3] > 0 && $endTime == '' && $strTime != '') {
                                        $endTime = $geoTime;
                                        if (strtotime($endTime) - strtotime($strTime) >= 600) {
                                            //echo strtotime($endTime) - strtotime($strTime)."<br>";
                                            $res2 = simpleGeocode($pos1, $pos2);
                                            $res2 = str_replace('"', "", $res2);
                                            $totTime += strtotime($endTime) - strtotime($strTime);
                                            $finaTime = $strTime . "#" . $res2 . "#" . $endTime . "#" . gmdate("H:i:s", strtotime($endTime) - strtotime($strTime)) . "#" . $device . "#" . $devName . "#" . $totTime;
                                            array_push($timediff, $finaTime);
                                        }
                                        $strTime = '';
                                        $endTime = '';
                                        $strPoint = '';
                                        //}
                                    }
                                }
                                $cnt++;
                                array_push($timeArr, $geoTime);
                            }
                        }
                    }
                }
            }
            fclose($file1);
        }
    }
    return $timediff;
}
示例#10
0
    if ($fp_load) {
        return true;
    } else {
        return false;
    }
}
////////START READING DATA FROM FOLDER
if ($_SESSION[superAdminSID] != '') {
    $matches = array();
    $c = 0;
    $client_array = array();
    $res_clients = SuperAdminSF::getClients();
    while ($client_array = mysql_fetch_assoc($res_clients)) {
        //array_push($client_array,$clientIds);
        $path1 = $dataPath . "client_" . $client_array[clin_id] . "/" . date('d-m-Y', strtotime($_GET["date_offline"])) . "/";
        $chkFolder = chk_folder($path1);
        if ($chkFolder) {
            $getDriver = "SELECT * from driver_info,gps_task_info,vehicle_info where gti_vehicle_id = vi_id AND gti_driver_id = di_id AND gti_clientId =" . $client_array[clin_id] . " AND '" . $_GET[date_offline] . "' BETWEEN DATE_FORMAT( gti_start_date, '%Y-%m-%d' ) AND DATE_FORMAT( gti_end_date, '%Y-%m-%d' ) AND vi_reg_no = '" . $_GET[phoneNumber] . "' LIMIT 0 , 30";
            preg_match_all("/(a href\\=\")([^\\?\"]*)(\")/i", get_text($path1), $matches);
        }
    }
} else {
    $path1 = $dataPath . "client_" . $_GET[sessionid] . "/" . date('d-m-Y', strtotime($_GET["date_offline"])) . "/";
    //exit;
    $matches = array();
    $c = 0;
    preg_match_all("/(a href\\=\")([^\\?\"]*)(\")/i", get_text($path1), $matches);
    $getDriver = "SELECT * from driver_info,gps_task_info,vehicle_info where gti_vehicle_id = vi_id AND gti_driver_id = di_id AND gti_clientId =" . $_SESSION[clientID] . " AND '" . $_GET[date_offline] . "' BETWEEN DATE_FORMAT( gti_start_date, '%Y-%m-%d' ) AND DATE_FORMAT( gti_end_date, '%Y-%m-%d' ) AND vi_reg_no = '" . $_GET[phoneNumber] . "' LIMIT 0 , 30";
}
//
$resDriver = mysql_query($getDriver);
示例#11
0
function getTripReport($sdate, $userId, $devId, $usrSTime, $usrETime, $flag)
{
    $cnt = 1;
    $tmp = -1;
    $t1 = 0.0;
    $t2 = 0.0;
    $timeArr = array();
    $timediff = array();
    $strTime = '';
    $endTime = '';
    $k1 = 0;
    $totDist = 0;
    $file = $GLOBALS[dataPath] . "src/data/" . date('d-m-Y', strtotime($sdate)) . "/" . $devId . ".txt";
    //echo "<br><br>";
    if (chk_folder($file)) {
        $file1 = @fopen($file, "r");
        if ($file1) {
            while (!feof($file1)) {
                $data = fgets($file1);
            }
            $data = getSortedData($data);
        }
        if (count($data) > 0) {
            $data1 = explode("#", $data);
            for ($j1 = 0; $j1 < count($data1); $j1++) {
                $data2 = explode("@", $data1[$j1]);
                if (count($data2) > 1) {
                    $data3 = explode(",", $data2[1]);
                    //echo date("d-m-Y", strtotime($sdate))."==".date("d-m-Y",@mktime(($data3[4]+5),($data3[5]+30),$data3[6],$data3[2],$data3[1],$data3[3]));
                    $device = $data3[0];
                    $geodate = $data3[8] . " " . $data3[9];
                    $geoTime = $data3[9];
                    $curTime = explode(":", $data3[9]);
                    $curTime = $curTime[0] * 60 + $curTime[1];
                    $pos1 = calLat($data3[2]);
                    $pos2 = calLong($data3[1]);
                    if ($curTime >= $usrSTime && $curTime <= $usrETime) {
                        if ($pos1 > 0 && $pos2 > 0) {
                            if (!in_array($geoTime, $timeArr)) {
                                //echo $geoTime."	sss ".$data3[3];
                                //echo $usrSTime." >= ".$curTime." <= ".$usrETime." ".$totalDistance."<br>";
                                //echo "<BR>";
                                if ($data3[3] > 0 && $strTime == '') {
                                    $strTime = $geoTime;
                                    $res2 = simpleGeocode($pos1, $pos2);
                                    $res2 = str_replace('"', "", $res2);
                                    $strPoint = $res2;
                                    $avgSpeed += $data3[3];
                                    $pits1 = $pos1;
                                    $pits2 = $pos2;
                                    $k1++;
                                } else {
                                    if ($data3[3] > 0 && $endTime == '' && $strTime != '') {
                                        $avgSpeed += intval($data3[3]);
                                        $pits3 = $pos1;
                                        $pits4 = $pos2;
                                        $dist = getDistance($pits1, $pits2, $pits3, $pits4);
                                        $totDist += $dist;
                                        $pits1 = $pits3;
                                        $pits2 = $pits4;
                                        $k1++;
                                    } else {
                                        if ($data3[3] == 0 && $endTime == '' && $strTime != '') {
                                            $endTime = $geoTime;
                                            $res2 = simpleGeocode($pos1, $pos2);
                                            $res2 = str_replace('"', "", $res2);
                                            $endPoint = $res2;
                                            $avgSpeed += $data3[3];
                                            $avgSpeed = round($avgSpeed / $k1, 2);
                                            $pits3 = $pos1;
                                            $pits4 = $pos2;
                                            $dist = getDistance($pits1, $pits2, $pits3, $pits4);
                                            $totDist += $dist;
                                            $pits1 = $pits3;
                                            $pits2 = $pits4;
                                            $finaTime = $strPoint . "#" . $strTime . "#" . $endPoint . "#" . $endTime . "#" . gmdate("H:i:s", strtotime($endTime) - strtotime($strTime)) . "#" . round($totDist) . "#" . round($avgSpeed) . "#" . $device . "#" . date('d-m-Y', strtotime($sdate));
                                            //echo "<br>";
                                            //echo "---------------------------------------------------------------------------------------------------------------------------------------------";
                                            //echo "<BR>";
                                            if ($flag == 0) {
                                                $strTime = '';
                                                $endTime = '';
                                                $strPoint = '';
                                                $endPoint = '';
                                                $pits1 = '';
                                                $pits2 = '';
                                                $pits3 = '';
                                                $pits4 = '';
                                                $totDist = 0;
                                                $avgSpeed = 0;
                                            }
                                            array_push($timediff, $finaTime);
                                        }
                                    }
                                }
                                $cnt++;
                                array_push($timeArr, $geoTime);
                            }
                        }
                    }
                }
            }
            fclose($file1);
        }
    }
    return $timediff;
}