consejo.php
4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
include_once 'sesiones/session_admin.php';
class Consejo extends Controller{
function __construct()
{
parent::__construct();
}
function render(){
$consejs=$this->model->get();
$this->view->consejs=$consejs;
$this->view->render('consejo/index');
}
function Registrar(){
$this->view->render('consejo/registrar');
}
function RegistrarConsejo(){
$descripcion=$_POST['descripcion'];
$fecha=$_POST['fecha'];
$d=date("d-m-Y");
if($fecha > $d)
{
$mensaje='<div class="alert alert-danger icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p style="text-align:center;"><strong></strong> La fecha del Consejo no puede ser mayor que la vigente. Verifique la fecha.</p>
</div>';
$this->view->mensaje=$mensaje;
$this->render();
exit();
}
if($this->model->insert(['descripcion'=>$descripcion, 'fecha'=>$fecha])){
$mensaje='<div class="alert alert-success icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p><strong>Exitoso!</strong> <code style="color: green;"> Consejo Registrado</code> <strong>Correctamente</strong>.</p>
</div>';
}else{
$mensaje='<div class="alert alert-danger icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p><strong>Error</strong> Al Intentar <code> Registrar el Consejo </code> Por Favor, Intentalo de Nuevo.</p>
</div>';
}
$this->view->mensaje=$mensaje;
$this->render();
}
function ViewEdit($param=null){
$id_tipo_consejo=$param[0];
$edicion=$this->model->getID($id_tipo_consejo);
$this->view->edicion=$edicion;
$this->view->render('consejo/ViewEdit');
}
public function EditarConsejo(){
$id_tipo_consejo=$_POST['id_tipo_consejo'];
$descripcion=$_POST['descripcion'];
$fecha=$_POST['fecha'];
$d=date("d-m-Y");
if($fecha > $d)
{
$mensaje='<div class="alert alert-danger icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p style="text-align:center;"><strong></strong> La fecha del Consejo no puede ser mayor que la vigente. Verifique la fecha.</p>
</div>';
$this->view->mensaje=$mensaje;
$this->render();
exit();
}
if($this->model->update(['descripcion'=>$descripcion, 'fecha'=>$fecha, 'id_tipo_consejo'=>$id_tipo_consejo])){
$mensaje='<div class="alert alert-success icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p><strong>Exitoso!</strong> <code style="color: green;"> Consejo Modificado</code> <strong>Correctamente</strong>.</p>
</div>';
}else{
$mensaje='<div class="alert alert-danger icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p><strong>Error</strong> Al Intentar <code>Editar el Consejo </code> Por Favor, Intentalo de Nuevo.</p>
</div>';
}
$this->view->mensaje=$mensaje;
$this->render();
}
function eliminar($param = null){
$id_tipo_consejo = $param[0];
if($this->model->delete($id_tipo_consejo)){
$mensaje='<div class="alert alert-success icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p><strong>Exitoso!</strong> <code style="color: green;"> Se ha Eliminado el Consejo </code> <strong>Correctamente</strong>.</p>
</div>';
}else{
$mensaje='<div class="alert alert-danger icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p><strong>Error</strong> Al Intentar <code>Eliminar el Consejo </code> Por Favor, Intentalo de Nuevo.</p>
</div>';
}
$this->view->mensaje=$mensaje;
$this->render();
}
}
?>