<?php
class CatLoc {

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

    public static function getCatlocByNo($no) {
        $query = "SELECT * FROM catloc WHERE NoCatLoc=:no";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":no", $no);
        $statement->execute();
        return $statement->fetch();
    }

    public static function getCatlocByPret($pret = 1) {
        $query = "SELECT * FROM catloc WHERE Pret=:pret ORDER BY Position";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":pret", $pret);
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getCatlocByAncien($ancien = 1) {
        $query = "SELECT * FROM catloc WHERE Ancien=:ancien";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":ancien", $ancien);
        $statement->execute();
        return $statement->fetchAll();
    }


}