added filter
This commit is contained in:
parent
3b9791888c
commit
d574a28c1d
|
|
@ -25,8 +25,14 @@ class Jobs {
|
||||||
if ($cat == null) {
|
if ($cat == null) {
|
||||||
return $this->notFound();
|
return $this->notFound();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (isset($_GET['filter'])) {
|
||||||
|
$this->vars['jobs'] = $this->jobsTable->find('categoryId', $cat[0]->id, "location", $_GET['filter']);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$this->vars['jobs'] = $this->jobsTable->find('categoryId', $cat[0]->id);
|
$this->vars['jobs'] = $this->jobsTable->find('categoryId', $cat[0]->id);
|
||||||
|
|
||||||
|
}
|
||||||
$this->vars['heading'] = $cat[0]->name;
|
$this->vars['heading'] = $cat[0]->name;
|
||||||
return ['template' => 'category.html.php',
|
return ['template' => 'category.html.php',
|
||||||
'title' => 'Jo\'s Jobs- '. $_GET['page'],
|
'title' => 'Jo\'s Jobs- '. $_GET['page'],
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,16 @@
|
||||||
|
|
||||||
<section class="right">
|
<section class="right">
|
||||||
<h1> <?=$heading?> Jobs</h1>
|
<h1> <?=$heading?> Jobs</h1>
|
||||||
|
<form method="get" action="/jobs/category">
|
||||||
|
<label for="filter">Filter:</label>
|
||||||
|
<select name="filter">
|
||||||
|
<?php foreach ($jobs as $job) { ?>
|
||||||
|
<option value="<?=$job->location?>"><?=$job->location?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
<input type="hidden" name="page" value="<?=$_GET['page']?>" />
|
||||||
|
<input type="submit" name="submit" value="filter" />
|
||||||
|
</form>
|
||||||
<ul class="listing">
|
<ul class="listing">
|
||||||
<?php require 'job.html.php';?>
|
<?php require 'job.html.php';?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue