当前位置: 首页>>代码示例>>PHP>>正文


PHP Vehicle类代码示例

本文整理汇总了PHP中Vehicle的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle类的具体用法?PHP Vehicle怎么用?PHP Vehicle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Vehicle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Vehicle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。