/** * Devuelve los datos del reporte * Ejemplo: http://denunciaty/api/reporte/datos/2 * Para recibir reportes por tipo, poner 0 como valor de id y la id del tipo en $tipo_id * Ejemplo: http://denunciaty/api/reporte/datos/0/1 * @param int $id */ public function datos($id = null, $tipo_id = null) { $repo = new Reporte(); if ($id == 0 || $id == null) { if ($tipo_id != null) { $this->data = $repo->getReporteByTipo($tipo_id); } } else { $this->data = $repo->getReporte($id); } }
public function editar($id) { $rep = new Reporte(); $us = new Usuario(); $tip = new Tipo(); if (!$_POST) { $this->data = $rep->getReporte($id); $this->usuario = $us->getUsuario($this->data->usuario_id); $this->tipos = $tip->getTipos(); } else { $r = $rep->updateReporte($id, $_POST); if ($r != false) { Flash::success('Los datos del reporte han sido modificados.'); Redirect::to(''); } else { Flash::error('No han podido modificarse los datos del reporte.'); Redirect::to(''); } } }
public function index($id) { $rep = new Reporte(); $this->data = $rep->getReporte($id); }