portal templates made
This commit is contained in:
parent
21b90876eb
commit
10466ec99a
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
namespace jobs\controllers;
|
||||
class Admin {
|
||||
private $jobsTable;
|
||||
private $catsTable;
|
||||
private $appsTable;
|
||||
private $usersTable;
|
||||
private $vars = [];
|
||||
|
||||
public function __construct(\CSY2028\DatabaseTable $jobsTable, \CSY2028\DatabaseTable $catsTable, \CSY2028\DatabaseTable $appsTable, \CSY2028\DatabaseTable $usersTable) {
|
||||
$this->jobsTable = $jobsTable;
|
||||
$this->catsTable = $catsTable;
|
||||
$this->appsTable = $appsTable;
|
||||
$this->usersTable = $usersTable;
|
||||
$this->vars['cats'] = $this->catsTable->findAll();
|
||||
$this->vars['response'] = '';
|
||||
}
|
||||
|
||||
public function home() {
|
||||
return ['template' => 'login.html.php',
|
||||
'title' => 'Jo\'s Jobs- Login',
|
||||
'vars' => $this->vars];
|
||||
}
|
||||
|
||||
public function homeSubmit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
<?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>
|
||||
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
<?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,19 @@
|
|||
<h2>Applicants for job</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%">Name</th>
|
||||
<th style="width: 10%">Email</th>
|
||||
<th style="width: 65%">Details</th>
|
||||
<th style="width: 15%">CV</th>
|
||||
</tr>
|
||||
<?php foreach ($apps as $app) { ?>
|
||||
<tr>
|
||||
<td><?=$app->name?></td>
|
||||
<td><?=$app->email?></td>
|
||||
<td><?=$app->details?></td>
|
||||
<td><a href="/cvs/<?=$app->cv?>">Download CV</a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</thead>
|
||||
</table>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<h2>Categories</h2>
|
||||
<a class="new" href="addcategory.php">Add new category</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th style="width: 5%"> </th>
|
||||
<th style="width: 5%"> </th>
|
||||
</tr>
|
||||
<?php foreach ($cats as $cat) { ?>
|
||||
<tr>
|
||||
<td><?=$cat->name?></td>';
|
||||
<td><a style="float: right" href="/portal/edit?id=<?=$cat->id?>">Edit</a></td>';
|
||||
<td><form method="post" action="/portal">
|
||||
<input type="hidden" name="id" value="<?=$cat->id?>" />
|
||||
<input type="submit" name="submit" value="Delete" />
|
||||
</form></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</thead>
|
||||
</table>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<h2>Jobs</h2>
|
||||
<a class="new" href="addjob.php">Add new job</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th style="width: 15%">Salary</th>
|
||||
<th style="width: 5%"> </th>
|
||||
<th style="width: 15%"> </th>
|
||||
<th style="width: 5%"> </th>
|
||||
<th style="width: 5%"> </th>
|
||||
</tr>
|
||||
<?php foreach ($jobs as $job) { ?>
|
||||
<tr>
|
||||
<td><?=$job->title?></td>
|
||||
<td><?=$job->salary?></td>
|
||||
<td><a style="float: right" href="portal/edit?id=<?=$job->id?>">Edit</a></td>
|
||||
<td><a style="float: right" href="applicants.php?id=<?=$job->id?>">View applicants (count)</a></td>
|
||||
<td><form method="post" action="portal/delete">
|
||||
<input type="hidden" name="id" value="<?=$job->id?>" />
|
||||
<input type="submit" name="submit" value="Delete" />
|
||||
</form></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</thead>
|
||||
</table>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<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">
|
||||
<?=$table?>
|
||||
</section>
|
||||
</main>
|
||||
Loading…
Reference in New Issue