<th>Type</th>
                        <th>Marque</th>
                        <th>Modèle</th>
                        <th>Couleur</th>
                        <th>Immatriculation</th>
                        <th>Propriétaire</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
<?php 
    include_once 'class/Vehicule.class.php';
    $requete = $bdd->query('SELECT id FROM vehicule');
    while ($donnees = $requete->fetch()) {
        $vehicule = new Vehicule($donnees['id']);
        $nb_result = $vehicule->search($pattern, $nb_result);
    }
    ?>
        </tbody>
    </table>
    <?php 
    if ($nb_result == 0) {
        echo '<h2>Aucun resultat</h2>';
    } else {
        echo '<h3>' . $nb_result . ' résultat(s)</h3>';
    }
}
?>

예제 #2
0
 function sauvegarder(Vehicule $vehicule, $noMem)
 {
     $dbh = $this->_db;
     $sql = "INSERT INTO Vehicule (marqueVeh, modeleVeh, couleurVeh, nbrPlaces, nbrPlanches) VALUES  (:marqueVeh, :modeleVeh, :couleurVeh, :nbrPlaces, :nbrPlanches);";
     $sth = $dbh->prepare($sql);
     $sth->bindParam(":marqueVeh", $vehicule->marqueVeh(), PDO::PARAM_STR);
     $sth->bindParam(":modeleVeh", $vehicule->modeleVeh(), PDO::PARAM_STR);
     $sth->bindParam(":couleurVeh", $vehicule->couleurVeh(), PDO::PARAM_STR);
     $sth->bindParam(":nbrPlaces", $vehicule->nbrPlaces(), PDO::PARAM_INT);
     $sth->bindParam(":nbrPlanches", $vehicule->nbrPlanches(), PDO::PARAM_INT);
     if ($sth->execute() == 0) {
         print $dbh->errorInfo();
         // affiche message d'érreur de la bdd
     } else {
         $noVeh = $dbh->lastInsertId();
         $vehicule->setNoVeh($noVeh);
         $sql = "INSERT INTO Possede (noVeh, noMem) VALUES  (:noVeh, :noMem);";
         $sth = $dbh->prepare($sql);
         $sth->bindParam(":noVeh", $noVeh, PDO::PARAM_INT);
         $sth->bindParam(":noMem", $noMem, PDO::PARAM_INT);
         if ($sth->execute() == 0) {
             print $dbh->errorInfo();
             // affiche message d'érreur de la bdd
         }
     }
 }
예제 #3
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Vehicule $value A Vehicule object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Vehicule $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
예제 #4
0
        }
    }
}
class Human
{
}
$animalerie = new Animalerie();
$felix = $animalerie->buyAnimal("chat", "Felix");
echo $felix->crier();
$animalerie->toiletter($felix);
var_dump($felix);
//$julien = new Human("Julien","Humain");
$julien = new Human();
//echo $julien->crier();
$animalerie->toiletter($julien);
die;
$eric = new Animal("Eric", "rat");
//$eric->espece = "chat"; //erreur
//echo $eric->espece;
echo $eric->getEspece() . "<br>";
$eric->setEspece("chat") . "<br>";
echo $eric->getEspece() . "<br>";
$eric->manger("croquette");
$jc = new Animal("Anna", "loutre");
echo $jc->crier();
$clio = new Vehicule();
$clio->plaque = "JX-768PO";
echo $clio->rouler();
echo $clio->rouler();
echo $clio->rouler();
echo $clio->rouler();
예제 #5
0
 public function delete(Vehicule $vehicule)
 {
     $delete = $this->conn->prepare('DELETE FROM vehicule WHERE WHERE id = ?');
     $delete->bindParam(1, $vehicule->getId(), \PDO::PARAM_STR);
     $delete->execute();
 }
예제 #6
0
        <thead>
            <tr>
                <th>Type</th>
                <th>Marque</th>
                <th>Modèle</th>
                <th>Couleur</th>
                <th>Immatriculation</th>
                <th>Propriétaire</th>
                <th></th>
            </tr>
        </thead>
        <tbody>

            <?php 
include_once 'class/Vehicule.class.php';
include_once 'ouverture_bdd.php';
$reponse = $bdd->query('SELECT id FROM vehicule ORDER BY immat');
while ($donnees = $reponse->fetch()) {
    $vehicule = new Vehicule($donnees['id']);
    $vehicule->affiche_donnees_ligne();
}
$reponse->closeCursor();
?>
 
        </tbody>
    </table>
 	<!-- jQuery -->
    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    </body>
 </html>
예제 #7
0
 public function displayDescription()
 {
     parent::displayDescription();
     echo $this->count_helix . ' helices <br>';
     echo $this->count_wing . ' ailes<br>';
 }
