Fix filter and pagination combo on admin event page
This commit is contained in:
parent
309e308518
commit
5205a3f095
|
@ -29,13 +29,13 @@ if(isset($_GET['page'])){
|
||||||
}
|
}
|
||||||
|
|
||||||
$filterTitle = '';
|
$filterTitle = '';
|
||||||
if(isset($_POST['title'])){
|
if(isset($_GET['title'])){
|
||||||
$filterTitle = $_POST['title'];
|
$filterTitle = $_GET['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$filterOrganiser = '';
|
$filterOrganiser = '';
|
||||||
if(isset($_POST['organiser'])){
|
if(isset($_GET['organiser'])){
|
||||||
$filterOrganiser = $_POST['organiser'];
|
$filterOrganiser = $_GET['organiser'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter
|
// filter
|
||||||
|
@ -77,7 +77,7 @@ $events = array_values(array_filter(
|
||||||
<ul class="event-list">
|
<ul class="event-list">
|
||||||
<?php
|
<?php
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
$pageLimit = 10;
|
$pageLimit = 1;
|
||||||
|
|
||||||
for($i = ($pageLimit * ($page - 1)); $i < count($events) ;$i++){
|
for($i = ($pageLimit * ($page - 1)); $i < count($events) ;$i++){
|
||||||
if($counter == $pageLimit){
|
if($counter == $pageLimit){
|
||||||
|
@ -113,11 +113,11 @@ $events = array_values(array_filter(
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if($page != 1){
|
if($page != 1){
|
||||||
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '">Forrige side</a>';
|
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '&title=' . urlencode($filterTitle) . '&organiser=' . urlencode($filterOrganiser) . '">Forrige side</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($counter == $pageLimit) and (($pageLimit * $page) < count($events))){
|
if(($counter == $pageLimit) and (($pageLimit * $page) < count($events))){
|
||||||
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '">Neste side</a>';
|
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '&title=' . urlencode($filterTitle) . '&organiser=' . urlencode($filterOrganiser) . '">Neste side</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -126,7 +126,7 @@ $events = array_values(array_filter(
|
||||||
<h2>Verktøy</h2>
|
<h2>Verktøy</h2>
|
||||||
<a class="btn adminbtn" href="edit.php?new=1">Legg inn ny aktivitet</a>
|
<a class="btn adminbtn" href="edit.php?new=1">Legg inn ny aktivitet</a>
|
||||||
<h2>Filter</h2>
|
<h2>Filter</h2>
|
||||||
<form action="." method="post">
|
<form action="." method="get">
|
||||||
<p class="no-chin">Navn</p>
|
<p class="no-chin">Navn</p>
|
||||||
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
|
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
|
||||||
<p class="no-chin">Organisator</p>
|
<p class="no-chin">Organisator</p>
|
||||||
|
|
Loading…
Reference in New Issue