2022-12-06 19:51:39 +01:00
|
|
|
<?php namespace ProcessWire;
|
|
|
|
|
2024-11-14 18:42:06 +01:00
|
|
|
/** @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-03-11 12:53:47 +01:00
|
|
|
|
|
|
|
$atopar = $sanitizer->text($input->get('q'));
|
|
|
|
|
2022-12-06 19:51:39 +01:00
|
|
|
$menu = '';
|
2024-11-14 18:42:06 +01:00
|
|
|
|
2022-12-06 19:51:39 +01:00
|
|
|
|
2023-03-11 12:53:47 +01:00
|
|
|
if($configuracion['mantemento']['activo'] && !$user->isLoggedin())
|
2022-12-06 19:51:39 +01:00
|
|
|
{
|
2024-11-14 18:42:06 +01:00
|
|
|
$menu = renderMenu($inicio->and($pages->get('/noticias')->and($pages->get('/contacto'))));
|
2022-12-06 19:51:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-11-14 18:42:06 +01:00
|
|
|
$menu = renderMenu($inicio->and($inicio->children));
|
2023-03-11 12:53:47 +01:00
|
|
|
}
|
2024-11-14 18:42:06 +01:00
|
|
|
?>
|
|
|
|
<main id="contido" class="completo">
|
|
|
|
<nav id="migas" aria-label="<?=_x("Breadcrumb", "Breadcrumb");?>">
|
|
|
|
<?=renderMigasPan($page);?>
|
|
|
|
</nav>
|
|
|
|
<?php
|
2023-03-11 12:53:47 +01:00
|
|
|
if($atopar)
|
|
|
|
{
|
|
|
|
$input->whitelist('q', $atopar);
|
|
|
|
$atopar = $sanitizer->selectorValue($atopar);
|
2022-12-06 19:51:39 +01:00
|
|
|
|
2023-03-11 12:53:47 +01:00
|
|
|
$selector = "";
|
|
|
|
$selector .= "(title|seccions.titular|seccions.artigo~=$atopar)";
|
|
|
|
$selector .= ",(seccions.destacados.titular~=$atopar)";
|
|
|
|
$selector .= ",(seccions.destacados.artigo~=$atopar), limit=50";
|
|
|
|
if($user->isLoggedin()) $selector .= ", has_parent!=2";
|
|
|
|
$matches = $pages->find($selector);
|
2022-12-06 19:51:39 +01:00
|
|
|
|
2023-03-11 12:53:47 +01:00
|
|
|
$cnt = $matches->count;
|
2022-12-06 19:51:39 +01:00
|
|
|
|
2023-03-11 12:53:47 +01:00
|
|
|
if($cnt)
|
|
|
|
{
|
2024-11-14 18:42:06 +01:00
|
|
|
?>
|
|
|
|
<article id="<?=$page->name;?>">
|
|
|
|
<h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
|
|
|
|
<h2>Resultados para: <?=$atopar;?></h2>
|
|
|
|
<p><?=sprintf(_n(_x('Found %d page', 'found 1 page'),_x('Found %d pages', 'found multiple pages'), $cnt), $cnt);?></p>
|
|
|
|
<section>
|
|
|
|
<h3 class="accesibilidade-oculto"><?=_x("Search results", "search results");?></h3>
|
|
|
|
<ul class="lista">
|
|
|
|
<?php foreach($matches as $paxina): ?>
|
|
|
|
<li class="info">
|
|
|
|
<a href="<?=$paxina->url;?>"><i class="icon-play"></i> <?=$paxina->title;?></a>
|
|
|
|
</li>
|
|
|
|
<?php endforeach;?>
|
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
</article>
|
|
|
|
<?php
|
2022-12-06 19:51:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-11-14 18:42:06 +01:00
|
|
|
?>
|
|
|
|
<article id="<?=$page->name;?>" class="destacado">
|
|
|
|
<h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
|
|
|
|
<h2><?=_x('Sitemap', 'sitemap');?></h3>
|
|
|
|
<p><?=_x('Sorry, no results were found', 'no results found');?>.</p>
|
|
|
|
<section>
|
|
|
|
<h3 class="accesibilidade-oculto"><?=_x('Sitemap', 'sitemap');?></h3>
|
|
|
|
<nav id="mapa-sitio">
|
|
|
|
<?=renderMapaDoSitio($inicio, 3);?>
|
|
|
|
</nav>
|
|
|
|
</section>
|
|
|
|
</article>
|
|
|
|
<?php
|
2022-12-06 19:51:39 +01:00
|
|
|
}
|
2023-03-11 12:53:47 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-11-14 18:42:06 +01:00
|
|
|
?>
|
|
|
|
<article id="<?=$page->name;?>" class="destacado">
|
|
|
|
<h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
|
|
|
|
<h2><?=_x('Sitemap', 'sitemap');?></h3>
|
|
|
|
<p><?=_x('Sorry, no results were found', 'no results found');?>.</p>
|
|
|
|
<section>
|
|
|
|
<h3 class="accesibilidade-oculto"><?=_x('Sitemap', 'sitemap');?></h3>
|
|
|
|
<nav id="mapa-sitio">
|
|
|
|
<?=renderMapaDoSitio($inicio, 3);?>
|
|
|
|
</nav>
|
|
|
|
</section>
|
|
|
|
</article>
|
|
|
|
<?php
|
2023-03-11 12:53:47 +01:00
|
|
|
}
|
2024-11-14 18:42:06 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
</main>
|
|
|
|
<?php
|