- Moved class APIv1_Controller from FHC_Controller.php to APIv1_Controller.php

- Moved class DB_Model from FHC_Model.php to DB_Model.php
- load method of class person (person.class.php) now is calling getPerson
  method of the class Person_model
- getAllForBewerbung method of class studiengang (studiengang.class.php) now is calling getAllForBewerbung
  method of the class Studiengang_model
- getStudienplaene method of class studienplan (studienplan.class.php) now is calling getStudienplaene
  method of the class Studienplan_model
This commit is contained in:
paolo
2016-04-25 18:25:03 +02:00
parent a3a9c42e99
commit 4cc83999ed
10 changed files with 177 additions and 174 deletions
+13 -15
View File
@@ -2,20 +2,6 @@
class Studiengang_model extends DB_Model
{
//
protected $_allForBewerbungQuery = "SELECT DISTINCT studiengang_kz,
typ,
organisationseinheittyp_kurzbz,
studiengangbezeichnung,
standort,
studiengangbezeichnung_englisch,
lgartcode,
tbl_lgartcode.bezeichnung
FROM lehre.vw_studienplan LEFT JOIN bis.tbl_lgartcode USING (lgartcode)
WHERE onlinebewerbung IS TRUE
AND aktiv IS TRUE
ORDER BY typ, studiengangbezeichnung, tbl_lgartcode.bezeichnung ASC";
/**
*
*/
@@ -30,12 +16,24 @@ class Studiengang_model extends DB_Model
public function getAllForBewerbung()
{
$result = NULL;
$allForBewerbungQuery = "SELECT DISTINCT studiengang_kz,
typ,
organisationseinheittyp_kurzbz,
studiengangbezeichnung,
standort,
studiengangbezeichnung_englisch,
lgartcode,
tbl_lgartcode.bezeichnung
FROM lehre.vw_studienplan LEFT JOIN bis.tbl_lgartcode USING (lgartcode)
WHERE onlinebewerbung IS TRUE
AND aktiv IS TRUE
ORDER BY typ, studiengangbezeichnung, tbl_lgartcode.bezeichnung ASC";
// Checks if the operation is permitted by the API caller
// All the code should be put inside this if statement
if(isAllowed($this->getAddonID(), 'course'))
{
$result = $this->db->query($this->_allForBewerbungQuery);
$result = $this->db->query($allForBewerbungQuery);
}
return $result;
+39 -41
View File
@@ -2,41 +2,6 @@
class Person_model extends DB_Model
{
//
protected $_loadQuery = "SELECT person_id,
sprache,
anrede,
titelpost,
titelpre,
nachname,
vorname,
vornamen,
gebdatum,
gebort,
gebzeit,
foto,
anmerkung,
homepage,
svnr,
ersatzkennzeichen,
familienstand,
anzahlkinder,
aktiv,
insertamum,
insertvon,
updateamum,
updatevon,
ext_id,
geschlecht,
staatsbuergerschaft,
geburtsnation,
kurzbeschreibung,
zugangscode,
foto_sperre,
matr_nr
FROM public.tbl_person
WHERE person_id = ?";
/**
*
*/
@@ -48,7 +13,7 @@ class Person_model extends DB_Model
/**
*
*/
public function getPerson($personID = NULL, $code = NULL, $email = NULL)
public function getPerson($personId = NULL, $code = NULL, $email = NULL)
{
$result = NULL;
@@ -66,7 +31,7 @@ class Person_model extends DB_Model
}
else
{
$result = $this->_getPersonByID($personID);
$result = $this->_getPersonByID($personId);
}
}
@@ -74,16 +39,49 @@ class Person_model extends DB_Model
}
/**
* @param int $personID Person ID
* @param int $personId Person ID
* @return object
*/
private function _getPersonByID($personID = NULL)
private function _getPersonByID($personId = NULL)
{
$result = NULL;
$loadQuery = "SELECT person_id,
sprache,
anrede,
titelpost,
titelpre,
nachname,
vorname,
vornamen,
gebdatum,
gebort,
gebzeit,
foto,
anmerkung,
homepage,
svnr,
ersatzkennzeichen,
familienstand,
anzahlkinder,
aktiv,
insertamum,
insertvon,
updateamum,
updatevon,
ext_id,
geschlecht,
staatsbuergerschaft,
geburtsnation,
kurzbeschreibung,
zugangscode,
foto_sperre,
matr_nr
FROM public.tbl_person
WHERE person_id = ?";
if(isset($personID))
if(isset($personId))
{
$result = $this->db->query($this->_loadQuery, array($personID));
$result = $this->db->query($loadQuery, array($personId));
}
return $result;