Summary Files Commits Branches @commit @diff @stats
path: root / src / controllers / CreateOfferController.php
blob: a2234634c179b34ae7ad376f3ea6b30b49d95839 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
include_once('controllers/BaseController.php');
include_once('models/Company.php');

class CreateOfferController extends BaseController {
	private static $companies;

	public static function get() {
		self::$companies = Company::getAllFromDB();
		include 'views/create-offer.php';
	}

	public static function post() {
		$newJobOffer = new JobOffer($_POST['title'], $_POST['description'], $_POST['company'], $_POST['salary']);
		JobOffer::insertIntoDB($newJobOffer);

		// Redirect to landing page
		header("Location: /", TRUE, 301);
		exit();
	}
}