' . "\n";
$saida .= '
' . $titulo . ' ' . "\n";
$saida .= '
' . "\n";
$saida .= $texto . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderGaleria($seccion)
{
$saida = '';
$saida .= '
' . "\n";
$saida .= '' . (($seccion->titular) ? $seccion->titular : 'Galeria') . ' ' . "\n";
$saida .= '' . "\n";
foreach($seccion->imaxes as $imaxe)
{
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= ' ' . "\n";
$saida .= '' . $imaxe->description . ' ' . "\n";
$saida .= ' ' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
}
$saida .= '
' . "\n";
$saida .= 'Previous
' . "\n";
$saida .= 'Next
' . "\n";
$saida .= '' . "\n";
$saida .= ' ';
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderReixa($seccion)
{
$saida = '';
$saida .= '
' . "\n";
$saida .= '' . (($seccion->titular) ? $seccion->titular : 'Reixa') . ' ' . "\n";
$saida .= '' . "\n";
foreach($seccion->imaxes as $imaxe)
{
$saida .= '
' . "\n";
$saida .= ' ' . "\n";
$saida .= ' ' . "\n";
}
$saida .= '
' . "\n";
$saida .= '' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= ' ' . "\n";
$saida .= '' . $imaxe->description . ' ' . "\n";
$saida .= ' ' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= ' ';
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderImaxeTexto($seccion)
{
$saida = '';
$imaxe = '';
$texto = '';
$botons = '';
if($seccion->imaxe)
{
$imaxe .= renderImaxe($seccion);
}
$texto .= renderTexto($seccion);
if($seccion->botons->isEmpty())
{
$botons .= '
' . "\n";
$botons .= getSeccions($seccion->botons) . "\n";
$botons .= '
' . "\n";
}
switch ($seccion->imaxe_posicion->value)
{
case 'superior':
$saida .= '
' . "\n";
$saida .= '' . "\n";
$saida .= $imaxe . "\n";
$saida .= '
' . "\n";
$saida .= '' . "\n";
$saida .= $texto . "\n";
$saida .= '
' . "\n";
$saida .= $botons . "\n";
break;
case 'esquerda':
case 'dereita':
$saida .= '' . "\n";
$saida .= '' . "\n";
$saida .= '
' . "\n";
$saida .= $imaxe . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= $texto . "\n";
$saida .= $botons . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
break;
}
$saida .= ' ' . "\n";
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderImaxe($seccion)
{
$saida = '';
$saida .= '' . "\n";
$saida .= ' ' . "\n";
$saida .= '' . $seccion->imaxe->description . ' ' . "\n";
$saida .= ' ' . "\n";
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderTexto($seccion, $centrado = false)
{
$saida = '';
if($seccion->titular)
{
$saida .= '' . "\n";
$saida .= '
' . $seccion->titular . ' ' . "\n";
$saida .= '' . "\n";
}
$saida .= '' . "\n";
$saida .= $seccion->artigo . "\n";
$saida .= '
' . "\n";
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderBoton($seccion)
{
$saida = '';
$clases = '';
$sufijo = '';
switch ($seccion->botons_estilo->value)
{
case 'activo':
$clases = 'btn btn-lg btn-primary';
break;
case 'secundario':
$clases = 'btn btn-lg btn-secundary';
break;
case 'inactivo':
$clases = 'btn btn-lg btn-primary disabled';
break;
case 'aviso':
$clases = 'btn btn-lg text-black btn-outline-warning';
break;
case 'ligazon':
$clases = 'd-inline-flex align-items-center link-primary text-decoration-none text-uppercase';
$sufijo = ' ';
break;
}
$saida .= '';
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderLigazonImaxe($seccion)
{
$saida = '';
$saida .= '' . "\n";
$saida .= ' ' . "\n";
$saida .= '' . "\n";
$saida .= '' . $seccion->titular . ' ' . "\n";
$saida .= '' . _x('See details', 'see details') . '
' . "\n";
$saida .= ' ' . "\n";
$saida .= ' ' . "\n";
$saida .= ' ' . "\n";
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderDestacado($seccion)
{
$saida = '';
$icona = '';
$saida .= '' . "\n";
$saida .= '' . $seccion->titular . ' ' . "\n";
$saida .= '' . "\n";
$saida .= getSeccions($seccion->destacados);
$saida .= '
' . "\n";
$saida .= ' ' . "\n";
return $saida;
}
/**
* @param array|PageArray $seccion
* @param int $posicion
* @return string
*/
function renderElemento($seccion, $posicion = 0)
{
$saida = '';
$saida .= '' . "\n";
switch($seccion->destacado_icona_tipo->value)
{
case 'icona':
$saida .= '
';
break;
case 'imaxe':
$saida .= '
';
break;
case 'posicion':
$saida .= '
' . $posicion . '
';
break;
default:
$saida .= '';
break;
}
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= renderTexto($seccion);
if($seccion->botons && $seccion->botons->isEmpty())
{
$saida .= '
' . "\n";
$saida .= getSeccions($seccion->botons) . "\n";
$saida .= '
' . "\n";
}
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderCategoriasEtiquetas($seccion)
{
$saida = '';
switch ($seccion->first()->template->name)
{
case 'categoria':
$icono = 'folder';
$nome = 'categorias';
break;
case 'etiqueta':
$icono = 'tag';
$nome = 'etiquetas';
break;
default:
$icono = 'sn';
$nome = 'sin';
break;
}
$saida .= '' . "\n";
return $saida;
}
/**
* @param array|PageArray $artigos
* @param int $posicion
* @return string
*/
function renderPaxinacion($artigos, $posicion)
{
$paxinacion = $artigos->renderPager(
array(
'listMarkup' => ' ',
'itemMarkup' => '{out} ',
'linkMarkup' => '{out} ',
'nextItemLabel' => ' ',
'previousItemLabel' => ' ',
'separatorItemClass' => 'separador',
'nextItemClass' => 'seguinte',
'previousItemClass' => 'anterior',
'lastItemClass' => 'derradeiro',
'currentItemClass' => 'actual'
)
);
return $paxinacion;
}
/**
* @param array|PageArray $publicacion
* @param string $locale
* @param boolean $resumen
* @return string
*/
function renderArtigos($publicacion, $locale, $resumen = true)
{
$saida = '';
$data = strtotime($publicacion->fecha_publicacion);
$dateFormatter = \IntlDateFormatter::create(
$locale,
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
\date_default_timezone_get(),
\IntlDateFormatter::GREGORIAN
);
$saida .= '' . "\n";
$saida .= '' . "\n";
$saida .= '' ."\n";
$dateFormatter->setPattern('EEEE');
$saida .= '' . ucfirst(datefmt_format($dateFormatter, $data)) . ' ' . "\n";
$dateFormatter->setPattern('MMMM');
$saida .= '' . ucfirst(datefmt_format($dateFormatter, $data)) . ' ' . "\n";
$dateFormatter->setPattern('dd');
$saida .= '' . datefmt_format($dateFormatter, $data) . ' ' . "\n";
$saida .= ' ' . "\n";
$saida .= '' . "\n";
$saida .= '
' . "\n";
$saida .= '
' . "\n";
$saida .= ' ' . pages()->get('/noticias/categorias/')->title . ' ' . "\n";
$saida .= '' . $publicacion->categorias->title . ' ' . "\n";
$saida .= ' ' . pages()->get('/noticias/etiquetas/')->title . ' ' . "\n";
$saida .= '' . $publicacion->etiquetas->each("{title} ") . ' ' . "\n";
$saida .= ' ' . "\n";
$saida .= '
' . "\n";
$saida .= ' ' . "\n";
if($resumen)
{
if($publicacion->imaxe)
{
$thumb = $publicacion->imaxe->size(466, 260);
$saida .= ' ' . "\n";
}
$saida .= '' . "\n";
}
else
{
if($publicacion->imaxe)
{
$thumb = $publicacion->imaxe->size(466, 260);
$saida .= ' ' . "\n";
}
$saida .= '' . "\n";
$saida .= getSeccions($publicacion->seccions) . "\n";
$saida .= '
' . "\n";
}
$saida .= ' ' . "\n";
return $saida;
}
/**
* @param string $texto
* @param int $limite
* @param string $fin
* @return string
*/
function renderResumen($texto = '', $limite = 120, $fin = '...')
{
$saida = '';
if($texto == '') return '';
if(strlen($texto) <= $limite) return $texto;
$saida = substr($texto, 0, $limite);
$pos = strrpos($saida, " ");
if($pos>0)
{
$saida = substr($saida, 0, $pos);
}
$saida .= $fin;
return $saida;
}