public function verdptoAction() { $variable = $this->request->getPost(); $sid = new Container('base'); $db_name = $sid->offsetGet('dbNombre'); $this->dbAdapter = $this->getServiceLocator()->get($db_name); $dpto = new UnidadTable($this->dbAdapter); $lista = $dpto->getVerDpto($this->dbAdapter, $variable['idUnidad']); $nombreD1 = ""; $titularD1 = ""; $contactoD1 = ""; $condicionD1 = ""; $tablaD1 = ""; $status = "ok"; if (count($lista) > 0) { $tablaD1 = "<table class='table table-hover'><thead><tr><th>Nombres</th><th>Contacto</th><th></th></tr></thead><tbody>"; $nombreD1 = $lista[0]['dpto']; for ($i = 0; $i < count($lista); $i++) { if ($lista[$i]['titular'] == "1") { $titularD1 = isset($lista[$i]['nombre']) ? $lista[$i]['nombre'] : ""; if (isset($lista[$i]['condicion'])) { $condicionD1 = $lista[$i]['condicion'] == "A" ? "Arrendatario" : "Copropetario"; } $contactoD1 = isset($lista[$i]['contacto']) ? $lista[$i]['contacto'] : ""; } else { $tablaD1 = $tablaD1 . "<tr><td>" . $lista[$i]['nombre'] . "</td><td>" . $lista[$i]['contacto'] . "</td><td>" . $lista[$i]['condicion'] . "</td></tr>"; } } $tablaD1 = $tablaD1 . "</tbody></table>"; } return new JsonModel(array('status' => $status, 'nombreD1' => $nombreD1, 'titularD1' => $titularD1, 'contactoD1' => $contactoD1, 'condicionD1' => $condicionD1, 'tablaD1' => $tablaD1)); }