예제 #8
0
 /**
  * Declares an association between this object and a Vehicule object.
  *
  * @param      Vehicule $v
  * @return     Intervention The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setVehicule(Vehicule $v = null)
 {
     if ($v === null) {
         $this->setVehiculeId(NULL);
     } else {
         $this->setVehiculeId($v->getId());
     }
     $this->aVehicule = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Vehicule object, it will not be re-added.
     if ($v !== null) {
         $v->addIntervention($this);
     }
     return $this;
 }
예제 #9
0
 public function delete(Vehicule $vehicule)
 {
     $this->db->exec('DELETE FROM vehicules WHERE id = ' . $vehicule->id());
 }
예제 #10
0
파일: test.php 프로젝트: raphamim/POO
<?php

require_once 'config/config.conf.php';
#### VEHICULE ####
$voiture1 = new Vehicule();
$voiture1->marque = 'bmw';
$voiture1->modele = '320i';
$voiture1->annee = '2002';
$voiture1->couleur = 'noir';
$voiture1->displayDescription();
echo '<hr>';
$voiture2 = new Vehicule('peugeot', '106', '2011', 'rouge');
$voiture2->displayDescription();
echo '<hr>';
#### AIRPLANE ####
$airplane1 = new Airplane('boeing', '747', '1985', 'blanc');
$airplane1->count_helix = 2;
$airplane1->count_wing = 2;
$airplane1->displayDescription();
$airplane1->decoller();
echo '<hr>';
#### JDC ####
// On simule un resultat de requete BDD
$result = array('id' => '123', 'name' => 'bob', 'content' => 'Lorem ipsum...', 'picture' => 'toto.png', 'creation_date' => '2015-11-10 13:10:00');
$jdc = new Jdc($result);
echo $jdc->displayJdc();
예제 #11
0
 public static function install()
 {
     self::init();
     global $wpdb;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     /* Create Devis Table */
     $sql_create_table = 'CREATE TABLE ' . Devis::getTableName() . ' (
         id int(10) unsigned NOT NULL AUTO_INCREMENT,
         utilisateur_id int(11) NOT NULL,
         vehicule_id int(11) NOT NULL,
         state tinyint(3) unsigned NOT NULL,
         creationDate datetime NOT NULL,
         updateDate datetime DEFAULT NULL,
         mailSent tinyint DEFAULT 0 NOT NULL,
         proposition_id int(11) NULL,
         PRIMARY KEY  (id),
         KEY state (state)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Dommage Table */
     $sql_create_table = 'CREATE TABLE ' . Dommage::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         devis_id int(11) NOT NULL,
         piece int(11) NOT NULL,
         type varchar(30) DEFAULT NULL,
         taille varchar(30) DEFAULT NULL,
         peinture char(3) DEFAULT NULL,
         commentaire text,
         demi float NULL,
         complet float NULL,
         simple float NULL,
         complexe float NULL,
         t_mo float NULL,
         qt float NULL,
         tarif float NULL,
         PRIMARY KEY  (id),
         KEY devis_id (devis_id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Photo table */
     $sql_create_table = 'CREATE TABLE ' . Photo::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         dommage_id int(11) NOT NULL,
         name varchar(50) NOT NULL,
         PRIMARY KEY  (id),
         KEY dommage_id (dommage_id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Utilisateur Table */
     $sql_create_table = 'CREATE TABLE ' . Utilisateur::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         civilite varchar(5) NOT NULL,
         nom varchar(100) NOT NULL,
         prenom varchar(100) NOT NULL,
         societe varchar(100) DEFAULT NULL,
         code_client varchar(20) DEFAULT NULL,
         adresse varchar(255) NOT NULL,
         cmplt_adresse varchar(255) DEFAULT NULL,
         cp varchar(10) NOT NULL,
         ville varchar(100) NOT NULL,
         pays varchar(50) DEFAULT NULL,
         tel varchar(20) NOT NULL,
         mobile varchar(20) DEFAULT NULL,
         email varchar(100) NOT NULL,
         comment_connu tinyint(4) NOT NULL,
         PRIMARY KEY  (id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Vehicule Table */
     $sql_create_table = 'CREATE TABLE ' . Vehicule::getTableName() . ' (
         id int(11) NOT NULL AUTO_INCREMENT,
         immatriculation varchar(30) NOT NULL,
         marque varchar(50) NOT NULL,
         modele varchar(50) NOT NULL,
         kms int(11) DEFAULT NULL,
         numero_chassis varchar(100) DEFAULT NULL,
         PRIMARY KEY  (id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     /* Create Devis Table */
     $sql_create_table = 'CREATE TABLE ' . Proposition::getTableName() . ' (
         id int(10) unsigned NOT NULL AUTO_INCREMENT,
         main_oeuvre float  NOT NULL,
         F_prise_charge int  NOT NULL,
         remise int  NOT NULL,
         ht float  NOT NULL,
         ht_r float  NOT NULL,
         tva float  NOT NULL,
         tot float  NOT NULL,
         comment text NULL,
         acompte int  NOT NULL,
         date1 datetime  NOT NULL,
         date2 datetime NOT NULL,
         date3 datetime NOT NULL,
         matin_midi1 tinyint NOT NULL,
         matin_midi2 tinyint NOT NULL,
         matin_midi3 tinyint NOT NULL,
         PRIMARY KEY  (id)
     )' . $charset_collate . ';';
     if (dbDelta($sql_create_table)) {
     } else {
     }
     add_option('dw_devis_db_version', self::DB_VERSION);
     /* TODO : [création | modification] du répertoire upload avec les bons droits */
     return true;
 }