102 lines
3.1 KiB
PHP
102 lines
3.1 KiB
PHP
<?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 */
|
|
|
|
$atopar = $sanitizer->text($input->get('q'));
|
|
|
|
$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));
|
|
}
|
|
?>
|
|
<main id="contido" class="completo">
|
|
<nav id="migas" aria-label="<?=_x("Breadcrumb", "Breadcrumb");?>">
|
|
<?=renderMigasPan($page);?>
|
|
</nav>
|
|
<?php
|
|
if($atopar)
|
|
{
|
|
$input->whitelist('q', $atopar);
|
|
$atopar = $sanitizer->selectorValue($atopar);
|
|
|
|
$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);
|
|
|
|
$cnt = $matches->count;
|
|
|
|
if($cnt)
|
|
{
|
|
?>
|
|
<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
|
|
}
|
|
else
|
|
{
|
|
?>
|
|
<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
|
|
}
|
|
}
|
|
else
|
|
{
|
|
?>
|
|
<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
|
|
}
|
|
?>
|
|
|
|
</main>
|
|
<?php
|