Summary Files Commits Branches @commit @diff @stats
path: root / src / controllers / CreateOfferController.php
blob: bb6015b69391a1cbe2e0e5e9ebafd2176fb874bb (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();
	}
}