/** * Devuelve el listado principal de registros del mantenimiento * @return Response */ public function consultarInventariosDetJSONAction() { $user = $this->get('security.context')->getToken()->getUser(); $inventarioDetDao = new InventarioDetDao($this->getDoctrine()); $registros = $inventarioDetDao->getInventariosDet($user->getEntidad()->getEntId()); $numfilas = count($registros); //$emple = new InventarioDet(); if ($numfilas != 0) { $inventarioDet = new InventarioDet(); $i = 0; foreach ($registros as $ent) { $inventarioDet->setInvDetFecha($ent['invDetFecha']); $registros[$i]['invDetFechaText'] = $inventarioDet->getInvDetFechaText(); $i = $i + 1; } } else { //$rows[0]['id'] = 0; //$rows[0]['cell'] = array(' ', ' ',' ', ' ', ' ', ' ', ' ', ' '); } $datos = json_encode($registros); $pages = floor($numfilas / 10) + 1; $jsonresponse = '{ "page":"1", "total":"' . $pages . '", "records":"' . $numfilas . '", "rows":' . $datos . '}'; $response = new Response($jsonresponse); $response->headers->set('Content-Type', 'application/json'); return $response; }