/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/App
/Model
/LabelModel.php
$carouselTemplate = ContentService::getPartialContent(self::TEMPLATE);
$carouselTemplateItem = ContentService::getPartialContent(self::TEMPLATE_ITEM);
$labelsList = self::getLabelsDetail($labelsId, $carouselTemplateItem);
$carousel = str_replace('[#carousel-list#]', $labelsList, $carouselTemplate);
$content = str_replace('[#tags-carousel#]', $carousel, $content);
return $content;
}
public static function getLabelsDetail($labels, $template)
{
global $hg;
$listHtml = '';
foreach ($labels as $labelId) {
$labelVertex = new Vertex($labelId, 'Label', $hg);
$labelVertex = $labelVertex->expose();
$label = [
'label' => $labelVertex['displayName'],
'link' => '/relacoes/' . $labelVertex['id'],
'description' => $labelVertex['description']
];
$listHtml .= ContentService::fillData($label, $template);
}
return $listHtml;
}
public static function getRelatedContent($id)
{
global $hg;
$contentsId = $hg->getLinkedVertices(
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/App
/Model
/LabelModel.php
$carouselTemplate = ContentService::getPartialContent(self::TEMPLATE);
$carouselTemplateItem = ContentService::getPartialContent(self::TEMPLATE_ITEM);
$labelsList = self::getLabelsDetail($labelsId, $carouselTemplateItem);
$carousel = str_replace('[#carousel-list#]', $labelsList, $carouselTemplate);
$content = str_replace('[#tags-carousel#]', $carousel, $content);
return $content;
}
public static function getLabelsDetail($labels, $template)
{
global $hg;
$listHtml = '';
foreach ($labels as $labelId) {
$labelVertex = new Vertex($labelId, 'Label', $hg);
$labelVertex = $labelVertex->expose();
$label = [
'label' => $labelVertex['displayName'],
'link' => '/relacoes/' . $labelVertex['id'],
'description' => $labelVertex['description']
];
$listHtml .= ContentService::fillData($label, $template);
}
return $listHtml;
}
public static function getRelatedContent($id)
{
global $hg;
$contentsId = $hg->getLinkedVertices(
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/App
/Model
/LabelModel.php
public static function getLabelsByContentId($id)
{
global $hg;
$labelsId = $hg->getLinkedVertices(
[LANGUAGE, SITE, $id],
[
'fromSCHEMATail' => '*',
'SCHEMAEdge' => '*',
'toSCHEMATail' => '*',
'toSCHEMAVertex' => 'Label',
'match' => '*',
'order' => 'id',
'offset' => 0,
'rowcount' => 100000
]
);
$template = '<a href="[#link#]">[#label#]</a>, ';
$labelsList = self::getLabelsDetail($labelsId, $template);
return rtrim($labelsList, ', ');
}
}
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/App
/Model
/PostModel.php
public static function getAboutList($posts)
{
$postTemplate = ContentService::getPartialContent('template/sobre-item.html');
return self::getList($posts, $postTemplate);
}
public static function getVisitList($posts)
{
$postTemplate = ContentService::getPartialContent('template/planeje-sua-visita-item.html');
return self::getList($posts, $postTemplate);
}
public static function getPost($postId, $content)
{
global $hg;
$postVertex = new Vertex($postId, 'Post', $hg);
$post = $postVertex->expose();
$tags = LabelModel::getLabelsByContentId($postId);
$img = '<div class="no-img no-img--full"></div>';
if ($post["coverImageURL"]) {
$img = '<figure>
<img src="' . $post["coverImageURL"] . '" alt="">
<figcaption>' . $post["coverImageLabel"] . '</figcaption>
</figure>';
}
$title = $post["title"];
$summary = $post["summary"];
$link = 'post/' . $postId;
$publishDate = '';
if ($post["publishDate"] && $post['layout'] && $post['layout'] != 'artigo') {
$publishDate = new DateTime($post["publishDate"]);
$publishDate = $publishDate->format('d M Y');
}
$description = $post['content'];
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/App
/Handler
/PostHandler.php
*/
class PostHandler
{
const TEMPLATE = 'template/post-interna.html';
private $hg;
private $vertex;
public function __construct()
{
global $hg;
$this->hg = $hg;
}
public function handle($routes, $id)
{
$content = ContentService::getContent($this::TEMPLATE, $routes);
$content = PostModel::getPost($id, $content);
$relateds = LabelModel::getRelatedContentByContentId($id);
$content = str_replace('[#related#]', $relateds, $content);
http_response_code(200);
echo $content;
}
}
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/Routes
/Routes.php
}
if (array_key_exists($path, $this->routes[$this->method])) {
$handler = new $this->routes[$this->method][$path];
$language = $this->variables[$this->method][$path]["language"];
setlocale(LC_TIME, $language . '.utf-8');
define('LANGUAGE', constant($language));
$handler->handle($this);
return;
}
foreach ($this->regex[$this->method] as $key => $regex) {
preg_match_all($regex, $path, $matches, PREG_SET_ORDER, 0);
if ($matches) {
$this->path = $key;
$handler = new $this->routes[$this->method][$key];
$language = $this->variables[$this->method][$key]["language"];
setlocale(LC_TIME, $language . '.utf-8');
define('LANGUAGE', constant($language));
$handler->handle($this, $matches[0][2]);
return;
}
}
$this->show404();
}
private function show404()
{
http_response_code(404);
echo ContentService::getContent('template/404.html');
die();
}
}
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/config
/config.routes.php
$routes->addRoute('/en/agenda', 'App\Handler\ScheduleHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/agenda/[name]', 'App\Handler\EventHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/artistas', 'App\Handler\ArtistsHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/artistas/[name]', 'App\Handler\ArtistHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/enunciados', 'App\Handler\EnunciadosHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/enunciados/[name]', 'App\Handler\EnunciadoHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/exposicoes', 'App\Handler\ExhibitionHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/exposicoes/[name]', 'App\Handler\EventHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/multimidia', 'App\Handler\MultimediaHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/planeje-sua-visita', 'App\Handler\VisitHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/post/[name]', 'App\Handler\PostHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/educacao', 'App\Handler\EducationProjectHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/publicacoes', 'App\Handler\PublicationsHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/relacoes', 'App\Handler\LabelsHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/relacoes/[name]', 'App\Handler\LabelHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/sobrea34', 'App\Handler\AboutHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/search', 'App\Handler\SearchHandler', 'POST', ['language' => 'pt_BR']);
$routes->run();
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/index.php
<?php
ob_start('ob_gzhandler');
// Set Cache-Control header
header("Cache-Control: private, max-age=186400");
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/config/config.development.php';
require __DIR__ . '/config/config.php';
require __DIR__ . '/config/config.mercurio.php';
require __DIR__ . '/config/config.routes.php';
ob_end_flush();