Exemplo n.º 1
0
     $wp->att('statusid', WaypointStatus::STATUS_CHARGED);
     $wp->save();
     // retrieve the data
     echo json_encode(GetTripDetail($tripId));
     break;
 case 'savedeparture':
     //-------------------------------------
     // get other parameters
     $tripId = strtolower($_REQUEST['tripid']);
     $wpId = strtolower($_REQUEST['wpid']);
     $departuretypical = strtolower($_REQUEST['departuretypical']);
     $departuredistance = strtolower($_REQUEST['departuredistance']);
     $departureconsumption = strtolower($_REQUEST['departureconsumption']);
     // do the update of the waypoint
     $wp = new waypoint();
     $wp->retrieve($wpId);
     $wp->att('departuredistance', $departuredistance);
     $wp->att('departuretypical', $departuretypical);
     $wp->att('departureconsumption', $departureconsumption);
     $wp->att('departuretime', time());
     $wp->att('statusid', WaypointStatus::STATUS_LEFT);
     $wp->save();
     // change status of Trip for start at first waypont
     if ($wp->att('typeid') == WaypointType::TYPE_STARTPOINT) {
         $trip = new trip();
         $trip->retrieve($tripId);
         $trip->att('statusid', TripStatus::STATUS_STARTED);
         $trip->save();
     }
     // retrieve the data
     echo json_encode(GetTripDetail($tripId));