<?php include dirname(__FILE__) . '\\..\\modelo\\Persona.php'; include dirname(__FILE__) . '\\..\\modelo\\Mapeador.php'; include dirname(__FILE__) . '\\..\\dao\\PersonaDAO.php'; $documento = ""; if (array_key_exists('documento', $_POST)) { $documento = $_POST['documento']; } $personaDAO = new PersonaDAO(); $persona = new Persona(); $persona = $personaDAO->leerPorDocumento($documento); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Nueva Persona</title> </head> <body> <form id="form1" name="form1" method="post" action="ctlPersona.php"> <input name="modificar" type="hidden" value="1"/> <p> </p> <table width="383" border="1" cellspacing="1" cellpadding="1"> <caption>NUEVA PERSONA</caption> <tr> <td width="76">Documentos</td> <td width="294"><input name="persona[documento]" type="text" readonly="yes" id="documentos" value="<?php
function hayOpcionChequeada(frm) { arrObjs = frm.elements; for(i=0; i < arrObjs.length; i++){ if(arrObjs[i].type === 'radio' && arrObjs[i].checked === true){ return true; } } return false; } </script> </head> <body> <?php $pdao = new PersonaDAO(); $personas = $pdao->leerTodos(); ?> <form name="form1" method="post" action=""> <table width="757" border="1" cellspacing="1" cellpadding="1"> <caption> PERSONAS </caption> <tr> <th width="34" align="center" scope="col"> </th> <th width="139" scope="col">Documento</th> <th width="135" scope="col">Nombres</th> <th width="137" scope="col">Apellidos</th> <th width="131" scope="col">Telefono</th> <th width="148" scope="col">Dirección</th> </tr>
<?php session_start(); require_once '../bean/UsuarioBean.php'; require_once '../bean/PersonaBean.php'; require_once '../dao/UsuarioDAO.php'; require_once '../dao/PersonaDAO.php'; $usuarioBean = new UsuarioBean(); $usuarioDAO = new UsuarioDAO(); $personaBean = new PersonaBean(); $personaDAO = new PersonaDAO(); $op = $_POST["op"]; switch ($op) { case 0: session_destroy(); echo 1; break; case 1: $username = $_POST["username"]; $password = $_POST["password"]; $usuarioBean->setUsuario($username); $usuarioBean->setPassw($password); $listaUsuario = $usuarioDAO->validarUsuario($usuarioBean); if (sizeof($listaUsuario) != 0) { foreach ($listaUsuario as $user) { $_SESSION['idusuario'] = $user['idusuario']; $_SESSION['usuario'] = $user['usuario']; $_SESSION['idpersona'] = $user['idpersona']; } } echo json_encode($listaUsuario);
<?php include dirname(__FILE__) . '\\..\\modelo\\Persona.php'; include dirname(__FILE__) . '\\..\\modelo\\Mapeador.php'; include dirname(__FILE__) . '\\..\\dao\\PersonaDAO.php'; $persona = new Persona(); $mensaje = ""; $datos = array('documento' => $_POST['persona']['documento'], 'nombres' => $_POST['persona']['nombres'], 'apellidos' => $_POST['persona']['apellidos'], 'telefono1' => $_POST['persona']['telefono1'], 'telefono2' => $_POST['persona']['telefono2'], 'email' => $_POST['persona']['email'], 'direccion' => $_POST['persona']['direccion']); Mapeador::mapearPersona($persona, $datos); $personaDAO = new PersonaDAO(); try { if (array_key_exists("agregar", $_POST)) { $retorno = $personaDAO->insertarPersona($persona); } elseif (array_key_exists("modificar", $_POST)) { $retorno = $personaDAO->actualizarPersona($persona); } elseif (array_key_exists("eliminar", $_POST)) { $retorno = $personaDAO->eliminarPersona($persona); } } catch (Exception $ex) { $mensaje = "HA OCURRIDO UN ERROR!!!: " . $ex->getMessage(); } echo $mensaje . "<p/><a href='../index.php'>Regresar al inicio</a>";