<?php
require_once 'alumno.entidad7.php';
require_once 'alumno.model7.php';
// Logica
$alm = new Categoria();
$model = new CategoriaModel();
if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'actualizar':
// Recupero el id del campo hidden
$alm->__SET('titulo_documento', $_REQUEST['titulo_documento']);
$alm->__SET('proyecto', $_REQUEST['proyecto']);
$alm->__SET('estado', $_REQUEST['estado']);
$alm->__SET('idioma', $_REQUEST['idioma']);
$alm->__SET('num_documento', $_REQUEST['num_documento']);
$alm->__SET('version', $_REQUEST['version']);
$alm->__SET('revision', $_REQUEST['revision']);
$alm->__SET('descripcion', $_REQUEST['descripcion']);
$alm->__SET('fecha', $_REQUEST['fecha']);
$alm->__SET('subcategoria', $_REQUEST['subcategoria']);
$alm->__SET('confidencialidad', $_REQUEST['confidencialidad']);
$alm->__SET('tipo_documento', $_REQUEST['tipo_documento']);
$alm->__SET('acro_usuario', $_REQUEST['acro_usuario']);
$alm->__SET('aprobado_por', $_REQUEST['aprobado_por']);
$alm->__SET('autorizado_por', $_REQUEST['autorizado_por']);
$alm->__SET('revisor', $_REQUEST['revisor']);
$alm->__SET('compania', $_REQUEST['compania']);
$alm->__SET('codigo_proyecto', $_REQUEST['codigo_proyecto']);
$update_results = $model->Actualizar($alm, $_POST['id'],$alm, $_POST['id'],$alm, $_POST['id'],$alm, $_POST['id']);
header('Location: index7.php');
break;
case 'registrar':
$alm->__SET('titulo_documento', $_REQUEST['titulo_documento']);
$alm->__SET('proyecto', $_REQUEST['proyecto']);
$alm->__SET('estado', $_REQUEST['estado']);
$alm->__SET('idioma', $_REQUEST['idioma']);
$alm->__SET('num_documento', $_REQUEST['num_documento']);
$alm->__SET('version', $_REQUEST['version']);
$alm->__SET('revision', $_REQUEST['revision']);
$alm->__SET('descripcion', $_REQUEST['descripcion']);
$alm->__SET('fecha', $_REQUEST['fecha']);
$alm->__SET('subcategoria', $_REQUEST['subcategoria']);
$alm->__SET('confidencialidad', $_REQUEST['confidencialidad']);
$alm->__SET('tipo_documento', $_REQUEST['tipo_documento']);
$alm->__SET('acro_usuario', $_REQUEST['acro_usuario']);
$alm->__SET('aprobado_por', $_REQUEST['aprobado_por']);
$alm->__SET('autorizado_por', $_REQUEST['autorizado_por']);
$alm->__SET('revisor', $_REQUEST['revisor']);
$alm->__SET('compania', $_REQUEST['compania']);
$alm->__SET('codigo_proyecto', $_REQUEST['codigo_proyecto']);
$model->Registrar($alm);
header('Location: index7.php');
break;
case 'eliminar':
$model->Eliminar($_REQUEST['titulo_documento']);
$model->Eliminar($_REQUEST['num_documento']);
$model->Eliminar($_REQUEST['version']);
$model->Eliminar($_REQUEST['revision']);
header('Location: index7.php');
break;
case 'editar':
// Recupero los datos por el id
// $obj_categoria es un objeto del tipo Categoria
$obj_categoria = $model->Obtener($_REQUEST['id']);
break;
default:
// MENSAJE 404 PARA CUANDO LA ACCION NO ES VALIDA
header('HTTP/1.0: 404 Not Found');
die('<h1>404 Page Not Found</h1>');
}
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<title>Anexsoft</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
</head>
<body style="padding:15px;">
<div class="pure-g">
<div class="pure-u-1-12">
<form action="?action=<?php echo isset($obj_categoria) ? 'actualizar' : 'registrar'; ?>" method="POST" class="pure-form pure-form-stacked" style="margin-bottom:30px;">
<input type="" name="id" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('titulo_documento') : ''; ?>" />
<input type="" name="id" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('num_documento') : ''; ?>" />
<input type="" name="id" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('version') : ''; ?>" />
<input type="" name="id" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('revision') : ''; ?>" />
<table style="width:500px;">
<tr>
<th style="text-align:left;">Titulo del Documento</th>
<td><input type="text" name="titulo_documento" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('titulo_documento') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Acronimo Proyecto</th>
<td><input type="text" name="proyecto" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('proyecto') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Estado</th>
<td><input type="text" name="estado" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('estado') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Numero de documento</th>
<td><input type="text" name="num_documento" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('num_documento') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Idioma</th>
<td><input type="text" name="idioma" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('idioma') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Version</th>
<td><input type="text" name="version" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('version') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Revision</th>
<td><input type="text" name="revision" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('revision') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<tr>
<th style="text-align:left;">Descripcion</th>
<td><input type="text" name="descripcion" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('descripcion') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Fecha</th>
<td><input type="text" name="fecha" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('fecha') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Acronimo Subcategoria</th>
<td><input type="text" name="subcategoria" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('subcategoria') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Confidencialidad</th>
<td><input type="text" name="confidencialidad" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('confidencialidad') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Tipo de documento</th>
<td><input type="text" name="tipo_documento" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('tipo_documento') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Usuario</th>
<td><input type="text" name="acro_usuario" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('acro_usuario') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Aprobado por</th>
<td><input type="text" name="aprobado_por" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('aprobado_por') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Autorizado por</th>
<td><input type="text" name="autorizado_por" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('autoriado_por') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Revisor</th>
<td><input type="text" name="revisor" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('revisor') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Compañia</th>
<td><input type="text" name="compania" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('compania') : ''; ?>" style="width:100%;" required /></td>
</tr>
<tr>
<th style="text-align:left;">Codigo del proyecto</th>
<td><input type="text" name="codigo_proyecto" value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('codigo_proyecto') : ''; ?>" style="width:100%;" required/></td>
<td colspan="2">
<button type="submit" class="pure-button pure-button-primary">Guardar</button>
</td>
</tr>
</table>
</form>
<table class="pure-table pure-table-horizontal">
<thead>
<tr>
<th style="text-align:left;">Titulo del documento</th>
<th style="text-align:left;">Acronimo Proyecto</th>
<th style="text-align:left;">Estadp</th>
<th style="text-align:left;">Idioma</th>
<th style="text-align:left;">Nº del documento</th>
<th style="text-align:left;">Version</th>
<th style="text-align:left;">Revision</th>
<th style="text-align:left;">Descripcion</th>
<th style="text-align:left;">Fecha</th>
<th style="text-align:left;">Acronimo Subcategoria</th>
<th style="text-align:left;">Confidencialidad</th>
<th style="text-align:left;">Tipo de documento</th>
<th style="text-align:left;">Usuario</th>
<th style="text-align:left;">Aprobado por</th>
<th style="text-align:left;">Autorizado por</th>
<th style="text-align:left;">Revisor</th>
<th style="text-align:left;">Compañia</th>
<th style="text-align:left;">Codigo proyecto</th>
<th style="text-align:left;">Edicion</th>
<th style="text-align:left;">Eliminar</th>
</tr>
</thead>
<?php foreach ($model->Listar() as $r): ?>
<tr>
<td><?php echo $r->__GET('titulo_documento'); ?></td>
<td><?php echo $r->__GET('proyecto'); ?></td>
<td><?php echo $r->__GET('estado'); ?></td>
<td><?php echo $r->__GET('idioma'); ?></td>
<td><?php echo $r->__GET('num_documento'); ?></td>
<td><?php echo $r->__GET('version'); ?></td>
<td><?php echo $r->__GET('revision'); ?></td>
<td><?php echo $r->__GET('descripcion'); ?></td>
<td><?php echo $r->__GET('fecha'); ?></td>
<td><?php echo $r->__GET('subcategoria'); ?></td>
<td><?php echo $r->__GET('confidencialidad'); ?></td>
<td><?php echo $r->__GET('tipo_documento'); ?></td>
<td><?php echo $r->__GET('acro_usuario'); ?></td>
<td><?php echo $r->__GET('aprobado_por'); ?></td>
<td><?php echo $r->__GET('autorizado_por'); ?></td>
<td><?php echo $r->__GET('revisor'); ?></td>
<td><?php echo $r->__GET('compania'); ?></td>
<td><?php echo $r->__GET('codigo_proyecto'); ?></td>
<td>
<a href="?action=editar&id=<?php echo $r->titulo_documento;echo $r->num_documento; echo $r->version;echo $r->revision; ?>"><img src="icon_editthis.png" width="30px" height="30px"/></a>
</td>
<td>
<a href="?action=eliminar&titulo_documento=<?php echo $r->titulo_documento;echo $r->num_documento;echo $r->version;echo $r->revision; ?>"><img src="delete.png" width="30px" height="30px"/></a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</body>
</html>