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);
|
$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 == "") {
|
if ($column2 == "" && $value2 == "") {
|
||||||
$values = [
|
$values = [
|
||||||
'value' => $value
|
'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->setFetchMode(\PDO::FETCH_CLASS, $this->entityClass, $this->entityConstructor);
|
||||||
$stmt->execute($values);
|
$stmt->execute($values);
|
||||||
return $stmt->fetchAll();
|
return $stmt->fetchAll();
|
||||||
|
|
@ -51,7 +51,7 @@ class DatabaseTable {
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'value2' => $value2
|
'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->setFetchMode(\PDO::FETCH_CLASS, $this->entityClass, $this->entityConstructor);
|
||||||
$stmt->execute($values);
|
$stmt->execute($values);
|
||||||
return $stmt->fetchAll();
|
return $stmt->fetchAll();
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@
|
||||||
namespace jobs;
|
namespace jobs;
|
||||||
class Routes extends \CSY2028\Routes {
|
class Routes extends \CSY2028\Routes {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
setDbTables();
|
$this->setDbTables();
|
||||||
$this->controllers = [
|
$this->controllers = [
|
||||||
"jobs" => new \jobs\controllers\Jobs($this->databaseTables["jobs"], $this->databaseTables["categories"], $this->databaseTables["applicants"]),
|
"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"]),
|
"portal" => new \jobs\controllers\Portal($this->databaseTables["categories"], $this->databaseTables["jobs"], $this->databaseTables["applicants"]),
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class Jobs {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function home() {
|
public function home() {
|
||||||
|
$this->vars['jobs'] = $this->jobsTable->find("closingDate", date("y-m-d"), ">", "DESC");
|
||||||
return ['template' => 'home.html.php',
|
return ['template' => 'home.html.php',
|
||||||
'title' => 'Jo\'s Jobs- Home',
|
'title' => 'Jo\'s Jobs- Home',
|
||||||
'vars' => $this->vars
|
'vars' => $this->vars
|
||||||
|
|
|
||||||
|
|
@ -82,5 +82,10 @@ class Portal {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: add functions for adding jobs and categories
|
//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">
|
<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>
|
<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>
|
<h2>Select the type of job you are looking for:</h2>
|
||||||
<ul>
|
<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>
|
</ul>
|
||||||
</main>
|
</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,8 +1,12 @@
|
||||||
<main class = "sidebar">
|
<main class = "sidebar">
|
||||||
<section class="left">
|
<section class="left">
|
||||||
<ul>
|
<ul>
|
||||||
<?php require 'nav.html.php'?>
|
<?php foreach($cats as $cat) { ?>
|
||||||
</ul>
|
<li>
|
||||||
|
<a href="/jobs/category?page=<?=urlencode($cat->name)?>"><?=$cat->name?></a>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="right">
|
<section class="right">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,18 @@
|
||||||
<main class="home">
|
<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>
|
<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>
|
<section>
|
||||||
<ul>
|
<h2>Select the type of job you are looking for:</h2>
|
||||||
<?php require 'nav.html.php'?>
|
<ul>
|
||||||
</ul>
|
<?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>
|
</main>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<h2>Jobs</h2>
|
<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">
|
<form method="get" action="/portal">
|
||||||
<label for="filter">Filter:</label>
|
<label for="filter">Filter:</label>
|
||||||
<select name="filter">
|
<select name="filter">
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,14 @@
|
||||||
</section>
|
</section>
|
||||||
</header>
|
</header>
|
||||||
<nav>
|
<nav>
|
||||||
<?=$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>
|
</nav>
|
||||||
<img src="../images/randombanner.php"/>
|
<img src="../images/randombanner.php"/>
|
||||||
<?=$content;?>
|
<?=$content;?>
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,19 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/">Home</a></li>
|
<?php foreach($cats as $cat) { ?>
|
||||||
<li>Jobs
|
<li>
|
||||||
<ul>
|
<a href="/jobs/category?page=<?=urlencode($cat->name)?>"><?=$cat->name?></a>
|
||||||
<?php foreach($cats as $cat) { ?>
|
</li>
|
||||||
<li>
|
<?php } ?>
|
||||||
<a href="/jobs/category?page=<?=urlencode($cat->name)?>"><?=$cat->name?></a>
|
</ul>
|
||||||
</li>
|
<?php if (isset($_SESSION['loggedin'])) {
|
||||||
<?php } ?>
|
if ($_SESSION['userType'] == 'admin') {?>
|
||||||
</ul>
|
<li><a href="/portal">Admin Portal</a></li>
|
||||||
</li>
|
<?php }
|
||||||
<li><a href="/jobs/faq">FAQ</a></li>
|
else if ($_SESSION['userType'] == 'client') {?>
|
||||||
<li><a href="/jobs/about">About Us</a></li>
|
<li><a href="/portal">Client Portal</a></li>
|
||||||
<?php if (isset($_SESSION['loggedin'])) {
|
<?php } ?>
|
||||||
if ($_SESSION['userType'] == 'admin') {?>
|
|
||||||
<li><a href="/portal">Admin Portal</a></li>
|
|
||||||
<?php }
|
|
||||||
else if ($_SESSION['userType'] == 'client') {?>
|
|
||||||
<li><a href="/portal">Client Portal</a></li>
|
|
||||||
<?php } ?>
|
|
||||||
<li><a href="/user/logout">Logout</a></li>
|
<li><a href="/user/logout">Logout</a></li>
|
||||||
<?php }
|
<?php }
|
||||||
else {?>
|
else {?>
|
||||||
<li><a href="/user/login">Login</a></li>
|
<li><a href="/user/login">Login</a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
6
todo
6
todo
|
|
@ -10,14 +10,14 @@ Assignment 2:
|
||||||
- Add cat name as new column in table @done
|
- Add cat name as new column in table @done
|
||||||
- Add filter to be able to filter by cat @done
|
- Add filter to be able to filter by cat @done
|
||||||
- Allow customers to filter by location @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
|
- Add admin user control to admin panel
|
||||||
- Client user accounts
|
- Client user accounts
|
||||||
- restricted admin panel @done
|
- restricted admin panel @done
|
||||||
- add and remove jobs
|
- add and remove jobs
|
||||||
- see who has applied for jobs @done
|
- see who has applied for jobs @done
|
||||||
- Client can only see their 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
|
- Contact form on contact page
|
||||||
- forms store data in db
|
- forms store data in db
|
||||||
- stored enquiries can be accessed from admin panel
|
- stored enquiries can be accessed from admin panel
|
||||||
|
|
@ -29,7 +29,7 @@ Assignment 2:
|
||||||
- Limit applications to jobs to 1 per email
|
- Limit applications to jobs to 1 per email
|
||||||
- Show number of applicants on job_table
|
- Show number of applicants on job_table
|
||||||
- Show job name at top of applicant_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
|
- find where the 1 had come from @done
|
||||||
- PHPUnit tests
|
- PHPUnit tests
|
||||||
- Technical Documentation
|
- Technical Documentation
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue