From 63db2326ed2157a3e8983a0977cf4e877e94c7d3 Mon Sep 17 00:00:00 2001 From: paolo Date: Thu, 12 May 2016 10:05:29 +0200 Subject: [PATCH] - Added new permission to access to tbl_studiengang table using basis/studiengang - Added method getStudiengang to class Studiengang2 to get a studiengang from pk - Added method addDistinct to class DB_Model to add the distinct clause to a query --- application/config/fhcomplete.php | 2 ++ .../api/v1/organisation/Studiengang2.php | 16 ++++++++++++++++ application/core/DB_Model.php | 10 ++++++++++ 3 files changed, 28 insertions(+) diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php index 9e56b1a88..b0af59794 100644 --- a/application/config/fhcomplete.php +++ b/application/config/fhcomplete.php @@ -24,6 +24,8 @@ $config['fhc_acl'] = array 'public.tbl_prestudent' => 'basis/person', 'public.tbl_prestudentstatus' => 'basis/person', 'public.tbl_organisationseinheit' => 'basis/organisationseinheit', + 'public.tbl_studiengang' => 'basis/studiengang', + 'public.tbl_sprache' => 'admin', 'public.tbl_msg_thread' => 'admin', 'public.tbl_msg_message' => 'admin' diff --git a/application/controllers/api/v1/organisation/Studiengang2.php b/application/controllers/api/v1/organisation/Studiengang2.php index 237a85f11..0a05e020a 100644 --- a/application/controllers/api/v1/organisation/Studiengang2.php +++ b/application/controllers/api/v1/organisation/Studiengang2.php @@ -27,6 +27,22 @@ class Studiengang2 extends APIv1_Controller $this->StudiengangModel->setUID($this->_getUID()); } + public function getStudiengang() + { + $studiengang_kz = $this->get('studiengang_kz'); + + if(isset($studiengang_kz)) + { + $result = $this->StudiengangModel->load($studiengang_kz); + + $this->response($result, REST_Controller::HTTP_OK); + } + else + { + $this->response(); + } + } + public function getAllForBewerbung() { $this->response($this->StudiengangModel->getAllForBewerbung(), REST_Controller::HTTP_OK); diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index 777c9b26c..5cf38c121 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -224,6 +224,16 @@ class DB_Model extends FHC_Model return $this->_success(TRUE); } + /** --------------------------------------------------------------- + * Add distinct clause + * + * @return void + */ + public function addDistinct() + { + $this->db->distinct(); + } + /** --------------------------------------------------------------- * Add limit clause *