/
calificar_parque.php
70 lines (58 loc) · 2.43 KB
/
calificar_parque.php
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
<?php
require('configs/include.php');
class c_calificar_parque extends super_controller {
public function calificar(){
$this->engine->assign('codigo',$this->post->codigo);
$this->engine->assign('nombre',$this->post->nombre);
$this->engine->assign('municipio',$this->post->municipio);
$calificacion = new calificacion($this->post);
$calificacion->set('fecha',date('Y-m-d'));
if(is_empty($calificacion->get('calificacion'))){
throw_exception("Debe ingresar una calificacion");
}elseif (($calificacion->get('calificacion')) != 1
AND ($calificacion->get('calificacion')) != 2
AND ($calificacion->get('calificacion')) != 3
AND ($calificacion->get('calificacion')) != 4
AND ($calificacion->get('calificacion')) != 5){
throw_exception("Calificacion invalida, calificacion valida: 1, 2, 3, 4, 5");
}
$this->orm->connect();
$this->orm->insert_data("normal",$calificacion);
$this->orm->close();
$this->type_warning = "Exito";
$this->msg_warning = "Calificacion registrada";
$this->temp_aux = 'message.tpl';
$this->engine->assign('type_warning',$this->type_warning);
$this->engine->assign('msg_warning',$this->msg_warning);
}
public function display()
{
$this->engine->assign('codigo',$this->post->codigo);
$this->engine->assign('nombre',$this->post->nombre);
$this->engine->assign('municipio',$this->post->municipio);
$this->engine->display('header.tpl');
$this->engine->display($this->temp_aux);
$this->engine->display('calificar_parque.tpl');
$this->engine->display('footer.tpl');
}
public function run() {
try {
if (isset($this->get->option)) {
if ($this->get->option == "calificar")
$this->{$this->get->option}();
else
throw_exception("Opción ". $this->get->option." no disponible");
}
} catch (Exception $e) {
$this->error=1;
$this->msg_warning=$e->getMessage();
$this->temp_aux = 'message.tpl';
$this->engine->assign('type_warning',$this->type_warning);
$this->engine->assign('msg_warning',$this->msg_warning);
}
$this->display();
}
}
$call = new c_calificar_parque();
$call->run();
?>