Summary Files Commits Branches @commit @diff @stats
path: root / src / controllers / CreateOfferController.php
diff options
context:
space:
mode:
1 files changed, 21 insertions, 0 deletions
-rw-r--r--src/controllers/CreateOfferController.php21
diff --git a/src/controllers/CreateOfferController.php b/src/controllers/CreateOfferController.php
new file mode 100644
index 0000000..a223463
--- /dev/null
+++ b/src/controllers/CreateOfferController.php
@@ -0,0 +1,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();
+ }
+}