praiadeseselle/site/templates/blogue.php

109 lines
No EOL
5.9 KiB
PHP

<?php namespace ProcessWire;
$mantemento = $inicio->mantemento;
if($mantemento && !$user->isLoggedin())
{
$session->redirect('/praiadeseselle');
}
else
{
$menu = renderMenu($inicio->and($inicio->children), 0, 'paxinas');
$contido = '';
$categorias = pages()->get('/noticias/categorias/')->children();
$etiquetas = pages()->get('/noticias/etiquetas/')->children();
$contido .= ' ' . renderMigasPan($page) . "\n";
$contido .= ' <article id="' . $page->name .'">' . "\n";
$contido .= ' <header>' . "\n";
$contido .= ' <div class="columna">' . "\n";
$contido .= ' <h2>' . ucfirst($page->title) . '</h2>' . "\n";
$contido .= ' </div>' . "\n";
$contido .= ' </header>' . "\n";
$contido .= ' <div class="contedor">' . "\n";
$contido .= ' <section id="categorias">' . "\n";
$contido .= ' <h3>' . pages()->get('/noticias/categorias/')->title . '</h3>' . "\n";
$contido .= ' <ul class="lista">' . "\n";
foreach($categorias as $categoria)
{
$contido .= ' <li class="info">' . "\n";
$contido .= ' <a href="' . $categoria->url . '"><i class="icon-folder"></i> ' . $categoria->title . '</a>' . "\n";
$contido .= ' <span>(' . $categoria->numPosts(true) . ')</span>' . "\n";
$contido .= ' </li>' . "\n";
}
$contido .= ' </ul>' . "\n";
$contido .= ' </section>' . "\n";
$contido .= ' <section id="etiquetas">' . "\n";
$contido .= ' <h3>' . pages()->get('/noticias/etiquetas/')->title . '</h3>' . "\n";
$contido .= ' <ul class="nube">' . "\n";
foreach($etiquetas as $etiqueta)
{
$contido .= ' <li class="info">' . "\n";
$contido .= ' <a href="' . $etiqueta->url . '"><i class="icon-tag"></i> ' . $etiqueta->title . '</a>' . "\n";
$contido .= ' <span>(' . $etiqueta->numPosts(true) . ')</span>' . "\n";
$contido .= ' </li>' . "\n";
}
$contido .= ' </ul>' . "\n";
$contido .= ' </section>' . "\n";
$contido .= '<section id="publicacions">' . "\n";
if($page->numChildren)
{
$publicacions = pages()->get('/noticias/publicacions/')->children("template='publicacion',sort=-data_publicacion,limit=10");
$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('Author', 'Post author') . '"><i class="icon-user"></i><span class="oculto-movil"> ' . _x('Author', 'Post author') . '</span></dt>' . "\n";
$contido .= '<dd>' . ucfirst($publicacion->createdUser->name) . '</dd>' . "\n";
$contido .= '<dt title="' . pages()->get('/noticias/categorias/')->title . '"><i class="icon-folder"></i><span class="oculto-movil"> ' . pages()->get('/noticias/categorias/')->title . '</span></dt>' . "\n";
$contido .= '<dd><a href="' . $publicacion->categorias->url . '">' . $publicacion->categorias->title . '</a></dd>' . "\n";
$contido .= '<dt title="' . pages()->get('/noticias/etiquetas/')->title . '"><i class="icon-tag"></i><span class="oculto-movil"> ' . pages()->get('/noticias/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("Read more", "Read more") . '</a></p>' ."\n";
$contido .= '</div>' . "\n";
$contido .= '</div>' . "\n";
}
$contido .= renderPaxinacion($publicacions, 'inferior');
}
$contido .= '</section>' . "\n";
$contido .= '</div>' . "\n";
$contido .= '</article>' . "\n";
}