File: /home/undanet/www//PortalEmpleo/src/Views/ConvocatoriaViewAdmin.php
<?php
const MAX_RESULT_PAG=10;
if(current_user_can('administrator')) {
echo '<form method="post" action=""><table><tbody><tr><td><input type="submit" name="accionConvocatoria" value="' . __( 'Add a new call', 'panoramic_child' ) . '"></td></tr></tbody></table></form>';
}
echo '<table border="0">
<tr>
<td style="vertical-align:top" width="20%">
' . __( 'Reference', 'panoramic_child' ) . '
</td>
<td style="vertical-align:top" width="26.5%">
' . __( 'Published on', 'panoramic_child') . '
</td>
<td style="vertical-align:top">
' . __( 'State', 'panoramic_child' ) . '
</td>
<td style="vertical-align:top">
</td>
</tr>
<tr>
<td style="vertical-align:top" width="15%" colspan=3>';
$i = 0;
$j = 0;
$misconvocatorias = array();
if( isset($data['ltribunal']) ) {
foreach ($data['ltribunal'] as $ltribunal) {
if( ! $ltribunal->getEssuplente() ){
array_push( $misconvocatorias, ($ltribunal->getCodigoconvocatoria())->getIdconvocatoria() );
}
}
}
if( isset($data['lConvocatorias']) ) {
foreach ($data['lConvocatorias'] as $convocatoria)
{
$tieneExamen = $convocatoria->getTieneExamen() ? 'class="tieneExamen"' : '';
//echo count($ltribunal);
if( current_user_can('administrator') || in_array( $convocatoria->getIdconvocatoria(), $misconvocatorias) ) {
$j++;
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 . '" class="conv-pages">' : '<div id="p' . $pag . '" class="conv-pages" hidden>';
}
echo '<form method="post" action="" id="manage_call-' . $j . '"/>
<table class="nomargin"><tbody><tr><td width="20%" ' . $tieneExamen . '>
<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 ' . $tieneExamen . '><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 ' . $tieneExamen . '><input type="text" name="estadoconvocatoria" id="'. ($convocatoria->getCodigoestadoconvocatoria())->getIdestadoconvocatoria() .'" value="' , ($convocatoria->getCodigoestadoconvocatoria())->getEstado() . '" disabled="true" class="full_width"></td>';
echo '<td style=" width: 300px;">';
if(current_user_can('administrator')) {
echo '<button type="submit" name="accionConvocatoria" value="' . __( 'Modify', 'panoramic_child' ) . '" id="' . $convocatoria->getIdconvocatoria() . '" title="' . __( 'Modify', 'panoramic_child' ) . '">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16">
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
</svg>
</button>';
}
if(current_user_can('administrator')) {
echo '<button type="submit" name="accionConvocatoria" value="' . __( 'Modify', 'panoramic_child' ) . '" id="resolutions-' . $convocatoria->getIdconvocatoria() . '" class="toresolutions" title="' . __( 'Edit Resolutions, Requirements and Merits', 'panoramic_child' ) . '">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-folder" viewBox="0 0 16 16">
<path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4H2.19zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707z"/>
</svg>
</button>';
}
echo '<button type="submit" name="accionConvocatoria" value="GestionarValoraciones" id="' . $convocatoria->getIdconvocatoria() . '" class="tocall" title="' . __( 'Manage Valorations', 'panoramic_child' ) . '">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard-data" viewBox="0 0 16 16">
<path d="M4 11a1 1 0 1 1 2 0v1a1 1 0 1 1-2 0v-1zm6-4a1 1 0 1 1 2 0v5a1 1 0 1 1-2 0V7zM7 9a1 1 0 0 1 2 0v3a1 1 0 1 1-2 0V9z"/>
<path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
<path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
</svg>
</button>';
if( ($convocatoria->getCodigoestadoconvocatoria())->getIdestadoconvocatoria() == 10 ) {
echo '<button type="submit" name="accionConvocatoria" value="AprobacionesRequisisto" conv-id="' . $convocatoria->getIdconvocatoria() . '" class="toaprove" title="' . __( 'Aprove Valorations', 'panoramic_child' ) . '">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-square" viewBox="0 0 16 16">
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
<path d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.235.235 0 0 1 .02-.022z"/>
</svg>
</button>';
}
if( ($convocatoria->getCodigoestadoconvocatoria())->getIdestadoconvocatoria() == 12 ) {
echo '<button type="submit" name="accionConvocatoria" value="AprobacionesMerito" conv-id="' . $convocatoria->getIdconvocatoria() . '" class="toaprove" title="' . __( 'Aprove Valorations', 'panoramic_child' ) . '">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-square" viewBox="0 0 16 16">
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
<path d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.235.235 0 0 1 .02-.022z"/>
</svg>
</button>';
}
if( ($convocatoria->getCodigoestadoconvocatoria())->getIdestadoconvocatoria() == 15 ) {
echo '<button type="submit" name="accionConvocatoria" value="AprobacionesExamen" conv-id="' . $convocatoria->getIdconvocatoria() . '" class="toaprove" title="' . __( 'Aprove Valorations', 'panoramic_child' ) . '">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-square" viewBox="0 0 16 16">
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
<path d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.235.235 0 0 1 .02-.022z"/>
</svg>
</button>';
}
echo ' </td></tr></tbody></table></form>';
$i++;
}
}
}
echo '</td></tr></table>';
?>
<script>
jQuery( document ).ready(function($) {
$( '.toresolutions' ).click( function (e) {
var inputHTML = document.createElement("input");
inputHTML.type = "hidden";
inputHTML.name = "toresolutions";
inputHTML.value = "toresolutions";
$(this).closest( "form" ).append( inputHTML );
});
$( '.tocall' ).click( function (e) {
var inputHTML = document.createElement("input");
inputHTML.type = "hidden";
inputHTML.name = "codigoUsuarioWP";
inputHTML.value = "<?php echo get_current_user_id(); ?>";
$(this).closest( "form" ).append( inputHTML );
var inputHTML = document.createElement("input");
inputHTML.type = "hidden";
inputHTML.name = "slctConvocatorias";
inputHTML.value = $(this).attr('id');
$(this).closest( "form" ).append( inputHTML );
});
$( '.toaprove' ).click( function (e) {
var inputHTML = document.createElement("input");
inputHTML.type = "hidden";
inputHTML.name = "codigoUsuarioWP";
inputHTML.value = "<?php echo get_current_user_id(); ?>";
$(this).closest( "form" ).append( inputHTML );
var inputHTML = document.createElement("input");
inputHTML.type = "hidden";
inputHTML.name = "slctConvocatorias";
inputHTML.value = $(this).attr('conv-id');
$(this).closest( "form" ).append( inputHTML );
});
});
</script>
<?php
$p = intdiv(count($data['lConvocatorias']), 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>';
}
if(current_user_can('administrator')) {
echo '<form method="post" action=""><input type="submit" name="accionConvocatoria" value="' . __( 'Add a new call', 'panoramic_child' ) . '"></form>';
}
?>