1: <?php
2: class CnbMetodo
3: {
4: function __construct($bd=null)
5: {
6: if(empty($bd)){
7: require_once('../core/incluir.php');
8: $nivel_dir = 3;
9: $libs = new Incluir($nivel_dir);
10: $this->bd = $libs->incluir('db');
11: }
12: $this->bd = (!empty($bd)) ? $bd : $this->bd;
13: }
14:
15: 16: 17: 18: 19:
20: public function abrir_metodo($arr_filtro=null, $campos = '*')
21: {
22: $respuesta = array();
23: $query = "select ".$campos." from cnb_metodo ";
24: if(is_array($arr_filtro)){
25: $query .= " where _id>0 ";
26: foreach ($arr_filtro as $key => $filtro) {
27: $query .= " and ".$key."=".$filtro;
28: }
29: }
30: $stmt = $this->bd->ejecutar($query);
31: while ($metodo = $this->bd->obtener_fila($stmt)) {
32: array_push($respuesta, $metodo);
33: }
34:
35:
36: return $respuesta;
37: }
38: }
39: ?>