update
This commit is contained in:
parent
9607c6be3c
commit
841ab2f36f
|
|
@ -36,12 +36,12 @@ class DatabaseTable {
|
|||
$this->pdo->prepare('UPDATE '. $this->table .' SET '. \implode(', ', $params) .' WHERE '. $this->pk .' = :primaryKey')->execute($record);
|
||||
}
|
||||
|
||||
public function find($column, $value, $column2 = "", $value2 = "") {
|
||||
public function find($column, $value, $comparator = "=", $order = "ASC", $column2 = "", $value2 = "") {
|
||||
if ($column2 == "" && $value2 == "") {
|
||||
$values = [
|
||||
'value' => $value
|
||||
];
|
||||
$stmt = $this->pdo->prepare('SELECT * FROM '. $this->table . ' WHERE '. $column . ' = :value');
|
||||
$stmt = $this->pdo->prepare('SELECT * FROM '. $this->table . ' WHERE '. $column . ' '. $comparator .' :value ORDER BY '. $column ." ". $order);
|
||||
$stmt->setFetchMode(\PDO::FETCH_CLASS, $this->entityClass, $this->entityConstructor);
|
||||
$stmt->execute($values);
|
||||
return $stmt->fetchAll();
|
||||
|
|
@ -51,7 +51,7 @@ class DatabaseTable {
|
|||
'value' => $value,
|
||||
'value2' => $value2
|
||||
];
|
||||
$stmt = $this->pdo->prepare('SELECT * FROM '. $this->table . ' WHERE '. $column . ' = :value AND '. $column2 .' = :value2');
|
||||
$stmt = $this->pdo->prepare('SELECT * FROM '. $this->table . ' WHERE '. $column . ' '. $comparator .' :value AND '. $column2 .' = :value2');
|
||||
$stmt->setFetchMode(\PDO::FETCH_CLASS, $this->entityClass, $this->entityConstructor);
|
||||
$stmt->execute($values);
|
||||
return $stmt->fetchAll();
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
namespace jobs;
|
||||
class Routes extends \CSY2028\Routes {
|
||||
|
||||
|
||||
|
||||
public function __construct() {
|
||||
setDbTables();
|
||||
$this->setDbTables();
|
||||
$this->controllers = [
|
||||
"jobs" => new \jobs\controllers\Jobs($this->databaseTables["jobs"], $this->databaseTables["categories"], $this->databaseTables["applicants"]),
|
||||
"portal" => new \jobs\controllers\Portal($this->databaseTables["categories"], $this->databaseTables["jobs"], $this->databaseTables["applicants"]),
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Jobs {
|
|||
}
|
||||
|
||||
public function home() {
|
||||
$this->vars['jobs'] = $this->jobsTable->find("closingDate", date("y-m-d"), ">", "DESC");
|
||||
return ['template' => 'home.html.php',
|
||||
'title' => 'Jo\'s Jobs- Home',
|
||||
'vars' => $this->vars
|
||||
|
|
|
|||
|
|
@ -82,5 +82,10 @@ class Portal {
|
|||
}
|
||||
|
||||
//TODO: add functions for adding jobs and categories
|
||||
public function addJob() {
|
||||
return ['template' => 'add.html.php',
|
||||
'title' => 'Add Job',
|
||||
'vars' => $this->vars];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
|
||||
<main class="home">
|
||||
<p>Welcome to Jo's Jobs, we're a recruitment agency based in Northampton. We offer a range of different office jobs. Get in touch if you'd like to list a job with us.</a></p>
|
||||
<h2>Select the type of job you are looking for:</h2>
|
||||
<ul>
|
||||
<?php require "nav.html.php"?>
|
||||
<?php foreach($cats as $cat) { ?>
|
||||
<li>
|
||||
<a href="/jobs/category?page=<?=urlencode($cat->name)?>"><?=$cat->name?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<main class="home">
|
||||
<form>
|
||||
<!-- TODO: Create form for adding a job -->
|
||||
<!-- Look in to generifying for all add types -->
|
||||
</form>
|
||||
</main>
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
<main class = "sidebar">
|
||||
<section class="left">
|
||||
<ul>
|
||||
<?php require 'nav.html.php'?>
|
||||
<?php foreach($cats as $cat) { ?>
|
||||
<li>
|
||||
<a href="/jobs/category?page=<?=urlencode($cat->name)?>"><?=$cat->name?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,18 @@
|
|||
<main class="home">
|
||||
<p>Welcome to Jo's Jobs, we're a recruitment agency based in Northampton. We offer a range of different office jobs. Get in touch if you'd like to list a job with us.</a></p>
|
||||
<section>
|
||||
<h2>Select the type of job you are looking for:</h2>
|
||||
<ul>
|
||||
<?php require 'nav.html.php'?>
|
||||
<?php foreach($cats as $cat) { ?>
|
||||
<li>
|
||||
<a href="/jobs/category?page=<?=urlencode($cat->name)?>"><?=$cat->name?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Jobs About to close:</h2>
|
||||
<ul class= "listing">
|
||||
<?php require 'job.html.php' ?>
|
||||
</ul>
|
||||
</main>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<h2>Jobs</h2>
|
||||
<a class="new" href="addjob.php">Add new job</a>
|
||||
<a class="new" href="/portal/addJob">Add new job</a>
|
||||
<form method="get" action="/portal">
|
||||
<label for="filter">Filter:</label>
|
||||
<select name="filter">
|
||||
|
|
|
|||
|
|
@ -17,7 +17,14 @@
|
|||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<?=$nav?>
|
||||
</li>
|
||||
<li><a href="/jobs/faq">FAQ</a></li>
|
||||
<li><a href="/jobs/about">About Us</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<img src="../images/randombanner.php"/>
|
||||
<?=$content;?>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<?php foreach($cats as $cat) { ?>
|
||||
<li>
|
||||
|
|
@ -8,9 +5,6 @@
|
|||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/jobs/faq">FAQ</a></li>
|
||||
<li><a href="/jobs/about">About Us</a></li>
|
||||
<?php if (isset($_SESSION['loggedin'])) {
|
||||
if ($_SESSION['userType'] == 'admin') {?>
|
||||
<li><a href="/portal">Admin Portal</a></li>
|
||||
|
|
@ -23,6 +17,3 @@
|
|||
else {?>
|
||||
<li><a href="/user/login">Login</a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
|
|||
6
todo
6
todo
|
|
@ -10,14 +10,14 @@ Assignment 2:
|
|||
- Add cat name as new column in table @done
|
||||
- Add filter to be able to filter by cat @done
|
||||
- Allow customers to filter by location @done
|
||||
- Move new framework into project
|
||||
- Move new framework into project @done
|
||||
- Add admin user control to admin panel
|
||||
- Client user accounts
|
||||
- restricted admin panel @done
|
||||
- add and remove jobs
|
||||
- see who has applied for jobs @done
|
||||
- Client can only see their jobs @done
|
||||
- Homepage has 10 jobs that are about to reach closing date
|
||||
- Homepage has 10 jobs that are about to reach closing date @done
|
||||
- Contact form on contact page
|
||||
- forms store data in db
|
||||
- stored enquiries can be accessed from admin panel
|
||||
|
|
@ -29,7 +29,7 @@ Assignment 2:
|
|||
- Limit applications to jobs to 1 per email
|
||||
- Show number of applicants on job_table
|
||||
- Show job name at top of applicant_table
|
||||
- Seperate jobs section from nav template
|
||||
- Seperate jobs section from nav template @done
|
||||
- find where the 1 had come from @done
|
||||
- PHPUnit tests
|
||||
- Technical Documentation
|
||||
|
|
|
|||
Loading…
Reference in New Issue