From 66afe6d8f98a2a1f048cf46fc731e5d162cf0322 Mon Sep 17 00:00:00 2001 From: bison-paolo Date: Thu, 17 Nov 2016 14:53:23 +0100 Subject: [PATCH] Added new parameter nachreichbar to controller Dokumentstudiengang and to model Dokumentstudiengang_model --- .../api/v1/crm/Dokumentstudiengang.php | 30 ++++++++++++------- .../models/crm/Dokumentstudiengang_model.php | 21 ++++++++----- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/application/controllers/api/v1/crm/Dokumentstudiengang.php b/application/controllers/api/v1/crm/Dokumentstudiengang.php index 2d90c44e7..09989198b 100644 --- a/application/controllers/api/v1/crm/Dokumentstudiengang.php +++ b/application/controllers/api/v1/crm/Dokumentstudiengang.php @@ -12,7 +12,7 @@ */ // ------------------------------------------------------------------------ -if (!defined("BASEPATH")) exit("No direct script access allowed"); +if (!defined('BASEPATH')) exit('No direct script access allowed'); class Dokumentstudiengang extends APIv1_Controller { @@ -23,7 +23,7 @@ class Dokumentstudiengang extends APIv1_Controller { parent::__construct(); // Load model DokumentstudiengangModel - $this->load->model("crm/Dokumentstudiengang_model", "DokumentstudiengangModel"); + $this->load->model('crm/Dokumentstudiengang_model', 'DokumentstudiengangModel'); } /** @@ -31,8 +31,8 @@ class Dokumentstudiengang extends APIv1_Controller */ public function getDokumentstudiengang() { - $studiengang_kz = $this->get("studiengang_kz"); - $dokument_kurzbz = $this->get("dokument_kurzbz"); + $studiengang_kz = $this->get('studiengang_kz'); + $dokument_kurzbz = $this->get('dokument_kurzbz'); if (isset($studiengang_kz) && isset($dokument_kurzbz)) { @@ -51,13 +51,19 @@ class Dokumentstudiengang extends APIv1_Controller */ public function getDokumentstudiengangByStudiengang_kz() { - $studiengang_kz = $this->get("studiengang_kz"); - $onlinebewerbung = $this->get("onlinebewerbung"); - $pflicht = $this->get("pflicht"); + $studiengang_kz = $this->get('studiengang_kz'); + $onlinebewerbung = $this->get('onlinebewerbung'); + $pflicht = $this->get('pflicht'); + $nachreichbar = $this->get('nachreichbar'); if (isset($studiengang_kz)) { - $result = $this->DokumentstudiengangModel->getDokumentstudiengangByStudiengang_kz($studiengang_kz, $onlinebewerbung, $pflicht); + $result = $this->DokumentstudiengangModel->getDokumentstudiengangByStudiengang_kz( + $studiengang_kz, + $onlinebewerbung, + $pflicht, + $nachreichbar + ); $this->response($result, REST_Controller::HTTP_OK); } @@ -74,9 +80,13 @@ class Dokumentstudiengang extends APIv1_Controller { if ($this->_validate($this->post())) { - if (isset($this->post()["studiengang_kz"]) && isset($this->post()["dokument_kurzbz"])) + if (isset($this->post()['studiengang_kz']) && isset($this->post()['dokument_kurzbz'])) { - $result = $this->DokumentstudiengangModel->update(array($this->post()["studiengang_kz"], $this->post()["dokument_kurzbz"]), $this->post()); + $result = $this->DokumentstudiengangModel->update( + array($this->post()['studiengang_kz'], + $this->post()['dokument_kurzbz']), + $this->post() + ); } else { diff --git a/application/models/crm/Dokumentstudiengang_model.php b/application/models/crm/Dokumentstudiengang_model.php index 9ffe90e91..e96bd6e55 100644 --- a/application/models/crm/Dokumentstudiengang_model.php +++ b/application/models/crm/Dokumentstudiengang_model.php @@ -8,28 +8,33 @@ class Dokumentstudiengang_model extends DB_Model public function __construct() { parent::__construct(); - $this->dbTable = "public.tbl_dokumentstudiengang"; - $this->pk = array("studiengang_kz", "dokument_kurzbz"); + $this->dbTable = 'public.tbl_dokumentstudiengang'; + $this->pk = array('studiengang_kz', 'dokument_kurzbz'); } - public function getDokumentstudiengangByStudiengang_kz($studiengang_kz, $onlinebewerbung, $pflicht) + public function getDokumentstudiengangByStudiengang_kz($studiengang_kz, $onlinebewerbung = null, $pflicht = null, $nachreichbar = null) { // Checks if the operation is permitted by the API caller - if (($isEntitled = $this->isEntitled("public.tbl_dokument", "s", FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) + if (($isEntitled = $this->isEntitled('public.tbl_dokument', 's', FHC_NORIGHT, FHC_MODEL_ERROR)) !== true) return $isEntitled; - $this->addJoin("public.tbl_dokument", "dokument_kurzbz"); + $this->addJoin('public.tbl_dokument', 'dokument_kurzbz'); - $parameterArray = array("studiengang_kz" => $studiengang_kz); + $parameterArray = array('studiengang_kz' => $studiengang_kz); if( isset($onlinebewerbung)) { - $parameterArray["onlinebewerbung"] = $onlinebewerbung; + $parameterArray['onlinebewerbung'] = $onlinebewerbung; } if( isset($pflicht)) { - $parameterArray["pflicht"] = $pflicht; + $parameterArray['pflicht'] = $pflicht; + } + + if( isset($nachreichbar)) + { + $parameterArray['nachreichbar'] = $nachreichbar; } return $this->loadWhere($parameterArray);