function loadCarInsuranceData(car $car) { $response->model = $car->getModel(); $response->color = $car->getColor(); $response->year = $car->getYear(); $response->license = $car->getLicense(); $response->imageSource = $car->getInsurance()->getOutputLocation(); return $response; }
function createCarForm(car $car, $title) { print '<fieldset > <legend> <h3>Véhicule ' . $title . '</h3> </legend> <div style="display:block" >'; print createDemandTextField(car::MODEL_TAG, $car->getModel(), '', $car->getModelParamName(), '32', $car->getModelParamName(), $car->getModelErrorMessage()); print createDemandTextField(car::COLOR_TAG, $car->getColor(), '', $car->getColorParamName(), '16', $car->getColorParamName(), $car->getColorErrorMessage()); print createDemandTextField(car::YEAR_TAG, $car->getYear(), '', $car->getYearParamName(), '4', $car->getYearParamName(), $car->getYearErrorMessage()); print createDemandTextField(car::LICENSE_TAG, $car->getLicense(), '', $car->getLicenseParamName(), '128', $car->getLicenseParamName(), $car->getLicenseErrorMessage()); print createCheckBoxField($car->getElectricParamName(), $car->getIsElectric(), car::ELECTRIC_TAG); print createDemandFileField(car::INSURANCE_TAG, '(nom de fichier alphanumérique [a-z][0-9] sans espace)', '', 'file', $car->getInsuranceParamName(), '', $car->getInsuranceParamName(), $car->getInsuranceErrorMessage(), $car->getInsurance()); print ' </div> </fieldset>'; }
public function __construct($value = '') { parent::__construct(); $this->db = pc_base::load_model(); # code... }
BF::load_model("car"); $id = BF::gg(0); $action = BF::gg(1); if ($action == "view") { $car = new car($id); if (!$car->exists()) { throw new BF_not_found(); } BF::load_module("BF_output_template"); $tpl = new BF_output_template("view_car"); $tpl->assign('car', $car); $tpl->disp(); } elseif ($action == "save") { BF::load_module("BF_form"); $form = new BF_form('edit_car'); $car = new car($id); if (!$car->exists()) { throw new BF_not_found(); } // check if (!$form->check()) { $form->show_error(); } // process $car->name = $form->gval("name"); $car->price = $form->gval("price"); $car->save(); // redirect BF::gr("example")->redirect(); } else { // list all cars from db
function getCarHtmlContent(car $car) { $carIndex = $car->getIndex(); return "<span id='demandVerificationInfoContainer'>\t\n\t\t\t\t\t<label class='infoFieldTitleWithBar' >" . util::cleanUTF8('Modèle') . "</label>\n\t\t\t\t\t<label id='car" . $carIndex . "Model' class='infoFieldValue' style='font-size:18px'>" . $car->getModel() . "</label>\n\t\t\t\t\n\t\t\t\t\t<label class='infoFieldTitleWithBar' >Couleur</label>\n\t\t\t\t\t<label id='car" . $carIndex . "Color' class='infoFieldValue' style='font-size:18px'>" . $car->getColor() . "</label> \n\t\t\t\t\n\t\t\t\t\t<label class='infoFieldTitleWithBar' >" . util::cleanUTF8('Année') . "</label>\n\t\t\t\t\t<label id='car" . $carIndex . "Year' class='infoFieldValue' style='font-size:18px'>" . $car->getYear() . "</label> \n\t\t\t\t\n\t\t\t\t\t<label class='infoFieldTitleWithBar' >" . util::cleanUTF8('Année') . "</label>\n\t\t\t\t\t<label id='car" . $carIndex . "License' class='infoFieldValue' style='font-size:18px'>" . $car->getLicense() . "</label>\n\t\t\t\t</span>"; }
<?php require 'class_lib.php'; $car = new car(); $car->setCarColor('punane'); $car->setCarMark('Audi'); $car->setCarModel('A4s'); $vheel = new vheels(); $vheel->setVheelColor('valge'); $vheel->setVheelDiameter('17'); $image = new image(); $image->setImage('https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTDs5Q6m8IFBO1XhNo9OIcVQ-TN7zqvT5ITB4dgeARQ9sw3TtohLw'); echo 'See ' . $car->getCarMark() . ' ' . $car->getCarModel() . ' on ' . $car->getCarColor() . ' ja sellel on ' . $vheel->getVheelColor() . 'd veljed, nende velgede läbimõõt on ' . $vheel->getVheelDiameter() . '".'; echo '<br>'; var_dump($image->getImage('https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTDs5Q6m8IFBO1XhNo9OIcVQ-TN7zqvT5ITB4dgeARQ9sw3TtohLw'));
class car extends transport { public function start() { $this->command = 'start'; $this->show(); return $this; } public function go() { $this->command = 'go'; $this->show(); return $this; } } $car = new car(); $car->start()->go(); include_once "config.php"; include_once "school.class.php"; //echo "<pre>";print_r($array);echo "</pre>"; $school = new school(); /*Добавить книгу*/ //$school->addBook('Первое чудо'); /*Добавить автора*/ //$school->addAuthor('Герман'); /*Добавить студента*/ //$school->addStudent('Генадий'); /*Установить связь книги с автором*/ //$school->setBookOfAuthor(7,1); /*книги 1-7, Авторы 1-5*/ // Студент взял книгу ID Студента и ID книги
echo 'VROOOOOOOOMMMMM'; } } class chanceOfRain { public $chance; function __construct() { $this->chance = rand(0, 10); // echo $this->chance; } function checkForRain() { if ($this->chance > 5) { return true; } else { return false; } } } $myCar = new car(); $myCar->accelerate(); $myCar->letsOpenTheTop(); $myNewCar = new bmw(); $myNewCar->accelerate(); // $myNewCar->letsOpenTheTop(); $rain = new chanceOfRain(); if ($rain) { echo "<p>It's raining!</p>"; $myCar->letsCloseTheTop(); }
public $iq = 100; public function say() { $arr = array('早上好', '晚上好', 'shit'); if ($this->iq >= 100) { echo $arr[0]; } else { $rad = rand(0, 2); echo $arr[$rad]; } } } class car { public function hit($m) { $ra = rand(50, 150); $m->iq = $ra; } } $m = new man(); $c = new car(); echo $m->say(); echo "<br>"; $c->hit($m); echo $m->iq; echo "<br>"; echo $m->say(); echo "<br>"; echo $m->say(); echo "<br>";
public function __construct($value = '') { parent::__construct(); $this->car_ask_note = pc_base::load_model("car_ask_note_model"); }
public function __construct($p, $s, $f, $m) { $this->price = $p; $this->speed = $s; $this->fuel = $f; $this->mileage = $m; if ($this->price > 10000) { $this->tax = 0.15; } else { $this->tax = 0.12; } } public function Display_all() { echo "Price: " . $this->price . "<br>"; echo "Speed: " . $this->speed . "<br>"; echo "Fuel: " . $this->fuel . "<br>"; echo "Mileage: " . $this->mileage . "<br>"; echo "Tax: " . $this->tax . "<br>"; } } $car1 = new car(2000, "35mph", "Full", "15mpg"); $car2 = new car(2000, "5mph", "Not Full", "105mpg"); $car3 = new car(2000, "15mph", "Kind of Full", "95mpg"); $car4 = new car(2000, "45mph", "Empty", "25mpg"); $car5 = new car(20000000, "35mph", "Empty", "15mpg"); echo $car1->Display_all() . "<br>"; echo $car2->Display_all() . "<br>"; echo $car3->Display_all() . "<br>"; echo $car4->Display_all() . "<br>"; echo $car5->Display_all() . "<br>";
$this->price = $price; $this->speed = $speed . "mph"; $this->fuel = $fuel; $this->mileage = $mileage . "mpg"; if ($price > 10000) { $this->tax = 0.15; } else { $this->tax = 0.12; } } function display_all() { echo "Price: " . $this->price . "<br>"; echo "Speed: " . $this->speed . "<br>"; echo "Fuel: " . $this->fuel . "<br>"; echo "Mileage: " . $this->mileage . "<br>"; echo "Tax: " . $this->tax . "<br>"; } } $car1 = new car(2000, 35, "Full", 15); $car1->display_all(); $car2 = new car(2000, 5, "Not Full", 105); $car2->display_all(); $car3 = new car(2000, 15, "Kind of Full", 95); $car3->display_all(); $car4 = new car(2000, 25, "Full", 25); $car4->display_all(); $car5 = new car(2000, 45, "Empty", 15); $car5->display_all(); $car6 = new car(20000000, 35, "Empty", 15); $car6->display_all();