當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Vehicle::getDriver方法代碼示例

本文整理匯總了PHP中Vehicle::getDriver方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vehicle::getDriver方法的具體用法?PHP Vehicle::getDriver怎麽用?PHP Vehicle::getDriver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Vehicle的用法示例。


在下文中一共展示了Vehicle::getDriver方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setDriver

 function setDriver($driver)
 {
     //require_once '../framework/DBConnect.php';
     // opening db connection
     $db = new Connection();
     $conn = $db->connect();
     $vehicle = new Vehicle($this->id);
     $prevDriver = $vehicle->getDriver();
     if ($prevDriver == $driver) {
         return false;
     }
     $mUser = new User();
     $sql = "UPDATE vehicle SET driver = '{$driver}' WHERE id = '{$this->id}'";
     //print_r($sql);
     if (mysqli_query($conn, $sql)) {
         //print_r("<br>Record updated successfully");
         if ($driver != 0) {
             $action = 1;
             //assigning driver
         } else {
             $action = -1;
             //removing driver
             $driver = $prevDriver;
         }
         return Timeline::addTimelineEvent("driver_allotment", $this->id, $driver, "", $mUser->getId(), $action);
     } else {
         //print_r("<br>Error updating record: " . mysqli_error($conn));
         return false;
     }
 }
開發者ID:rusty1909,項目名稱:Navigator,代碼行數:30,代碼來源:Vehicle.php

示例2: Vehicle

 $mVehicle = new Vehicle($vehicle);
 if ($mVehicle == null || $mVehicle->getCompany() != $company) {
     $setupResponse->status = "FAILURE";
     $error = new Error();
     $error->reason = "VEHICLE ERROR";
     $error->message = "No such vehicle exists";
     $result->error = $error;
 } else {
     if ($mVehicle->getIMEI() == $imei) {
         $addressInfo = getAddress($lat, $lng);
         $address = $addressInfo->results[0]->formatted_address;
         $city = getCity($addressInfo->results[0]);
         //echo $address."   ".$city;
         if ($city != "" && $mVehicle->getCurrentCity() != $city) {
             $vehicleId = $mVehicle->getId();
             $driver = $mVehicle->getDriver();
             Notification::addLocationNotification($driver, $vehicleId, $lat, $lng, $city);
         }
         if (isset($_GET['accuracy']) && $_GET['accuracy'] <= 20) {
             if ($mVehicle->setLocation($lat, $lng, $address, $city) && $mVehicle->addTrack($lat, $lng, $address)) {
                 $setupResponse->status = "SUCCESS";
                 $setupResponse->request = "location, track";
             }
         } else {
             if ($mVehicle->setLocation($lat, $lng, $address, $city)) {
                 $setupResponse->status = "SUCCESS";
                 $setupResponse->request = "location";
             }
         }
     } else {
         $setupResponse->status = "FAILURE";
開發者ID:rusty1909,項目名稱:Navigator,代碼行數:31,代碼來源:location.php

示例3: Vehicle

            echo "<a href='#' title='Next Page'>Next »</a><a href='#' title='Last Page'>Last »</a>";
        }
        ?>
										</div> -->
										<div class="clear"></div>
									</td>
								</tr>
							</tfoot> 
						 
							<tbody>
								<?php 
        $mVehicleList = $mDeployedVehicleList;
        for ($i = 0; $i < sizeof($mVehicleList); $i++) {
            $mVehicle = new Vehicle($mVehicleList[$i]);
            $mJob = new Job($mVehicle->getCurrentJob());
            $mDriver = new Driver($mVehicle->getDriver());
            $vehType = $mVehicle->getType();
            if (empty($vehType)) {
                $vehType = 'Truck';
            }
            echo "<tr>";
            echo "<td><img id='type' height='20' width='20' src='../../../images/vehicle_types/" . $vehType . ".png' title=" . $vehType . " alt=" . $vehType . " style='vertical-align:-5px;'></td>";
            echo "<td>" . $mVehicle->getModel() . "</td>";
            echo "<td><b><a style='text-transform:uppercase;' href='detail.php?id=" . $mVehicle->getId() . "'>" . $mVehicle->getVehicleNumber() . "</a></b></td>";
            if ($mVehicle->getDriver() != "0") {
                echo "<td><img height='15' width='15' src='../../../images/driver_icon.png'>&nbsp;<b><a href='../driver/detail.php?id=" . $mDriver->getId() . "' style='text-transform:uppercase;vertical-align:2px;'>" . $mDriver->getName() . "</a></b></td>";
            } else {
                echo "<td></td>";
            }
            echo "</tr>";
        }
開發者ID:rusty1909,項目名稱:Navigator,代碼行數:31,代碼來源:index.php


注:本文中的Vehicle::getDriver方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。