本文整理汇总了PHP中Vehicle类的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle类的具体用法?PHP Vehicle怎么用?PHP Vehicle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vehicle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: executeAddVehicle
public function executeAddVehicle(sfWebRequest $request)
{
$v = new Vehicle();
$v->setUserId($this->getUserIdFromRouteOrSession());
$this->form = new VehicleForm($v);
$this->processVehicleForm($request, $this->form);
$this->setTemplate('noVehicle');
}
开发者ID:rbolliger,项目名称:otokou,代码行数:8,代码来源:actions.class.php
示例2: getForm
public function getForm($object = null, $options = array())
{
if (null === $object) {
$object = new Vehicle();
}
$object->setUserId($this->getUserId());
return parent::getForm($object, $options);
}
开发者ID:rbolliger,项目名称:otokou,代码行数:8,代码来源:vehicleGeneratorConfiguration.class.php
示例3: executeCreate
public function executeCreate(sfWebRequest $request)
{
$charge = new Vehicle();
$charge->setUserId($this->getUserIdFromRouteOrSession());
$this->form = $this->configuration->getForm($charge);
$this->vehicle = $charge;
$this->processForm($request, $this->form);
$this->setTemplate('new');
}
开发者ID:rbolliger,项目名称:otokou,代码行数:9,代码来源:actions.class.php
示例4: getAllVehicles
public function getAllVehicles()
{
$db = new Db();
$vehicles = array();
$results = $db->select("select vehicleID as vid, orderOwned, type, modelYear,\n make, model, color, numCyl, transType, purchaseYear, modifiedDate from vehicles;");
foreach ($results as $result) {
$vehicle = new Vehicle();
$vehicle->hydrate($result);
$vehicles[] = $vehicle;
}
return $vehicles;
}
开发者ID:stevekrog,项目名称:cars,代码行数:12,代码来源:inventory_manager.class.php
示例5: selectByCollection
public static function selectByCollection($id)
{
$connection = Flight::dbMain();
try {
$sql = "SELECT * FROM vehicle_collection WHERE collection_id = :collection_id;";
$query = $connection->prepare($sql);
$query->bindParam(':collection_id', $id, PDO::PARAM_INT);
$query->execute();
$rows = $query->fetchAll(PDO::FETCH_ASSOC);
$result = array();
foreach ($rows as $row) {
$vehicleCollection = new VehicleCollection();
$vehicleCollection->Id = (int) $row['id'];
$vehicleCollection->Vehicle = Vehicle::select($row['vehicle_id']);
$vehicleCollection->Collection = Collection::select($row['collection_id']);
array_push($result, $vehicleCollection);
}
return $result;
} catch (PDOException $pdoException) {
throw $pdoException;
} catch (Exception $exception) {
throw $exception;
} finally {
$connection = null;
}
}
开发者ID:rhalf,项目名称:app_track,代码行数:26,代码来源:vehiclecollection.php
示例6: consumption
public static function consumption($v)
{
$vid = Vehicle::getVehicle($v);
$users = User::getUserIDs($vid["idvehicle"]);
if ($users != NULL) {
$uid = array();
//usersIDs
foreach ($users as $key => $value) {
array_push($uid, intval($users[$key]["iduser"]));
}
$consumption = array();
//consumption by userID
foreach ($uid as $key => $value) {
$data = Data::getDataBrowse($value);
if ($data != NULL && $data["max"] != NULL && $data["min"] != NULL && $data["fuel"] != NULL) {
$avg = intval($data["fuel"]) / (intval($data["max"]) - intval($data["min"])) * 100;
array_push($consumption, $avg);
}
}
if (!empty($consumption)) {
$avg = round(array_sum($consumption) / count($consumption), 2) . "L/100km";
$min = round(min($consumption), 2) . "L/100km";
$max = round(max($consumption), 2) . "L/100km";
return [$avg, $min, $max];
}
}
}
开发者ID:rokzidarn,项目名称:fueltank,代码行数:27,代码来源:IO.php
示例7: run
public function run()
{
Vehicle::create(array('id' => 1, 'plate' => 'GNM504', 'color' => 'Rojo', 'brand' => 'Renault', 'model' => 'Twingo 2007', 'capacity' => 4, 'status' => 1, 'type' => 1, 'users_id' => 1));
Vehicle::create(array('id' => 2, 'plate' => 'FKJ324', 'color' => 'Azul', 'brand' => 'Renault', 'model' => 'Clio 2008', 'capacity' => 2, 'status' => 1, 'type' => 1, 'users_id' => 2));
Vehicle::create(array('id' => 3, 'plate' => 'HJJ832', 'color' => 'Verde', 'brand' => 'Renault', 'model' => 'Sandero 2010', 'capacity' => 2, 'status' => 1, 'type' => 1, 'users_id' => 3));
Vehicle::create(array('id' => 4, 'plate' => 'FMJ313', 'color' => 'Negro', 'brand' => 'Ford', 'model' => 'Fordsito 2014', 'capacity' => 3, 'status' => 1, 'type' => 1, 'users_id' => 4));
}
开发者ID:andrescoulson,项目名称:ChancesAPI,代码行数:7,代码来源:VehicleTableSeeder.php
示例8: destroy
public function destroy()
{
$datos = Input::all();
$vehicle = Vehicle::find($datos['id']);
$vehicle->status = 0;
$vehicle->save();
return Redirect::intended('/vehiclelist');
}
开发者ID:andrescoulson,项目名称:ChancesAPI,代码行数:8,代码来源:VehicleController.php
示例9: actionIndex
public function actionIndex()
{
$criteria = new CDbCriteria();
$pages = new CPagination(Vehicle::model()->count($criteria));
$pages->pageSize = 8;
$pages->applyLimit($criteria);
$vehicles = Vehicle::model()->findAll($criteria);
$this->render('home', array('vehicles' => $vehicles, 'pages' => $pages));
}
开发者ID:CHILMEX,项目名称:amocasion,代码行数:9,代码来源:SiteController.php
示例10: getCylindersCounts
public function getCylindersCounts()
{
$entities = array();
$cylinders = Vehicle::distinct()->select('cylinders')->orderBy('cylinders')->where('cylinders', '>', 0)->get();
foreach ($cylinders as $cylinder) {
array_push($entities, (object) ['id' => $cylinder->cylinders, 'cylinders' => $cylinder->cylinders . ' Cylinders']);
}
return $this->getPropertiesList($entities, 'cylinders');
}
开发者ID:apetrailmukesh,项目名称:bootstrap,代码行数:9,代码来源:AdvancedController.php
示例11: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$vehicles = Vehicle::where('users_id', '=', Auth::user()->id)->get();
if ($vehicles->count() > 0) {
return View::make('chances.create', compact('vehicles'));
} else {
return View::make('vehicles.create')->withErrors('You must add a vehicle to create a Chance');
}
}
开发者ID:andrescoulson,项目名称:ChancesAPI,代码行数:14,代码来源:ChanceController.php
示例12: destroy
public function destroy($id)
{
$vehicle = Vehicle::find($id);
$result = $vehicle->delete();
if ($result) {
return $this->index();
} else {
return $this->index();
}
}
开发者ID:dbakiu,项目名称:dvc,代码行数:10,代码来源:VehicleController.php
示例13: getProcessedVehiclesSum
public static function getProcessedVehiclesSum($start, $end)
{
$processedList = DB::select(DB::raw("SELECT e_v.vehicle_fk, COUNT(*) as quantity\n FROM employees_vehicles AS e_v, invoices AS inv\n WHERE inv.date >= '{$start}'\n AND inv.date <= '{$end}'\n AND inv.id = e_v.invoice_fk\n AND inv.deleted_at IS NULL\n AND e_v.deleted_at IS NULL\n GROUP BY e_v.vehicle_fk"));
$totalSum = 0;
foreach ($processedList as $process) {
$price = Vehicle::getEmployeesCut($process->vehicle_fk);
$total = $price * $process->quantity;
$totalSum += $total;
}
return $totalSum;
}
开发者ID:dbakiu,项目名称:dvc,代码行数:11,代码来源:InvoiceElement.php
示例14: testCreate
public function testCreate()
{
$vehicle = new Vehicle();
$vehicle->setMPG(25);
$vehicle->setUser(new User());
$vehicle->setMake(new Make());
$this->assertSame(25, $vehicle->getMPG());
$this->assertTrue($vehicle->getUser() instanceof User);
$this->assertTrue($vehicle->getMake() instanceof Make);
}
开发者ID:pdt256,项目名称:truecar,代码行数:10,代码来源:VehicleTest.php
示例15: download
public function download($id)
{
$invoiceInfo = Invoice::find($id);
$invoiceElements = InvoiceElement::getInvoiceElements($id);
$employeeInfo = Employee::withTrashed()->find($invoiceElements[0]->employee_fk);
$elementData = [];
foreach ($invoiceElements as $element) {
$price = Vehicle::withTrashed()->where('id', '=', $element->vehicle_fk)->pluck('price');
$type = Vehicle::withTrashed()->where('id', '=', $element->vehicle_fk)->pluck('type');
$elementData[$element->vehicle_fk] = ['type' => $type, 'price' => $price];
}
$pdf = PDF::loadView('invoice.invoice', ['invoiceInfo' => $invoiceInfo, 'invoiceElements' => $invoiceElements, 'elementData' => $elementData, 'employeeInfo' => $employeeInfo]);
return $pdf->download($invoiceInfo->date . ' - ' . $invoiceInfo->bill_to . '.pdf');
}
开发者ID:dbakiu,项目名称:dvc,代码行数:14,代码来源:InvoiceController.php
示例16: __construct
function __construct()
{
if (empty($_SESSION['user'])) {
return null;
}
$this->companyId = $_SESSION['user']['company'];
$this->userId = new User();
$mDeployedVehicleList = $this->userId->getDeployedVehicleList();
//currently running vehicles...
$this->activationamount = $this->totalAmount = $this->totalPaidAmount = $this->amountreqfornextcycle = $this->totalRemainingAmount = 0;
$this->vehListActivationReq = $this->vehListPayReq = $this->vehList = "";
//calcultaion for deplyoed vehicles....
for ($i = 0; $i < sizeof($mDeployedVehicleList); $i++) {
$mVehicle = new Vehicle($mDeployedVehicleList[$i]);
$this->vehListPayReq .= $mVehicle->getId() . ", ";
$mVehPayments = new Payments($mVehicle->getId(), $this->companyId);
if ($mVehPayments->getId() != "") {
$this->totalAmount += $mVehPayments->getTotalAmount();
$this->totalPaidAmount += $mVehPayments->getPaidpayment();
$this->totalRemainingAmount += $mVehPayments->getRemainingAmount();
if ($mVehPayments->isDue() != 0) {
$this->amountreqfornextcycle += $mVehPayments->isDue();
}
}
}
///calculate amount with respect to the initate vehicels...
$mPreviousVehicleList = $this->userId->getWaitingVehicleList();
//previous used vehicles...
for ($i = 0; $i < sizeof($mPreviousVehicleList); $i++) {
$mVehicle = new Vehicle($mPreviousVehicleList[$i]);
$this->vehListActivationReq .= $mVehicle->getId() . ", ";
$mVehPayments = new Payments($mVehicle->getId(), $this->companyId);
$this->activationamount += $mVehPayments->getVehicleActivationAmount();
}
$this->vehList = $this->vehListPayReq . $this->vehListActivationReq;
}
开发者ID:rusty1909,项目名称:Navigator,代码行数:36,代码来源:PaymentHelper.php
示例17: postEdit
public function postEdit()
{
$rules = array('vehicleid' => 'required|numeric|exists:vehicles,id', 'playerid' => 'required|numeric|exists:players,playerid', 'reason' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes() && Auth::user()->canEditVehicle(Input::get('playerid'))) {
$alive = 0;
if (Input::get('alive') == 1) {
$alive = 1;
}
$active = 0;
if (Input::get('active') == 1) {
$active = 1;
}
$delete = 0;
if (Input::get('delete') == 1) {
$delete = 1;
}
if ($delete) {
$log = new Adminlog();
$log->type = 'vehicle';
$log->editor = Auth::user()->id;
$log->objectid = Input::get('vehicleid');
$log->playerid = DB::table('players')->where('playerid', Input::get('playerid'))->first()->uid;
$log->reason = Input::get('reason');
$log->difference = $log->getDifference(array('deleted' => 0), array('deleted' => 1));
$log->save();
DB::table('vehicles')->where('id', Input::get('vehicleid'))->delete();
} else {
$vehicle = Vehicle::find(Input::get('vehicleid'));
$log = new Adminlog();
$log->type = 'vehicle';
$log->editor = Auth::user()->id;
$log->objectid = Input::get('vehicleid');
$log->playerid = DB::table('players')->where('playerid', Input::get('playerid'))->first()->uid;
$log->reason = Input::get('reason');
$log->difference = $log->getDifference(array('alive' => $vehicle->alive, 'active' => $vehicle->active), array('alive' => $alive, 'active' => $active));
$log->save();
$vehicle->alive = $alive;
$vehicle->active = $active;
$vehicle->save();
}
return Redirect::to('/vehicles')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
} else {
return Redirect::to('/vehicles')->with(array('message' => 'Leider ist ein Fehler aufgetreten, die Änderung wurde verworfen.', 'type' => 'danger'));
}
}
开发者ID:GlitchedMan,项目名称:a3l-webinterface,代码行数:46,代码来源:VehiclesController.php
示例18: OnPlayerEnterVehicle
public static function OnPlayerEnterVehicle(Player $player, Vehicle $vehicle, $ispassenger)
{
if (!$ispassenger && $vehicle->Type() == VEHICLE_SHOP) {
$price = VehicleShop::$prices[$vehicle->ID()];
$name = $vehicle->Name();
$capacity = $vehicle->FuelSpace();
$usage = sprintf('%.2f', $vehicle->FuelUsage() * 60);
$trunk = $vehicle->TrunkSpace();
$player->Send(COLOR_CARSHOP_HEADER, '');
$player->Send(COLOR_CARSHOP_HEADER, '.:: Vehicle shop ::.');
$player->Send(COLOR_CARSHOP_INFO, "This '{$name}' is for sale for {$price}\$");
$player->Send(COLOR_CARSHOP_INFO, 'If you want to buy it, type /buy');
$player->Send(COLOR_CARSHOP_INFO, 'Vehicle details:');
$player->Send(COLOR_CARSHOP_INFO, "* Gas tank capacity: {$capacity}lt");
$player->Send(COLOR_CARSHOP_INFO, "* Fuel usage: {$usage}lt / minute");
$player->Send(COLOR_CARSHOP_INFO, "* Trunk space: {$trunk} units");
$vehicle->SetHealth(1000);
return CALLBACK_BREAK;
}
return CALLBACK_OK;
}
开发者ID:ryden,项目名称:ItalyMafia-3.0,代码行数:21,代码来源:shop.php
示例19: 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 retvehicle (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)) {
return true;
} else {
return false;
}
}
开发者ID:rusty1909,项目名称:Navigator,代码行数:21,代码来源:RetVehicle.php
示例20: store
public function store()
{
$data = Input::all();
$idchance = $data['chances_id'];
$iduser = Auth::user()->id;
$data['users_id'] = $iduser;
$chance = Chance::find($idchance);
$userofchances = UserofChance::where('chances_id', '=', $idchance)->where('users_id', '=', $iduser)->get();
if (empty($userofchances)) {
$message = json_encode(array('message', 'You have already taken this chance'));
return $message;
}
$vehicle = Vehicle::find($chance->vehicles_id);
if ($vehicle->users_id == $iduser) {
$message = json_encode(array('message', 'You created this chance'));
} else {
UserofChance::create($data);
$chance->capacity = $chance->capacity - 1;
$chance->save();
return Redirect::intended('/chanceslist/');
}
}
开发者ID:Fercho05,项目名称:chancerosApi,代码行数:22,代码来源:UsersofChanceController.php
注:本文中的Vehicle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论