File: /home/undanet/dump/data/PortalEmpleo/src/Views/ConvocatoriaViewAdmin.php
<html>
<head>
<title>Listado de Convocatorias</title>
</head>
<body>
<!--<h2 class="cabecera_contenido">Listado de Convocatorias</h2>-->
<?php
const MAX_RESULT_PAG=10;
if(isset($_GET['lang']))
{
switch($_GET['lang'])
{
case 'en':
case 'en_GB':
$lang = 'en';
break;
default:
$lang = 'es';
break;
}
}
else {
$lang = 'es';
}
if($lang == 'en')
{
echo '<form method="post" action=""><table><tbody><tr><td><input type="submit" name="accionConvocatoria" value="Add a new call"></td></tr></tbody></table></form>';
echo '<table border="0">
<tr>
<td style="vertical-align:top" width="18%">
Reference
</td>
<td style="vertical-align:top" width="18%">
Published on
</td>
<td style="vertical-align:top" width="60%">
State
</td>
</tr>
<tr>
<td style="vertical-align:top" width="15%" colspan=3>';
$i = 0;
foreach ($data as $convocatoria)
{
if($i % MAX_RESULT_PAG == 0)
{
if($i>0)
{
echo '</div>';
}
$pag = intdiv($i, MAX_RESULT_PAG) + 1;
echo $pag==1 ? '<div id="p' . $pag . '">' : '<div id="p' . $pag . '" hidden>';
}
echo '<form method="post" action="">
<table class="nomargin"><tbody><tr><td width="20%">
<input type="hidden" name="convocatoriaId" value="'. $convocatoria->getIdconvocatoria() .'">
<input type="text" name="referencia" id="'. $convocatoria->getReferencia() .'" value="' . $convocatoria->getReferencia() . '" disabled="true" class="full_width">
</td>';
echo '<td width="20%"><input type="text" name="fechainicio" id="'. $convocatoria->getFechaInicio()->format('d-m-Y') .'" value="' , $convocatoria->getFechaInicio()->format('d-m-Y') . '" disabled="true" class="full_width"></td>';
echo '<td width="60%"><input type="text" name="estadoconvocatoria" id="'. ($convocatoria->getCodigoestadoconvocatoria())->getIdestadoconvocatoria() .'" value="' , ($convocatoria->getCodigoestadoconvocatoria())->getEstado() . '" disabled="true" class="full_width"></td>';
echo '<td><input type="submit" name="accionConvocatoria" value="Modify" id="' . $convocatoria->getIdconvocatoria() . '">
</td></tr></tbody></table></form>';
$i++;
}
echo '</td></tr></table>';
$p = intdiv(count($data), MAX_RESULT_PAG) + 1;
if($p > 1 && (count($data) != MAX_RESULT_PAG))
{
echo '<div class="pagination">';
for ($x=0; $x<$p; $x++) {
echo '<input type="button" id="b' . ($x+1) .'" value="'. ($x+1) .'" onClick="fncpaginacion(this,' . $p . ');">';
}
echo '</div><br>';
echo'<script language="javascript">
document.getElementById("b1").setAttribute("class","active");
function fncpaginacion(object,pag)
{
for (var j = 1; j <= pag; j++)
{
var pagina = "p" + j;
var boton = "b" + j;
document.getElementById(boton).removeAttribute("class");
if(j==object.getAttribute("value"))
{
document.getElementById(pagina).hidden = false;
object.setAttribute("class","active");
}
else
{
document.getElementById(pagina).hidden = true;
}
}
}
</script>';
}
echo '<form method="post" action=""><input type="submit" name="accionConvocatoria" value="Add a new call"></form>';
}
else
{
echo '<form method="post" action=""><table><tbody><tr><td><input type="submit" name="accionConvocatoria" value="Nueva Convocatoria"></td></tr></tbody></table></form>';
echo '<table border="0">
<tr>
<td style="vertical-align:top" width="18%">
Refencia
</td>
<td style="vertical-align:top" width="18%">
Fecha de Publicación
</td>
<td style="vertical-align:top" width="60%">
Estado
</td>
</tr>
<tr>
<td style="vertical-align:top" width="15%" colspan=3>';
$i = 0;
foreach ($data as $convocatoria)
{
if($i % MAX_RESULT_PAG == 0)
{
if($i>0)
{
echo '</div>';
}
$pag = intdiv($i, MAX_RESULT_PAG) + 1;
echo $pag==1 ? '<div id="p' . $pag . '">' : '<div id="p' . $pag . '" hidden>';
}
echo '<form method="post" action="">
<table class="nomargin"><tbody><tr><td width="20%">
<input type="hidden" name="convocatoriaId" value="'. $convocatoria->getIdconvocatoria() .'">
<input type="text" name="referencia" id="'. $convocatoria->getReferencia() .'" value="' . $convocatoria->getReferencia() . '" disabled="true" class="full_width">
</td>';
echo '<td width="20%"><input type="text" name="fechainicio" id="'. $convocatoria->getFechaInicio()->format('d-m-Y') .'" value="' , $convocatoria->getFechaInicio()->format('d-m-Y') . '" disabled="true" class="full_width"></td>';
echo '<td width="60%"><input type="text" name="estadoconvocatoria" id="'. ($convocatoria->getCodigoestadoconvocatoria())->getIdestadoconvocatoria() .'" value="' , ($convocatoria->getCodigoestadoconvocatoria())->getEstado() . '" disabled="true" class="full_width"></td>';
echo '<td><input type="submit" name="accionConvocatoria" value="Modificar" id="' . $convocatoria->getIdconvocatoria() . '">
</td></tr></tbody></table></form>';
$i++;
}
echo '</td></tr></table>';
$p = intdiv(count($data), MAX_RESULT_PAG) + 1;
if($p > 1 && (count($data) != MAX_RESULT_PAG))
{
echo '<div class="pagination">';
for ($x=0; $x<$p; $x++) {
echo '<input type="button" id="b' . ($x+1) .'" value="'. ($x+1) .'" onClick="fncpaginacion(this,' . $p . ');">';
}
echo '</div><br>';
echo'<script language="javascript">
document.getElementById("b1").setAttribute("class","active");
function fncpaginacion(object,pag)
{
for (var j = 1; j <= pag; j++)
{
var pagina = "p" + j;
var boton = "b" + j;
document.getElementById(boton).removeAttribute("class");
if(j==object.getAttribute("value"))
{
document.getElementById(pagina).hidden = false;
object.setAttribute("class","active");
}
else
{
document.getElementById(pagina).hidden = true;
}
}
}
</script>';
}
echo '<form method="post" action=""><input type="submit" name="accionConvocatoria" value="Nueva Convocatoria"></form>';
}
?>
</body>
</html>