forked from Public/pics
Initial commit.
This is to be the new HashRU website based on the Aaronweb.net/Kabuki CMS.
This commit is contained in:
45
controllers/ViewPeople.php
Normal file
45
controllers/ViewPeople.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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/');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user