File: /home/undanet/www/wp-content/themes/panoramic-child/inc/shortcodes.php
<?php
function listarConvocatoriasPHP($atts)
{
if ($_SERVER['REQUEST_METHOD'] == "POST" && !is_user_logged_in()) {
$_POST['nologin'] = true;
}
ob_start();
require_once(ABSPATH . 'PortalEmpleo/listarconvocatorias.php');
$output = ob_get_clean();
return $output;
}
add_shortcode('listarConvocatorias', 'listarConvocatoriasPHP');
function gestionarConvocatoriasPHP($atts)
{
ob_start();
require_once(ABSPATH
. '/PortalEmpleo/src/Views/GestionarConvocatorias.php');
$output = ob_get_clean();
return $output;
}
add_shortcode('gestionarConvocatorias', 'gestionarConvocatoriasPHP');
function detalleConvocatoriasPHP($atts)
{
if (isset($_GET["id"]) && is_numeric($_GET["id"])) {
$_SERVER['REQUEST_METHOD'] = "POST";
if (!isset($_POST['accionConvocatoria'])) {
$_POST['accionConvocatoria'] = 'DetalleConvocatoria';
}
$_POST['convocatoriaId'] = $_GET["id"];
if (is_user_logged_in()) {
$_POST['candidatoIdWP'] = get_current_user_id();
}
ob_start();
require_once(ABSPATH . '/PortalEmpleo/listarconvocatorias.php');
$output = ob_get_clean();
} else {
if (!is_admin()) {
global $wp_query;
$wp_query->set_404();
status_header(404);
get_template_part(404);
exit();
}
$output = "";
}
return $output;
}
add_shortcode('detalleConvocatoria', 'detalleConvocatoriasPHP');
function buscadorConvocatoriasPHP($atts)
{
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['accionConvocatoria'] = 'BuscarConvocatorias';
ob_start();
require_once(ABSPATH . '/PortalEmpleo/listarconvocatorias.php');
$output = ob_get_clean();
return $output;
}
add_shortcode('buscadorConvocatoria', 'buscadorConvocatoriasPHP');
function gestionarMisCandidaturasPHP($atts)
{
if (is_user_logged_in()) {
if (
$_SERVER['REQUEST_METHOD'] != "POST" && !isset($_POST['accionMisCandidaturas'])
) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['accionMisCandidaturas'] = 'ListarCandidaturas';
$_POST['codigoUsuarioWP'] = get_current_user_id();
}
ob_start();
require_once(ABSPATH
. '/PortalEmpleo/src/Views/GestionarMisCandidaturas.php');
$output = ob_get_clean();
return $output;
}
}
add_shortcode('gestionarMisCandidaturas', 'gestionarMisCandidaturasPHP');
function gestionarConvocatoriaCandidatosPHP($atts)
{
if (is_user_logged_in()) {
if (
$_SERVER['REQUEST_METHOD'] != "POST" && !isset($_POST['accionConvocatoria'])
) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['accionConvocatoria'] = 'ListarConvocatoriasReferencia';
$_POST['codigoUsuarioWP'] = get_current_user_id();
}
ob_start();
require_once(ABSPATH
. '/PortalEmpleo/src/Views/GestionarConvocatorias.php');
$output = ob_get_clean();
return $output;
}
}
add_shortcode('gestionarConvocatoriaCandidatos', 'gestionarConvocatoriaCandidatosPHP');
function gestionarConvocatoriaTribunalPHP($atts)
{
if (is_user_logged_in()) {
if (
$_SERVER['REQUEST_METHOD'] != "POST" && !isset($_POST['accionConvocatoria'])) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['accionConvocatoria'] = 'ListarTribunalReferencia';
$_POST['codigoUsuarioWP'] = get_current_user_id();
}
ob_start();
require_once(ABSPATH
. '/PortalEmpleo/src/Views/GestionarConvocatorias.php');
$output = ob_get_clean();
return $output;
}
}
add_shortcode('gestionarConvocatoriaTribunal', 'gestionarConvocatoriaTribunalPHP');
function gestionarValoracionesTribunalPHP($atts)
{
$_SERVER['HTTPS'] = $_SERVER['HTTPS'] == 'off'
? ''
: $_SERVER['HTTPS'];
$root = (!empty($_SERVER['HTTPS'])
? 'https'
: 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
if (is_user_logged_in()) {
if (
$_SERVER['REQUEST_METHOD'] != "POST" && !isset($_POST['accionConvocatoria'])
) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['accionConvocatoria'] = 'Valoraciones Tribunal';
}
$_POST['codigoUsuarioWP'] = get_current_user_id();
require_once(ABSPATH
. '/PortalEmpleo/src/Views/GestionarConvocatorias.php');
}
}
add_shortcode('gestionarValoracionesTribunal', 'gestionarValoracionesTribunalPHP');
function detalleCandidatoPHP($atts)
{
if (is_user_logged_in()) {
if (
$_SERVER['REQUEST_METHOD'] != "POST" && !isset($_POST['accionCandidato'])
) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['accionCandidato'] = 'DetalleCandidato';
$_POST['codigoUsuarioWP'] = get_current_user_id();
}
ob_start();
require_once(ABSPATH
. '/PortalEmpleo/src/Views/GestionarCandidatos.php');
$output = ob_get_clean();
return $output;
}
}
add_shortcode('detalleCandidato', 'detalleCandidatoPHP');
function fichaCandidatoPHP($atts)
{
$_SERVER['HTTPS'] = $_SERVER['HTTPS'] == 'off'
? ''
: $_SERVER['HTTPS'];
$root = (!empty($_SERVER['HTTPS'])
? 'https'
: 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
if (
isset($_GET["id"])
&& is_numeric($_GET["id"])
&& isset($_GET["cvt"])
&& is_numeric($_GET["cvt"])
&& isset($_GET["ref"])
&& strlen($_GET["ref"]) > 0
) {
$_SERVER['REQUEST_METHOD'] = "POST";
if (!isset($_POST['accionCandidato'])) {
$_POST['accionCandidato'] = 'VerFicha';
}
$_POST['candidatoId'] = $_GET["id"];
$_POST['convocatoriaId'] = $_GET["cvt"];
$_POST['convocatoriaRef'] = $_GET["ref"];
require_once($_SERVER['DOCUMENT_ROOT']
. '/PortalEmpleo/src/Views/GestionarCandidatos.php');
} else {
if (
isset($_GET["id"]) && is_numeric($_GET["id"]) && !isset($_GET["cvt"])
) {
$_SERVER['REQUEST_METHOD'] = "POST";
if (!isset($_POST['accionCandidato'])) {
$_POST['accionCandidato'] = 'VerFicha';
}
$_POST['candidatoId'] = $_GET["id"];
$_POST['convocatoriaId'] = null;
$_POST['convocatoriaRef'] = null;
require_once($_SERVER['DOCUMENT_ROOT']
. '/PortalEmpleo/src/Views/GestionarCandidatos.php');
} else {
header("LOCATION:$root");
}
}
}
add_shortcode('fichaCandidato', 'fichaCandidatoPHP');
function buscadorCandidatosPHP($atts)
{
$_SERVER['HTTPS'] = $_SERVER['HTTPS'] == 'off'
? ''
: $_SERVER['HTTPS'];
$root = (!empty($_SERVER['HTTPS'])
? 'https'
: 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['accionCandidato'] = 'BuscarCandidatos';
require_once($_SERVER['DOCUMENT_ROOT']
. '/PortalEmpleo/src/Views/GestionarCandidatos.php');
}
add_shortcode('buscadorCandidato', 'buscadorCandidatosPHP');
function downloadCandidatoPHP($atts)
{
$root = get_site_url() . '/';
if (isset($_GET["id"]) && isset($_GET["file"])) {
if (is_user_logged_in()) {
$user = wp_get_current_user();
$roles = ( array )$user->roles;
if (
get_current_user_id() == $_GET["id"]
|| current_user_can('administrator')
|| in_array('um_evaluador', $roles)
) {
require_once(ABSPATH . '/PortalEmpleo/src/Utils/download.php');
} else {
header("LOCATION:$root");
}
} else {
header("LOCATION:$root");
}
}
}
add_shortcode('downloadCandidato', 'downloadCandidatoPHP');
function downloadConvocatoriaPHP($atts)
{
$_SERVER['HTTPS'] = $_SERVER['HTTPS'] == 'off'
? ''
: $_SERVER['HTTPS'];
$root = (!empty($_SERVER['HTTPS'])
? 'https'
: 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
if (isset($_GET["ref"]) && isset($_GET["file"])) {
require_once($_SERVER['DOCUMENT_ROOT']
. '/PortalEmpleo/src/Utils/download.php');
}
if (
isset($_GET["impugcvt"])
&& isset($_GET["impugcdt"])
&& isset($_GET["file"])
) {
require_once($_SERVER['DOCUMENT_ROOT']
. '/PortalEmpleo/src/Utils/download.php');
}
}
add_shortcode('downloadConvocatoria', 'downloadConvocatoriaPHP');
/** Login Menu
*/
function panoramic_child_loginMenu($atts)
{
$atts = shortcode_atts([
'registerurl' => '#',
'profileurl' => '#',
], $atts);
ob_start();
include(get_theme_file_path()
. '/partial-templates/shortcode-login-menu.php');
$output = ob_get_clean();
return $output;
}
add_shortcode('loginMenu', 'panoramic_child_loginMenu');
/** INFORMES
*/
function candidatePersInfo($atts)
{
$root = get_site_url() . '/404';
if (is_user_logged_in() && current_user_can('administrator')) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['actionReport'] = 'candidatePersInfo';
ob_start();
require_once(ABSPATH . '/PortalEmpleo/src/Views/GestionarReports.php');
$output = ob_get_clean();
return $output;
} else {
header("LOCATION:$root");
}
}
add_shortcode('report_candidate_persol_info', 'candidatePersInfo');
function candidateAccessInfo($atts)
{
$root = get_site_url() . '/404';
if (is_user_logged_in() && current_user_can('administrator')) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['actionReport'] = 'candidateAccessInfo';
ob_start();
require_once(ABSPATH . '/PortalEmpleo/src/Views/GestionarReports.php');
$output = ob_get_clean();
return $output;
} else {
header("LOCATION:$root");
}
}
add_shortcode('report_candidate_access_info', 'candidateAccessInfo');
function callInfo($atts)
{
$root = get_site_url() . '/404';
if (is_user_logged_in() && current_user_can('administrator')) {
$_SERVER['REQUEST_METHOD'] = "POST";
$_POST['actionReport'] = 'call';
ob_start();
require_once(ABSPATH . '/PortalEmpleo/src/Views/GestionarReports.php');
$output = ob_get_clean();
return $output;
} else {
header("LOCATION:$root");
}
}
add_shortcode('report_call', 'callInfo');
function getPdfConvertedInPage($atts)
{
$root = get_site_url() . '/404';
if (is_user_logged_in()) {
$user = wp_get_current_user();
$roles = ( array )$user->roles;
if (
current_user_can('administrator')
|| in_array('um_evaluador', $roles)
) {
$_SERVER['REQUEST_METHOD'] = "POST";
ob_start();
require_once(ABSPATH
. '/PortalEmpleo/src/Views/GestionarConvocatorias.php');
$output = ob_get_clean();
return $output;
}
} else {
header("LOCATION:$root");
}
}
add_shortcode('pdf_page', 'getPdfConvertedInPage');
?>