public function action_index() { if (isset($_POST['submit'])) { $archivos = new Model_aarchivos(); $fecha_1 = explode('/', $_POST['fechaIni']); $fecha_2 = explode('/', $_POST['fechaFin']); $fecha1 = $fecha_1[2] . '-' . $fecha_1[1] . '-' . $fecha_1[0] . ' 00:00:00'; $fecha2 = $fecha_2[2] . '-' . $fecha_2[1] . '-' . $fecha_2[0] . ' 23:59:59'; $_POST['fecha1'] = $fecha1; $_POST['fecha2'] = $fecha2; switch ($_POST['tipo']) { case 1: $result = $archivos->reporte1($_POST['user'], $fecha1, $fecha2); $this->template->content = View::factory('archivero/reportes/result1')->bind('post', $_POST)->bind('result', $result); break; case 2: $result = $archivos->reporte2($_POST['user'], $fecha1, $fecha2); $this->template->content = View::factory('archivero/reportes/result2')->bind('post', $_POST)->bind('result', $result); break; default: $result = $archivos->reporte3($_POST['user'], $fecha1, $fecha2); $this->template->content = View::factory('archivero/reportes/result3')->bind('post', $_POST)->bind('result', $result); break; } } else { $tipos = ORM::factory('tipoarchivos')->find_all(); $users = ORM::factory('users')->find_all(); $this->template->content = View::factory('archivero/reportes/vistauser')->bind('tipos', $tipos)->bind('users', $users); } }