diff options
Merge pull request #1 from Syndamia/dev v0.1
Implemented main functionality
1 files changed, 21 insertions, 0 deletions
| -rw-r--r-- | src/controllers/CreateOfferController.php | 21 |
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(); + } +} |
