## third party
https://github.com/FabianBeiner/PHP-IMDB-Grabber with some modifications
https://getuikit.com/
+https://jdan.github.io/98.css/
<?php if(!empty($TemplateData['pagination']) && $TemplateData['pagination']['pages'] > 1) { ?>
-<div class="uk-grid-small uk-grid-match uk-grid">
- <div class="uk-width-1-3">
- <ul class="uk-pagination" >
- <?php require Summoner::themefile('collections/collections_pagination.html', UI_THEME); ?>
- </ul>
- </div>
- <div class="uk-width-2-3">
- <?php if(!isset($TemplateData['pagination']['hideSort'])) { ?>
- <div class="uk-inline">
- <button class="uk-button uk-button-default uk-button-small" type="button">Sort</button>
- <div uk-dropdown>
- <ul class="uk-nav uk-dropdown-nav">
- <?php if(!empty($TemplateData['defaultSortField'])) { ?>
- <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>$TemplateData['defaultSortField'],'sd'=>$TemplateData['defaultSortOrder'])); ?>">Default</a></li>
- <?php } else { ?>
- <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>'','sd'=>'ASC')); ?>">Latest</a></li>
- <?php } ?>
+ <?php require Summoner::themefile('collections/collections_pagination.html', UI_THEME); ?>
+
+ <?php if(!isset($TemplateData['pagination']['hideSort'])) { ?>
+ <form method="get" action="index.php">
+ <?php
+ foreach($TemplateData['pagination']['currentGetParameters'] as $ck=>$cp) {
+ echo '<input type="hidden" name="'.$ck.'" value="'.$cp.'" />';
+ }
+ ?>
+ <select name="s">
+ <?php if(!empty($TemplateData['defaultSortField'])) { ?>
+ <option value="<?php echo $TemplateData['defaultSortField']; ?>">Default</option>
+ <?php } else { ?>
+ <option value="">Latest</option>
+ <?php } ?>
- <?php
- if(!empty($TemplateData['simpleSearchFields'])) {
- foreach($TemplateData['simpleSearchFields'] as $k=>$v) {
- ?>
- <li class="<?php if(isset($v['selected'])) echo 'uk-active' ?>"><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>$k,'sd'=>'ASC')); ?>"><?php echo $v['displayname']; ?></a></li>
- <?php
- }
+ <?php
+ if(!empty($TemplateData['simpleSearchFields'])) {
+ foreach($TemplateData['simpleSearchFields'] as $k=>$v) {
+ ?>
+ <option value="<?php echo $k; ?>" <?php if(isset($v['selected'])) echo 'selected' ?> ><?php echo $v['displayname']; ?></option>
+ <?php
}
- ?>
+ }
+ ?>
+ </select>
+ <select name="sd">
+ <option value="ASC">ascending</option>
+ <option value="DESC">descending</option>
+ </select>
+ <input type="submit" value="Sort" />
+ </form>
+ <?php } ?>
- <li class="uk-nav-divider"></li>
- <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('sd'=>'DESC')); ?>"><span class="uk-icon uk-margin-small-right" uk-icon="icon: chevron-down"></span></a></li>
- <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('sd'=>'ASC')); ?>"><span class="uk-icon uk-margin-small-right" uk-icon="icon: chevron-up"></span></a></li>
- </ul>
- </div>
- </div>
- <?php } ?>
- </div>
-</div>
<?php } ?>
<?php if(!empty($TemplateData['search'])) { ?>
-<div uk-alert id="searchNotice">
- <button class="uk-alert-close" type="button" uk-close></button>
- <p>Display result for: <b><?php echo $TemplateData['search']; ?></b></p>
+<div class="window">
+ <div class="title-bar">
+ <div class="title-bar-text">Search</div>
+ <div class="title-bar-controls">
+ <button aria-label="Close" id="searchNoteWindowCloseButton"></button>
+ </div>
+ </div>
+ <div class="window-body">
+ <p>Display result for: <b><?php echo $TemplateData['search']; ?></b></p>
+ </div>
</div>
-<script type="text/javascript">
- UIkit.util.on('#searchNotice', 'hide', function () {
+<script>
+ const searchNoteWindowCloseButton = document.getElementById('searchNoteWindowCloseButton');
+ searchNoteWindowCloseButton.addEventListener('click', () => {
window.location.href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>";
});
</script>
<?php } ?>
<?php if(!empty($TemplateData['entries'])) { ?>
-<h3 class="uk-h3"><?php echo Summoner::ifset($TemplateData['loadedCollection'], 'name'); ?></h3>
-<div class="uk-grid-small uk-grid-match" uk-grid>
- <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
- <div class="uk-width-1-4@s uk-width-1-6@l">
- <div class="uk-card uk-card-default uk-card-small">
- <div class="uk-card-media-top">
- <?php if(Summoner::ifset($entry['fields'], 'coverimage')) { ?>
- <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>">
- <img src="<?php echo $TemplateData['storagePath'].'/'.$entryK.'/'.$entry['fields']['coverimage']['value']; ?>"
- alt="<?php echo $entry['fields']['coverimage']['displayname']; ?>">
- </a>
- <?php } ?>
- </div>
- <div class="uk-card-body uk-visible@l">
- <?php if(Summoner::ifset($entry['fields'], 'title')) { ?>
- <h3 class="uk-card-title"><?php echo $entry['fields']['title']['value']; ?></h3>
- <?php } ?>
-
- <?php if(Summoner::ifset($entry['fields'], array('description','value'))) { ?>
- <p><?php echo $entry['fields']['description']['value']; ?></p>
- <?php } ?>
- </div>
- <div class="uk-card-footer">
- <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" class="uk-button uk-button-text">View</a>
- </div>
- </div>
- </div>
- <?php } ?>
+<h3><?php echo Summoner::ifset($TemplateData['loadedCollection'], 'name'); ?></h3>
+<div class="sunken-panel">
+ <table width="100%">
+ <thead>
+ <tr>
+ <th>Image</th>
+ <th>Title</th>
+ <th>Description</th>
+ <th>View</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
+ <tr>
+ <td>
+ <?php if(Summoner::ifset($entry['fields'], 'coverimage')) { ?>
+ <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>">
+ <img src="<?php echo $TemplateData['storagePath'].'/'.$entryK.'/'.$entry['fields']['coverimage']['value']; ?>"
+ alt="<?php echo $entry['fields']['coverimage']['displayname']; ?>"
+ width="50px">
+ </a>
+ <?php } ?>
+ </td>
+ <td>
+ <?php if(Summoner::ifset($entry['fields'], 'title')) {
+ echo $entry['fields']['title']['value'];
+ } ?>
+ </td>
+ <td>
+ <?php if(Summoner::ifset($entry['fields'], array('description','value'))) {
+ echo $entry['fields']['description']['value'];
+ } ?>
+ </td>
+ <td>
+ <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>">View</a>
+ </td>
+ </tr>
+ <?php } ?>
+ </tbody>
+ </tbody>
+ </table>
</div>
<?php } elseif(!empty($TemplateData['collections'])) { ?>
-<h3 class="uk-h3">Collection overview</h3>
-<div class="uk-grid-small uk-grid-row-small uk-grid-row-small" uk-grid>
- <div class="uk-width-2-3@m uk-width-1-2@xl">
- <dl class="uk-description-list uk-description-list-divider">
- <?php foreach($TemplateData['collections'] as $k=>$v) { ?>
- <dt><a href="index.php?p=collections&collection=<?php echo $k; ?>"><?php echo $v['name']; ?></a></dt>
- <dd><?php echo $v['description']; ?></dd>
- <?php } ?>
- </dl>
- </div>
+<h3>Collection overview</h3>
+<div class="sunken-panel">
+ <table width="100%">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach($TemplateData['collections'] as $k=>$v) { ?>
+ <tr>
+ <td><a href="index.php?p=collections&collection=<?php echo $k; ?>"><?php echo $v['name']; ?></a></td>
+ <td><?php echo $v['description']; ?></td>
+ <tr>
+ <?php } ?>
+ </tbody>
+ </table>
</div>
<?php } ?>
<?php if(!empty($TemplateData['pagination']) && $TemplateData['pagination']['pages'] > 1) { ?>
-<div class="uk-grid-small uk-grid-match uk-grid">
- <div class="uk-width-3-4">
- <ul class="uk-pagination" >
- <?php require Summoner::themefile('collections/collections_pagination.html', UI_THEME); ?>
- </ul>
- </div>
-</div>
+<?php require Summoner::themefile('collections/collections_pagination.html', UI_THEME); ?>
<?php } ?>
+++ /dev/null
-<?php
-/**
- * Bibliotheca
- *
- * Copyright 2018-2021 Johannes Keßler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once 'lib/mancubus.class.php';
-$Mancubus = new Mancubus($DB,$Doomguy);
-require_once 'lib/trite.class.php';
-$Trite = new Trite($DB,$Doomguy);
-
-$_collection = '';
-if(isset($_GET['collection']) && !empty($_GET['collection'])) {
- $_collection = trim($_GET['collection']);
- $_collection = Summoner::validate($_collection,'digit') ? $_collection : '';
-}
-
-// field identifier to search within
-$_fid = '';
-if(isset($_GET['fid']) && !empty($_GET['fid'])) {
- $_fid = trim($_GET['fid']);
- $_fid = Summoner::validate($_fid,'nospace') ? $_fid : '';
-}
-
-// field value to look up
-$_fv = false;
-if(isset($_GET['fv']) && !empty($_GET['fv'])) {
- $_fv = trim($_GET['fv']);
- $_fv = Summoner::validate($_fv) ? $_fv : false;
-}
-
-// nav search
-$_search = '';
-if(isset($_GET['navSearch'])) {
- $_search = trim($_GET['navSearch']);
- $_search = urldecode($_search);
- $_search = Summoner::validate($_search) ? $_search : '';
-}
-
-## pagination
-$TemplateData['pagination'] = array('pages' => 0);
-
-$_curPage = 1;
-if(isset($_GET['page']) && !empty($_GET['page'])) {
- $_curPage = trim($_GET['page']);
- $_curPage = Summoner::validate($_curPage,'digit') ? $_curPage : 1;
-}
-
-$_sort = '';
-if(isset($_GET['s']) && !empty($_GET['s'])) {
- $_sort = trim($_GET['s']);
- $_sort = Summoner::validate($_sort,'nospace') ? $_sort : '';
-}
-
-$_sortDirection = '';
-if(isset($_GET['sd']) && !empty($_GET['sd'])) {
- $_sortDirection = trim($_GET['sd']);
- $_sortDirection = Summoner::validate($_sortDirection,'nospace') ? $_sortDirection : '';
-}
-
-$_queryOptions = array(
- 'limit' => RESULTS_PER_PAGE,
- 'offset' => (RESULTS_PER_PAGE * ($_curPage-1)),
- 'sort' => $_sort,
- 'sortDirection' => $_sortDirection
-);
-## pagination end
-
-$TemplateData['pageTitle'] = "Collection overview";
-$TemplateData['loadedCollection'] = array();
-$TemplateData['storagePath'] = '';
-$TemplateData['entries'] = array();
-$TemplateData['collections'] = array();
-$TemplateData['search'] = '';
-// needed for pagination link building
-$TemplateData['pagination']['currentGetParameters']['p'] = 'collections';
-$TemplateData['pagination']['currentGetParameters']['collection'] = $_collection;
-
-if(!empty($_collection)) {
- $TemplateData['loadedCollection'] = $Trite->load($_collection);
- if(!empty($TemplateData['loadedCollection'])) {
- $Mancubus->setCollection($Trite->param('id'));
-
- $TemplateData['defaultSortField'] = $Trite->param('defaultSortField');
- $TemplateData['defaultSortOrder'] = $Trite->param('defaultSortOrder');
- $TemplateData['simpleSearchFields'] = $Trite->getSimpleSearchFields();
- if(!empty($_queryOptions['sort'])) {
- $TemplateData['simpleSearchFields'][$_queryOptions['sort']]['selected'] = true;
- }
- if(!empty($TemplateData['defaultSortField'])) {
- unset($TemplateData['simpleSearchFields'][$TemplateData['defaultSortField']]);
- if(empty($_queryOptions['sort'])) {
- $_queryOptions['sort'] = $TemplateData['defaultSortField'];
- }
- }
- if(!empty($TemplateData['defaultSortOrder'])) {
- if(empty($_queryOptions['sortDirection'])) {
- $_queryOptions['sortDirection'] = $TemplateData['defaultSortOrder'];
- }
- }
-
- $Mancubus->setQueryOptions($_queryOptions);
-
- $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id');
- $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$Trite->param('id');
- $TemplateData['navSearchAction'] = array('p' => 'collections', 'collection' => $Trite->param('id'));
-
- $_fd = $Trite->getCollectionFields();
-
- $_sdata = array();
- if (!empty($_fv) && !empty($_fid)) {
- $_sdata[0] = array(
- 'colName' => $_fd[$_fid]['identifier'],
- 'colValue' => $_fv,
- 'fieldData' => $_fd[$_fid],
- 'exactTagMatch' => true
- );
- $_search = $_fv;
- $TemplateData['pagination']['currentGetParameters']['fid'] = $_fid;
- $TemplateData['pagination']['currentGetParameters']['fv'] = $_fv;
- }
- elseif(isset($_fd[$Trite->param('defaultSearchField')])) {
- $_sdata[0] = array(
- 'colName' => $Trite->param('defaultSearchField'),
- 'colValue' => $_search,
- 'fieldData' =>$_fd[$Trite->param('defaultSearchField')]
- );
- if (!empty($_search)) {
- $TemplateData['pagination']['hideSort'] = true;
- }
- }
-
- $TemplateData['entries'] = $Mancubus->getEntries($_sdata);
- if (!empty($_search)) {
- $TemplateData['search'] = $_search;
- $TemplateData['pagination']['currentGetParameters']['navSearch'] = urlencode($_search);
- }
-
- $TemplateData['pageTitle'] = $Trite->param('name');
-
- }
- else {
- $TemplateData['message']['content'] = "Can not load given collection.";
- $TemplateData['message']['status'] = "error";
- }
-}
-else {
- $TemplateData['collections'] = $Trite->getCollections();
-}
-
-# pagination
-if(!empty($TemplateData['entries']['amount'])) {
- $TemplateData['pagination']['pages'] = (int)ceil($TemplateData['entries']['amount'] / RESULTS_PER_PAGE);
- $TemplateData['pagination']['curPage'] = $_curPage;
-
- $TemplateData['pagination']['currentGetParameters']['page'] = $_curPage;
- $TemplateData['pagination']['currentGetParameters']['s'] = $_sort;
- $TemplateData['pagination']['currentGetParameters']['sd'] = $_sortDirection;
-}
-
-if($TemplateData['pagination']['pages'] > 11) {
- # first pages
- $TemplateData['pagination']['visibleRange'] = range(1,3);
- # last pages
- foreach(range($TemplateData['pagination']['pages']-2, $TemplateData['pagination']['pages']) as $e) {
- $TemplateData['pagination']['visibleRange'][] = $e;
- }
- # pages before and after current page
- $cRange = range($TemplateData['pagination']['curPage']-1, $TemplateData['pagination']['curPage']+1);
- foreach($cRange as $e) {
- $TemplateData['pagination']['visibleRange'][] = $e;
- }
- $TemplateData['pagination']['currentRangeStart'] = array_shift($cRange);
- $TemplateData['pagination']['currentRangeEnd'] = array_pop($cRange);
-}
-else {
- $TemplateData['pagination']['visibleRange'] = range(1,$TemplateData['pagination']['pages']);
-}
-# pagination end
+<div class="pagination">
<?php
if($TemplateData['pagination']['curPage'] > 1) {
- echo '<li><a href="index.php?'.Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('page'=>($TemplateData['pagination']['curPage']-1))).'">
- <span uk-pagination-previous></span></a></li>';
+ echo '<a href="index.php?'.Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('page'=>($TemplateData['pagination']['curPage']-1))).'"
+ title="previous"><</a>';
}
$ellipsisShown = 0;
for($i=1;$i<=$TemplateData['pagination']['pages'];$i++) {
$active = '';
- if($i == $TemplateData['pagination']['curPage']) $active = 'uk-active';
+ if($i == $TemplateData['pagination']['curPage']) $active = 'paginationActive';
if(in_array($i,$TemplateData['pagination']['visibleRange'])) {
- echo '<li class="'.$active.'"><a href="index.php?'.Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('page'=>$i)).'"
- title="Goto page '.$i.'">'.$i.'</a></li>';
+ echo '<a class="'.$active.'" href="index.php?'.Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('page'=>$i)).'"
+ title="Goto page '.$i.'">'.$i.'</a>';
}
else {
if($i < $TemplateData['pagination']['currentRangeStart'] && $ellipsisShown == 0) {
- echo '<li class="uk-disabled"><span>…</span></li>';
+ echo '<span>…</span>';
$ellipsisShown = 1;
}
if($i > $TemplateData['pagination']['currentRangeEnd'] && ($ellipsisShown == 0 || $ellipsisShown == 1)) {
- echo '<li class="uk-disabled"><span>…</span></li>';
+ echo '<span>…</span>';
$ellipsisShown = 2;
}
}
}
if($TemplateData['pagination']['curPage'] < $TemplateData['pagination']['pages']) {
- echo '<li><a href="index.php?'.Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('page'=>($TemplateData['pagination']['curPage']+1))).'">
- <span uk-pagination-next></span></a></li>';
+ echo '<a href="index.php?'.Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('page'=>($TemplateData['pagination']['curPage']+1))).'"
+ title="next">></a>';
}
?>
+</div>
+++ /dev/null
-<?php
-/**
- * Bibliotheca
- *
- * Copyright 2018-2020 Johannes Keßler
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once 'lib/mancubus.class.php';
-$Mancubus = new Mancubus($DB,$Doomguy);
-
-$TemplateData['search'] = false;
-
-$_search = '';
-if(isset($_GET['navSearch'])) {
- $_search = trim($_GET['navSearch']);
- $_search = urldecode($_search);
- $_search = Summoner::validate($_search,'text') ? $_search : '';
- $TemplateData['navSearched'] = '&navSearch='.urlencode($_search);
-}
-
-$TemplateData['latest'] = $Mancubus->getLatest(5,5,$_search);
-if (!empty($_search)) {
- $TemplateData['search'] = $_search;
-}
<footer class="status-bar">
<p class="status-bar-field"><a href="https://www.bananas-playground.net/projekt/bibliotheca/" target=_blank>Bibliotheca</a></p>
<p class="status-bar-field">© 2018 - <?php echo date('Y'); ?></p>
+ <p class="status-bar-field">Theme <a href="https://jdan.github.io/98.css/" target="_blank">98.css</a></p>
</footer>
</div>
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
+
+.pagination {
+ padding-bottom: 5px;
+ padding-top: 5px;
+}
+.pagination a, .pagination span {
+ margin-right: 5px;
+}
+.paginationActive {
+ font-weight: bold
+}