示例#1
0
while ($tblconduite = fetch($linkconduite)) {
    //recherche si le jour fait partie du mois
    $tabjour = explode(" ", $tblconduite["time"]);
    if ($lastjour != $tabjour[0]) {
        $first = true;
        $lastspeed = 0;
        $lastlat = 0;
        $lastlon = 0;
        $lastdistance = 0;
        $semaine[$tabjour[0]]["debut"] = 0;
        $lastjour = $tabjour[0];
        $i = 0;
        $trajet = array();
        $debut = 0;
        $fin = 0;
        $semaine[$tabjour[0]]["date"] = affichedateiso($tabjour[0]) . " - " . jourfr(dayOfWeek(strtotime($tabjour[0])) - 1);
    }
    //$semaine[$tabjour[0]]["km"]+=(int)$tblconduite["distance_next"]/1000;
    $distance = 0;
    if ($lastlat != $tblconduite["latitude"] && $lastlon != $tblconduite["longitude"]) {
        if ($lastlat != 0 && $lastlon != 0) {
            //print "ici2";
            $distance = haversineGreatCircleDistance($lastlat, $lastlon, $tblconduite["latitude"], $tblconduite["longitude"]) / 1000;
            $semaine[$tabjour[0]]["km"] += round($distance, 2);
            $totaldistance += $semaine[$tabjour[0]]["km"];
        }
    }
    $semaine[$tabjour[0]]["vitessemax"] = $semaine[$tabjour[0]]["vitessemax"] > vitessekmh($tblconduite["speed"]) ? $semaine[$tabjour[0]]["vitessemax"] : vitessekmh($tblconduite["speed"]);
    // if(($lastspeed!=$tblconduite["speed"]&&$lastspeed==0)||($lastdistance!=$distance&&$lastdistance==0)){
    if ($lastspeed != $tblconduite["speed"] && $lastspeed == 0 || $lastlat != round($tblconduite["latitude"], 4) && $lastlon != round($tblconduite["longitude"], 4) && !$first && $tblconduite["speed"] != 0) {
        $semaine[$tabjour[0]]["debut"] = $semaine[$tabjour[0]]["debut"] == 0 ? $tblconduite["time"] : $semaine[$tabjour[0]]["debut"];
示例#2
0
文件: alarme.php 项目: jcmwc/fleet
     while ($tbl_user_dest = fetch($link_user_dest)) {
         //print $tbl_user_dest["email"]."<br>";
         sendmailmister('', '', 'Alarme d\'entretien véhicule ' . $tbl_list_entretien["nomvehicule"], $html, $tbl_user_dest["email"]);
     }
     //suppression de l'alarme
     $sql = "update " . __racinebd__ . "alarme_entretien set supprimer=1 where alarme_entretien_id=" . $tbl_list_entretien["alarme_entretien_id"];
     query($sql);
     //print $sql;
 }
 //alarme operationnelle
 require "alarme-operationelle.php";
 //listing des utilisateurs du compte qui travaille aujourd'hui
 $sql = "select *,u.usergps_id from  " . __racinebd__ . "compte c \r\n          inner join " . __racinebd__ . "usergps u on u.compte_id=c.compte_id      \r\n          where actif=1 and u.supprimer=0 and c.compte_id=" . $tbl_compte["compte_id"];
 $link_user = query($sql);
 while ($tbl_user = fetch($link_user)) {
     $indicedujour = dayOfWeek(mktime(0, 0, 0, date("n"), date("j"), date("Y")));
     $sql = "select mc.* from " . __racinebd__ . "jour_usersgps mc\r\n        inner join " . __racinebd__ . "usergps u on u.usergps_id=mc.usergps_id and u.usergps_id=" . $tbl_user["usergps_id"] . " and jour_id=" . $indicedujour;
     //print $sql."<br>";
     $link_jour = query($sql);
     if (num_rows($link_jour) != 0) {
         //
         //creation des droits
         $_SESSION["logfront"] = 1;
         $_SESSION["email"] = $tbl_user["email"];
         $_SESSION["users_id"] = $tbl_user["usergps_id"];
         $_SESSION["usersgps_id"] = $tbl_user["usergps_id"];
         //recherche du compte affecté
         $_SESSION["compte_id"] = $tbl_user["compte_id"];
         $_SESSION["raisonsociale"] = $tbl_user["raisonsociale"];
         $sql = "select * from " . __racinebd__ . "preference_compte where compte_id='" . $_SESSION["compte_id"] . "'";
         $link_preference = query($sql);
示例#3
0
function monthStartWeekDay($timestamp)
{
    return dayOfWeek(firstDayOfMonth($timestamp));
}
示例#4
0
文件: function.php 项目: jcmwc/fleet
function jourfinsemaine($today)
{
    $month = $today[mon];
    $mday = $today[mday];
    $year = $today[year];
    $tsp = mktime(0, 0, 0, $month, $mday - dayOfWeek(mktime(0, 0, 0, $month, $mday, $year)) + 7, $year);
    return $lbonnedate = strftime("%d-%m-%Y", $tsp);
}
示例#5
0
function handleMonthly($eStartDTO, $interval, $byday, $byMonthDay)
{
    $tStamp = $eStartDTO->getTimestamp();
    $eMonth = date('n', $tStamp);
    $eYear = date('Y', $tStamp);
    $nextMonth = $eMonth;
    $nextYear = $eYear;
    $nextEvent = $eStartDto;
    if ($byMonthDay != null) {
        $nextFound = false;
        while (!$nextFound) {
            $nextMonth += $interval;
            if ($nextMonth > 12) {
                $nextMonth -= 12;
                $nextYear++;
            }
            $monthDays = cal_days_in_month(CAL_GREGORIAN, $nextMonth, $nextYear);
            if ($monthDays >= $byMonthDay) {
                $nextFound = true;
            }
        }
        $nextEvent->setDate($nextYear, $nextMonth, $byMonthDay);
    } else {
        if (byDay != null) {
            pregex('^([-]\\d{2})(.{2})$', $byDay, $matches);
            $num = $matches[1];
            $day = dayOfWeek($matches[2]);
            $nextMonth += $interval;
            if ($nextMonth > 12) {
                $nextMonth -= 12;
                $nextYear++;
            }
            $nextEvent = $eStartDTO;
            if ($day > 0) {
                $nextEvent->setDate($nextYear, $nextDay, 1);
                $firstDay = date('w', $nextEvent->getTimeStamp());
                $monthDay = $day - $firstDay;
                if ($monthDay < 0) {
                    $monthDay += 7;
                }
                $nextEvent->setDate($nextYear, $nextMonth, $monthDay + 7 * ($num - 1));
            } else {
                if ($day < 0) {
                    $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $nextMonth, $nextYear);
                    $nextEvent->setDate($nextYear, $nextMonth, $daysInMonth);
                    $lastDay = date('w', $nextEvent->getTimeStamp());
                    $monthDay = $lastDay - $day;
                    if ($monthDay < 0) {
                        $monthDay += 7;
                    }
                    $monthDay = $daysInMonth - $monthDay;
                    $monthDay -= 7 * ($num - 1);
                    $nextEvent->setDate($nextYear, $nextMonthe, $monthDay);
                }
            }
        }
    }
    return diff($eStartDTO, $nextEvent);
}
示例#6
0
文件: login.php 项目: jcmwc/fleet
require "../../conf_front.php";
if ($_POST["mdp"] != "" && $_POST["ident"] != "") {
    //$sql="select * from users where username='******' and active=1 and user_template_id is null";
    /*
    $sql="select u.*,c.compte_id,c.raisonsociale from users u 
    inner join ".__racinebd__."compte c on u.original_application_id=c.application_id and  actif=1 and supprimer=0
    where username='******' and active=1 and user_template_id is null";
    */
    $sql = "select u.*,c.compte_id,c.raisonsociale from " . __racinebd__ . "usergps u\r\n  inner join " . __racinebd__ . "compte c on c.compte_id=u.compte_id\r\n  where c.supprimer=0 and u.supprimer=0\r\n  and username='******'";
    //print $sql;
    $link = query($sql);
    if (num_rows($link) > 0) {
        $tbl = fetch($link);
        if ($tbl["password"] == md5($_POST["mdp"])) {
            //verification si elle peut se connecter aujourd'hui
            $indicedujour = dayOfWeek(time());
            /*
            $sql="select mc.* from ".__racinebd__."jour_usersgps mc
            inner join ".__racinebd__."usergps u on u.usergps_id=mc.usergps_id and user_id=".$tbl["user_id"]." and jour_id=".$indicedujour;
            */
            $sql = "select * from " . __racinebd__ . "jour_usersgps where usergps_id=" . $tbl["usergps_id"] . " and jour_id=" . $indicedujour;
            //print $sql;
            $link2 = query($sql);
            if (num_rows($link2) == 0) {
                print "nok2";
                die;
            }
            //creation des sessions
            $_SESSION["logfront"] = 1;
            $_SESSION["users_id"] = $tbl["usergps_id"];
            //recherche du compte affecté