From bb3f8ef61776830885c22237458e2006b93775ea Mon Sep 17 00:00:00 2001 From: paolo Date: Tue, 24 May 2016 12:28:49 +0200 Subject: [PATCH] - Added method getStudienplan to the controller Studienplan - Introduced parameter new in method postPrestudentstatus of the controller Prestudentstatus --- .../api/v1/crm/Prestudentstatus.php | 21 ++++++++----------- .../api/v1/organisation/Studienplan.php | 16 ++++++++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/application/controllers/api/v1/crm/Prestudentstatus.php b/application/controllers/api/v1/crm/Prestudentstatus.php index f1bfda16a..a73e03bc6 100644 --- a/application/controllers/api/v1/crm/Prestudentstatus.php +++ b/application/controllers/api/v1/crm/Prestudentstatus.php @@ -55,27 +55,24 @@ class Prestudentstatus extends APIv1_Controller */ public function postPrestudentstatus() { - $prestudentstatus = $this->_parseData($this->post()); - - $this->response($prestudentstatus); - + $prestudentstatus = $this->_parseData($this->post()); + if ($this->_validate($prestudentstatus)) { - if (isset($prestudentstatus['ausbildungssemester']) && isset($prestudentstatus['studiensemester_kurzbz']) && - isset($prestudentstatus['status_kurzbz']) && isset($prestudentstatus['prestudent_id'])) + if(isset($prestudentstatus['new']) && $prestudentstatus['new'] == true) + { + $result = $this->PrestudentstatusModel->insert($prestudentstatus); + } + else { $pksArray = array($prestudentstatus['ausbildungssemester'], $prestudentstatus['studiensemester_kurzbz'], $prestudentstatus['status_kurzbz'], $prestudentstatus['prestudent_id'] ); - + $result = $this->PrestudentstatusModel->update($pksArray, $prestudentstatus); } - else - { - $result = $this->PrestudentstatusModel->insert($prestudentstatus); - } $this->response($result, REST_Controller::HTTP_OK); } @@ -85,7 +82,7 @@ class Prestudentstatus extends APIv1_Controller } } - private function _validate($prestudentstatus = NULL) + private function _validate($prestudentstatus = null) { return true; } diff --git a/application/controllers/api/v1/organisation/Studienplan.php b/application/controllers/api/v1/organisation/Studienplan.php index 4b1f2e5da..f27043d82 100644 --- a/application/controllers/api/v1/organisation/Studienplan.php +++ b/application/controllers/api/v1/organisation/Studienplan.php @@ -28,6 +28,22 @@ class Studienplan extends APIv1_Controller $this->StudienplanModel->setUID($this->_getUID()); } + public function getStudienplan() + { + $studienplan_id = $this->get('studienplan_id'); + + if (isset($studienplan_id)) + { + $result = $this->StudienplanModel->load($studienplan_id); + + $this->response($result, REST_Controller::HTTP_OK); + } + else + { + $this->response(); + } + } + public function getStudienplaene() { $studiengang_kz = $this->get('studiengang_kz');