<?php
class VehiculesLocation {
    public static function getVehiculeLocationByNoChassisAndCategoryMultiNot3($noChassis) {
        $query = "SELECT * FROM vehiculeslocation".ID_GARAGE." WHERE (CategorieMulti NOT LIKE '%3%') OR (NoChasis = :nochassis) ORDER BY Position";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":nochassis", $noChassis);
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getVehiculeLocationByNoChassis($noChassis) {
        $query = "SELECT * FROM vehiculeslocation".ID_GARAGE." WHERE NoChasis = :nochassis";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":nochassis", $noChassis);
        $statement->execute();
        return $statement->fetch();
    }

    public static function getVehiculeLocationByCategorie($catLoc) {
        $query = "SELECT * FROM vehiculeslocation".ID_GARAGE." WHERE Categorie=:catloc";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":catloc", $catLoc);
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getVehiculeLocationByCatLoc($catLoc) {
        $query = "SELECT * FROM vehiculeslocation".ID_GARAGE." WHERE CategorieMulti LIKE :catloc";
        $statement = Connection::getStatement($query);
        $statement->bindValue(":catloc", '%'.$catLoc.'%');
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getVehiculeLocation() {
        $query = "SELECT * FROM vehiculeslocation".ID_GARAGE." WHERE CategorieMulti NOT LIKE '%3%' ORDER BY Position";
        $statement = Connection::getStatement($query);
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getAll() {
        $query = "SELECT * FROM vehiculeslocation".ID_GARAGE." ORDER BY Position";
        $statement = Connection::getStatement($query);
        $statement->execute();
        return $statement->fetchAll();
    }
}