File: //home/undanet/dump/data/PortalEmpleo/src/Views/CandidatoBuscadorView.php
<html>
<head>
<title>Listado de Candidatos</title>
</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">';
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($lang == 'en')
{
echo '<tr><th>Last Name</th><th>Last Name 2</th><th>First Name</th><th>Email</th><th>Document</th><th>Job</th></tr>';
}
else
{
echo '<tr><th>Apellido 1</th><th>Apellido 2</th><th>Nombre</th><th>Email</th><th>Documento</th><th>Perfil</th></tr>';
}
echo '</thead><tbody>';
if($lang == 'en')
{
foreach ($data as $candidato)
{
echo '<tr class="cebra link" onclick="window.location=\'' . $root . 'en/candidate-tab/?id=' . $candidato[0]->getIdcandidato() . '\';">';
echo '<td>' . $candidato[0]->getApellido1() . '</td>';
echo '<td>' . $candidato[0]->getApellido2() . '</td>';
echo '<td>' . $candidato[0]->getNombre() . '</td>';
echo '<td>' . ($candidato[0]->getCodigousuariowp())->getUserEmail() . '</td>';
echo '<td>' . $candidato[0]->getDocumento() . '</td>';
if($candidato[1])
{
echo '<td>' . ($candidato[1]->getCodigoperfil())->getPerfil() . '</td>';
}
else
{
echo '<td></td>';
}
echo '</tr>';
}
}
else
{
foreach ($data as $candidato)
{
echo '<tr class="cebra link" onclick="window.location=\'' . $root . 'es/ficha-candidato/?id=' . $candidato[0]->getIdcandidato() . '\';">';
echo '<td>' . $candidato[0]->getApellido1() . '</td>';
echo '<td>' . $candidato[0]->getApellido2() . '</td>';
echo '<td>' . $candidato[0]->getNombre() . '</td>';
echo '<td>' . ($candidato[0]->getCodigousuariowp())->getUserEmail() . '</td>';
echo '<td>' . $candidato[0]->getDocumento() . '</td>';
if($candidato[1])
{
echo '<td>' . ($candidato[1]->getCodigoperfil())->getPerfil() . '</td>';
}
else
{
echo '<td></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>