File: //home/undanet/dump/data/PortalEmpleo/src/Views/ConvocatoriaBuscadorView.php
<html>
<head>
<title>Listado de Convocatorias</title>
<!--<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> !-->
</head>
<body>
<?php
if(isset($data))
{
$_SERVER['HTTPS'] = $_SERVER['HTTPS'] == 'off' ? '' : $_SERVER['HTTPS'];
$root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
$rootwp = "";
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' || $lang=='en_GB')
{
echo '<label id="lblfiltrar" class="link" onclick ="toggle();">+ Filter</label>';
}
else
{
echo '<label id="lblfiltrar" class="link" onclick ="cambiar();">+ Filtrar</label>';
}
echo '<section id="no-more-tables"><div id="divFiltar" hidden="true">';
/*echo '<table border="0" class="azul nomargin"><thead>';
if($lang == 'en')
{
echo '<tr id="headFiltrar" style="padding-bottom:0.3em;"><th>Reference</th><th>Job Position</th><th>Published on</th><th>End Date</th><th>State</th></tr></thead>';
echo '<tbody><tr id="trFiltrar" style="padding-bottom:0.3em;"><td data-title="Reference"><input type="text"></td><td data-title="Job Position"><input type="text"></td><td data-title="Published on"><input type="date"></td><td data-title="End Date"><input type="date"></td><td data-title="State"></td>';
}
else
{
echo '<tr id="headFiltrar" style="padding-bottom:0.3em;"><th>Referencia</th><th>Puesto Trabajo</th><th>Fecha Publicación</th><th>Fecha Fin</th><th>Estado</th></tr></thead>';
echo '<tbody><tr id="trFiltrar" style="padding-bottom:0.3em;"><td data-title="Referencia"><input type="text"></td><td data-title="Puesto Trabajo"><input type="text"></td><td data-title="Fecha Publicación"><input type="date"></td><td data-title="FechaFin"><input type="date"></td><td data-title="Estado">';
}
$nombreCombo = "EstadoConvocatoria";
include(__DIR__ . "/../Utils/combobox_loader.php");
echo '</td><td></td></tr></tbody></table>';
echo '<table border="0" class="sinlabel"><thead hidden="true"></thead><tbody><tr><td><input type="submit" value="Aplicar Filtros"></td></tr></tbody></table>';*/
if($lang=='en' || $lang=='en_GB')
{
echo '<input id="txtBuscar" type="text" placeholder="Type something to filter" />';
}
else
{
echo '<input id="txtBuscar" type="text" placeholder="Escriba algo para filtrar" />';
}
echo '</div></section>';
echo '<table border="0" class="azul" id="tbResultados"><thead>';
if ( isset($nombreCombo) ){
unset ($nombreCombo);
}
if($lang == 'en')
{
echo '<tr><th>Reference</th><th>Description</th><th>Published on</th><th>End Date</th><th>State</th><th>Document</th></tr>';
}
else
{
echo '<tr><th>Referencia</th><th>Descripción</th><th>Fecha Publicación</th><th>Fecha Fin</th><th>Estado</th><th>Documento</th></tr>';
}
echo '</thead><tbody>';
if($lang == 'en')
{
foreach ($data as $convocatoria) {
echo '<tr class="cebra link" onclick="window.location=\'' . $root . 'en/call-details/?id=' . $convocatoria->getIdconvocatoria() . '\';"><td>';
echo $convocatoria->getReferencia() . '</td>';
echo '<td>' . $convocatoria->getDescripcion() . '</td>';
echo '<td>' . $convocatoria->getFechaInicio()->format('d/m/Y') . '</td>';
echo '<td>' . $convocatoria->getFechaFin()->format('d/m/Y') . '</td>';
echo '<td>' . ($convocatoria->getCodigoestadoconvocatoria())->getEstado() . '</td>';
if($convocatoria->getRutaarchivoresolucionfinal()!= null && strlen(trim($convocatoria->getRutaarchivoresolucionfinal()))>0)
{
//echo '<td class="centrado"><a href="' . $convocatoria->getRutaarchivoresolucionfinal() . '" target="_self"><img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon_Final.png' . '" width="25" height="25" alt="Resolution PDF" class="link"/></a></td>';
echo '<td class="centrado"><a href="' . $root . 'descargaC/?ref=' . $convocatoria->getReferencia() . '&file=' . basename($convocatoria->getRutaarchivoresolucionfinal()) . '" target="_self"> <img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon_Final.png' . '" width="25" height="25" alt="Resolution PDF" class="link"/></a></td>';
}
else
{
//echo '<td class="centrado"><a href="' . $convocatoria->getRutaarchivoconvocatoria() . '" target="_self"><img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon.png' . '" width="25" height="25" alt="Call PDF" class="link"/></a></td>';
echo '<td class="centrado"><a href="' . $root . 'descargaC/?ref=' . $convocatoria->getReferencia() . '&file=' . basename($convocatoria->getRutaarchivoconvocatoria()) . '" target="_self"> <img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon.png' . '" width="25" height="25" alt="Resolution PDF" class="link"/></a></td>';
}
echo '</tr>';
}
}
else
{
foreach ($data as $convocatoria) {
echo '<tr class="cebra link" onclick="window.location=\'' . $root . 'es/detalle-de-convocatoria/?id=' . $convocatoria->getIdconvocatoria() . '\';"><td>';
echo $convocatoria->getReferencia() . '</td>';
echo '<td>' . $convocatoria->getDescripcion() . '</td>';
echo '<td>' . $convocatoria->getFechaInicio()->format('d/m/Y') . '</td>';
echo '<td>' . $convocatoria->getFechaFin()->format('d/m/Y') . '</td>';
echo '<td>' . ($convocatoria->getCodigoestadoconvocatoria())->getEstado() . '</td>';
if($convocatoria->getRutaarchivoresolucionfinal()!= null && strlen(trim($convocatoria->getRutaarchivoresolucionfinal()))>0)
{
//echo '<td class="centrado"><a href="' . $convocatoria->getRutaarchivoresolucionfinal() . '" target="_self"><img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon_Final.png' . '" width="25" height="25" alt="PDF Resolución" class="link"/></a></td>';
echo '<td class="centrado"><a href="' . $root . 'descargaC/?ref=' . $convocatoria->getReferencia() . '&file=' . basename($convocatoria->getRutaarchivoresolucionfinal()) . '" target="_self"> <img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon_Final.png' . '" width="25" height="25" alt="Resolution PDF" class="link"/></a></td>';
}
else
{
//echo '<td class="centrado"><a href="' . $convocatoria->getRutaarchivoconvocatoria() . '" target="_self"><img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon.png' . '" width="25" height="25" alt="PDF Convocatoria" class="link"/></a></td>';
echo '<td class="centrado"><a href="' . $root . 'descargaC/?ref=' . $convocatoria->getReferencia() . '&file=' . basename($convocatoria->getRutaarchivoconvocatoria()) . '" target="_self"> <img id="imgConvocatoria" name="imgConvocatoria" src="' . $root . $rootwp . 'PortalEmpleo/img/' . 'PDF_Icon.png' . '" width="25" height="25" alt="Resolution PDF" class="link"/></a></td>';
}
echo '</tr>';
}
}
echo '</tbody></table>';
}
?>
<script language="javascript">
function toggle() {
var lbl = document.getElementById('lblfiltrar');
var divFiltrar = document.getElementById('divFiltar');
if(divFiltrar.hidden)
{
divFiltrar.hidden = false;
lbl.innerHTML = "- Filter";
}
else
{
divFiltrar.hidden = true;
lbl.innerHTML = "+ Filter";
}
}
function cambiar() {
var lbl = document.getElementById('lblfiltrar');
var divFiltrar = document.getElementById('divFiltar');
if(divFiltrar.hidden)
{
divFiltrar.hidden = false;
lbl.innerHTML = "- Filtrar";
}
else
{
divFiltrar.hidden = true;
lbl.innerHTML = "+ Filtrar";
}
}
var busqueda = document.getElementById('txtBuscar');
buscaTabla = function(){
var table = document.getElementById("tbResultados").tBodies[0];
texto = busqueda.value.toLowerCase();
var r=0;
while(row = table.rows[r++])
{
if ( row.innerText.toLowerCase().indexOf(texto) !== -1 )
row.style.display = null;
else
row.style.display = 'none';
}
}
busqueda.addEventListener('keyup', buscaTabla);
</script>
</body>
</html>