added enquiry admin portal
This commit is contained in:
parent
e9f4b7de97
commit
1f487fe45e
|
|
@ -15,7 +15,7 @@ class Enquiry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAdmin() {
|
public function getAdmin() {
|
||||||
if ($completed == 'y') {
|
if ($this->completed == 'y') {
|
||||||
return $this->usersTable->find(['id'], ['value0' => $this->admin_id])[0];
|
return $this->usersTable->find(['id'], ['value0' => $this->admin_id])[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class Routes extends \CSY2028\Routes {
|
||||||
$this->setDbTables();
|
$this->setDbTables();
|
||||||
$this->controllers = [
|
$this->controllers = [
|
||||||
"jobs" => new \jobs\controllers\Jobs($this->databaseTables["jobs"], $this->databaseTables["categories"], $this->databaseTables["applicants"], $this->databaseTables['enquiries']),
|
"jobs" => new \jobs\controllers\Jobs($this->databaseTables["jobs"], $this->databaseTables["categories"], $this->databaseTables["applicants"], $this->databaseTables['enquiries']),
|
||||||
"portal" => new \jobs\controllers\Portal($this->databaseTables["categories"], $this->databaseTables["jobs"], $this->databaseTables["applicants"], $this->databaseTables['users']),
|
"portal" => new \jobs\controllers\Portal($this->databaseTables["categories"], $this->databaseTables["jobs"], $this->databaseTables["applicants"], $this->databaseTables['users'], $this->databaseTables['enquiries']),
|
||||||
"user" => new \jobs\controllers\User($this->databaseTables["users"], $this->databaseTables["categories"])
|
"user" => new \jobs\controllers\User($this->databaseTables["users"], $this->databaseTables["categories"])
|
||||||
];
|
];
|
||||||
$this->loginControllers = [
|
$this->loginControllers = [
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,15 @@ class Portal {
|
||||||
private $jobsTable;
|
private $jobsTable;
|
||||||
private $appsTable;
|
private $appsTable;
|
||||||
private $usersTable;
|
private $usersTable;
|
||||||
|
private $enquiryTable;
|
||||||
private $vars;
|
private $vars;
|
||||||
|
|
||||||
public function __construct(\jobs\JobDatabaseTable $catsTable, \jobs\JobDatabaseTable $jobsTable, \jobs\JobDatabaseTable $appsTable, \jobs\JobDatabaseTable $usersTable) {
|
public function __construct(\jobs\JobDatabaseTable $catsTable, \jobs\JobDatabaseTable $jobsTable, \jobs\JobDatabaseTable $appsTable, \jobs\JobDatabaseTable $usersTable, \jobs\JobDatabaseTable $enquiryTable) {
|
||||||
$this->catsTable = $catsTable;
|
$this->catsTable = $catsTable;
|
||||||
$this->jobsTable = $jobsTable;
|
$this->jobsTable = $jobsTable;
|
||||||
$this->appsTable = $appsTable;
|
$this->appsTable = $appsTable;
|
||||||
$this->usersTable = $usersTable;
|
$this->usersTable = $usersTable;
|
||||||
|
$this->enquiryTable = $enquiryTable;
|
||||||
$this->vars['cats'] = $this->catsTable->findAll();
|
$this->vars['cats'] = $this->catsTable->findAll();
|
||||||
$this->vars['table'] = 'job_table.html.php';
|
$this->vars['table'] = 'job_table.html.php';
|
||||||
}
|
}
|
||||||
|
|
@ -109,6 +111,27 @@ class Portal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enquiries() {
|
||||||
|
if ($_SESSION['userType'] == 'admin') {
|
||||||
|
$this->vars['table'] = 'enquiry_table.html.php';
|
||||||
|
$this->vars['enqs'] = $this->enquiryTable->findAll();
|
||||||
|
return ['template' => 'portal.html.php',
|
||||||
|
'title' => 'Jo\'s Jobs- Enquiries',
|
||||||
|
'vars' => $this->vars
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function enquiriesSubmit() {
|
||||||
|
$record = [
|
||||||
|
'id' => $_POST['enq_id'],
|
||||||
|
'completed' => 'y',
|
||||||
|
'admin_id' => $_SESSION['loggedin']
|
||||||
|
];
|
||||||
|
$this->enquiryTable->save($record);
|
||||||
|
$this->enquiries();
|
||||||
|
}
|
||||||
|
|
||||||
public function addUser() {
|
public function addUser() {
|
||||||
if ($_SESSION['userType'] == 'admin') {
|
if ($_SESSION['userType'] == 'admin') {
|
||||||
if (isset($_GET['user_id'])) {
|
if (isset($_GET['user_id'])) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<h2>Enquiries</h2>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Telephone</th>
|
||||||
|
<th>Enquiry</th>
|
||||||
|
<th>Completed</th>
|
||||||
|
<th>Handled by</th>
|
||||||
|
<th style="width: 5%"> </th>
|
||||||
|
<th style="width: 5%"> </th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach ($enqs as $enq) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?=$enq->name?></td>
|
||||||
|
<td><?=$enq->email?></td>
|
||||||
|
<td><?=$enq->telephone?></td>
|
||||||
|
<td><?=$enq->enquiry?></td>
|
||||||
|
<td><?=$enq->completed?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
if ($enq->getAdmin() == 'N/A') {
|
||||||
|
echo 'N/A';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo $enq->getAdmin()->username;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<?php if($enq->completed == 'n') { ?>
|
||||||
|
<td>
|
||||||
|
<form method="post" action="/portal/enquiries">
|
||||||
|
<input type="hidden" name="enq_id" value="<?=$enq->id?>" />
|
||||||
|
<input type="submit" name="submit" value="Complete" />
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<li><a href="/portal">Jobs</a></li>
|
<li><a href="/portal">Jobs</a></li>
|
||||||
<?php if ($_SESSION['userType'] == 'admin') { ?>
|
<?php if ($_SESSION['userType'] == 'admin') { ?>
|
||||||
<li><a href="/portal/categories">Categories</a></li>
|
<li><a href="/portal/categories">Categories</a></li>
|
||||||
|
<li><a href="/portal/enquiries">Enquiries</a></li>
|
||||||
<li><a href="/portal/users">Users</a></li>
|
<li><a href="/portal/users">Users</a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
10
todo
10
todo
|
|
@ -22,11 +22,11 @@ Assignment 2:
|
||||||
- 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 @done
|
- Homepage has 10 jobs that are about to reach closing date @done
|
||||||
- Contact form on contact page
|
- Contact form on contact page @done
|
||||||
- forms store data in db
|
- forms store data in db @done
|
||||||
- stored enquiries can be accessed from admin panel
|
- stored enquiries can be accessed from admin panel @done
|
||||||
- can mark enquieries as Completed once admin has responded
|
- can mark enquieries as Completed once admin has responded @done
|
||||||
- Keep list of all previous enquieries and which admin dealt with it
|
- Keep list of all previous enquieries and which admin dealt with it @done
|
||||||
- Create entity classes for database entities (topic 18) @done
|
- Create entity classes for database entities (topic 18) @done
|
||||||
- page 37-38 for implementation @done
|
- page 37-38 for implementation @done
|
||||||
- Restrict categories by jobs available past current date @done
|
- Restrict categories by jobs available past current date @done
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue