first commit
This commit is contained in:
commit
a30eb74e3e
Binary file not shown.
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
namespace CSY2028;
|
||||
class DatabaseTable {
|
||||
private $table;
|
||||
private $pk;
|
||||
private $entityClass;
|
||||
private $entityConstructor;
|
||||
|
||||
public function __construct($table, $pk = 'id', $entityClass = 'stdclass', $entityConstructor = []) {
|
||||
$this->table = $table;
|
||||
$this->pk = $pk;
|
||||
$this->entityClass = $entityClass;
|
||||
$this->entityConstructor = $entityConstructor;
|
||||
}
|
||||
|
||||
private function startDB() { //TODO: Maybe move
|
||||
$server = 'mysql';
|
||||
$username = 'student';
|
||||
$password = 'student';
|
||||
$schema = 'job';
|
||||
return new \PDO('mysql:dbname='.$schema.';host='.$server, $username, $password);
|
||||
}
|
||||
|
||||
private function insert($record) {
|
||||
$keys = \array_keys($record);
|
||||
$columns = \implode(', ', $keys);
|
||||
$values = \implode(', :', $keys);
|
||||
startDB()->prepare('INSERT INTO '. $this->table . ' (' . $columns . ') VALUES (:' . $values . ')')->execute($record);
|
||||
}
|
||||
|
||||
private function update($record) {
|
||||
$params = [];
|
||||
foreach ($record as $key => $value) {
|
||||
$params[] = $key . ' = :' .$key;
|
||||
}
|
||||
$record['primaryKey'] = $record[$this->pk];
|
||||
startDB()->prepare('UPDATE '. $this->table .' SET '. \implode(', ', $params) .' WHERE '. $this->pk .' = :primaryKey')->execute($record);
|
||||
}
|
||||
|
||||
public function find($column, $value) {
|
||||
$values = [
|
||||
'value' => $value
|
||||
];
|
||||
return startDB()->prepare('SELECT * FROM '. $this->table . ' WHERE '. $field . ' = :value')->setFetchMode(\PDO::FETCH_CLASS, $this->entityClass, $this->entityConstructor)->execute($values)->fetchAll();
|
||||
}
|
||||
|
||||
public function findAll() {
|
||||
return startDB()->prepare('SELECT * FROM ' . $this->table)->execute()->fetchAll();
|
||||
}
|
||||
|
||||
public function delete($column, $value) {
|
||||
$values = [
|
||||
'value' => $value
|
||||
];
|
||||
startDB()->prepare('DELETE FROM '. $this->$table .' WHERE '. $column .' = :value')->execute($values);
|
||||
}
|
||||
|
||||
public function save($record) {
|
||||
if (\empty($record[$pk])) {
|
||||
\unset($record[$pk]);
|
||||
}
|
||||
try {
|
||||
insert($record);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
update($record);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
namespace CSY2028;
|
||||
class EntryPoint {
|
||||
private $routes;
|
||||
|
||||
public function __construct(\CSY2028\Routes $routes) {
|
||||
$this->routes = $routes;
|
||||
}
|
||||
|
||||
public function loadTemplate($fileName, $templateData) {
|
||||
\extract($templateData);
|
||||
\ob_start();
|
||||
require $fileName;
|
||||
return \ob_get_clean();
|
||||
}
|
||||
|
||||
public function run() {
|
||||
$route = \ltrim(\explode('?', $_SERVER['REQUEST_URI'])[0], '/');
|
||||
if ($route == '') {
|
||||
$route = $this->routes->getDefaultRoute();
|
||||
}
|
||||
|
||||
list($controllerName, $functionName) = \explode('/', $route);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$functionName = $functionName . 'Submit';
|
||||
}
|
||||
|
||||
$page = $this->routes->getController($controllerName)->$functionName();
|
||||
$content = $this->loadTemplate('../templates/' . $page['template'], $page['vars']);
|
||||
$title = $page['title'];
|
||||
require '../templates/layout.html.php';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
namespace CSY2028;
|
||||
interface Routes {
|
||||
public function getController($name);
|
||||
public function getDefaultRoute();
|
||||
public function checkLogin($route);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
function autoload($name) {
|
||||
require '../'. str_replace('\\', '/', $name) .'.php';
|
||||
}
|
||||
spl_autoload_register('autoload');
|
||||
?>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace jobs;
|
||||
class Routes implements \CSY2028\Routes {
|
||||
public function getController($name) {
|
||||
//TODO: Add Database Tables
|
||||
//Remember entities
|
||||
$jobsTable = new \CSY2028\DatabaseTable('jobs', 'id');
|
||||
|
||||
$controllers = [];
|
||||
//TODO: Add Controllers
|
||||
$controllers['home'] = new \jobs\controllers\Home($jobsTable);
|
||||
|
||||
return $controllers[$name];
|
||||
}
|
||||
|
||||
public function getDefaultRoute() {
|
||||
return 'home/home';
|
||||
}
|
||||
|
||||
public function checkLogin($route) {
|
||||
\session_start();
|
||||
$loginRoutes = [];
|
||||
//TODO: Add login routes
|
||||
//$loginRoutes['job/edit'] = true;
|
||||
$requiresLogin = $loginRoutes[$route] ?? false;
|
||||
|
||||
if ($requiresLogin && !\isset($_SESSION['loggedin'])) {
|
||||
\header('location: /user/login');
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
namespace jobs\controllers;
|
||||
class Home {
|
||||
private $jobTable;
|
||||
|
||||
public function __construct(\CSY2028\DatabaseTable $jobTable) {
|
||||
$this->jobTable = $jobTable;
|
||||
}
|
||||
|
||||
public function home() {
|
||||
return ['template' => 'home.html.php',
|
||||
'title' => 'Jo\'s Jobs- Home',
|
||||
'vars' => []
|
||||
];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - About</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="it.php">IT</a></li>
|
||||
<li><a href="hr.php">Human Resources</a></li>
|
||||
<li><a href="sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="images/randombanner.php"/>
|
||||
<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>
|
||||
<li><a href="it.php">IT</a></li>
|
||||
<li><a href="hr.php">Human Resources</a></li>
|
||||
<li><a href="sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Add Category</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$stmt = $pdo->prepare('INSERT INTO category (name) VALUES (:name)');
|
||||
|
||||
$criteria = [
|
||||
'name' => $_POST['name']
|
||||
];
|
||||
|
||||
$stmt->execute($criteria);
|
||||
echo 'Category added';
|
||||
}
|
||||
else {
|
||||
?>
|
||||
|
||||
|
||||
<h2>Add Category</h2>
|
||||
|
||||
<form action="" method="POST">
|
||||
<label>Name</label>
|
||||
<input type="text" name="name" />
|
||||
|
||||
|
||||
<input type="submit" name="submit" value="Add Category" />
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post">
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Add Job</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$stmt = $pdo->prepare('INSERT INTO job (title, description, salary, location, closingDate, categoryId)
|
||||
VALUES (:title, :description, :salary, :location, :closingDate, :categoryId)');
|
||||
|
||||
$criteria = [
|
||||
'title' => $_POST['title'],
|
||||
'description' => $_POST['description'],
|
||||
'salary' => $_POST['salary'],
|
||||
'location' => $_POST['location'],
|
||||
'categoryId' => $_POST['categoryId'],
|
||||
'closingDate' => $_POST['closingDate'],
|
||||
];
|
||||
|
||||
$stmt->execute($criteria);
|
||||
|
||||
echo 'Job Added';
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<h2>Add Job</h2>
|
||||
|
||||
<form action="addjob.php" method="POST"">
|
||||
<label>Title</label>
|
||||
<input type="text" name="title" />
|
||||
|
||||
<label>Description</label>
|
||||
<textarea name="description"></textarea>
|
||||
|
||||
<label>Salary</label>
|
||||
<input type="text" name="salary" />
|
||||
|
||||
<label>Location</label>
|
||||
<input type="text" name="location" />
|
||||
|
||||
<label>Category</label>
|
||||
|
||||
<select name="categoryId">
|
||||
<?php
|
||||
$stmt = $pdo->prepare('SELECT * FROM category');
|
||||
$stmt->execute();
|
||||
|
||||
foreach ($stmt as $row) {
|
||||
echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
|
||||
<label>Closing Date</label>
|
||||
<input type="date" name="closingDate" />
|
||||
|
||||
<input type="submit" name="submit" value="Add" />
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post">
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Applicants</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
|
||||
$stmt = $pdo->prepare('SELECT * FROM job WHERE id = :id');
|
||||
|
||||
$stmt->execute(['id' => $_GET['id']]);
|
||||
|
||||
$job = $stmt->fetch();
|
||||
?>
|
||||
|
||||
|
||||
<h2>Applicants for <?=$job['title'];?></h2>
|
||||
|
||||
<?php
|
||||
echo '<table>';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th style="width: 10%">Name</th>';
|
||||
echo '<th style="width: 10%">Email</th>';
|
||||
echo '<th style="width: 65%">Details</th>';
|
||||
echo '<th style="width: 15%">CV</th>';
|
||||
echo '</tr>';
|
||||
|
||||
$stmt = $pdo->prepare('SELECT * FROM applicants WHERE jobId = :id');
|
||||
|
||||
$stmt->execute(['id' => $_GET['id']]);
|
||||
|
||||
foreach ($stmt as $applicant) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $applicant['name'] . '</td>';
|
||||
echo '<td>' . $applicant['email'] . '</td>';
|
||||
echo '<td>' . $applicant['details'] . '</td>';
|
||||
echo '<td><a href="/cvs/' . $applicant['cv'] . '">Download CV</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</thead>';
|
||||
echo '</table>';
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post">
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Categories</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
?>
|
||||
|
||||
|
||||
<h2>Categories</h2>
|
||||
|
||||
<a class="new" href="addcategory.php">Add new category</a>
|
||||
|
||||
<?php
|
||||
echo '<table>';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th>Name</th>';
|
||||
echo '<th style="width: 5%"> </th>';
|
||||
echo '<th style="width: 5%"> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
$categories = $pdo->query('SELECT * FROM category');
|
||||
|
||||
foreach ($categories as $category) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $category['name'] . '</td>';
|
||||
echo '<td><a style="float: right" href="editcategory.php?id=' . $category['id'] . '">Edit</a></td>';
|
||||
echo '<td><form method="post" action="deletecategory.php">
|
||||
<input type="hidden" name="id" value="' . $category['id'] . '" />
|
||||
<input type="submit" name="submit" value="Delete" />
|
||||
</form></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</thead>';
|
||||
echo '</table>';
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post">
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
|
||||
$stmt = $pdo->prepare('DELETE FROM category WHERE id = :id');
|
||||
$stmt->execute(['id' => $_POST['id']]);
|
||||
|
||||
|
||||
header('location: categories.php');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
|
||||
$stmt = $pdo->prepare('DELETE FROM job WHERE id = :id');
|
||||
$stmt->execute(['id' => $_POST['id']]);
|
||||
|
||||
|
||||
header('location: jobs.php');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Edit Category</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$stmt = $pdo->prepare('UPDATE category SET name = :name WHERE id = :id ');
|
||||
|
||||
$criteria = [
|
||||
'name' => $_POST['name'],
|
||||
'id' => $_POST['id']
|
||||
];
|
||||
|
||||
$stmt->execute($criteria);
|
||||
echo 'Category Saved';
|
||||
}
|
||||
else {
|
||||
$currentCategory = $pdo->query('SELECT * FROM category WHERE id = ' . $_GET['id'])->fetch();
|
||||
?>
|
||||
|
||||
|
||||
<h2>Edit Category</h2>
|
||||
|
||||
<form action="" method="POST">
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $currentCategory['id']; ?>" />
|
||||
<label>Name</label>
|
||||
<input type="text" name="name" value="<?php echo $currentCategory['name']; ?>" />
|
||||
|
||||
|
||||
<input type="submit" name="submit" value="Save Category" />
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post">
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Edit Job</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$stmt = $pdo->prepare('UPDATE job
|
||||
SET title = :title,
|
||||
description = :description,
|
||||
salary = :salary,
|
||||
location = :location,
|
||||
categoryId = :categoryId,
|
||||
closingDate = :closingDate
|
||||
WHERE id = :id
|
||||
');
|
||||
|
||||
$criteria = [
|
||||
'title' => $_POST['title'],
|
||||
'description' => $_POST['description'],
|
||||
'salary' => $_POST['salary'],
|
||||
'location' => $_POST['location'],
|
||||
'categoryId' => $_POST['categoryId'],
|
||||
'closingDate' => $_POST['closingDate'],
|
||||
'id' => $_POST['id']
|
||||
];
|
||||
|
||||
$stmt->execute($criteria);
|
||||
|
||||
|
||||
echo 'Job saved';
|
||||
}
|
||||
else {
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
|
||||
$stmt = $pdo->prepare('SELECT * FROM job WHERE id = :id');
|
||||
|
||||
$stmt->execute($_GET);
|
||||
|
||||
$job = $stmt->fetch();
|
||||
?>
|
||||
|
||||
<h2>Edit Job</h2>
|
||||
|
||||
<form action="editjob.php" method="POST">
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $job['id']; ?>" />
|
||||
<label>Title</label>
|
||||
<input type="text" name="title" value="<?php echo $job['title']; ?>" />
|
||||
|
||||
<label>Description</label>
|
||||
<textarea name="description"><?php echo $job['description']; ?></textarea>
|
||||
|
||||
<label>Location</label>
|
||||
<input type="text" name="location" value="<?php echo $job['location']; ?>" />
|
||||
|
||||
|
||||
<label>Salary</label>
|
||||
<input type="text" name="salary" value="<?php echo $job['salary']; ?>" />
|
||||
|
||||
<label>Category</label>
|
||||
|
||||
<select name="categoryId">
|
||||
<?php
|
||||
$stmt = $pdo->prepare('SELECT * FROM category');
|
||||
$stmt->execute();
|
||||
|
||||
foreach ($stmt as $row) {
|
||||
if ($job['categoryId'] == $row['id']) {
|
||||
echo '<option selected="selected" value="' . $row['id'] . '">' . $row['name'] . '</option>';
|
||||
}
|
||||
else {
|
||||
echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
|
||||
<label>Closing Date</label>
|
||||
<input type="date" name="closingDate" value="<?php echo $job['closingDate']; ?>" />
|
||||
|
||||
<input type="submit" name="submit" value="Save" />
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post">
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Admin Home</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if (isset($_POST['submit'])) {
|
||||
if ($_POST['password'] == 'letmein') {
|
||||
$_SESSION['loggedin'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
?>
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
<h2>You are now logged in</h2>
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post" style="padding: 40px">
|
||||
|
||||
<label>Enter Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Job list</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
|
||||
?>
|
||||
|
||||
|
||||
<h2>Jobs</h2>
|
||||
|
||||
<a class="new" href="addjob.php">Add new job</a>
|
||||
|
||||
<?php
|
||||
echo '<table>';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th>Title</th>';
|
||||
echo '<th style="width: 15%">Salary</th>';
|
||||
echo '<th style="width: 5%"> </th>';
|
||||
echo '<th style="width: 15%"> </th>';
|
||||
echo '<th style="width: 5%"> </th>';
|
||||
echo '<th style="width: 5%"> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
$stmt = $pdo->query('SELECT * FROM job');
|
||||
|
||||
foreach ($stmt as $job) {
|
||||
$applicants = $pdo->prepare('SELECT count(*) as count FROM applicants WHERE jobId = :jobId');
|
||||
|
||||
$applicants->execute(['jobId' => $job['id']]);
|
||||
|
||||
$applicantCount = $applicants->fetch();
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>' . $job['title'] . '</td>';
|
||||
echo '<td>' . $job['salary'] . '</td>';
|
||||
echo '<td><a style="float: right" href="editjob.php?id=' . $job['id'] . '">Edit</a></td>';
|
||||
echo '<td><a style="float: right" href="applicants.php?id=' . $job['id'] . '">View applicants (' . $applicantCount['count'] . ')</a></td>';
|
||||
echo '<td><form method="post" action="deletejob.php">
|
||||
<input type="hidden" name="id" value="' . $job['id'] . '" />
|
||||
<input type="submit" name="submit" value="Delete" />
|
||||
</form></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</thead>';
|
||||
echo '</table>';
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
?>
|
||||
<h2>Log in</h2>
|
||||
|
||||
<form action="index.php" method="post">
|
||||
<label>Password</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="submit" name="submit" value="Log In" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
session_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Apply</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="/it.php">IT</a></li>
|
||||
<li><a href="/hr.php">Human Resources</a></li>
|
||||
<li><a href="/sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="/images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="jobs.php">Jobs</a></li>
|
||||
<li><a href="categories.php">Categories</a></li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($_FILES['cv']['error'] == 0) {
|
||||
|
||||
$parts = explode('.', $_FILES['cv']['name']);
|
||||
|
||||
$extension = end($parts);
|
||||
|
||||
$fileName = uniqid() . '.' . $extension;
|
||||
|
||||
move_uploaded_file($_FILES['cv']['tmp_name'], 'cvs/' . $fileName);
|
||||
|
||||
$criteria = [
|
||||
'name' => $_POST['name'],
|
||||
'email' => $_POST['email'],
|
||||
'details' => $_POST['details'],
|
||||
'jobId' => $_POST['jobId'],
|
||||
'cv' => $fileName
|
||||
];
|
||||
|
||||
$stmt = $pdo->prepare('INSERT INTO applicants (name, email, details, jobId, cv)
|
||||
VALUES (:name, :email, :details, :jobId, :cv)');
|
||||
|
||||
$stmt->execute($criteria);
|
||||
|
||||
echo 'Your application is complete. We will contact you after the closing date.';
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
echo 'There was an error uploading your CV';
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$stmt = $pdo->prepare('SELECT * FROM job WHERE id = :id');
|
||||
|
||||
$stmt->execute($_GET);
|
||||
|
||||
$job = $stmt->fetch();
|
||||
?>
|
||||
|
||||
<h2>Apply for <?=$job['title'];?></h2>
|
||||
|
||||
<form action="apply.php" method="POST" enctype="multipart/form-data">
|
||||
<label>Your name</label>
|
||||
<input type="text" name="name" />
|
||||
|
||||
<label>E-mail address</label>
|
||||
<input type="text" name="email" />
|
||||
|
||||
<label>Cover letter</label>
|
||||
<textarea name="details"></textarea>
|
||||
|
||||
<label>CV</label>
|
||||
<input type="file" name="cv" />
|
||||
|
||||
<input type="hidden" name="jobId" value="<?=$job['id'];?>" />
|
||||
|
||||
<input type="submit" name="submit" value="Apply" />
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Human Resources</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="it.php">IT</a></li>
|
||||
<li><a href="hr.php">Human Resources</a></li>
|
||||
<li><a href="sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="it.php">IT</a></li>
|
||||
<li class="current" ><a href="hr.php">Human Resources</a></li>
|
||||
<li><a href="sales.php">Sales</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<h1>Human Resources Jobs</h1>
|
||||
|
||||
<ul class="listing">
|
||||
|
||||
|
||||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
$stmt = $pdo->prepare('SELECT * FROM job WHERE categoryId = 2 AND closingDate > :date');
|
||||
|
||||
$date = new DateTime();
|
||||
|
||||
$values = [
|
||||
'date' => $date->format('Y-m-d')
|
||||
];
|
||||
|
||||
$stmt->execute($values);
|
||||
|
||||
|
||||
foreach ($stmt as $job) {
|
||||
echo '<li>';
|
||||
|
||||
echo '<div class="details">';
|
||||
echo '<h2>' . $job['title'] . '</h2>';
|
||||
echo '<h3>' . $job['salary'] . '</h3>';
|
||||
echo '<p>' . nl2br($job['description']) . '</p>';
|
||||
|
||||
echo '<a class="more" href="/apply.php?id=' . $job['id'] . '">Apply for this job</a>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - IT Jobs</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="it.php">IT</a></li>
|
||||
<li><a href="hr.php">Human Resources</a></li>
|
||||
<li><a href="sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li class="current" ><a href="it.php">IT</a></li>
|
||||
<li><a href="hr.php">Human Resources</a></li>
|
||||
<li><a href="sales.php">Sales</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<h1>IT Jobs</h1>
|
||||
|
||||
<ul class="listing">
|
||||
|
||||
|
||||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
$stmt = $pdo->prepare('SELECT * FROM job WHERE categoryId = 1 AND closingDate > :date');
|
||||
|
||||
$date = new DateTime();
|
||||
|
||||
$values = [
|
||||
'date' => $date->format('Y-m-d')
|
||||
];
|
||||
|
||||
$stmt->execute($values);
|
||||
|
||||
|
||||
foreach ($stmt as $job) {
|
||||
echo '<li>';
|
||||
|
||||
echo '<div class="details">';
|
||||
echo '<h2>' . $job['title'] . '</h2>';
|
||||
echo '<h3>' . $job['salary'] . '</h3>';
|
||||
echo '<p>' . nl2br($job['description']) . '</p>';
|
||||
|
||||
echo '<a class="more" href="/apply.php?id=' . $job['id'] . '">Apply for this job</a>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title>Jo's Jobs - Sales</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="it.php">IT</a></li>
|
||||
<li><a href="hr.php">Human Resources</a></li>
|
||||
<li><a href="sales.php">Sales</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/about.html">About Us</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<img src="images/randombanner.php"/>
|
||||
<main class="sidebar">
|
||||
|
||||
<section class="left">
|
||||
<ul>
|
||||
<li><a href="it.php">IT</a></li>
|
||||
<li><a href="hr.php">Human Resources</a></li>
|
||||
<li class="current"><a href="sales.php">Sales</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="right">
|
||||
|
||||
<h1>Sales Jobs</h1>
|
||||
|
||||
<ul class="listing">
|
||||
|
||||
|
||||
<?php
|
||||
$pdo = new PDO('mysql:dbname=job;host=mysql', 'student', 'student');
|
||||
$stmt = $pdo->prepare('SELECT * FROM job WHERE categoryId = 4 AND closingDate > :date');
|
||||
|
||||
$date = new DateTime();
|
||||
|
||||
$values = [
|
||||
'date' => $date->format('Y-m-d')
|
||||
];
|
||||
|
||||
$stmt->execute($values);
|
||||
|
||||
|
||||
foreach ($stmt as $job) {
|
||||
echo '<li>';
|
||||
|
||||
echo '<div class="details">';
|
||||
echo '<h2>' . $job['title'] . '</h2>';
|
||||
echo '<h3>' . $job['salary'] . '</h3>';
|
||||
echo '<p>' . nl2br($job['description']) . '</p>';
|
||||
|
||||
echo '<a class="more" href="/apply.php?id=' . $job['id'] . '">Apply for this job</a>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
||||
<footer>
|
||||
© Jo's Jobs 2017
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 148 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
//Pick a file at random from the 'banners' directory and display it
|
||||
$files = [];
|
||||
foreach (new DirectoryIterator('./banners') as $file) {
|
||||
if ($file->isDot()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strpos($file->getFileName(), '.jpg')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = $file->getFileName();
|
||||
}
|
||||
|
||||
header('content-type: image/jpg');
|
||||
|
||||
$contents = file_get_contents('./banners/' . $files[rand(0,count($files)-1)]);
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header('content-length: ' . strlen($contents));
|
||||
|
||||
echo $contents;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
require '../autoload.php';
|
||||
$routes = new \jobs\Routes();
|
||||
$entryPoint = new \CSY2028\EntryPoint($routes);
|
||||
$entryPoint->run();
|
||||
?>
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
/* import fonts */
|
||||
@import url('https://stockfont.org/?3e1218d9a01517d5734a1be9e67be4af797abff1230ab272235ec8ed759251d6');
|
||||
* {margin: 0; padding: 0;}
|
||||
|
||||
html {font-family: 'Oxygen-Regular', verdana, sans-serif; }
|
||||
|
||||
body {background-color: #eaeaea;}
|
||||
header {background-color: #4b72ad
|
||||
|
||||
; color: white;
|
||||
|
||||
height: 200px;
|
||||
|
||||
}
|
||||
|
||||
header img {width: 500px; float: left; background-color: white; border-radius: 20px; margin-top: 20px;}
|
||||
header aside {float: right; margin-top: 15px;}
|
||||
header section {width: 1000px; display: block; margin:auto;}
|
||||
header h1 {float: left; margin-left: 20px;}
|
||||
nav {width: 100%; background-color: #264f87; overflow: auto;}
|
||||
body > img {width: 100%; display: block;}
|
||||
nav ul {width: 1000px; margin: auto; display: block; list-style-type: none;}
|
||||
nav ul li {width: 25%; float: left; overflow: auto; text-align: center;}
|
||||
nav li {color: white; padding-top: 10px; display: block;}
|
||||
nav a {color: white; text-decoration: none}
|
||||
nav ul ul {
|
||||
max-height: 0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
background-color: #264f87;
|
||||
transition: max-height 0.5s;
|
||||
margin-left: 4em;
|
||||
width: 20vw;
|
||||
}
|
||||
main ul {
|
||||
margin-left: 3em;
|
||||
}
|
||||
|
||||
nav ul ul li { float: none; text-align: left; margin-left: 3em; width: auto;}
|
||||
|
||||
li:hover ul { max-height: 400px; }
|
||||
|
||||
|
||||
main a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
nav {font-family: 'Oxygen-Regular';}
|
||||
header section { display: block; font-family: 'Oxygen-Regular', cursive;}
|
||||
|
||||
header h1 {font-weight: normal;}
|
||||
|
||||
|
||||
h1 { font-size:4em; color: white; text-align: center; padding-top: 20px; text-shadow: 2px 2px 2px #000;}
|
||||
|
||||
main {min-height: 50vh; background-color: #fff; width: 70vw; display: block; margin: auto; box-shadow: 0px 0px 10px #888; color:#444;}
|
||||
footer {min-height: 5vh; color: white;}
|
||||
|
||||
main h2 {font-size:2em;}
|
||||
.home {padding: 5vw; width: 60vw;}
|
||||
|
||||
p, li, h2 {margin-bottom: 1em;}
|
||||
ol {margin-left: 30px;}
|
||||
|
||||
pre {margin-top: 20px;}
|
||||
code {background-color: #ccc;}
|
||||
pre code {display: block;}
|
||||
|
||||
footer {background-color: #4b72ad; padding: 10px; color: white;}
|
||||
|
||||
form select, form label, form input, form textarea {float: left; width: 200px; padding: 10px; margin-top: 20px;}
|
||||
form label {clear: left;}
|
||||
textarea {height: 100px;}
|
||||
form input[type="text"], form input[type="password"], textarea {color: #999; font-family: verdana, sans-serif}
|
||||
input[type="submit"] {clear: both; margin-left: 220px; width: 220px;}
|
||||
|
||||
|
||||
.left ul {list-style-type: none }
|
||||
section a {color: #444;}
|
||||
|
||||
form select {width: 220px;}
|
||||
table {width: 100%; margin-top: 20px;}
|
||||
td {padding: 5px; border-bottom: 1px solid #333;}
|
||||
|
||||
.jobs {list-style-type: none}
|
||||
.jobs strong {width: 150px; float: left; clear: left;}
|
||||
.jobs p {width: 500px; float: left;}
|
||||
|
||||
.jobs li {padding-top: 20px; padding-bottom: 20px; border-bottom: 2px solid #aaa; overflow: auto}
|
||||
.jobs a {float: right; clear: both;}
|
||||
|
||||
img.shop {width: 800px;}
|
||||
|
||||
.stock, .sidebar {display: table;}
|
||||
.stock > ul, .sidebar .left { width: 10vw; list-style-type: none; display: table-cell; padding: 10px; background-color: #555; margin: 0;}
|
||||
|
||||
.stock .products, .sidebar .right {display: table-cell; padding: 20px;}
|
||||
|
||||
.stock > ul a, .sidebar .left a {color: white; text-decoration: none;}
|
||||
|
||||
table td input[type="submit"] {margin: 0; float: right; width: auto; padding: auto;}
|
||||
|
||||
.listing ul {margin-top: 40px; list-style-type: none;}
|
||||
.listing li {border-top: 2px solid #888; padding: 20px; overflow: auto;}
|
||||
|
||||
.listing li .noimage, .listing li img {width: 20%; margin-right: 4%; min-height: 50px; float: left;}
|
||||
.listing .info {float: left; width: 75%;}
|
||||
|
||||
.current {background-color: #ddd; color: #333; display: block; }
|
||||
.current a {color: #333 !important;}
|
||||
.stock > ul .current a {color: #333;}
|
||||
.categories li {margin: 0; padding: 0.5em; font-size: 2em;}
|
||||
|
||||
.products > img {max-height: 300px;}
|
||||
|
||||
a:hover {color: #ccc !important;}
|
||||
|
||||
.right {padding: 20px;}
|
||||
|
||||
main h1 {color: #666;}
|
||||
|
||||
main img {display: block;}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<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>
|
||||
<li><a href="?page=it">IT</a></li>
|
||||
<li><a href="?page=hr">Human Resources</a></li>
|
||||
<li><a href="?page=sales">Sales</a></li>
|
||||
</ul>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css"/>
|
||||
<title> <?=$title;?> </title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<aside>
|
||||
<h3>Office Hours:</h3>
|
||||
<p>Mon-Fri: 09:00-17:30</p>
|
||||
<p>Sat: 09:00-17:00</p>
|
||||
<p>Sun: Closed</p>
|
||||
</aside>
|
||||
<h1>Jo's Jobs</h1>
|
||||
</section>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li>Jobs
|
||||
<ul>
|
||||
<li><a href="?page=it">IT</a></li>
|
||||
<li><a href="?page=hr">Human Resources</a></li>
|
||||
<li><a href="?page=sales">Sales</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="?page=about">About Us</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<img src="../images/randombanner.php"/>
|
||||
<main class="home">
|
||||
<?=$content;?>
|
||||
</main>
|
||||
<footer>
|
||||
© Jo's Jobs <?=date('Y');?>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
Assignment 2:
|
||||
- Copyright updates to current year @done
|
||||
- Add FAQs page
|
||||
- Placeholder text ('FAQs coming soon')
|
||||
- Menu link
|
||||
- Admin can update categories but are not visable on site
|
||||
- Add cats to Jobs page
|
||||
- Add cats to nav bar
|
||||
- Job list in admin area lists all jobs
|
||||
- Add cat name as new column in table
|
||||
- Add filter to be able to filter by cat
|
||||
- Allow customers to filter by location
|
||||
- Add admin user control to admin panel
|
||||
- Client user accounts
|
||||
- restricted admin panel
|
||||
- add and remove jobs
|
||||
- see who has applied for jobs
|
||||
- Client can only see their jobs
|
||||
- Homepage has 10 jobs that are about to reach closing date
|
||||
- Contact form on contact page
|
||||
- forms store data in db
|
||||
- stored enquiries can be accessed from admin panel
|
||||
- can mark enquieries as Completed once admin has responded
|
||||
- Keep list of all previous enquieries and which admin dealt with it
|
||||
- Create entity classes for database entities (topic 18)
|
||||
- page 37-38 for implementation
|
||||
Loading…
Reference in New Issue