acta.php
5.97 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php
include_once 'sesiones/session_admin.php';
class Acta extends Controller{
function __construct()
{
parent::__construct();
}
function render(){
$actas=$this->model->get();
$this->view->actas=$actas;
$this->view->render('acta/index');
}
function Registrar(){
$consejos=$this->model->getTipoConsejo();
$this->view->consejos=$consejos;
$this->view->render('acta/registrar');
}
function RegistrarActa(){
$numero=$_POST['numero'];
$fecha=$_POST['fecha'];
$id_tipo_consejo=$_POST['id_tipo_consejo'];
$d=date("d-m-Y");
$ruta1= "asdas";
$time = time();
$file1= date("Y-m-d (H:i:s)", $time).$_FILES['file1']['name'];
$ruta1= $_FILES['file1']['tmp_name'];
$destino1 = "src/acta/". $file1;
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 Acta no puede ser mayor que la vigente. Verifique la fecha.</p>
</div>';
$this->view->mensaje=$mensaje;
$this->render();
exit();
}
if($var=$this->model->existe($numero)){
$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> Esta Acta ya fue Registrada <code>' . $var . '</code> Verifique Nuevamente.</p>
</div>';
$this->view->mensaje=$mensaje;
$this->render();
exit();
}
if($this->model->insert(['numero'=>$numero, 'fecha'=>$fecha, 'file1'=>$file1, 'id_tipo_consejo'=>$id_tipo_consejo, 'destino1'=>$destino1,'ruta1'=>$ruta1])){
$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;"> Acta Nro. '.$numero.' 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 Acta '.$numero.' </code> Por Favor, Intentalo de Nuevo.</p>
</div>';
}
$this->view->mensaje=$mensaje;
$this->render();
}
function ViewEdit($param=null){
$id_acta=$param[0];
$edicion=$this->model->getID($id_acta);
$this->view->edicion=$edicion;
$consejos=$this->model->getTipoConsejo();
$this->view->consejos=$consejos;
$this->view->render('acta/ViewEdit');
}
public function EditarActa(){
$numero=$_POST['numero'];
$fecha=$_POST['fecha'];
$id_tipo_consejo=$_POST['id_tipo_consejo'];
$id_acta=$_POST['id_acta'];
$d=date("d-m-Y");
$ruta1="asdas";
$time = time();
$file1=date("Y-m-d (H:i:s)", $time).$_FILES['file1']['name'];
$ruta1= $_FILES['file1']['tmp_name'];
$destino1 = "src/acta/". $file1;
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 Acta no puede ser mayor que la vigente. Verifique la fecha.</p>
</div>';
$this->view->mensaje=$mensaje;
$this->render();
exit();
}
if($this->model->update(['numero'=>$numero, 'fecha'=>$fecha, 'file1'=>$file1, 'id_tipo_consejo'=>$id_tipo_consejo, 'id_acta'=>$id_acta, 'destino1'=>$destino1,'ruta1'=>$ruta1])){
$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;"> Acta Nro. '.$numero.' 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 Acta '.$numero.' </code> Por Favor, Intentalo de Nuevo.</p>
</div>';
}
$this->view->mensaje=$mensaje;
$this->render();
}
function eliminar($param = null){
$id_acta=$param[0];
if($this->model->delete($id_acta)){
$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 Acta </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 Acta </code> Por Favor, Debe Eliminar la Resolución Asociada e Intentelo Nuevamente.</p>
</div>';
}
$this->view->mensaje=$mensaje;
$this->render();
}
function viewDetalle($param = null){
$id_acta=$param[0];
$edicion=$this->model->getID($id_acta);
$this->view->edicion=$edicion;
$this->view->render('acta/viewDetalle');
}
}
?>