<?php

include_once("server/lib/mod_dbm/package.dbm.php");

class MarcasManager {

    static function getMarcas($activeOnly = true) {
        $res = null;
        try {
            $q = sprintf("SELECT * FROM machine_brands %s ORDER BY machine_brand_name;", ($activeOnly) ? "WHERE activa=1" : "");
            $dao = new dbObject();
            $res = $dao->fetchQuery($q);
        } catch (Exception $e) {
            
        }
        return $res;
    }
    
    static function getModelosDeMarca($idMarca,$activeOnly = true) {
        $res = null;
        try {
            $q = sprintf("SELECT * FROM machine_models WHERE machine_brand_id = %d %s ORDER BY machine_model_name;", $idMarca, ($activeOnly) ? "AND activo=1" : "");
            $dao = new dbObject();
            $res = $dao->fetchQuery($q);
        } catch (Exception $e) {
            
        }
        return $res;
    }
}
?>