256 lines
13 KiB
PHP
256 lines
13 KiB
PHP
<?php
|
|
|
|
|
|
function EN_user_has_role($user_id, $role_name)
|
|
{
|
|
$user_meta = get_userdata($user_id);
|
|
$user_roles = $user_meta->roles;
|
|
return in_array($role_name, $user_roles);
|
|
}
|
|
|
|
function EN_user_viewer() {
|
|
|
|
//Só mudar o ano após ter criado os campos "miniX_20XX" para todos os minicursos disponíveis
|
|
//e também os campos novos "online20XX" e "presencial20XX"
|
|
//A role "inscritos_20XX" também deve ser criada previamente em "Members->Adicionar nova Função"
|
|
$ano = 2023;
|
|
|
|
//Limitação para somente usuários cadastrados
|
|
if (!is_user_logged_in())
|
|
{
|
|
$out = '<hr><br><h3>EXCLUSIVE ACCESS FOR REGISTERED USERS</h3>';
|
|
$out .= '<p>Log in to the website: <a href="https://www.sige.ita.br/log-in/">LOGIN</a> or complete your registration right now: <a href="https://www.sige.ita.br/cadastro_en/">REGISTRATION</a>.</p><br><hr>';
|
|
return $out;
|
|
}
|
|
|
|
$usr = wp_get_current_user();
|
|
$usr_info = get_userdata( $usr->ID );
|
|
|
|
//Código para restringir acesso e testar modificações
|
|
#if (!user_has_role(get_current_user_id(), 'administrator')){
|
|
# $out = '<br><hr><br><h3>Em manutenção, retorne em breve. </h3><hr>';
|
|
#return $out;
|
|
#}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
/// Adicionar Opção para participação ONLINE/////////////
|
|
$out ="<h1>XXV SYMPOSIUM ON OPERATIONAL APPLICATIONS IN DEFENSE AREAS</h1><hr><br>";
|
|
|
|
//Definir Texto Exibido
|
|
$out .='<h2><strong>ACCESS TO THE ONLINE EVENT CONTENT</strong></h2>';
|
|
$out .= '<p>You will have remote access to all the exclusive content of the ' .$ano .' event, including access to the academic papers with presentations by the authors themselves, sending questions and following the live broadcasts.</p>';
|
|
|
|
//Define as Roles que devem ser alteradas e metadados atualizados
|
|
if (isset($_POST['btn_online']))
|
|
{
|
|
//Para o caso do acesso online a aprovação é imediata
|
|
//O metadata "online20XX" deve ser criado para os usuários no plugin "Campos Personalizados"
|
|
update_user_meta( $usr->ID, 'online'.$ano, 'Participação APROVADA');
|
|
//O role "inscritos_20XX" também deve ser criada previamente em "Members->Adicionar nova Função"
|
|
//com apenas a função básica de ler
|
|
$usr->add_role( 'inscritos_'.$ano );
|
|
}
|
|
|
|
//Atualizar o metadado a ser coletado para checar o status da inscrição para o ano desejado
|
|
$status = get_metadata('user', $usr->ID, 'online'.$ano, true);
|
|
$colorRequest = "#009900";
|
|
|
|
//Este trecho serve para exibir a inscrição aprovada ou disponibilizar o botão de solicitação
|
|
if ($status == "Participação APROVADA" )
|
|
{
|
|
$out .= '<p>STATUS: <span style="color:green"> <strong>Access Authorized </span></strong></p>';
|
|
}
|
|
else
|
|
{
|
|
$out .= '<p>STATUS: <strong><span style="color:teal"> Access to the event not requested </span></strong></p>';
|
|
|
|
wp_nonce_field('btn_online_clicked');
|
|
$out .= '<form id="frm" method="post" action="" >';
|
|
$out .= '<input style="background-color:' . $colorRequest . ';
|
|
border: solid 0px #6E6E6E;
|
|
height: 30px;
|
|
width: 160px;
|
|
font-size:14px;
|
|
color:white;
|
|
margin-top:0px; margin-left:0x;margin-bottom:4px; "
|
|
type="submit" value="Request Access" id="submit" name="btn_online" /> </form>';
|
|
|
|
$out .= '<hr style="height:1px;border:none;color:#e3e3e3;background-color:#e3e3e3"/>';
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
//Adicionar Botão para participação PRESENCIAL/////////////
|
|
$out .= '<hr style="height:1px;border:none;color:#e3e3e3;background-color:#e3e3e3"/>';
|
|
$out .='<h2><strong>IN-PERSON PARTICIPATION </strong></h2>';
|
|
$out .='<p>Seize this opportunity! You will have the chance to attend the lectures, technical sessions, workshops, presentations, and mini-courses held at facilities of the ITA during this edition of SIGE. Moreover, you will have the opportunity to engage with military personnel, academics, and companies actively involved in the development of cutting-edge defense solutions. Secure your spot now, as we have limited availability, and registrations will be accepted until <strong>September 19, 2023</strong>.</p>';
|
|
|
|
$btn_presencial_sige = 'presencial'.$ano;
|
|
if (isset($_POST[$btn_presencial_sige]))
|
|
{
|
|
update_user_meta( $usr->ID, $btn_presencial_sige, $_POST[$btn_presencial_sige]);
|
|
//Role "inscritos_20XX" deve estar criada, ela garante a contagem total de inscritos
|
|
$usr->add_role( 'inscritos_'.$ano );
|
|
update_user_meta( $usr->ID, "presencial_geral", "Sim");
|
|
}
|
|
|
|
//Aqui é adicionado o botão para solicitar a participação, ultimo valor é se ainda está aberto as inscrições
|
|
$out .= EN_create_status_request($usr, $btn_presencial_sige, 'STATUS: ', true);
|
|
|
|
|
|
$chekon_status = get_metadata('user', $usr->ID, 'presencial'.$ano, true);
|
|
|
|
if ($chekon_status != "Não Solicitada" && $chekon_status != "" && $chekon_status != "Cancelar Solicitação")
|
|
{
|
|
//update_user_meta( $usr->ID, 'online'.$ano, "Participação APROVADA");
|
|
|
|
} elseif ($chekon_status == "Cancelar Solicitação"){
|
|
update_user_meta( $usr->ID,"mini1_2023","");
|
|
update_user_meta( $usr->ID,"mini2_2023","");
|
|
update_user_meta( $usr->ID,"mini3_2023","");
|
|
update_user_meta( $usr->ID,"mini4_2023","");
|
|
update_user_meta( $usr->ID,"mini5_2023","");
|
|
update_user_meta( $usr->ID,"inovacao2023","");
|
|
update_user_meta( $usr->ID,"aerologlab2023","");
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
//Adicionar Botões para participação em Mini Cursos/////////////
|
|
//As descrições dos minicursos devem ser atualizadas aqui para o que o usuário irá enxergar
|
|
//a Key do array correponde ao nome da chave do campo adicional do usuário
|
|
$courses = array("mini3_".$ano =>array("Mini Curso 1","Towards Trustworthy AI-Integrating Reasoning and Learning" , "Prof. Dr. Fredrik Heintz", "https://liu.se/en/employee/frehe08", true),
|
|
"mini1_".$ano =>array("Mini Curso 2","Value-Focused Thinking for Capability-Based Planning", "Coronel (USAF) Gregory S. Parnell", "https://industrial-engineering.uark.edu/directory/index/uid/gparnell/name/Gregory+S.+Parnell/", true),
|
|
"mini2_".$ano =>array("Mini Curso 3","Competency-based Training to Address Representative Engineering Grand Challenges", "Prof. Dr. Girum Urgessa", "https://civil.gmu.edu/profiles/gurgessa", true),
|
|
"mini4_".$ano =>array("Mini Curso 4","Introdução à Engenharia de Sistemas Espaciais", "Prof. Dr. Márcio Martins da Silva Costa", "http://lattes.cnpq.br/9992346581154486", true),
|
|
"mini5_".$ano =>array("Mini Curso 5","Introdução à Criptografia Quântica", "Prof. Dr. André Jorge Carvalho Chaves", "http://lattes.cnpq.br/5727667279534190", true)
|
|
);
|
|
|
|
|
|
$out .= '<hr>';// style="height:1px;border:none;color:#e3e3e3;background-color:#e3e3e3"/>';
|
|
$out .= '<p><h2><strong>MINI-COURSES</strong></h2></p>';
|
|
$out .= '<p>The mini-courses have limited places, so do not miss out on this opportunity to take part in person. Secure your place as soon as possible, but do not worry if you can not make it. The mini-courses will be recorded and made available on our website after the event is over.</p>';
|
|
|
|
//Para solicitar os minicursos disponíveis o usuário deve ter solicitado participação presencial
|
|
//Atenção para atualizar o metadado no par ao ano correto
|
|
|
|
$chekon_statusP = get_metadata('user', $usr->ID, 'presencial'.$ano, true);
|
|
if ($chekon_statusP == "Não Solicitada" || $chekon_statusP == "")
|
|
{
|
|
$out .= '<br<strong><span style="color:red"> ATTENTION: </span></strong><br>';
|
|
$out .= 'You have not requested In-Person Attendance yet. When you request participation in a workshop, your in-person registration request will also be submitted.';
|
|
} else{
|
|
|
|
if ($chekon_statusP == "Cancelar Solicitação")
|
|
{
|
|
$out .= '<br><strong><span style="color:red"> ATTENTION: </span></strong><br>';
|
|
$out .= 'You have requested the cancellation of your In-Person Participation. Automatically, all your registrations for workshops and other in-person events at SIGE have been deleted. If you change your mind, please feel free to request your participation again.';
|
|
update_user_meta( $usr->ID,"mini1_2023","");
|
|
update_user_meta( $usr->ID,"mini2_2023","");
|
|
update_user_meta( $usr->ID,"mini3_2023","");
|
|
update_user_meta( $usr->ID,"mini4_2023","");
|
|
update_user_meta( $usr->ID,"mini5_2023","");
|
|
update_user_meta( $usr->ID,"inovacao2023","");
|
|
update_user_meta( $usr->ID,"aerologlab2023","");
|
|
} else{
|
|
|
|
|
|
|
|
//Para cada minicurso é gerado o botão de solicitação
|
|
$out .= '<hr style="height:1px;border:none;color:#e3e3e3;background-color:#e3e3e3"/>';
|
|
foreach ( $courses as $mini => $desc )
|
|
{
|
|
|
|
$buttonName = $mini ;
|
|
|
|
if (isset($_POST[$buttonName]))
|
|
{
|
|
update_user_meta( $usr->ID, $mini, $_POST[$buttonName]);
|
|
if ($chekon_statusP == "Não Solicitada" || $chekon_statusP == "")
|
|
{
|
|
//Atualizar ano do metadado
|
|
//update_user_meta( $usr->ID, 'presencial'.$ano, "Solicitar Participação");
|
|
header("Refresh:0");
|
|
}
|
|
|
|
}
|
|
$desc_info = '<strong>' . $desc[0] . '</strong> : ' . $desc[1] . ' (<a href=' . $desc[3] . ' target="_blank" >' . $desc[2] . ')</a><br>Status: ';
|
|
|
|
$out .= EN_create_status_request($usr, $buttonName, $desc_info , $desc[4] );
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
//Adicionar Botão para participação PRESENCIAL/////////////
|
|
$out .= '<hr style="height:1px;border:none;color:#e3e3e3;background-color:#e3e3e3"/>';
|
|
$out .='<h2><strong>OTHER EVENTS </strong></h2>';
|
|
$out .='<p>In this edition of SIGE, we are honored to have the participation of the Logistics Engineering Laboratory of the Technological Institute of Aeronautics (AEROLOGLAB) and the Innovation Management Coordination of the Department of Aerospace Science and Technology (DCTA). They will provide our distinguished audience with high-level presentations on highly relevant topics, such as the use of Digital Twins technology to support aircraft and the interconnection between the Aeronautics Innovation System and the Defense Industrial Base.</p>';
|
|
$out .='<p>Check our schedule for more information. Dont miss this opportunity.</p>';
|
|
$out .= '<hr style="height:1px;border:none;color:#e3e3e3;background-color:#e3e3e3"/>';
|
|
|
|
|
|
$btn_inovacao = 'inovacao'.$ano;
|
|
if (isset($_POST[$btn_inovacao]))
|
|
{
|
|
update_user_meta( $usr->ID, $btn_inovacao, $_POST[$btn_inovacao]);
|
|
//Role "inscritos_20XX" deve estar criada, ela garante a contagem total de inscritos
|
|
$usr->add_role( 'inscritos_'.$ano );
|
|
if ($chekon_statusP == "Não Solicitada" || $chekon_statusP == "" || $chekon_statusP =="Cancelar Solicitação")
|
|
{
|
|
//Atualizar ano do metadado
|
|
//update_user_meta( $usr->ID, 'presencial'.$ano, "Solicitar Participação");
|
|
header("Refresh:0");
|
|
}
|
|
}
|
|
|
|
//Aqui é adicionado o botão para solicitar a participação, ultimo valor é se ainda está aberto as inscrições
|
|
$out .= '<p><strong>PRESENTATION 01</strong>: O Sistema de Inovação da Aeronáutica e sua Conexão com a Base Industrial de Defesa.</p>';
|
|
$out .= EN_create_status_request($usr, $btn_inovacao, 'STATUS: ', true);
|
|
|
|
|
|
|
|
$btn_aerologlab = 'aerologlab'.$ano;
|
|
if (isset($_POST[$btn_aerologlab]))
|
|
{
|
|
update_user_meta( $usr->ID, $btn_aerologlab, $_POST[$btn_aerologlab]);
|
|
//Role "inscritos_20XX" deve estar criada, ela garante a contagem total de inscritos
|
|
$usr->add_role( 'inscritos_'.$ano );
|
|
if ($chekon_statusP == "Não Solicitada" || $chekon_statusP == "" || $chekon_statusP =="Cancelar Solicitação")
|
|
{
|
|
//Atualizar ano do metadado
|
|
//update_user_meta( $usr->ID, 'presencial'.$ano, "Solicitar Participação");
|
|
header("Refresh:0");
|
|
}
|
|
}
|
|
|
|
//Aqui é adicionado o botão para solicitar a participação, ultimo valor é se ainda está aberto as inscrições
|
|
$out .= '<p><strong>PRESENTATION 02</strong>: Gêmeo Digital em Suporte à Aeronave.</p>';
|
|
$out .= EN_create_status_request($usr, $btn_aerologlab, 'STATUS: ', true);
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
}
|
|
}
|
|
|
|
return $out;
|
|
}
|
|
add_shortcode('EN_sige_user_viewer', 'EN_user_viewer');
|
|
|
|
function EN_header_insc() {
|
|
$out = '<h2>MY EVENT REGISTRATIONS: </h2>';
|
|
if (!is_user_logged_in())
|
|
{
|
|
//$out = '<br><hr><br><h3>EXCLUSIVE ACCESS FOR REGISTERED USERS </h3><hr>';
|
|
return $out;
|
|
}
|
|
$usr = wp_get_current_user();
|
|
$usr_info = get_userdata( $usr->ID );
|
|
|
|
$usr_info->user_email;
|
|
|
|
$out .= '<h5><strong>' . $usr_info->display_name . '</strong><br></h5><hr style="height:4px;">';
|
|
return $out;
|
|
}
|
|
|
|
add_shortcode('EN_header_insc', 'EN_header_insc');
|
|
|
|
|
|
?>
|