Added filter to job list in portal
This commit is contained in:
parent
69da9ef69b
commit
699eb929f1
|
|
@ -16,11 +16,21 @@ class Portal {
|
||||||
|
|
||||||
public function home() {
|
public function home() {
|
||||||
$this->vars['table'] = 'job_table.html.php';
|
$this->vars['table'] = 'job_table.html.php';
|
||||||
if ($_SESSION['userType'] == 'client') {
|
if (isset($_GET['filter'])) {
|
||||||
$this->vars['jobs'] = $this->jobsTable->find('clientId', $_SESSION['loggedin']);
|
if ($_SESSION['userType'] == 'client') {
|
||||||
}
|
$this->vars['jobs'] = $this->jobsTable->find('clientId', $_SESSION['loggedin'], "categoryId", $_GET['filter']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->vars['jobs'] = $this->jobsTable->find("categoryId", $_GET['filter']);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$this->vars['jobs'] = $this->jobsTable->findAll();
|
if ($_SESSION['userType'] == 'client') {
|
||||||
|
$this->vars['jobs'] = $this->jobsTable->find('clientId', $_SESSION['loggedin']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->vars['jobs'] = $this->jobsTable->findAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ['template' => 'portal.html.php',
|
return ['template' => 'portal.html.php',
|
||||||
'title' => 'Jo\'s Jobs- Jobs',
|
'title' => 'Jo\'s Jobs- Jobs',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<h2>Jobs</h2>
|
<h2>Jobs</h2>
|
||||||
<a class="new" href="addjob.php">Add new job</a>
|
<a class="new" href="addjob.php">Add new job</a>
|
||||||
<form method="post" action="portal/">
|
<form method="get" action="/portal">
|
||||||
<label for="filter">Filter:</label>
|
<label for="filter">Filter:</label>
|
||||||
<select name="filter">
|
<select name="filter">
|
||||||
<?php foreach ($cats as $cat) { ?>
|
<?php foreach ($cats as $cat) { ?>
|
||||||
|
|
|
||||||
2
todo
2
todo
|
|
@ -7,7 +7,7 @@ Assignment 2:
|
||||||
- Add cats to Jobs page @done
|
- Add cats to Jobs page @done
|
||||||
- Add cats to nav bar @done
|
- Add cats to nav bar @done
|
||||||
- Job list in admin area lists all jobs
|
- Job list in admin area lists all jobs
|
||||||
- Add cat name as new column in table
|
- Add cat name as new column in table @done
|
||||||
- Add filter to be able to filter by cat
|
- Add filter to be able to filter by cat
|
||||||
- Allow customers to filter by location
|
- Allow customers to filter by location
|
||||||
- Add admin user control to admin panel
|
- Add admin user control to admin panel
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue