diff options
| Commit | f8c1df9a9a24be0ff3811dc33e00f92bf51465ab (patch) | |
|---|---|---|
| Author | 2021-04-03 11:54:52 +0300 | |
| Committer | 2021-04-03 11:54:52 +0300 | |
| Files | 56dfbe9d57e3150b480928da543b3dba30e11692 /src/controllers/EditOfferController.php | |
| devrix-job-board-0.1.tar devrix-job-board-0.1.tar.gz devrix-job-board-0.1.zip | ||
| Parent | aa2e361c3114b53ac7858e118454b9dfaf51ebe4 (diff) | |
| Parent | fff8c08ad7f3845eb32671292392cbf08bb738c9 (diff) | |
Merge pull request #1 from Syndamia/dev v0.1
Implemented main functionality
1 files changed, 30 insertions, 0 deletions
| -rw-r--r-- | src/controllers/EditOfferController.php | 30 |
diff --git a/src/controllers/EditOfferController.php b/src/controllers/EditOfferController.php new file mode 100644 index 0000000..ae49c5b --- /dev/null +++ b/src/controllers/EditOfferController.php @@ -0,0 +1,30 @@ +<?php +include_once('controllers/BaseController.php'); +include_once('models/JobOffer.php'); +include_once('models/Company.php'); +include_once('controllers/DashboardController.php'); + +class EditOfferController extends BaseController { + private static $job; + private static $companies; + + public static function get() { + self::$job = JobOffer::getFromDBById($_POST['jobId']); + self::$companies = Company::getAllFromDB(); + include "views/edit-offer.php"; + } + + public static function put() { + $newJobOffer = new JobOffer($_POST['title'], $_POST['description'], $_POST['company'], $_POST['salary']); + $newJobOffer->id = $_POST['id']; + JobOffer::updateFromDB($newJobOffer); + + DashboardController::get(); + } + + public static function delete() { + JobOffer::deleteFromDB($_POST['jobId']); + + DashboardController::get(); + } +} |
