-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcollectionAsList.php
48 lines (37 loc) · 1.5 KB
/
collectionAsList.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @author James Baster <[email protected]>
* @copyright City of Edinburgh Council & James Baster
* @license Open Source under the 3-clause BSD License
* @url https://github.com/City-Outdoors/City-Outdoors-Web
*/
require 'includes/src/global.php';
$currentUser = getCurrentUser();
$collection = Collection::loadBySlug($_GET['c']);
if (!$collection) die('not found');
$tpl = getSmarty($currentUser);
$tpl->assign('inCollectionTab',true);
$tpl->assign('inCollectionId',$collection->getId());
$tpl->assign('collection',$collection);
$tpl->assign('organisation',$collection->getOrganisation());
$collectionSearch = new CollectionSearch();
$tpl->assign('collections', $collectionSearch->getAllResultsIndexed());
$page = isset($_GET['page']) ? max(intval($_GET['page']),1) : 1;
$itemSearch = new ItemSearch();
$itemSearch->setPaging($page, 10);
$itemSearch->inCollection($collection);
$itemSearch->orderByField($collection->getTitleField());
if (isset($_GET['letter']) && trim($_GET['letter'])) {
$tpl->assign('activeLetter',trim($_GET['letter']));
$itemSearch->fieldStartsWith($collection->getTitleField(), trim($_GET['letter']));
} else {
$tpl->assign('activeLetter',null);
}
$itemSearch->includeChildCollections();
$tpl->assign('itemSearch',$itemSearch);
if ($collection->getSlug() == $CONFIG->HIDDEN_COLLECTION_SLUG) {
$tpl->display('collectionAsList.hidden.htm');
} else {
$tpl->assign('hiddenCollection', Collection::loadBySlug($CONFIG->HIDDEN_COLLECTION_SLUG));
$tpl->display('collectionAsList.htm');
}