# and some defaults
$TemplateData = array();
$TemplateData['pagination'] = array();
-$TemplateData['searchAction'] = 'index.php';
+$TemplateData['navSearchAction'] = array();
$TemplateData['pageTitle'] = 'Dashboard';
# the view
$View = Summoner::themefile('dashboard/dashboard.html', UI_THEME);
<?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">
+ <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-1-4">
+ <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>
</div>
</div>
+ <?php } ?>
</div>
</div>
<?php } ?>
$_fv = Summoner::validate($_fv) ? $_fv : false;
}
+// nav search
$_search = '';
-if(isset($_POST['navSearch'])) {
- $_search = trim($_POST['navSearch']);
+if(isset($_GET['navSearch'])) {
+ $_search = trim($_GET['navSearch']);
+ $_search = urldecode($_search);
$_search = Summoner::validate($_search) ? $_search : '';
}
// needed for pagination link building
$TemplateData['pagination']['currentGetParameters']['p'] = 'collections';
$TemplateData['pagination']['currentGetParameters']['collection'] = $_collection;
-$_doNotShowPagination = false;
if(!empty($_collection)) {
$TemplateData['loadedCollection'] = $Trite->load($_collection);
$TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id');
$TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$Trite->param('id');
- $TemplateData['searchAction'] = 'index.php?p=collections&collection='.$Trite->param('id');
+ $TemplateData['navSearchAction'] = array('p' => 'collections', 'collection' => $Trite->param('id'));
$_fd = $Trite->getCollectionFields();
'colValue' => $_search,
'fieldData' =>$_fd[$Trite->param('defaultSearchField')]
);
- $_doNotShowPagination = true; // fulltextsearch does not support order
+ 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');
}
# pagination
-if(!$_doNotShowPagination) {
- if(!empty($TemplateData['entries']['amount'])) {
- $TemplateData['pagination']['pages'] = 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(!empty($TemplateData['entries']['amount'])) {
+ $TemplateData['pagination']['pages'] = (int)ceil($TemplateData['entries']['amount'] / RESULTS_PER_PAGE);
+ $TemplateData['pagination']['curPage'] = $_curPage;
- if($TemplateData['pagination']['pages'] > 11) {
- # first pages
- $TemplateData['pagination']['visibleRange'] = array(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);
+ $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;
}
- else {
- $TemplateData['pagination']['visibleRange'] = range(1,$TemplateData['pagination']['pages']);
+ # 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
for($i=1;$i<=$TemplateData['pagination']['pages'];$i++) {
$active = '';
if($i == $TemplateData['pagination']['curPage']) $active = 'uk-active';
+
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>';
<div class="uk-grid-divider uk-child-width-expand@s" uk-grid>
<?php foreach($TemplateData['latest'] as $k=>$v) { ?>
<div class="uk-width-1@s uk-width-1-2@m uk-width-1-3@l">
- <a href="index.php?p=collections&collection=<?php echo $k; ?>"><?php echo $v['name']; ?></a><br />
+ <a href="index.php?p=collections&collection=<?php echo $k; echo Summoner::ifset($TemplateData, 'navSearched'); ?>"><?php echo $v['name']; ?></a><br />
<?php echo $v['description']; ?>
<?php
$Mancubus = new Mancubus($DB,$Doomguy);
$TemplateData['search'] = false;
-$TemplateData['searchAction'] = 'index.php';
$_search = '';
-if(isset($_POST['navSearch'])) {
- $_search = trim($_POST['navSearch']);
+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($TemplateData['loadedCollection'])) {
$Mancubus->setCollection($Trite->param('id'));
$TemplateData['entry'] = $Mancubus->getEntry($_id);
- $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id') . '/' . $_id;
- $TemplateData['searchAction'] = 'index.php?p=collections&collection=' . $Trite->param('id');
+ $TemplateData['storagePath'] = PATH_WEB_STORAGE.'/'.$Trite->param('id').'/'.$_id;
+ $TemplateData['navSearchAction'] = array('p' => 'collections', 'collection' => $Trite->param('id'));
$ManageEntry->setCollection($Trite->param('id'));
$TemplateData['showEdit'] = $ManageEntry->canEditEntry($_id);
<div>
<a class="uk-navbar-toggle" uk-search-icon href="#"></a>
<div class="uk-drop" uk-drop="mode: click; pos: left-center; offset: 0">
- <form class="uk-search uk-search-navbar uk-width-1-1" method="post" action="<?php echo $TemplateData['searchAction']; ?>">
+ <form class="uk-search uk-search-navbar uk-width-1-1" method="get" action="index.php">
+ <?php
+ if(isset($TemplateData['navSearchAction'])) {
+ foreach($TemplateData['navSearchAction'] as $param=>$pValue) {
+ echo '<input type="hidden" name="'.$param.'" value="'.$pValue.'" />';
+ }
+ }
+ ?>
<input class="uk-search-input" type="search" placeholder="Search..." name="navSearch" autofocus>
<small><a href="index.php?p=advancedsearch">Advanced</a></small>
</form>
$TemplateData['search'] = array();
$_search = '';
-if(isset($_POST['navSearch'])) {
- $_search = trim($_POST['navSearch']);
+if(isset($_GET['navSearch'])) {
+ $_search = trim($_GET['navSearch']);
+ $_search = urldecode($_search);
$_search = Summoner::validate($_search) ? $_search : '';
}
if(!empty($_collection)) {
$TemplateData['loadedCollection'] = $Trite->load($_collection);
if(!empty($TemplateData['loadedCollection'])) {
- $TemplateData['searchAction'] = 'index.php?p=tags&collection='.$Trite->param('id');
+ $TemplateData['navSearchAction'] = array('p' => 'tags', 'collection' => $Trite->param('id'));
$Mancubus->setCollection($Trite->param('id'));
//$TemplateData['tags'] = $Mancubus->getTags($_search);
$TemplateData['tags'] = $Trite->getTags($_search);