erm did a small amount
output database to view added basic filters improve bootstrap theming and positioning added pagination
This commit is contained in:
67
index.php
67
index.php
@@ -1,24 +1,79 @@
|
||||
<?php
|
||||
// load required classes
|
||||
require_once('Models/UserDataSet.php');
|
||||
require_once('Models/FacilityDataSet.php');
|
||||
require_once("logincontroller.php");
|
||||
// make a view class
|
||||
$view = new stdClass();
|
||||
$view->pageTitle = 'Home';
|
||||
|
||||
// include the view
|
||||
require_once('Views/index.phtml');
|
||||
|
||||
// create a new student dataset object that we can generate data from
|
||||
$facilityDataSet = new FacilityDataSet();
|
||||
$view->facilityDataSet = $facilityDataSet->fetchAll();
|
||||
$filterArray = [
|
||||
'titlFilter' => "",
|
||||
'cateFilter' => "",
|
||||
'descFilter' => "",
|
||||
'statFilter' => "",
|
||||
'strtFilter' => "",
|
||||
'cntyFilter' => "",
|
||||
'townFilter' => "",
|
||||
'postFilter' => "",
|
||||
'contFilter' => ""
|
||||
];
|
||||
$filterArray = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
2 => "",
|
||||
3 => "",
|
||||
4 => "",
|
||||
5 => "",
|
||||
6 => "",
|
||||
7 => "",
|
||||
8 => ""
|
||||
];
|
||||
$values = [
|
||||
"Title" => 0,
|
||||
"Category" => 1,
|
||||
"Description" => 2,
|
||||
"Status" => 3,
|
||||
"Street" => 4,
|
||||
"County" => 5,
|
||||
"Town" => 6,
|
||||
"Postcode" => 7,
|
||||
"Contributor" => 8,
|
||||
];
|
||||
$rowLimit = 7; //$_POST['rowCount'];
|
||||
$offset = 0; //$_POST['offset'];
|
||||
|
||||
if (isset($_POST['applyFilters'])) {
|
||||
//$filterNumeric = array_values($filterArray);
|
||||
$filterArray[(int)$_POST['filter']] = $_POST['applyFilters'];
|
||||
//$filterArray = array_combine(array_keys($filterArray), $filterNumeric);
|
||||
}
|
||||
if (isset($_POST['applyAdvFilters'])) {
|
||||
array_push($filterArray, $_POST['titlFilter'], $_POST['cateFilter'],
|
||||
$description = $_POST['descFilter'], $status = $_POST['statFilter'],
|
||||
$street = $_POST['strtFilter'], $county = $_POST['cntyFilter'],
|
||||
$town = $_POST['townFilter'], $postcode = $_POST['postFilter'],
|
||||
$contributor = $_POST['contFilter']);
|
||||
var_dump($filterArray);
|
||||
}
|
||||
//$view->facilityDataSet = $facilityDataSet->fetchAll($filterArray, $rowLimit, $offset);
|
||||
require_once('Models/Paginator.php');
|
||||
$view->paginator = new Paginator($rowLimit, $offset, $facilityDataSet->fetchAll($filterArray, null, null));
|
||||
|
||||
$view->pageNumber = $view->paginator->getPageFromUri();
|
||||
$view->paginator->setPageUri($view->pageNumber);
|
||||
$view->pageData = $view->paginator->getPage($view->pageNumber);
|
||||
$view->user = new User();
|
||||
// send a results count to the view to show how many results were retrieved
|
||||
if (count($view->facilityDataSet) == 0)
|
||||
if ($view->paginator->countPageResults($view->pageNumber) == 0)
|
||||
{
|
||||
$view->dbMessage = "No results";
|
||||
}
|
||||
else
|
||||
{
|
||||
$view->dbMessage = count($view->facilityDataSet) . " result(s)";
|
||||
}
|
||||
$view->dbMessage = $view->paginator->countPageResults($view->pageNumber) . " result(s)";
|
||||
}
|
||||
require_once('Views/index.phtml');
|
||||
|
Reference in New Issue
Block a user