contact page added
This commit is contained in:
parent
86bb50cc47
commit
e9f4b7de97
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
namespace jobs\Entity;
|
||||||
|
class Enquiry {
|
||||||
|
public $id;
|
||||||
|
public $name;
|
||||||
|
public $email;
|
||||||
|
public $telephone;
|
||||||
|
public $enquiry;
|
||||||
|
public $completed;
|
||||||
|
public $admin_id;
|
||||||
|
private $usersTable;
|
||||||
|
|
||||||
|
public function __construct(\jobs\JobDatabaseTable $usersTable) {
|
||||||
|
$this->usersTable = $usersTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAdmin() {
|
||||||
|
if ($completed == 'y') {
|
||||||
|
return $this->usersTable->find(['id'], ['value0' => $this->admin_id])[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -7,7 +7,7 @@ class Routes extends \CSY2028\Routes {
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->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"], $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']),
|
||||||
"user" => new \jobs\controllers\User($this->databaseTables["users"], $this->databaseTables["categories"])
|
"user" => new \jobs\controllers\User($this->databaseTables["users"], $this->databaseTables["categories"])
|
||||||
];
|
];
|
||||||
|
|
@ -26,6 +26,7 @@ class Routes extends \CSY2028\Routes {
|
||||||
$this->databaseTables["applicants"] = new \jobs\JobDatabaseTable('applicants', 'id', '\jobs\Entity\Applicant');
|
$this->databaseTables["applicants"] = new \jobs\JobDatabaseTable('applicants', 'id', '\jobs\Entity\Applicant');
|
||||||
$this->databaseTables["jobs"] = new \jobs\JobDatabaseTable('job', 'id', '\jobs\Entity\Job', [$this->databaseTables["categories"], $this->databaseTables['applicants']]);
|
$this->databaseTables["jobs"] = new \jobs\JobDatabaseTable('job', 'id', '\jobs\Entity\Job', [$this->databaseTables["categories"], $this->databaseTables['applicants']]);
|
||||||
$this->databaseTables["users"] = new \jobs\JobDatabaseTable('users', 'id', '\jobs\Entity\User');
|
$this->databaseTables["users"] = new \jobs\JobDatabaseTable('users', 'id', '\jobs\Entity\User');
|
||||||
|
$this->databaseTables["enquiries"] = new \jobs\JobDatabaseTable('enquiries', 'id', '\jobs\Entity\Enquiry', [$this->databaseTables['users']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -4,12 +4,14 @@ class Jobs {
|
||||||
private $jobsTable;
|
private $jobsTable;
|
||||||
private $catsTable;
|
private $catsTable;
|
||||||
private $appsTable;
|
private $appsTable;
|
||||||
|
private $enquiryTable;
|
||||||
private $vars = [];
|
private $vars = [];
|
||||||
|
|
||||||
public function __construct(\jobs\JobDatabaseTable $jobsTable, \jobs\JobDatabaseTable $catsTable, \jobs\JobDatabaseTable $appsTable) {
|
public function __construct(\jobs\JobDatabaseTable $jobsTable, \jobs\JobDatabaseTable $catsTable, \jobs\JobDatabaseTable $appsTable, \jobs\JobDatabaseTable $enquiryTable) {
|
||||||
$this->jobsTable = $jobsTable;
|
$this->jobsTable = $jobsTable;
|
||||||
$this->catsTable = $catsTable;
|
$this->catsTable = $catsTable;
|
||||||
$this->appsTable = $appsTable;
|
$this->appsTable = $appsTable;
|
||||||
|
$this->enquiryTable = $enquiryTable;
|
||||||
$this->vars['cats'] = $this->catsTable->findAll();
|
$this->vars['cats'] = $this->catsTable->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,6 +58,26 @@ class Jobs {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function contact() {
|
||||||
|
return ['template' => 'contact.html.php',
|
||||||
|
'title' => 'Jo\'s Jobs- Contact',
|
||||||
|
'vars' => $this->vars
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function contactSubmit() {
|
||||||
|
$record = [
|
||||||
|
'name' => $_POST['name'],
|
||||||
|
'email' => $_POST['email'],
|
||||||
|
'telephone' => $_POST['number'],
|
||||||
|
'enquiry' => $_POST['enquiry']
|
||||||
|
];
|
||||||
|
$this->enquiryTable->save($record);
|
||||||
|
$this->vars['response'] = 'Enquiry Sent';
|
||||||
|
return ['template' => 'response.html.php',
|
||||||
|
'title' => 'Jo\'s Jobs- Enquiry Sent',
|
||||||
|
'vars' => $this->vars];
|
||||||
|
}
|
||||||
|
|
||||||
public function notFound() {
|
public function notFound() {
|
||||||
$this->vars['response'] = 'The page you have requested has not been found';
|
$this->vars['response'] = 'The page you have requested has not been found';
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<main class="home">
|
||||||
|
<h2>Contact Us</h2>
|
||||||
|
<form method="post" action="/jobs/contact">
|
||||||
|
<label>Name</label>
|
||||||
|
<input type="text" name="name" />
|
||||||
|
<label>Email</label>
|
||||||
|
<input type="email" name="email" />
|
||||||
|
<label>Telephone Number</label>
|
||||||
|
<input type="text" name="number" />
|
||||||
|
<label>Enquiry</label>
|
||||||
|
<input type="text" name="enquiry" />
|
||||||
|
<input type="submit" name="submit" value="Send" />
|
||||||
|
</form>
|
||||||
|
</main>
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/jobs/faq">FAQ</a></li>
|
<li><a href="/jobs/faq">FAQ</a></li>
|
||||||
<li><a href="/jobs/about">About Us</a></li>
|
<li><a href="/jobs/about">About Us</a></li>
|
||||||
|
<li><a href="/jobs/contact">Contact</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<img src="../images/randombanner.php"/>
|
<img src="../images/randombanner.php"/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue