本文整理汇总了PHP中Vehicle::getIdByNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle::getIdByNumber方法的具体用法?PHP Vehicle::getIdByNumber怎么用?PHP Vehicle::getIdByNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle::getIdByNumber方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public static function add($type, $model, $vehicle_number, $make_year, $description)
{
//require_once '../framework/DBConnect.php';
// opening db connection
$db = new Connection();
$conn = $db->connect();
if (Vehicle::exists($conn, $vehicle_number)) {
return false;
}
if (!isset($_SESSION)) {
session_start();
}
$companyId = $_SESSION['user']['company'];
$userId = $_SESSION['user']['id'];
$sql = "INSERT INTO vehicle (type, model, vehicle_number, make_year, company_id, added_by, description) VALUES ('{$type}','{$model}','{$vehicle_number}','{$make_year}','{$companyId}','{$userId}','{$description}')";
if (mysqli_query($conn, $sql)) {
$vehicleId = Vehicle::getIdByNumber($vehicle_number);
//echo "hello";
return Timeline::addTimelineEvent("vehicle_addition", $vehicleId, "", "", $userId, 1);
} else {
return false;
}
}
示例2: trim
<?php
require_once '../framework/Vehicle.php';
require_once '../framework/Job.php';
//print_r($_POST);
$criteria = trim($_POST['criteria']);
$vehicle = trim($_POST['vehicle']);
$lattitude = trim($_POST['lattitude']);
$longitude = trim($_POST['longitude']);
$address = trim($_POST['address']);
$city = trim($_POST['city']);
//echo "<br>".Vehicle::getIdByNumber($vehicle)."<br>";
$mVehicle = new Vehicle(Vehicle::getIdByNumber($vehicle));
$mVehicle->setLocation($lattitude, $longitude, $address, $city);
//not supporting Job feature now!!!
//$mJob = new Job($mVehicle->getCurrentJob());
//$mJob->setLocation($lattitude, $longitude);
if ($criteria == "location") {
$mVehicle->addTrack($lattitude, $longitude, $address);
} else {
$mVehicle->updateDuration($lattitude, $longitude);
}
示例3: SetupResponse
}
class TempAdmin
{
public $id;
public $name;
public $phone;
}
$setupResponse = new SetupResponse();
$setupResponse->request = "setup";
$result = new Result();
if (isset($_GET['vehicle']) && isset($_GET['type']) && isset($_GET['imei']) && isset($_GET['mac'])) {
$vehicle = trim($_GET['vehicle']);
$type = trim($_GET['type']);
$imei = trim($_GET['imei']);
$mac = trim($_GET['mac']);
$vehicleId = Vehicle::getIdByNumber($vehicle);
if ($vehicleId == null) {
$setupResponse->status = "FAILURE";
$error = new Error();
$error->reason = "VEHICLE";
$error->message = "No such vehicle registered.";
$result->error = $error;
} else {
$mVehicle = new Vehicle($vehicleId);
if ($mVehicle->getType() != $type) {
$setupResponse->status = "FAILURE";
$error = new Error();
$error->reason = "VEHICLE_TYPE";
$error->message = "Vehicle type does not match";
$result->error = $error;
} else {
示例4: switch
if (isset($_GET['action'])) {
//die "q";
$action = $_GET['action'];
} else {
$action = "";
}
switch ($action) {
case "add":
$type = $_POST['type'];
$model = $_POST['model'];
$make_year = $_POST['make_year'];
$vehicle_number = $_POST['vehicle_number'];
$description = $_POST['description'];
if (Vehicle::add($type, $model, $vehicle_number, $make_year, $description)) {
//mail to admin..
$veh_id = Vehicle::getIdByNumber($vehicle_number);
$adder = new VehicleMailer($veh_id);
$adder->sendVehicleAddedMessage();
header('Location:index.php');
} else {
header('Location:abc.php');
}
break;
case "delete":
$id = $_GET['id'];
echo $_GET['id'];
$mVehicle = new Vehicle($id);
/* if getCurrentJob() retruns o means vehicle is not on job... */
if ($mVehicle->isOnTrip() != 0 || $mVehicle->getCurrentJob() != 0) {
echo '<script language="javascript">';
echo 'alert("Vehicle is on Job, can\'t delte now !!!")';