HEX
Server: Apache
System: Linux clpupre 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64
User: undanet (1000)
PHP: 7.4.3
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/undanet/www//PortalEmpleo/src/Views/FormularioGestionConvocatoria.php
<?php
$root = get_site_url() . '/';
$rootwp = "";
?>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<div class="wrap-content" ng-app="">

    <?php if (!isset($_POST['toresolutions'])) : ?>
        <form method="post" name="frmConvocatoria" id="frmConvocatoria"
              action="" enctype="multipart/form-data">
            <table border="0">
                <tbody>
                <tr>
                    <td>
                        <?php
                        echo '<label for="txtReferencia">'
                             . __('Reference', 'panoramic_child')
                             . ':</label></td>';
                        ?>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="text" name="txtReferencia" id="txtReferencia" value="'
                                 . $data['convocatoria']->getReferencia()
                                 . '" required>';
                        } else {
                            $value = (isset($_POST['txtReferencia']))
                                ? $_POST['txtReferencia']
                                : '';
                            echo '<input type="text" name="txtReferencia" id="txtReferencia" value="'
                                 . $value . '"required>';
                        }
                        ?>
                    </td>
					<td></td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="txtDescripcion">'
                             . __('Description', 'panoramic_child')
                             . ':</label></td>';
                        ?>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="text" name="txtDescripcion" id="txtDescripcion" value="'
                                 . $data['convocatoria']->getDescripcion()
                                 . '" required>';
                        } else {
                            $value = (isset($_POST['txtDescripcion']))
                                ? $_POST['txtDescripcion']
                                : '';
                            echo '<input type="text" name="txtDescripcion" id="txtDescripcion" value="'
                                 . $value . '" required>';
                        }
                        ?>
                    </td>					
					<td></td>

                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="txtDescripcionen">'
                             . __('Description Eng', 'panoramic_child')
                             . ':</label></td>';
                        ?>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="text" name="txtDescripcionen" id="txtDescripcionen" value="'
                                 . $data['convocatoria']->getDescripcionEn()
                                 . '" required>';
                        } else {
                            $value = (isset($_POST['txtDescripcionen']))
                                ? $_POST['txtDescripcionen']
                                : '';
                            echo '<input type="text" name="txtDescripcionen" value="'
                                 . $value . '" id="txtDescripcionen" required>';
                        }
                        ?>
                    </td>
					<td></td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="txtPuestoTrabajo">'
                             . __('Job', 'panoramic_child') . ':</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="text" name="txtPuestoTrabajo" id="txtPuestoTrabajo" value="'
                                 . $data['convocatoria']->getPuestoTrabajo()
                                 . '" required>';
                        } else {
                            $value = (isset($_POST['txtPuestoTrabajo']))
                                ? $_POST['txtPuestoTrabajo']
                                : '';
                            echo '<input type="text" name="txtPuestoTrabajo" id="txtPuestoTrabajo" value="'
                                 . $value . '" required>';
                        }
                        ?>
                    </td>
                    <td>
                        <?php
                        echo '<div name="txtPuestoTrabajoInfo" id ="txtPuestoTrabajoInfo" class="small">'
                             . __('For multiple Jobs, divide then using semicolon character', 'panoramic_child')
                             . ' (;)</div>';
                        ?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="txtCentro">'
                             . __('Center', 'panoramic_child') . ':</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="text" name="txtCentro" id="txtCentro" value="'
                                 . $data['convocatoria']->getCentro()
                                 . '" required>';
                        } else {
                            $value = (isset($_POST['txtCentro']))
                                ? $_POST['txtCentro']
                                : '';
                            echo '<input type="text" name="txtCentro" id="txtCentro" value="'
                                 . $value . '" required>';
                        }
                        ?>
                    </td>
					<td></td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="dtFechaInicio">'
                             . __('Start Date', 'panoramic_child')
                             . ':</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="hidden" name="dtFechaInicio" id="dtFechaInicio" value="'
                                 .
                                 $data['convocatoria']->getFechaInicio()
                                     ->format('Y-m-d') . '" required>';
                            echo '<input type="date" name="dtFechaInicio" id="dtFechaInicio" value="'
                                 .
                                 $data['convocatoria']->getFechaInicio()
                                     ->format('Y-m-d')
                                 . '" disabled="true" required>';
                        } else {
                            echo '<input type="date" name="dtFechaInicio" id="dtFechaInicio" value="'
                                 . date("d-m-Y\TH-i") . '" required>';
                        }
                        ?>
                    </td>
					<td></td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="dtFechaFin">'
                             . __('End Date', 'panoramic_child') . ':</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            if ($data['convocatoria']->getFechaFin()
                                    ->format('Y-m-d') < date("Y-m-d")) {
                                echo '<input type="hidden" name="dtFechaFin" id="dtFechaFin" value="'
                                     .
                                     $data['convocatoria']->getFechaFin()
                                         ->format('Y-m-d') . '" required>';
                            }
                            echo '<input type="date" name="dtFechaFin" id="dtFechaFin" value="'
                                 .
                                 $data['convocatoria']->getFechaFin()
                                     ->format('Y-m-d') . '"';

                            if ($data['convocatoria']->getFechaFin()
                                    ->format('Y-m-d') < date("Y-m-d")) {
                                echo ' disabled="true"';
                            } else {
                                ' disabled="false"';
                            }
                            echo ' required>';
                        } else {
                            echo '<input type="date" name="dtFechaFin" id="dtFechaFin" value="'
                                 . date("d-m-Y\TH-i") . '" required>';
                        }

                        echo '<input type="date" name="dtFechaUltimaActualizacion" id="dtFechaUltimaActualizacion" value="'
                             . date("Y-m-d") . '" hidden="true" required>';
                        ?>
                    </td>
					<td></td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="flPDFConvocatoria">'
                             . __('PDF General Bases', 'panoramic_child')
                             . ' <small>(Max. 10MB)</small>:</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (
                            isset($data['convocatoria']) && is_object($data['convocatoria'])
                        ) {
                            echo '<div class="pe-d-flex"><div><input type="hidden" name="flPDFConvocatoria" id="flPDFConvocatoria" value="'
                                 . $data['convocatoria']->getRutaarchivoconvocatoria()
                                 . '" required>';
                            echo '<a href="' . $root . 'descargaC/?ref='
                                 . $data['convocatoria']->getReferencia()
                                 . '&file='
                                 . basename($data['convocatoria']->getRutaarchivoconvocatoria())
                                 . '" target="_blank">'
                                 . basename($data['convocatoria']->getRutaarchivoconvocatoria())
                                 . '</a></div>';

                            echo '<div><input type="file" name="flPDFConvocatoria" id="flPDFConvocatoria" accept=".pdf,application/pdf"></div></div>';

                        } else {
                            echo '<input type="file" name="flPDFConvocatoria" id="flPDFConvocatoria" accept=".pdf,application/pdf" required>';
                        }
                        ?>
                    </td>
                    <td>
                        <div name="flPDFConvocatoriaError"
                             id="flPDFConvocatoriaError" hidden="true">Admite
                            .pdf.
                        </div>
                    </td>
                    <script language="javascript">
                        var file = document.getElementById('flPDFConvocatoria');

                        file.onchange = function (e) {
                            var fileError = document.getElementById('flPDFConvocatoriaError');
                            var ext = this.value.match(/\.([^\.]+)$/)[1];
                            switch (ext) {
                                case 'pdf':
                                    //alert('Allowed');
                                    fileError.hidden = true;
                                    break;
                                default:
                                    //alert('Not allowed');
                                    this.value = '';
                                    fileError.hidden = false;
                                    break;
                            }
                        };
                    </script>
                </tr>

                <tr>
                    <td>
                        <?php
                        echo '<label for="flPDFEspecifico">'
                             . __('PDF Specific Bases', 'panoramic_child')
                             . ' <small>(Max. 10MB)</small>:</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (
                            isset($data['convocatoria'])
                            && is_object($data['convocatoria'])
                            && $data['convocatoria']->getRutaarchivoespecifico() != null
                        ) {
                            echo '<div class="pe-d-flex"><div><input type="hidden" name="flPDFEspecifico" id="flPDFEspecifico" value="'
                                 . $data['convocatoria']->getRutaarchivoespecifico()
                                 . '">';
                            //echo '<a href="' . $data['convocatoria']->getRutaarchivoespecifico() . '" target="_blank">' . $data['convocatoria']->getRutaarchivoespecifico()  . '</a>';
                            echo '<a href="' . $root . 'descargaC/?ref='
                                 . $data['convocatoria']->getReferencia()
                                 . '&file='
                                 . basename($data['convocatoria']->getRutaarchivoespecifico())
                                 . '" target="_blank">'
                                 . basename($data['convocatoria']->getRutaarchivoespecifico())
                                 . '</a></div>';

                            echo '<div><input type="file" name="flPDFEspecifico" id="flPDFEspecifico" accept=".pdf,application/pdf"></div></div>';
                        } else {
                            echo '<input type="file" name="flPDFEspecifico" id="flPDFEspecifico" accept=".pdf,application/pdf">';
                        }
                        ?>
                    </td>
                    <td>
                        <div name="flPDFEspecificoError"
                             id="flPDFEspecificoError" hidden="true">Admite
                            .pdf.
                        </div>
                    </td>
                    <script language="javascript">
                        var file = document.getElementById('flPDFEspecifico');

                        file.onchange = function (e) {
                            var fileError = document.getElementById('flPDFEspecificoError');
                            var ext = this.value.match(/\.([^\.]+)$/)[1];
                            switch (ext) {
                                case 'pdf':
                                    //alert('Allowed');
                                    fileError.hidden = true;
                                    break;
                                default:
                                    //alert('Not allowed');
                                    this.value = '';
                                    fileError.hidden = false;
                                    break;
                            }
                        };
                    </script>
                </tr>

                <tr>
                    <td>
                        <?php
                        echo '<label for="flPDFRequisitos">'
                             . __('Requirements resolution pdf', 'panoramic_child')
                             . ' <small>(Max. 10MB)</small>:</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (
                            isset($data['convocatoria'])
                            && is_object($data['convocatoria'])
                            &&  $data['convocatoria']->getRutaarchivorequisitos() != null
                        ) {
                            echo '<div class="pe-d-flex"><div><input type="hidden" name="flPDFRequisitos" id="flPDFRequisitos" value="'
                                 . $data['convocatoria']->getRutaarchivorequisitos()
                                 . '">';
                            echo '<a href="' . $root . 'descargaC/?ref='
                                 . $data['convocatoria']->getReferencia()
                                 . '&file='
                                 . basename($data['convocatoria']->getRutaarchivorequisitos())
                                 . '" target="_blank">'
                                 . basename($data['convocatoria']->getRutaarchivorequisitos())
                                 . '</a></div>';

                            echo '<div><input type="file" name="flPDFRequisitos" id="flPDFRequisitos" accept=".pdf,application/pdf"></div></div>';
                        } else {
                            echo '<input type="file" name="flPDFRequisitos" id="flPDFRequisitos" accept=".pdf,application/pdf">';
                        }
                        ?>
                    </td>
                    <td>
                        <div name="flPDFRequisitosError"
                             id="flPDFRequisitosError" hidden="true">Admite
                            .pdf.
                        </div>
                    </td>
                    <script language="javascript">
                        var file = document.getElementById('flPDFRequisitos');

                        file.onchange = function (e) {
                            var fileError = document.getElementById('flPDFRequisitosError');
                            var ext = this.value.match(/\.([^\.]+)$/)[1];
                            var todook = false;
                            switch (ext) {
                                case 'pdf':
                                    //alert('Allowed');
                                    fileError.hidden = true;
                                    todook = true;
                                    break;
                                default:
                                    //alert('Not allowed');
                                    this.value = '';
                                    fileError.hidden = false;
                                    break;
                            }
                            if (todook)
                                document.getElementById("cambioresolucionreq").value = 'si';

                        };
                    </script>
                </tr>
                <?php
                if (
                    isset($data['convocatoria'])
                    && is_object($data['convocatoria'])
                ) {
                ?>
                    <tr>
                        <td>
                            <?php
                            echo '<label for="flPDFExamen">'
                                 . __('Exam Resolution pdf', 'panoramic_child')
                                 . ' <small>(Max. 10MB)</small>:</label>';
                            ?>
                        </td>
                        <td>
                            <?php
                            if (
                                isset($data['convocatoria'])
                                && is_object($data['convocatoria'])
                                && $data['convocatoria']->getRutaarchivoexamen() != null
                            ) {
                                echo '<div class="pe-d-flex"><div><input type="hidden" name="flPDFExamen" id="flPDFExamen" value="'
                                     . $data['convocatoria']->getRutaarchivoexamen()
                                     . '">';
                                echo '<a href="' . $root . 'descargaC/?ref='
                                     . $data['convocatoria']->getReferencia()
                                     . '&file='
                                     . basename($data['convocatoria']->getRutaarchivoexamen())
                                     . '" target="_blank">'
                                     . basename($data['convocatoria']->getRutaarchivoexamen())
                                     . '</a></div>';

                                echo '<div><input type="file" name="flPDFExamen" id="flPDFExamen" accept=".pdf,application/pdf"></div></div>';
                            } else {
                                echo '<input type="file" name="flPDFExamen" id="flPDFExamen" accept=".pdf,application/pdf">';
                            }
                            ?>
                        </td>
                        <td>
                            <div name="flPDFExamenError" id="flPDFExamenError"
                                 hidden="true">Admite .pdf.
                            </div>
                        </td>
                        <script language="javascript">
                            var file = document.getElementById('flPDFExamen');

                            file.onchange = function (e) {
                                var fileError = document.getElementById('flPDFExamenError');
                                var ext = this.value.match(/\.([^\.]+)$/)[1];
                                var todook = false;
                                switch (ext) {
                                    case 'pdf':
                                        //alert('Allowed');
                                        fileError.hidden = true;
                                        todook = true;
                                        break;
                                    default:
                                        //alert('Not allowed');
                                        this.value = '';
                                        fileError.hidden = false;
                                        break;
                                }
                                if (todook)
                                    document.getElementById("cambioresolucionexam").value = 'si';

                            };
                        </script>
                    </tr>
                <?php } ?>
                <tr>
                    <td>
                        <?php
                        echo '<label for="flPDFResolucionFinal">'
                             . __('End Resolution PDF', 'panoramic_child')
                             . ' <small>(Max. 10MB)</small>:</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (
                            isset($data['convocatoria'])
                            && is_object($data['convocatoria'])
                            && $data['convocatoria']->getRutaarchivoresolucionfinal() != null
                        ) {
                            echo '<div class="pe-d-flex"><div><input type="hidden" name="flPDFResolucionFinal" id="flPDFResolucionFinal" value="'
                                 . $data['convocatoria']->getRutaarchivoresolucionfinal()
                                 . '">';
                            //echo '<a href="' . $data['convocatoria']->getRutaarchivoresolucionfinal() . '" target="_blank">' . $data['convocatoria']->getRutaarchivoresolucionfinal()  . '</a>';
                            echo '<a href="' . $root . 'descargaC/?ref='
                                 . $data['convocatoria']->getReferencia()
                                 . '&file='
                                 . basename($data['convocatoria']->getRutaarchivoresolucionfinal())
                                 . '" target="_blank">'
                                 . basename($data['convocatoria']->getRutaarchivoresolucionfinal())
                                 . '</a></div>';
                            echo '<div><input type="file" name="flPDFResolucionFinal" id="flPDFResolucionFinal" accept=".pdf,application/pdf"></div></div>';
                        } else {
                            echo '<input type="file" name="flPDFResolucionFinal" id="flPDFResolucionFinal" accept=".pdf,application/pdf">';
                        }
                        ?>
                    </td>
                    <td>
                        <div name="flPDFResolucionFinalError"
                             id="flPDFResolucionFinalError" hidden="true">Admite
                            .pdf.
                        </div>
                    </td>
                    <script language="javascript">
                        var file = document.getElementById('flPDFResolucionFinal');

                        file.onchange = function (e) {
                            var fileError = document.getElementById('flPDFResolucionFinalError');
                            var ext = this.value.match(/\.([^\.]+)$/)[1];
                            var todook = false;
                            switch (ext) {
                                case 'pdf':
                                    fileError.hidden = true;
                                    todook = true;
                                    break;
                                default:
                                    this.value = '';
                                    fileError.hidden = false;
                                    break;
                            }
                            if (todook)
                                document.getElementById("cambioresolucionfinal").value = 'si';
                        };
                    </script>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="txtWeb">Web:</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="text" name="txtWeb" id="txtWeb" value="'
                                 . $data['convocatoria']->getUrlweb()
                                 . '" required>';
                        } else {
                            $value = (isset($_POST['txtWeb']))
                                ? $_POST['txtWeb']
                                : '';
                            echo '<input type="text" name="txtWeb" id="txtWeb" value="'
                                 . $value . '" required>';
                        }
                        ?>
                    </td>
                    <td>
                        <div name="txtWebInfo" id="txtWebInfo" class="small">
                            E.g., http://www.dominio.com
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="txtWeb">'
                             . __('Scoring threshold', 'panoramic_child')
                             . ':</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<input type="text" name="txtUmbradePuntuacion" id="txtUmbradePuntuacion" value="'
                                 . $data['convocatoria']->getUmbraldepuntuacion()
                                 . '">';
                        } else {
                            $value = (isset($_POST['txtUmbradePuntuacion']))
                                ? $_POST['txtUmbradePuntuacion']
                                : '';
                            echo '<input type="text" name="txtUmbradePuntuacion" id="txtWeb" value="'
                                 . $value . '">';
                        }
                        ?>
                    </td>
                    <td>
                        <div name="txttxtUmbradePuntuacionInfo"
                             id="txttxtUmbradePuntuacionInfo"
                             class="small"><?php echo __('Minimum score that is required with respect to merits', 'panoramic_child'); ?></div>
                    </td>
                </tr>

                <tr style="display: none;">
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            $alguientieneumbralsuperado =
                                alguienTieneUmbralSuperado($data)
                                    ? 'si'
                                    : 'no';
                            $tieneExamen =
                                $data['convocatoria']->getTieneExamen()
                                    ? 'si'
                                    : 'no';

                            echo '<input type="text" name="alguientieneumbralsuperado" id="alguientieneumbralsuperado" value="'
                                 . $alguientieneumbralsuperado . '" >';
                            echo '<input type="text" name="codigoconvocatoria" id="codigoconvocatoria" value="'
                                 . $data['convocatoria']->getIdconvocatoria()
                                 . '" >';
                            echo '<input type="text" name="currentstate" id="currentstate" value="'
                                 . ($data['convocatoria']->getCodigoestadoconvocatoria())->getIdestadoconvocatoria()
                                 . '" >';
                            echo '<input type="text" name="allcandidatosemail" id="allcandidatosemail" value="'
                                 . getEmailTodosConvocatoria($data) . '" >';
                            echo '<input type="text" name="allcandidatossuperadosemail" id="allcandidatossuperadosemail" value="'
                                 . getEmailTodosSuperadosConvocatoria($data)
                                 . '" >';
                            echo '<input type="text" name="alltribunalemail" id="alltribunalemail" value="'
                                 . getEmailTodosTribunal($data) . '" >';
                            echo '<input type="text" name="cambioresolucionreq" id="cambioresolucionreq" value="no" >';
                            echo '<input type="text" name="cambioresolucionexam" id="cambioresolucionexam" value="no" >';
                            echo '<input type="text" name="cambioresolucionfinal" id="cambioresolucionfinal" value="no" >';
                            echo '<input type="text" name="tieneExamen" id="tieneExamen" value="'
                                 . $tieneExamen . '" >';
                        }

                        ?>
                    </td>
                </tr>

                <tr>
                    <td>
                        <?php echo '<label for="slctEstado">'
                                   . __('State', 'panoramic_child')
                                   . ':</label>'; ?>
                    </td>
                    <td>
                        <?php
                        $nombreCombo = "EstadoConvocatoria";
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            $valSelected =
                                ($data['convocatoria']->getCodigoestadoconvocatoria())->getEstado();
                        }
                        include(__DIR__ . "/../Utils/combobox_loader.php");

                        if (isset($nombreCombo)) {
                            unset ($nombreCombo);
                        }
                        if (isset($valSelected)) {
                            unset ($valSelected);
                        }
                        ?>

                    </td>
                    <?php if (isset($data['convocatoria'])
                              && is_object($data['convocatoria'])
                              && $data['convocatoria']->getTieneExamen()) { ?>
                        <script>
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(9)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(3)'));
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(10)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(6)'));
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(11)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(7)'));

                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(12)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(4)'));
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(13)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(5)'));
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(14)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(6)'));

                        </script>
                    <?php } else { ?>
                        <script>
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(9)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(3)'));
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(10)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(6)'));
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(11)').insertBefore(jQuery('select[name="slctEstadoConvocatoria"] option:eq(7)'));
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(12)').remove();
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(12)').remove();
                            jQuery('select[name="slctEstadoConvocatoria"] option:eq(12)').remove();

                        </script>
                    <?php } ?>
					<td></td>
                </tr>
                <tr>
                    <td>
                        <?php
                        echo '<label for="slctCaducada">'
                             . __('Expired', 'panoramic_child') . ':</label>';
                        ?>
                    </td>
                    <td>
                        <?php
                        if (isset($data['convocatoria'])
                            && is_object($data['convocatoria'])) {
                            echo '<select name="slctCaducada" id="slctCaducada" disabled="true">';
                            if ($data['convocatoria']->getCaducada()) {
                                echo '<option value="0" >No</option> 
												<option value="1" selected>S&iacute;</option>';
                            }
                            if (!$data['convocatoria']->getCaducada()) {
                                echo '<option value="0" selected>No</option> 
												<option value="1" >S&iacute;</option>';
                            }
                            echo '</select>';
                        } else {
                            echo '<select name="slctCaducada" id="slctCaducada" disabled="true">
											<option value="0" selected>No</option> 
										<option value="1" >S&iacute;</option>
									</select>';
                        }
                        ?>
                    </td>
					<td></td>
                </tr>
                <tr>
                    <td>
                        <?php
                        if (isset($data['convocatoria']) && is_object($data['convocatoria'])
                        ) {
                            ?>
                            <input type="checkbox" id="chkbaja"
                                   name="chkbaja" <?php echo $data['convocatoria']->getBaja()
                                ? 'checked'
                                : '' ?> >
                        <?php } else { ?>
                            <input type="checkbox" id="chkbaja"
                                   name="chkbaja" <?php echo isset($_POST['chkbaja'])
                                ? 'checked'
                                : '' ?> >
                        <?php } ?>

                        <label for="chkbaja"><?php echo __('Drop', 'panoramic_child') ?></label>
                    </td>
                </tr>
                <?php
                if (
                    !isset($data['convocatoria']) || !is_object($data['convocatoria'])
                ) {
                    ?>
                    <tr class="tr-examen_obligatorio_check">
                        <td>
                            <input type="checkbox" id="examen_obligatorio"
                                   name="examen_obligatorio" <?php echo (isset($_POST['examen_obligatorio']))
                                ? 'checked'
                                : '' ?> >
                            <label for="examen_obligatorio"><?php echo __('Mandatory exam', 'panoramic_child') ?></label>
                        </td>
                    </tr>
                    <tr class="tr-examen_obligatorio_input">
                        <td>
                            <?php echo '<label for="totalPuntos">'
                                       . __('Total number of points', 'panoramic_child')
                                       . ':</label>'; ?>
                        </td>
                        <td>
                            <input type="number" name="totalPuntos"
                                   id="totalPuntos"
                                   value=<?php echo (isset($_POST['totalPuntos']))
                                       ? $_POST['totalPuntos']
                                       : 0; ?>>
                        </td>
                    </tr>
                    <tr class="tr-examen_obligatorio_input">
                        <td>
                            <?php echo '<label for="puntuacionCorte">'
                                       . __('Mandatory exam cut-off score', 'panoramic_child')
                                       . ':</label>'; ?>
                        </td>
                        <td>
                            <input type="number" name="puntuacionCorte"
                                   id="puntuacionCorte"
                                   value=<?php echo (isset($_POST['puntuacionCorte']))
                                       ? $_POST['puntuacionCorte']
                                       : 0; ?>>
                        </td>
                    </tr>
                    <tr class="tr-examen_obligatorio_input">
                        <td>
                            <?php echo '<label for="puntuacionMaxima">'
                                       . __('Maximum exam score', 'panoramic_child')
                                       . ':</label>'; ?>
                        </td>
                        <td>
                            <input type="number" name="puntuacionMaxima"
                                   id="puntuacionMaxima"
                                   value=<?php echo (isset($_POST['puntuacionMaxima']))
                                       ? $_POST['puntuacionMaxima']
                                       : 0; ?>>
                        </td>
                    </tr>

                    <tr class="tr-examen_obligatorio_input">
                        <td>
                            <?php echo '<label for="puntuacionMaximaMeritos">'
                                       . __('Maximum merit score', 'panoramic_child')
                                       . ':</label>'; ?>
                        </td>
                        <td>
                            <input type="number" name="puntuacionMaximaMeritos"
                                   id="puntuacionMaximaMeritos"
                                   value=<?php echo (isset($_POST['puntuacionMaximaMeritos']))
                                       ? $_POST['puntuacionMaximaMeritos']
                                       : 0; ?>>
                        </td>
                    </tr>
                    <tr class="tr-examen_obligatorio_input">
                        <td>
                            <?php echo '<label for="ponderacionExamen">'
                                       . __('Examination Weighting', 'panoramic_child')
                                       . ' (%):</label>'; ?>
                        </td>
                        <td>
                            <input type="number" name="ponderacionExamen"
                                   id="ponderacionExamen"
                                   value=<?php echo (isset($_POST['ponderacionExamen']))
                                       ? $_POST['ponderacionExamen']
                                       : 0; ?>>
                        </td>
                    </tr>
                    <tr class="tr-examen_obligatorio_input">
                        <td>
                            <?php echo '<label for="ponderacionMeritos">'
                                       . __('Weighting Merits', 'panoramic_child')
                                       . ' (%):</label>'; ?>
                        </td>
                        <td>
                            <input type="number" name="ponderacionMeritos"
                                   id="ponderacionMeritos"
                                   value=<?php echo (isset($_POST['ponderacionMeritos']))
                                       ? $_POST['ponderacionMeritos']
                                       : 0; ?>>
                        </td>
                    </tr>
                <?php } else {
                    if (isset($data['convocatoria'])
                        && is_object($data['convocatoria'])
                        && $data['convocatoria']->getTieneExamen()) { ?>
                        <tr>
                            <td>
                                <input type="checkbox" id="examen_obligatorio"
                                       name="examen_obligatorio" disabled
                                       checked>
                                <label for="examen_obligatorio"><?php echo __('Mandatory exam', 'panoramic_child') ?></label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php echo '<label for="totalPuntos">'
                                           . __('Total number of points', 'panoramic_child')
                                           . ':</label>'; ?>
                            </td>
                            <td>
                                <input type="number" name="totalPuntos"
                                       id="totalPuntos"
                                       value=<?php echo $data['convocatoria']->getTotalPuntos() ?>>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php echo '<label for="puntuacionCorte">'
                                           . __('Mandatory exam cut-off score', 'panoramic_child')
                                           . ':</label>'; ?>
                            </td>
                            <td>
                                <input type="number" name="puntuacionCorte"
                                       id="puntuacionCorte"
                                       value=<?php echo $data['convocatoria']->getPuntuacionCorte() ?>>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php echo '<label for="puntuacionMaxima">'
                                           . __('Maximum exam score', 'panoramic_child')
                                           . ':</label>'; ?>
                            </td>
                            <td>
                                <input type="number" name="puntuacionMaxima"
                                       id="puntuacionMaxima"
                                       value=<?php echo $data['convocatoria']->getPuntuacionMaxima() ?>>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <?php echo '<label for="puntuacionMaximaMeritos">'
                                           . __('Maximum merit score', 'panoramic_child')
                                           . ':</label>'; ?>
                            </td>
                            <td>
                                <input type="number"
                                       name="puntuacionMaximaMeritos"
                                       id="puntuacionMaximaMeritos"
                                       value=<?php echo $data['convocatoria']->getPuntuacionMaximaMeritos() ?>>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php echo '<label for="ponderacionExamen">'
                                           . __('Examination Weighting', 'panoramic_child')
                                           . ' (%):</label>'; ?>
                            </td>
                            <td>
                                <input type="number" name="ponderacionExamen"
                                       id="ponderacionExamen"
                                       value=<?php echo $data['convocatoria']->getPonderacionExamen() ?>>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php echo '<label for="ponderacionMeritos">'
                                           . __('Weighting Merits', 'panoramic_child')
                                           . ' (%):</label>'; ?>
                            </td>
                            <td>
                                <input type="number" name="ponderacionMeritos"
                                       id="ponderacionMeritos"
                                       value=<?php echo $data['convocatoria']->getPonderacionMeritos() ?>>
                            </td>
                        </tr>
                    <?php
                    } else {
                        if (
                            isset($data['convocatoria'])
                            && is_object($data['convocatoria'])
                            && !$data['convocatoria']->getTieneExamen()
                        ) {
                            ?>
                            <tr>
                                <td>
                                    <input type="checkbox"
                                           id="examen_obligatorio"
                                           name="examen_obligatorio" disabled>
                                    <label for="examen_obligatorio"><?php echo __('Mandatory exam', 'panoramic_child') ?></label>
                                </td>
                            </tr>
                        <?php }
                    }
                } ?>
                <?php
                if(
                    isset($data['convocatoria'])
                    && is_object($data['convocatoria'])
                    && ($data['convocatoria']->getCodigoestadoconvocatoria())
                        ->getIdestadoconvocatoria() == 6
                ){
                    ?>
                    <tr>
                        <td>
                            <?php echo '<label for="plazaAdjudicada">'
                                       . __('Awarded place to', 'panoramic_child')
                                       . ':</label>'; ?>
                        </td>
                        <td>
                            <input type="text" name="plazaAdjudicada"
                                id="plazaAdjudicada"
                                value="<?php echo $data['convocatoria']->getPlazaAdjudicada() ?>"
                                <?php echo trim($data['convocatoria']->getPlazaAdjudicada()) == 'Plaza no cubierta' 
									? '' 
									: 'disabled' 
									?>
                            >
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?php echo '<label for="substitute">'
                                       . __('Substitute', 'panoramic_child')
                                       . ':</label>'; ?>
                        </td>
                        <td class=""substitute-td>
                            <div>
                                <input type="checkbox"
                                   id="substitute_check"
                                   name="substitute_check"
                                    <?php
                                    echo empty($data['convocatoria']->getSustituto())
                                        ? ''
                                        : 'checked disabled';
                                    ?>
                                >
                            </div>

                            <textarea name="substitute" id="substitute" class="<?php echo empty($data['convocatoria']->getSustituto()) ? 'substitute-not-display' : ''; ?>"><?php
								echo empty(
										$data['convocatoria']->getSustituto()
									 )
									? ''
									: trim($data['convocatoria']->getSustituto())
								?>
							</textarea>
                        </td>
                        <script>
                           jQuery('#substitute_check').click(function (){
                               jQuery('#substitute').toggleClass(
                                   'substitute-not-display'
                               );
                           })
                        </script>
                    </tr>
                <?php }  ?>
                </tbody>
            </table>

            <script language="javascript">
                function tolist() {
                    if (confirm('<?php echo __("Not saved changes will be lost. Do you want to return to the list of calls?", "panoramic_child") ?>')) {
                        form = document.getElementById("frmConvocatoria");
                        form.setAttribute('novalidate', true);
                        form.submit();
                    }
                }
            </script>

            <?php
            echo '<input type="button" id="btnListar" name="accionConvocatoria" value="'
                 . __('Calls List', 'panoramic_child')
                 . '" onClick="tolist();">';

            if (isset($data['convocatoria'])
                && is_object($data['convocatoria'])) {
                $_SESSION["data"] = $data['convocatoria'];
                echo '<button type="submit" name="accionConvocatoria" value="Update" class="margenes_laterales_4" onClick="return confirm(\''
                     . __('Do you want to update this call?', 'panoramic_child')
                     . '\');">' . __('Update', 'panoramic_child') . '</button>';
            } else {
                session_unset();
                echo '<button type="submit" name="accionConvocatoria" value="Add" class="margenes_laterales_4" onClick="return confirm(\''
                     . __('Do you want to add this call?\'', 'panoramic_child')
                     . ');">' . __('Add', 'panoramic_child') . '</button>';
            }
            ?>
        </form>
    <?php endif; ?>

    <?php if (isset($_POST['toresolutions'])) : ?>

        <?php
        if (!isset($data['convocatoria'])
            || !is_object($data['convocatoria'])) {
            echo '<div name="dvResoluciones" id ="dvResoluciones" hidden="true">';
        }
        ?>
        <section id="resoluciones" name="resoluciones">
            <br><br><br>

            <form method="post" name="frmConvocatoriaResolucion"
                  id="frmConvocatoriaResolucion" action=""
                  enctype="multipart/form-data">
                <?php
                echo '<h1>' . __('Resolutions', 'panoramic_child') . '</h1>';
                ?>
                <?php if (todosAprobaronReq($data)) { ?>

                    <table class="border_2">
                        <thead></thead>
                        <tbody>
                        <tr class="cebra">
                            <td>
                                <a class="download-pdf-save" href="#"
                                   pdftype="acreq"
                                   callid="<?php echo $data['convocatoria']->getIdConvocatoria() ?>"><?php echo __('Download', 'panoramic_child'); ?></a>
                            </td>
                        </tr>
                        </tbody>
                    </table>

                <?php } ?>
                <table border=0>
                    <tbody>
                    <tr>
                        <td style="padding-right: 0.3em;">
                            <?php
                            echo '<label>'
                                 . __('Description', 'panoramic_child')
                                 . '</label>';
                            echo '<input type="text" name="txtDescripcion" id="txtDescripcion" required>';
                            ?>
                        </td>
                        <td>
                            <?php
                            echo '<label>'
                                 . __('Resolution File', 'panoramic_child')
                                 . ' <small>(Max. 10MB)</small></label>';

                            echo '<input type="file" name="flResolucion" id="flResolucion" accept=".pdf,application/pdf" style="vertical-align: text-top;">';
                            echo '<td><div name="flResolucionError" id ="" hidden="true">Admite .pdf.</div></td>';
                            ?>

                            <?php echo '<input type="hidden" id="toresolutions-resolucion" name="toresolutions" value="toresolutions" >'; ?>


                        </td>
                        <td class="centrado">
                            <?php
                            echo '<label for="chkObligatorio">'
                                 . __('Visible', 'panoramic_child')
                                 . '</label>';

                            echo '<input type="checkbox" name="chkVisible" id="chkVisible" style="margin-top:0.5em;">';

                            ?>
                        </td>

                        <td style="vertical-align: bottom;">
                            <?php
                            if (isset($data['convocatoria'])
                                && is_object($data['convocatoria'])) {
                                echo '<input type="text" name="txtCvtResolucion" id="txtCvtResolucion" value="'
                                     . $data['convocatoria']->getIdconvocatoria()
                                     . '" hidden>';
                                echo '<input type="text" name="txtCvtReferencia" id="txtCvtReferencia" value="'
                                     . $data['convocatoria']->getReferencia()
                                     . '" hidden>';
                            }
                            echo '<input type="button" name="btnaccionConvocatoriaResolucion" value="'
                                 . __('Add', 'panoramic_child')
                                 . '"  class="margenes_laterales_4" onClick="fnccvtresolucionsubmit(this);">';

                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td colspan=5>
                            <br>
                            <table class="border_2">
                                <thead></thead>
                                <tbody>
                                <?php
                                if (isset($data['resoluciones'])
                                    && ($data['resoluciones'] != null)) {
                                    echo '<tr><td><input type="text" name="txtResolucion" id="txtResolucion" value="" hidden></td></tr>';
                                    foreach ($data['resoluciones'] as $resol) {
                                        $resvisible = ($resol->getVisible())
                                            ? 'Visible'
                                            : 'Not Visible';
                                        echo '<tr class="cebra"><td>'
                                             . $resol->getDescripcion()
                                             . '</td><td>'
                                             . $resol->getFecharesolucion()
                                                 ->format('d/m/Y')
                                             . '</td><td><a href="' . $root
                                             . 'descargaC/?ref='
                                             . $data['convocatoria']->getReferencia()
                                             . '&file='
                                             . basename($resol->getRutaficheroresolucion())
                                             . '" target="_self">'
                                             . basename($resol->getRutaficheroresolucion())
                                             . '</a></td><td>' . $resvisible
                                             . '</td><td><img id="btnaccionConvocatoriaResolucion" name="btnaccionConvocatoriaResolucion" value="'
                                             . $resol->getIdconvocatoriaresolucion()
                                             . '" src="' . $root . $rootwp
                                             . 'PortalEmpleo/img/'
                                             . 'X_Icon_1_150x150.png'
                                             . '" width="25" height="25" alt="Quitar Idioma" class="link" id="attachImg" onclick ="fncresolucionremove('
                                             . $resol->getIdconvocatoriaresolucion()
                                             . ',this);"/></td></tr>';
                                    }
                                } else {
                                    echo '<tr><td><label class="margenes_laterales_4 color_original_reducido">'
                                         . __('There is not resolutions inserted, please add any.', 'panoramic_child')
                                         . '</label></td></tr>';

                                }
                                ?>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo '<input type="text" id="accionConvocatoria" name="accionConvocatoria" value="" hidden>'; ?></td>
                    </tr>
                    <script language="javascript">
                        function fnccvtresolucionsubmit(object) {
                            if (document.getElementById('txtDescripcion').value.trim().length > 0) {
                                if (document.getElementById('flResolucion').value != null && document.getElementById('flResolucion').value.trim().length > 4) {
                                    document.getElementById("accionConvocatoria").value = 'AddResolucion';
                                    document.getElementById("frmConvocatoriaResolucion").submit();
                                }
                            }
                        }

                        function fncresolucionremove(id, object) {
                            document.getElementById("txtResolucion").value = object.getAttribute('value');
                            document.getElementById("accionConvocatoria").value = 'QuitarResolucion';
                            document.getElementById("frmConvocatoriaResolucion").submit();
                        }
                    </script>
                    </tbody>
                </table>
            </form>

            <script language="javascript">
                var file = document.getElementById('flResolucion');

                file.onchange = function (e) {
                    var fileError = document.getElementById('flResolucionError');
                    var ext = this.value.match(/\.([^\.]+)$/)[1];
                    switch (ext) {
                        case 'pdf':
                            //alert('Allowed');
                            fileError.hidden = true;
                            break;
                        default:
                            //alert('Not allowed');
                            this.value = '';
                            fileError.hidden = false;
                            break;
                    }
                };
            </script>
        </section>
    <?php
    if (!isset($data['convocatoria']) || !is_object($data['convocatoria'])) {
        echo '</div>';
    }
    ?>

    <?php
    if (!isset($data['convocatoria']) || !is_object($data['convocatoria'])) {
        echo '<div name="dvRequisitos" id ="dvRequisitos" hidden="true">';
    }
    ?>
        <section id="requisitos" name="requisitos">
            <br>
            <form method="post" name="frmConvocatoriaRequisito"
                  id="frmConvocatoriaRequisito" action=""
                  enctype="multipart/form-data">
                <?php
                echo '<h1>' . __('Requirements', 'panoramic_child') . '</h1>';
                ?>
                <table border=0>
                    <tbody>
                    <tr>
                        <td style="padding-right: 0.3em;">
                            <?php

                            echo '<label>'
                                 . __('Requirement', 'panoramic_child')
                                 . '</label>';

                            echo '<input type="text" name="txtRequisito" id="txtRequisito" required>';
                            ?>
                        </td>
                        <td style="padding-right: 0.3em;">
                            <?php
                            echo '<label>'
                                 . __('Description', 'panoramic_child')
                                 . '</label>';


                            echo '<input type="text" name="txtReqDescripcion" id="txtReqDescripcion">';
                            ?>
                        </td>
                        <td class="centrado">
                            <?php
                            echo '<label for="chkObligatorio">'
                                 . __('Required', 'panoramic_child')
                                 . '</label>';

                            echo '<input type="checkbox" name="chkObligatorio" id="chkObligatorio" style="margin-top:0.5em;">';

                            ?>
                            <?php echo '<input type="hidden" id="toresolutions-requirements" name="toresolutions" value="toresolutions" >'; ?>
                        </td>
                        <td style="vertical-align: bottom;">
                            <?php
                            if (isset($data['convocatoria'])
                                && is_object($data['convocatoria'])) {
                                echo '<input type="text" name="txtCvtRequisito" id="txtCvtRequisito" value="'
                                     . $data['convocatoria']->getIdconvocatoria()
                                     . '" hidden>';
                            }

                            echo '<input type="button" name="btnaccionConvocatoriaRequisito" value="'
                                 . __('Add', 'panoramic_child')
                                 . '" class="margenes_laterales_4" onClick="fnccvtrequisitosubmit(this);">';
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td colspan=4>
                            <br>
                            <table class="border_2">
                                <thead></thead>
                                <tbody>
                                <?php
                                if (isset($data['requisitos'])
                                    && ($data['requisitos'] != null)) {
                                    echo '<tr><td><input type="text" name="txtReq" id="txtReq" value="" hidden></td></tr>';
                                    foreach ($data['requisitos'] as $reqtos) {
                                        echo '<tr class="cebra"><td style="width:35%">'
                                             . $reqtos->getRequisito()
                                             . '</td><td style="width:55%">'
                                             . $reqtos->getDescripcion()
                                             . '</td>';

                                        if ($reqtos->getObligatorio()) {
                                            echo '<td style="width:5%;text-align: center;"><img src="'
                                                 . $root . $rootwp
                                                 . 'PortalEmpleo/img/'
                                                 . 'required.gif'
                                                 . '" width="22" height="22"/></td>';
                                        } else {
                                            echo '<td style="width:5%;text-align: center;">&nbsp;</td>';
                                        }

                                        echo '<td style="width:5%;text-align: center;"><img id="btnaccionConvocatoriaResolucion" name="btnaccionConvocatoriaResolucion" value="'
                                             . $reqtos->getIdconvocatoriarequisito()
                                             . '" src="' . $root . $rootwp
                                             . 'PortalEmpleo/img/'
                                             . 'X_Icon_1_150x150.png'
                                             . '" width="25" height="25" alt="Quitar" class="link" id="attachImg" onclick ="fncrequisitoremove('
                                             . $reqtos->getIdconvocatoriarequisito()
                                             . ',this);"/></td></tr>';
                                    }
                                } else {

                                    echo '<tr><td><label class="margenes_laterales_4 color_original_reducido">'
                                         . __('There is not requirements inserted, please add any.', 'panoramic_child')
                                         . '</label></td></tr>';

                                }
                                ?>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo '<input type="text" id="accionConvocatoriaReq" name="accionConvocatoria" value="" hidden>'; ?></td>
                    </tr>
                    <script language="javascript">
                        function fnccvtrequisitosubmit(object) {
                            if ((document.getElementById('txtRequisito').value.trim().length > 0) && (document.getElementById('txtReqDescripcion').value.trim().length > 0)) {
                                document.getElementById("accionConvocatoriaReq").value = 'AddRequisito';
                                document.getElementById("frmConvocatoriaRequisito").submit();
                            }

                        }

                        function fncrequisitoremove(id, object) {
                            document.getElementById("txtReq").value = object.getAttribute('value');
                            document.getElementById("accionConvocatoriaReq").value = 'QuitarRequisito';
                            document.getElementById("frmConvocatoriaRequisito").submit();
                        }
                    </script>
                    </tbody>
                </table>
            </form>
        </section>
    <?php
    if (!isset($data['convocatoria']) || !is_object($data['convocatoria'])) {
        echo '</div>';
    }
    ?>

    <?php
    if (!isset($data['convocatoria']) || !is_object($data['convocatoria'])) {
        echo '<div name="dvMeritos" id ="dvMeritos" hidden="true">';
    }
    ?>
        <section id="meritos" name="meritos">
            <br>
            <form method="post" name="frmConvocatoriaMerito"
                  id="frmConvocatoriaMerito" action=""
                  enctype="multipart/form-data">
                <?php

                echo '<h1>' . __('Merits', 'panoramic_child') . '</h1>';

                ?>
                <table border=0>
                    <tbody>
                    <tr>
                        <td style="padding-right: 0.3em;">
                            <?php
                            echo '<label>' . __('Merit', 'panoramic_child')
                                 . '</label>';

                            echo '<input type="text" name="txtMerito" id="txtMerito" required>';
                            ?>
                        </td>
                        <td>
                            <?php

                            echo '<label>'
                                 . __('Description', 'panoramic_child')
                                 . '</label>';


                            echo '<input type="text" name="txtMeritDescripcion" id="txtMeritDescripcion">';
                            ?>
                        </td>
                        <td style="vertical-align: bottom;">
                            <?php
                            if (isset($data['convocatoria'])
                                && is_object($data['convocatoria'])) {
                                echo '<input type="text" name="txtCvtMerito" id="txtCvtMerito" value="'
                                     . $data['convocatoria']->getIdconvocatoria()
                                     . '" hidden>';
                            }

                            echo '<input type="hidden" id="toresolutions-merito" name="toresolutions" value="toresolutions" >';

                            echo '<input type="button" name="btnaccionConvocatoriaMerito" value="'
                                 . __('Add', 'panoramic_child')
                                 . '" class="margenes_laterales_4" onClick="fnccvtmeritosubmit(this);">';

                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td colspan=3>
                            <br>
                            <table class="border_2">
                                <thead></thead>
                                <tbody>
                                <?php
                                if (isset($data['meritos'])
                                    && ($data['meritos'] != null)) {
                                    echo '<tr><td><input type="text" name="txtMerit" id="txtMerit" value="" hidden></td></tr>';
                                    foreach ($data['meritos'] as $mertos) {
                                        echo '<tr class="cebra"><td>'
                                             . $mertos->getMerito()
                                             . '</td><td style="width:60%">'
                                             . $mertos->getDescripcion()
                                             . '</td><td><img id="btnaccionConvocatoriaResolucion" name="btnaccionConvocatoriaResolucion" value="'
                                             . $mertos->getIdconvocatoriamerito()
                                             . '" src="' . $root . $rootwp
                                             . 'PortalEmpleo/img/'
                                             . 'X_Icon_1_150x150.png'
                                             . '" width="25" height="25" alt="Quitar" class="link" style="margin-right: 0.5em;" id="attachImg" onclick ="fncmeritoremove('
                                             . $mertos->getIdconvocatoriamerito()
                                             . ',this);"/></td></tr>';
                                    }
                                } else {

                                    echo '<tr><td><label class="margenes_laterales_4 color_original_reducido">'
                                         . __('There is not merit inserted, please add any.', 'panoramic_child')
                                         . '</label></td></tr>';

                                }
                                ?>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo '<input type="text" id="accionConvocatoriaMrt" name="accionConvocatoria" value="" hidden>'; ?></td>
                    </tr>
                    <script language="javascript">
                        function fnccvtmeritosubmit(object) {
                            if ((document.getElementById('txtMerito').value.trim().length > 0) && (document.getElementById('txtMeritDescripcion').value.trim().length > 0)) {
                                document.getElementById("accionConvocatoriaMrt").value = 'AddMerito';
                                document.getElementById("frmConvocatoriaMerito").submit();
                            }
                        }

                        function fncmeritoremove(id, object) {
                            document.getElementById("txtMerit").value = object.getAttribute('value');
                            document.getElementById("accionConvocatoriaMrt").value = 'QuitarMerito';
                            document.getElementById("frmConvocatoriaMerito").submit();
                        }
                    </script>
                    </tbody>
                </table>
            </form>
        </section>
    <?php
    if (!isset($data['convocatoria']) || !is_object($data['convocatoria'])) {
        echo '</div>';
    }
    ?>
        <script language="javascript">
            function tolist() {
                if (confirm('<?php echo __("Not saved changes will be lost. Do you want to return to the list of calls?", "panoramic_child") ?>')) {
                    form = document.getElementById("frmConvocatoria");
                    form.setAttribute('novalidate', true);
                    form.submit();
                }
            }

        </script>

        <?php
        echo '<form method="post" name="frmConvocatoria" id="frmConvocatoria" action="" enctype="multipart/form-data"><input type="button" id="btnListar" name="accionConvocatoria" value="'
             . __('Calls List', 'panoramic_child')
             . '" onClick="tolist()"></form>';

    endif; ?>
    <script>
        jQuery(document).ready(function ($) {
            $('.remove_flpdf').click(function (e) {
                e.preventDefault();

                var accionConvocatoria = $(this).attr('action');
                var codigoconvocatoria = <?php echo $data['convocatoria']->getIdConvocatoria(); ?>;

                $.ajax({
                    type: "POST",
                    url: "/wp-admin/admin-ajax.php",
                    data: {
                        action: 'gestionarconvocatorias',
                        accionConvocatoria: accionConvocatoria,
                        codigoconvocatoria: codigoconvocatoria
                    }, success: function (response) {
                        console.log(response.content);

                        if (response.content == 'ok') {
                            location.reload();
                        }
                    },
                    fail: function (err) {
                        console.log("There was an error: " + err);
                    }
                });
            });
        });
    </script>