File: /home/undanet/dump/data/PortalEmpleo/src/Views/FormularioInscripcionConvocatoriaView.php
<html>
<head>
<title>Inscripción para la convocatoria</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>
<form method="post" name="frmInscripcionConvocatoria" id="frmInscripcionConvocatoria" action="" enctype="multipart/form-data">
<?php
const SEPARADOR_PUESTOS_TRABAJO=';';
if(isset($data))
{
$_SERVER['HTTPS'] = $_SERVER['HTTPS'] == 'off' ? '' : $_SERVER['HTTPS'];
$root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
$rootwp = "";
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if(isset($_GET['lang']))
{
switch($_GET['lang'])
{
case 'en':
case 'en_GB':
$lang = 'en';
break;
default:
$lang = 'es';
break;
}
}
else {
$lang = 'es';
}
//if(isset($data['candidato']) && is_object($data['candidato']))
if(!isset($data['candidato']) || !is_object($data['candidato']))
{
if($lang=='en' || $lang=='en_GB')
{
echo '<div class="fondo_color"><u>You must fill your candidate profile</u> before apply to a call register. You can do it at <a href="' . $root . $rootwp . 'en/candidate-profile/?c=' . $_GET['id'] . '" target="_self" class="underline bold">this link</a>.</div>';
}
else
{
echo '<div class="fondo_color">Para inscribirte en alguna convocatoria <u>debes rellenar primero tu perfil de candidato</u>. Puedes hacerlo en el <a href="' . $root . $rootwp . 'es/perfil-del-candidato/?c=' . $_GET['id'] . '" target="_self" class="underline bold">siguiente enlace</a>.</div>';
}
}
else
{
if(isset($data['convocatoria']) && is_object($data['convocatoria']))
{
echo '<section id="infoconvocatoria"><div class="fondo_color">';
if($lang=='en' || $lang=='en_GB')
{
echo '<span class="underline bold">Info about the call</span>:';
echo '<br><br><ul class="lista_none"><li><span class="bold">Reference:</span> ' . $data['convocatoria']->getReferencia() . '</li><li><span class="bold">Description:</span> ' . $data['convocatoria']->getDescripcion() . '</li><li><span class="bold">Job:</span> ' . $data['convocatoria']->getPuestoTrabajo() . '</li><li><span class="bold">Center:</span> ' . $data['convocatoria']->getCentro() . '</li>';
}
else
{
echo '<span class="underline bold">Resumen de la convocatoria</span>:';
echo '<br><br><ul class="lista_none"><li><span class="bold">Referencia:</span> ' . $data['convocatoria']->getReferencia() . '</li><li><span class="bold">Descripción:</span> ' . $data['convocatoria']->getDescripcion() . '</li><li><span class="bold">Puesto Trabajo:</span> ' . $data['convocatoria']->getPuestoTrabajo() . '</li><li><span class="bold">Centro:</span> ' . $data['convocatoria']->getCentro() . '</li>';
}
echo '</p></div></section>';
if($lang=='en' || $lang=='en_GB')
{
echo '<div class="">When you register for this call, your personal data from your profile will be used. If you wish, you can check and update them at <a href="' . $root . $rootwp . 'en/candidate-profile/?c=' . $_GET['id'] . '" target="_self" class=""><u>this link</u></a>.</div>';
}
else
{
echo '<div class="">Al inscribirte en esta convocatoria se emplearán tus datos personales de tu perfil. Si lo deseas puedes consultarlos y/o actualizarlos en el <a href="' . $root . $rootwp . 'es/perfil-del-candidato/?c=' . $_GET['id'] . '" target="_self" class=""><u>siguiente enlace</u></a>.</div>';
}
echo '<div style="padding: 1em 2em 1em 2em;"><table class="borde_color_suave_2"><tbody><tr>';
if($lang=='en' || $lang=='en_GB')
{
echo '<td class="borde"><label for="slctPuestoTrabajo">Job:</label><label class="red nomargin">*</label></td>';
}
else
{
echo '<td class="borde"><label for="slctPuestoTrabajo">Puesto Trabajo:</label><label class="red nomargin">*</label></td>';
}
$lpuestos = explode(SEPARADOR_PUESTOS_TRABAJO, $data['convocatoria']->getPuestoTrabajo());
echo '<td>' . generarHTML('PuestoTrabajo', $lpuestos) . '</td></tr>';
echo '<tr><td>';
if($lang=='en' || $lang=='en_GB')
{
echo '<label for="flCV">Curriculum Vitae <small>(Max. 10MB)</small>:</label><label class="red nomargin">*</label></td>';
}
else
{
echo '<label for="flCV">Curriculum Vitae <small>(Max. 10MB)</small>:</label><label class="red nomargin">*</label></td>';
}
echo '</td><td><table class="nomargin"><tbody><tr>';
if(isset($data['candidato']) && is_object($data['candidato']) && strlen(trim($data['candidato']->getRutacv()))>0)
{
echo '<td class="noborde nofondo"><input type="text" id="txtflCV" name="txtflCV" value="' . $data['candidato']->getRutacv() . '" hidden></td></tr><tr>';
//echo '<td><a href="../../portalempleo/src/Utils/download.php?id=' . $data['candidato']->getIdcandidato() . '&file=' . basename($data['candidato']->getRutacv()) . '" target="_blank">' . basename($data['candidato']->getRutacv()) . '</a></td></tr><tr>';
echo '<td class="noborde nofondo"><a id="linkCV" name="linkCV" href="' . $root . 'descarga/?id=' . ($data['candidato']->getCodigousuariowp())->getId() . '&file=' . basename($data['candidato']->getRutacv()) . '" target="_blank" hidden>' . basename($data['candidato']->getRutacv()) . '</a></td></tr><tr>';
echo '<td class="noborde nofondo"><input type="file" name="flCV" id="flCV" accept=".doc,.docx,application/msword,.pdf,application/pdf" value="' . $data['candidato']->getRutacv() . '"></td>';
}
else
{
echo '<td class="noborde nofondo"><input type="file" name="flCV" id="flCV" accept=".doc,.docx,application/msword,.pdf,application/pdf" required></td>';
}
if($lang=='en' || $lang=='en_GB')
{
echo '<td class="noborde nofondo"><div name="flCVError" id ="flCVError" hidden="true" class="red">Admitted files .doc, .docx y .pdf</div></td>';
}
else
{
echo '<td class="noborde nofondo"><div name="flCVError" id ="flCVError" hidden="true" class="red">Admite .doc, .docx y .pdf</div></td>';
}
echo '</tr></tbody></table>';
if($lang=='en' || $lang=='en_GB')
{
echo '</tr><tr><td style="padding-left: 5%;" class="borde"><input type="checkbox" id="chkCVPerfil" name="chkCVPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Use CV from my profile</label></td>';
}
else
{
echo '</tr><tr><td style="padding-left: 5%;" class="borde"><input type="checkbox" id="chkCVPerfil" name="chkCVPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Utilizar el CV de mi perfil</label></td>';
}
echo '</td><tr><td>';
if($lang=='en' || $lang=='en_GB')
{
echo '<label for="flCartaPresentacion">Cover Letter <small>(Max. 10MB)</small>:</label></td>';
}
else
{
echo '<label for="flCartaPresentacion">Carta de Presentación <small>(Max. 10MB)</small>:</label></td>';
}
echo '</td><td><table class="nomargin"><tbody><tr>';
if(isset($data['candidato']) && is_object($data['candidato']) && strlen(trim($data['candidato']->getRutacp()))>0)
{
echo '<td class="noborde nofondo"><input type="text" id="txtflCartaPresentacion" name="txtflCartaPresentacion" value="' . $data['candidato']->getRutacp() . '" hidden></td></tr><tr>';
//echo '<td><a href="../../portalempleo/src/Utils/download.php?id=' . $data['candidato']->getIdcandidato() . '&file=' . basename($data['candidato']->getRutacp()) . '" target="_blank">' . basename($data['candidato']->getRutacp()) . '</a></td></tr><tr>';
echo '<td class="noborde nofondo"><a id="linkCP" name="linkCP" href="' . $root . 'descarga/?id=' . ($data['candidato']->getCodigousuariowp())->getId() . '&file=' . basename($data['candidato']->getRutacp()) . '" target="_blank" hidden>' . basename($data['candidato']->getRutacp()) . '</a></td></tr><tr>';
echo '<td class="noborde nofondo"><input type="file" name="flCartaPresentacion" id="flCartaPresentacion" accept=".doc,.docx,application/msword,.pdf,application/pdf" value="' . $data['candidato']->getRutacp() . '"></td>';
}
else
{
echo '<td class="noborde nofondo"><input type="file" name="flCartaPresentacion" id="flCartaPresentacion" accept=".doc,.docx,application/msword,.pdf,application/pdf" required></td>';
}
if($lang=='en' || $lang=='en_GB')
{
echo '<td class="noborde nofondo"><div name="flCartaPresentacionError" id ="flCartaPresentacionError" hidden="true" class="red">Admitted files .doc, .docx y .pdf</div></td>';
}
else
{
echo '<td class="noborde nofondo"><div name="flCartaPresentacionError" id ="flCartaPresentacionError" hidden="true" class="red">Admite .doc, .docx y .pdf</div></td>';
}
echo '</tr></tbody></table>';
if(isset($data['candidato']) && is_object($data['candidato']) && strlen(trim($data['candidato']->getRutacp()))>0)
{
if($lang=='en' || $lang=='en_GB')
{
echo '</tr><tr><td style="padding-left: 5%;"><input type="checkbox" id="chkCPPerfil" name="chkCPPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Use the cover letter from my profile</label></td>';
}
else
{
echo '</tr><tr><td style="padding-left: 5%;"><input type="checkbox" id="chkCPPerfil" name="chkCPPerfil" value="false"><label for="chkCVPerfil" style="font-size:small;">Utilizar la carta de presentación de mi perfil</label></td>';
}
}
echo '</td></tr></tbody></table></div>';
echo'<script language="javascript">
var filesA = [];
var filesR = [];
var file = document.getElementById("flCV");
file.onchange = function(e) {
var fileError = document.getElementById("flCVError");
var ext = this.value.match(/\.([^\.]+)$/)[1];
switch (ext) {
case "doc":
case "docx":
case "pdf":
//alert("Allowed");
fileError.hidden = true;
this.style.fontWeight="bold";
break;
default:
//alert("Not allowed");
this.value = "";
fileError.hidden = false;
this.style.fontWeight="unset";
break;
}
};
var file2 = document.getElementById("flCartaPresentacion");
file2.onchange = function(e) {
var fileError2 = document.getElementById("flCartaPresentacionError");
var ext = this.value.match(/\.([^\.]+)$/)[1];
switch (ext) {
case "doc":
case "docx":
case "pdf":
//alert("Allowed");
fileError2.hidden = true;
this.style.fontWeight="bold";
break;
default:
//alert("Not allowed");
fileError2.hidden = false;
this.value = "";
this.style.fontWeight="unset";
break;
}
};
var chkCV = document.getElementById("chkCVPerfil");
chkCV.onchange = function(e) {
var aCV = document.getElementById("linkCV");
var fileCV = document.getElementById("flCV");
if(chkCV.checked)
{
aCV.hidden = false;
fileCV.hidden = true;
}
else
{
aCV.hidden = true;
fileCV.hidden = false;
}
};
var chkCP = document.getElementById("chkCPPerfil");
chkCP.onchange = function(e) {
var aCP = document.getElementById("linkCP");
var fileCP = document.getElementById("flCartaPresentacion");
if(chkCP.checked)
{
aCP.hidden = false;
fileCP.hidden = true;
}
else
{
aCP.hidden = true;
fileCP.hidden = false;
}
};
</script>';
if(isset($data['requisitos']) && $data['requisitos']!= null)
{
echo '<hr><section id="inforequisitos"><div class="fondo_color header-image">';
if($lang=='en' || $lang=='en_GB')
{
echo '<span class="underline bold">Requirements</span>:';
echo '<br><br><ul class="lista_none">';
$i=1;
foreach ($data['requisitos'] as $req) {
echo '<li>';
if($req->getObligatorio())
{
echo '<span class="red">*</span>';
}
echo '<span class="bold">Requirement '. $i . ': ' . $req->getRequisito() . '</span></li><li>' . $req->getDescripcion() . '</li>';
if($req != $data['requisitos'][count($data['requisitos'])-1])
{
echo '<br>';
}
$i++;
}
echo '</ul>';
}
else
{
echo '<span class="underline bold">Requisitos</span>:';
echo '<br><br><ul class="lista_none">';
$i = 1;
foreach ($data['requisitos'] as $req) {
echo '<li>';
if($req->getObligatorio())
{
echo '<span class="red">*</span>';
}
echo '<span class="bold">Requisito '. $i . ': ' . $req->getRequisito() . '</span></li><li>' . $req->getDescripcion() . '</li>';
if($req != $data['requisitos'][count($data['requisitos'])-1])
{
echo '<br>';
}
$i++;
}
echo '</ul>';
}
echo '</div>';
if($lang=='en' || $lang=='en_GB')
{
echo '<br>Do not forget to attach the necessary files to evidence that you meet the requirements of the call';
echo '<br><div style="font-size: small;">Admitted Files: pdf, microsoft word, images (jpg,png,gif,bmp) until 10MB</div>';
}
else
{
echo '<br>No olvides adjuntar los archivos necesarios para demostrar que cumples con los requisitos de la convocatoria';
echo '<br><div style="font-size: small;">Ficheros Admitidos: pdf, microsoft word, imagenes (jpg,png,gif,bmp) hasta 10MB</div>';
}
echo '<input type="text" name="txtRequisitos" id="txtRequisitos" value="' . count($data['requisitos']) . '" hidden>';
echo '<div style="padding: 1em 2em 1em 2em;"><table class="borde_color_suave"><tbody><tr>';
for ($i=1; $i<=count($data['requisitos']); $i++) {
if($lang=='en' || $lang=='en_GB')
{
echo '<td>';
if($data['requisitos'][$i-1]->getObligatorio())
{
echo '<span class="red">*</span>';
}
echo 'Requirement ' . $i . '</td>';
}
else
{
echo '<td>';
if($data['requisitos'][$i-1]->getObligatorio())
{
echo '<span class="red">*</span>';
}
echo 'Requisito ' . $i . '</td>';
}
echo '<td><input type="file" name="R' . $i . '_A" id="flReq' . $i . 'A" accept=".doc,.docx,application/msword,.pdf,application/pdf,.jpg,.jpeg,image/jpg,.png,image/png,.bmp,image/bmp,.gif,image/gif" class="small_padding"';
if($data['requisitos'][$i-1]->getObligatorio())
{
echo ' required ';
}
echo '><p class="nomargin"></p>';
echo '<input type="file" name="R' . $i . '_R" id="flReq' . $i . 'R" accept=".doc,.docx,application/msword,.pdf,application/pdf,.jpg,.jpeg,image/jpg,.png,image/png,.bmp,image/bmp,.gif,image/gif" class="small_padding" hidden></td>';
echo '</tr>';
echo'<script language="javascript">
var x = ' . $i .';
filesA[x-1]= document.getElementById("flReq' . $i . 'A");
filesA[x-1].onchange = function(e) {
var flR = document.getElementById("flReq' . $i . 'R");
var ext = this.value.match(/\.([^\.]+)$/)[1];
switch (ext) {
case "doc":
case "docx":
case "pdf":
case "jpg":
case "jpeg":
case "png":
case "bmp":
case "gif":
//alert("Allowed");
this.style.fontWeight="bold";
flR.hidden = false;
break;
default:
//alert("Not allowed");
this.value = "";
this.style.fontWeight="unset";
flR.hidden = true;
break;
}
};
filesR[x-1]= document.getElementById("flReq' . $i . 'R");
filesR[x-1].onchange = function(e) {
var ext = this.value.match(/\.([^\.]+)$/)[1];
switch (ext) {
case "doc":
case "docx":
case "pdf":
case "jpg":
case "jpeg":
case "png":
case "bmp":
case "gif":
//alert("Allowed");
this.style.fontWeight="bold";
break;
default:
//alert("Not allowed");
this.value = "";
this.style.fontWeight="unset";
//this.hidden = true;
break;
}
};
</script>';
}
echo '</tbody></table></div>';
echo '</section>';
}
if(isset($data['meritos']) && $data['meritos']!= null)
{
echo '<hr><section id="infomeritos"><div class="fondo_color header-image">';
if($lang=='en' || $lang=='en_GB')
{
echo '<span class="underline bold">Merits</span>:';
echo '<br><br><ul class="lista_none">';
$i = 1;
foreach ($data['meritos'] as $mrt) {
echo '<li><span class="bold">Merit '. $i . ': ' . $mrt->getMerito() . '</span></li><li>' . $mrt->getDescripcion() . '</li>';
if($mrt != $data['meritos'][count($data['meritos'])-1])
{
echo '<br>';
}
$i++;
}
echo '</ul>';
}
else
{
echo '<span class="underline bold">Méritos</span>:';
echo '<br><br><ul class="lista_none">';
$i = 1;
foreach ($data['meritos'] as $mrt) {
echo '<li><span class="bold">Mérito '. $i . ': ' . $mrt->getMerito() . '</span></li><li>' . $mrt->getDescripcion() . '</li>';
if($mrt != $data['meritos'][count($data['meritos'])-1])
{
echo '<br>';
}
$i++;
}
echo '</ul>';
}
echo '</div>';
if($lang=='en' || $lang=='en_GB')
{
echo '<br>If you meet any merit of the call, please attach the necessary documentary evidence';
echo '<br><div style="font-size: small;">Admitted Files: pdf, microsoft word, images (jpg,png,gif,bmp) until 10MB</div>';
}
else
{
echo '<br>Si cumples con algún mérito, adjunta los archivos necesarios';
echo '<br><div style="font-size: small;">Ficheros Admitidos: pdf, microsoft word, imagenes (jpg,png,gif,bmp) hasta 10MB</div>';
}
echo '<input type="text" name="txtMeritos" id="txtMeritos" value="' . count($data['meritos']) . '" hidden>';
echo '<div style="padding: 1em 2em 1em 2em;"><table class="borde_color_suave"><tbody><tr>';
for ($i=1; $i<=count($data['meritos']); $i++) {
if($lang=='en' || $lang=='en_GB')
{
echo '<td>Merit ' . $i . '</td>';
}
else
{
echo '<td>Mérito ' . $i . '</td>';
}
echo '<td><input type="file" name="M' . $i . '_A" id="flMrt' . $i . 'A" accept=".doc,.docx,application/msword,.pdf,application/pdf,.jpg,.jpeg,image/jpg,.png,image/png,.bmp,image/bmp,.gif,image/gif" class="small_padding"><p class="nomargin"></p>';
echo '<input type="file" name="M' . $i . '_R" id="flMrt' . $i . 'R" accept=".doc,.docx,application/msword,.pdf,application/pdf,.jpg,.jpeg,image/jpg,.png,image/png,.bmp,image/bmp,.gif,image/gif" class="small_padding" hidden></td>';
echo '</tr>';
echo'<script language="javascript">
var x = ' . $i .';
filesA[x-1]= document.getElementById("flMrt' . $i . 'A");
filesA[x-1].onchange = function(e) {
var flR = document.getElementById("flMrt' . $i . 'R");
var ext = this.value.match(/\.([^\.]+)$/)[1];
switch (ext) {
case "doc":
case "docx":
case "pdf":
case "jpg":
case "jpeg":
case "png":
case "bmp":
case "gif":
//alert("Allowed");
this.style.fontWeight="bold";
flR.hidden = false;
break;
default:
//alert("Not allowed");
this.value = "";
this.style.fontWeight="unset";
flR.hidden = true;
break;
}
};
filesR[x-1]= document.getElementById("flMrt' . $i . 'R");
filesR[x-1].onchange = function(e) {
var ext = this.value.match(/\.([^\.]+)$/)[1];
switch (ext) {
case "doc":
case "docx":
case "pdf":
case "jpg":
case "jpeg":
case "png":
case "bmp":
case "gif":
//alert("Allowed");
this.style.fontWeight="bold";
break;
default:
//alert("Not allowed");
this.value = "";
this.style.fontWeight="unset";
break;
}
};
</script>';
}
echo '</tbody></table></div>';
echo '</section>';
}
}
}
}
else
{
echo '<script language="javascript">history.back();</script>';
}
function generarHTML($nombrecombo, $lvalorescombo)
{
//generar el codigo html del combo y devolverlo
$htmlcombo = '<select name="slct' . $nombrecombo . '" id="slct' . $nombrecombo . '" >';
foreach ($lvalorescombo as $val) {
$htmlcombo = $htmlcombo . '<option value="' . trim($val) . '" >' . trim($val) . '</option>';
}
$htmlcombo = $htmlcombo . '</select>';
return $htmlcombo;
}
?>
<?php
echo '<table class="nomargin"><tbody><tr><td><input type="text" id="accionConvocatoria" name="accionConvocatoria" value="" hidden></td></tr></tbody></table>';
if(isset($data['candidato']) && is_object($data['candidato']))
{
echo '<input type="text" name="txtCdt" id="txtCdt" value="' . $data['candidato']->getIdcandidato() . '" hidden>';
echo '<input type="text" name="codigoUsuarioWP" id="codigoUsuarioWP" value="' . ($data['candidato']->getCodigousuariowp())->getId() . '" hidden>';
echo '<input type="text" name="txtCvt" id="txtCvt" value="' . $data['convocatoria']->getIdconvocatoria() . '" hidden>';
}
if($lang=='en' || $lang=='en_GB')
{
echo '<input type="button" name="btnaccionConvocatoria" value="Register" onClick="fnccandidatoconvocatoriasubmit(this,\'' . trim($lang) . '\');">';
}
else
{
echo '<input type="button" name="btnaccionConvocatoria" value="Inscribirse" onClick="fnccandidatoconvocatoriasubmit(this,\'' . trim($lang) . '\');">';
}
echo '<script language="javascript">
function validar() {
if(document.getElementById("chkCVPerfil").checked || document.getElementById("flCV").value.trim().length>0)
{
return true;
}
return false;
}
function validar_requisitos() {';
echo'var x = ' . count($data['requisitos']) .';
for(i=1 ; i<=x ; i++)
{
var id= "flReq" + i + "A";
//alert(id);
if(document.getElementById(id).required == true && ( document.getElementById(id).value == null || document.getElementById(id).value.trim().length<=0))
{
return false;
}
}
return true;
';
echo '}';
echo 'function fnccandidatoconvocatoriasubmit(object,lang) {
if(validar() && validar_requisitos())
{
if(lang=="en" || lang=="en_GB")
{
var msg = "Do you want to register at this call?";
}
else
{
var msg = "¿Quieres inscribirte en esta convocatoria?";
}
if(confirm(msg))
{
document.getElementById("accionConvocatoria").value = "InscribirCandidato";
document.getElementById("frmInscripcionConvocatoria").submit();
}
}
else
{
if(!validar())
{
if(lang=="en" || lang=="en_GB")
{
alert("You must attach a curriculum file or mark the check if you want to use your profile\'s one");
}
else
{
alert("Debe adjuntar un curriculum o indicar que desea utilizar el de su perfil");
}
}
if(!validar_requisitos())
{
if(lang=="en" || lang=="en_GB")
{
alert("There are mandatory requirements, You must attach file(s) to certify that they are met");
}
else
{
alert("Existen requisitos obligatorios, debe adjuntar algún archivo para demostrar que los cumple");
}
}
}
}
</script>';
?>
</form>
</body>
</html>