<?php
class Formulaire {
    public static function getFormulaireByNoFormulaireNoDivisionNoVisu($noFormulaire, $noDivision, $noVisu) {
        $query = "SELECT * FROM formulaire WHERE NoFormulaire=:noformulaire AND NoDivision=:nodivision AND NoVisu=:novisu ORDER BY Position";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":noformulaire", $noFormulaire);
        $statement->bindParam(":nodivision", $noDivision);
        $statement->bindParam(":novisu", $noVisu);
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getFormulaireByNoFormulaireNoDivisionNoVisuNoChamp($noFormulaire, $noDivision, $noVisu, $noChamp) {
        $query = "SELECT * FROM formulaire WHERE NoFormulaire=:noformulaire AND NoDivision=:nodivision AND NoVisu=:novisu AND NoChamp=:nochamp";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":noformulaire", $noFormulaire);
        $statement->bindParam(":nodivision", $noDivision);
        $statement->bindParam(":novisu", $noVisu);
        $statement->bindParam(":nochamp", $noChamp);
        $statement->execute();
        return $statement->fetch();
    }

    public static function getFormulaireByNoFormulaireNoDivisionNoVisuPosition($noFormulaire, $noDivision, $noVisu, $position) {
        $query = "SELECT * FROM formulaire WHERE NoFormulaire=:noformulaire AND NoDivision=:nodivision AND NoVisu=:novisu AND Position=:position";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":noformulaire", $noFormulaire);
        $statement->bindParam(":nodivision", $noDivision);
        $statement->bindParam(":novisu", $noVisu);
        $statement->bindParam(":position", $position);
        $statement->execute();
        return $statement->fetch();
    }
}