praiadeseselle/site/templates/categoria.php

69 lines
3.5 KiB
PHP
Raw Normal View History

2022-10-25 14:47:38 +02:00
<?php namespace ProcessWire;
$menu = '';
$contido = '';
$mantemento = $inicio->mantemento;
if($mantemento && !$user->isLoggedin())
{
$session->redirect($inicio->url);
}
else
{
$contido .= '<article id="' . $page->name . '">' . "\n";
$contido .= '<h2 class="bloque"><i class="icon-folder"></i> ' . $page->parent()->title . ': ' . ucfirst($page->title) . '</h2>' . "\n";
$publicacions = pages()->get('/publicacions/')->children("template='publicacion',categorias=$page,sort=-data_publicacion,limit=10");
$contido .= '<section id="publicacions">' . "\n";
$contido .= renderPaxinacion($publicacions, 'superior');
foreach($publicacions as $publicacion)
{
$data = strtotime($publicacion->data_publicacion);
$dateFormatter = \IntlDateFormatter::create(
$languages->getLocale(),
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
\date_default_timezone_get(),
\IntlDateFormatter::GREGORIAN
);
$contido .= '<div class="artigo">' . "\n";
$contido .= '<header class="publicacion-info">' . "\n";
$contido .= '<div class="data">' . "\n";
$contido .= '<time datetime="' . $publicacion->data_publicacion . '">' ."\n";
$dateFormatter->setPattern('EEEE');
$contido .= '<em>' . ucfirst(datefmt_format($dateFormatter, $data)) . '</em>' . "\n";
$dateFormatter->setPattern('MMMM');
$contido .= '<strong>' . ucfirst(datefmt_format($dateFormatter, $data)) . '</strong>' . "\n";
$dateFormatter->setPattern('dd');
$contido .= '<span>' . datefmt_format($dateFormatter, $data) . '</span>' . "\n";
$contido .= '</time>' . "\n";
$contido .= '</div>' . "\n";
$contido .= '<div class="info">' . "\n";
$contido .= '<h3 class="publicacion-titulo">' . "\n";
$contido .= '<a href="' . $publicacion->url . '"><i class="icon-book"></i> ' . $publicacion->title . '</a>' . "\n";
$contido .= '</h3>' . "\n";
$contido .= '<dl>' . "\n";
$contido .= '<dt title="' . _x('Autor', 'Post author') . '"><i class="icon-user"></i><span class="oculto-movil"> ' . _x('Autor', 'Post author') . '</span></dt>' . "\n";
$contido .= '<dd>' . $publicacion->createdUser->name . '</dd>' . "\n";
$contido .= '<dt title="' . pages()->get('/categorias/')->title . '"><i class="icon-folder"></i><span class="oculto-movil"> ' . pages()->get('/categorias/')->title . '</span></dt>' . "\n";
$contido .= '<dd><a href="' . $publicacion->categorias->url . '">' . $publicacion->categorias->title . '</a></dd>' . "\n";
$contido .= '<dt title="' . pages()->get('/etiquetas/')->title . '"><i class="icon-tag"></i><span class="oculto-movil"> ' . pages()->get('/etiquetas/')->title . '</span></dt>' . "\n";
$contido .= '<dd>' . $publicacion->etiquetas->each("<a href='{url}'>{title}</a>") . '</dd>' . "\n";
$contido .= '</dl>' . "\n";
$contido .= '</div>' . "\n";
$contido .= '</header>' . "\n";
$contido .= '<div class="resumo">' . "\n";
$contido .= '<p>' . renderResumen(getTextoLimpo(getSeccions($publicacion->seccions))) . '</p>' . "\n";
$contido .= '<p><a href="' . $publicacion->url . '"><i class="icon-arrow-right"></i>' . _x("Ler máis", "Read more") . '</a></p>' ."\n";
$contido .= '</div>' . "\n";
$contido .= '</div>' . "\n";
}
$contido .= renderPaxinacion($publicacions, 'inferior');
$contido .= '</section>' . "\n";
$contido .= '</article>' . "\n";
}