praiadeseselle/site/templates/contacto.php

95 lines
4.2 KiB
PHP
Raw Normal View History

<?php namespace ProcessWire;
/** @var Page $page */
/** @var Pages $pages */
/** @var Config $config */
/** @var Sanitizer $sanitizer API variable */
/** @var WireInput $input API variable */
/** @var User $user API variable */
/** @var Languages $languages API variable */
/** @var SiteConfig $configuracion */
/** @var HomePage $inicio */
2023-02-21 14:48:37 +01:00
$menu = '';
if($configuracion['mantemento']['activo'] && !$user->isLoggedin())
{
$menu = renderMenu($inicio->and($pages->get('/noticias')->and($pages->get('/contacto'))));
}
else
{
$menu = renderMenu($inicio->and($inicio->children));
}
$saida = '';
$captcha = $modules->get('MarkupGoogleRecaptcha');
2023-03-22 17:48:48 +01:00
if ($captcha->verifyResponse() === true)
2023-03-22 17:48:48 +01:00
{
$correo = wireMail();
//$correo->to($configuracion['contacto_correo']);
//$correo->bcc('laegnur@artabro.org');
$correo->to('laegnur@artabro.org');
$correo->from($sanitizer->email($input->post->correo));
$correo->fromName($sanitizer->text($input->post->nome));
$correo->subject($sanitizer->text($input->post->asunto));
$correo->body($sanitizer->text($input->post->mensaxe));
$enviado = $correo->send();
if($enviado)
{
$saida .= '<p>' . _x('Mail sent', 'mail sent');
}
else
{
$saida .= '<p>' . _x('Error sending email', 'error sending mail');
}
$saida .= '<br><a class="boton activo centrado" href="' . $page->url . '" >' . _x('Go back to form', 'go back to form') .'</a></p>';
2023-03-22 17:48:48 +01:00
}
else
{
$saida .= '<form method="post" action="' . $page->url . '">';
$saida .= '<label for="nome">' . _x('Name', 'name') . '</label>';
$saida .= '<input type="text" name="nome" id="nome" required>';
$saida .= '<label for="correo">' . _x('Email', 'email') . '</label>';
$saida .= '<input type="email" name="correo" id="correo" required>';
$saida .= '<label for="asunto">' . _x('Subject', 'subject') . '</label>';
$saida .= '<input type="text" name="asunto" id="asunto" required>';
$saida .= '<label for="mensaxe">' . _x('Message', 'message') . '</label>';
$saida .= '<textarea name="mensaxe" id="mensaxe" cols="30" rows="6" required></textarea>';
$saida .= $captcha->render();
$saida .= '<input type="submit" id="enviar" name="enviar" class="boton activo" value="' . _x('Send message', 'send message') . '">';
$saida .= '</form>' . "\n";
$saida .= $captcha->getScript();
2023-03-22 17:48:48 +01:00
}
?>
<main id="contido" class="completo">
<nav id="migas" aria-label="<?=_x("Breadcrumb", "Breadcrumb");?>">
<?=renderMigasPan($page);?>
</nav>
<article id="<?=$page->name;?>">
<h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
<section id="contacto-formulario">
<h2 class="visually-hidden">Formulario de contacto</h2>
<?=$saida;?>
<iframe id="mapa" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d167.88206925427303!2d-8.223339!3d43.43177!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0xd2e759aa6d41317%3A0x25ccd67bb4c850ab!2sApartamentos%20tur%C3%ADsticos%20Praia%20de%20Seselle!5e1!3m2!1ses!2ses!4v1676985980478!5m2!1ses!2ses" style="border:0" allowfullscreen="" loading="lazy"></iframe>
</section>
<section id="contacto-info">
<div class="elemento">
<i class="icona icon-map-pin"></i>
<h2><?=_x('Address', 'address');?></h2>
<p><?=$configuracion['contacto_direccion'];?></p>
</div>
<div class="elemento">
<i class="icona icon-phone"></i>
<h2><?=_x('Phone', 'phone');?></h2>
<p><a href="tel://<?=$configuracion['contacto_telefono'];?>"><?=$configuracion['contacto_telefono'];?></a></p>
</div>
<div class="elemento">
<i class="icona icon-mail"></i>
<h2><?=_x('E-Mail', 'email');?></h2>
<p><a href="mailto:<?=$configuracion['contacto_correo'];?>"><?=$configuracion['contacto_correo'];?></a></p>
</div>
</section>
</article>
</main>
<?php