1: <?php
2: 3: 4:
5: class PlnMetodo
6: {
7: protected $bd;
8: 9: 10: 11:
12: function __construct($libs=null)
13: {
14: if(empty($libs)){
15: require_once('../core/incluir.php');
16: $nivel_dir = 3;
17: $this->libs = new Incluir($nivel_dir);
18: }
19: else{
20: $this->libs = $libs;
21: }
22: $this->bd = $this->libs->incluir('db');
23: }
24:
25: 26: 27: 28: 29: 30:
31: public function crear_pln_metodo($id_registro, $id_metodo=null)
32: {
33: $respuesta = array('msj'=>'no', 'arr_id'=>array());
34: if(is_array($id_metodo)){
35: $id_metodo = implode("), (".$id_registro.", ", $id_metodo);
36: }
37: $query = "insert into pln_metodo (id_registro, id_metodo) values (".$id_registro.", ".$id_metodo.")";
38: if($this->bd->ejecutar($query)){
39: $respuesta['msj'] = 'si';
40: array_push($respuesta['arr_id'], $this->bd->lastID());
41: }
42: return $respuesta;
43: }
44:
45: 46: 47: 48: 49: 50:
51: public function eliminar_pln_metodo($campo, $valor)
52: {
53: $query = "delete from pln_metodo where ".$campo."=".$valor;
54: if($this->bd->ejecutar($query)){
55: return true;
56: }
57: }
58: }
59: ?>