pics/controllers/ViewPeople.php
Aaron van Geffen ab0e4efbcb Initial commit.
This is to be the new HashRU website based on the Aaronweb.net/Kabuki CMS.
2017-11-09 17:00:22 +01:00

46 lines
1.2 KiB
PHP

<?php
/*****************************************************************************
* ViewPeople.php
* Contains the people index controller
*
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
*****************************************************************************/
class ViewPeople extends HTMLController
{
const PER_PAGE = 24;
public function __construct()
{
// Fetch subalbums.
// !!! TODO: pagination.
$subalbums = Tag::getPeople();
// What assets are we using?
$id_assets = array_map(function($album) {
return (int) $album['id_asset_thumb'];
}, $subalbums);
// Fetch assets for thumbnails.
$assets = Asset::fromIds($id_assets, 'object');
// Build album list.
$albums = [];
foreach ($subalbums as $album)
{
$albums[$album['id_tag']] = [
'id_tag' => $album['id_tag'],
'caption' => $album['tag'],
'link' => BASEURL . '/' . $album['slug'] . '/',
'thumbnail' => !empty($album['id_asset_thumb']) ? $assets[$album['id_asset_thumb']]->getImage() : null,
];
}
$index = new AlbumIndex($albums);
parent::__construct('People - ' . SITE_TITLE);
$this->page->adopt($index);
$this->page->setCanonicalUrl(BASEURL . '/people/');
}
}