mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 17:02:19 +00:00
- Cleaned the controllers by moving the database related code and more complex logic
in the models or libraries - DmsLib bug fix - Person_model bug fix
This commit is contained in:
@@ -15,8 +15,6 @@ if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Studiengang2 extends APIv1_Controller
|
||||
{
|
||||
private static $PROPERTIES_SEPARATOR = "properties_separator";
|
||||
|
||||
/**
|
||||
* Course API constructor.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Studienplan extends APIv1_Controller
|
||||
{
|
||||
@@ -23,14 +23,12 @@ class Studienplan extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('organisation/studienplan_model', 'StudienplanModel');
|
||||
|
||||
|
||||
$this->load->model("organisation/studienplan_model", "StudienplanModel");
|
||||
}
|
||||
|
||||
public function getStudienplan()
|
||||
{
|
||||
$studienplan_id = $this->get('studienplan_id');
|
||||
$studienplan_id = $this->get("studienplan_id");
|
||||
|
||||
if (isset($studienplan_id))
|
||||
{
|
||||
@@ -46,15 +44,11 @@ class Studienplan extends APIv1_Controller
|
||||
|
||||
public function getStudienplaene()
|
||||
{
|
||||
$studiengang_kz = $this->get('studiengang_kz');
|
||||
$studiengang_kz = $this->get("studiengang_kz");
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$result = $this->StudienplanModel->addJoin('lehre.tbl_studienordnung', 'studienordnung_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->StudienplanModel->loadWhere(array('studiengang_kz' => $this->get('studiengang_kz')));
|
||||
}
|
||||
$result = $this->StudienplanModel->getStudienplaene($studiengang_kz);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -66,37 +60,19 @@ class Studienplan extends APIv1_Controller
|
||||
|
||||
public function getStudienplaeneFromSem()
|
||||
{
|
||||
$studiengang_kz = $this->get('studiengang_kz');
|
||||
$studiensemester_kurzbz = $this->get('studiensemester_kurzbz');
|
||||
$ausbildungssemester = $this->get('ausbildungssemester');
|
||||
$orgform_kurzbz = $this->get('orgform_kurzbz');
|
||||
$studiengang_kz = $this->get("studiengang_kz");
|
||||
$studiensemester_kurzbz = $this->get("studiensemester_kurzbz");
|
||||
$ausbildungssemester = $this->get("ausbildungssemester");
|
||||
$orgform_kurzbz = $this->get("orgform_kurzbz");
|
||||
|
||||
if (isset($studiengang_kz) && isset($studiensemester_kurzbz))
|
||||
{
|
||||
$result = $this->StudienplanModel->addJoin('lehre.tbl_studienordnung', 'studienordnung_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->StudienplanModel->addJoin('lehre.tbl_studienplan_semester', 'studienplan_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$whereArray = array('tbl_studienplan.aktiv' => 'TRUE',
|
||||
'tbl_studienordnung.studiengang_kz' => $studiengang_kz,
|
||||
'tbl_studienplan_semester.studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
);
|
||||
|
||||
if(isset($ausbildungssemester))
|
||||
{
|
||||
$whereArray['tbl_studienplan_semester.semester'] = $ausbildungssemester;
|
||||
}
|
||||
|
||||
if(isset($orgform_kurzbz))
|
||||
{
|
||||
$whereArray['orgform_kurzbz'] = $orgform_kurzbz;
|
||||
}
|
||||
|
||||
$result = $this->StudienplanModel->loadWhere($whereArray);
|
||||
}
|
||||
}
|
||||
$result = $this->StudienplanModel->getStudienplaeneBySemester(
|
||||
$studiengang_kz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester,
|
||||
$orgform_kurzbz
|
||||
);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Kontakt extends APIv1_Controller
|
||||
{
|
||||
@@ -24,9 +24,7 @@ class Kontakt extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('person/kontakt_model', 'KontaktModel');
|
||||
|
||||
|
||||
$this->load->model("person/kontakt_model", "KontaktModel");
|
||||
}
|
||||
|
||||
public function getKontakt()
|
||||
@@ -35,15 +33,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('kontakt_id' => $kontakt_id));
|
||||
}
|
||||
}
|
||||
$result = $this->KontaktModel->getWholeKontakt($kontakt_id);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -59,7 +49,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('kontakt_id' => $kontakt_id));
|
||||
$result = $this->KontaktModel->load($kontakt_id);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -75,15 +65,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('person_id' => $person_id));
|
||||
}
|
||||
}
|
||||
$result = $this->KontaktModel->getWholeKontakt(null, $person_id);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -99,7 +81,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('person_id' => $person_id));
|
||||
$result = $this->KontaktModel->loadWhere(array("person_id" => $person_id));
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -116,15 +98,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($person_id) && isset($kontakttyp))
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('person_id' => $person_id, 'kontakttyp' => $kontakttyp));
|
||||
}
|
||||
}
|
||||
$result = $this->KontaktModel->getWholeKontakt(null, $person_id, $kontakttyp);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -140,9 +114,9 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (is_array($post))
|
||||
{
|
||||
if (isset($post['kontakt_id']))
|
||||
if (isset($post["kontakt_id"]))
|
||||
{
|
||||
$result = $this->KontaktModel->update($post['kontakt_id'], $post);
|
||||
$result = $this->KontaktModel->update($post["kontakt_id"], $post);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -31,27 +31,30 @@ class Person extends APIv1_Controller
|
||||
*/
|
||||
public function getPerson()
|
||||
{
|
||||
$personID = $this->get("person_id");
|
||||
$person_id = $this->get("person_id");
|
||||
$code = $this->get("code");
|
||||
$email = $this->get("email");
|
||||
|
||||
if (isset($code) || isset($email) || isset($personID))
|
||||
if (isset($code) || isset($email) || isset($person_id))
|
||||
{
|
||||
if (isset($code) && isset($email))
|
||||
{
|
||||
$result = $this->PersonModel->addJoin("public.tbl_kontakt", "person_id");
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->PersonModel->loadWhere(array("zugangscode" => $code, "kontakt" => $email));
|
||||
}
|
||||
}
|
||||
elseif (isset($code))
|
||||
{
|
||||
$result = $this->PersonModel->loadWhere(array("zugangscode" => $code));
|
||||
$result = $this->PersonModel->getPersonKontaktByZugangscode($code, $email);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->PersonModel->load($personID);
|
||||
$parametersArray = array();
|
||||
|
||||
if (isset($code))
|
||||
{
|
||||
$parametersArray["zugangscode"] = $code;
|
||||
}
|
||||
else
|
||||
{
|
||||
$parametersArray["person_id"] = $person_id;
|
||||
}
|
||||
|
||||
$result = $this->PersonModel->loadWhere($parametersArray);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
@@ -61,6 +64,26 @@ class Person extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getCheckBewerbung()
|
||||
{
|
||||
$email = $this->get("email");
|
||||
$studiensemester_kurzbz = $this->get("studiensemester_kurzbz");
|
||||
|
||||
if (isset($email))
|
||||
{
|
||||
$result = $this->PersonModel->checkBewerbung($email, $studiensemester_kurzbz);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
@@ -74,28 +97,7 @@ class Person extends APIv1_Controller
|
||||
{
|
||||
if(isset($person["person_id"]) && !(is_null($person["person_id"])) && ($person["person_id"] != ""))
|
||||
{
|
||||
if (isset($person["svnr"]) && $person["svnr"] != "")
|
||||
{
|
||||
$this->PersonModel->addOrder("svnr", "DESC");
|
||||
$result = $this->PersonModel->loadWhere(array(
|
||||
"person_id != " => $person["person_id"],
|
||||
"SUBSTRING(svnr FROM 1 FOR 10) = " => $person["svnr"])
|
||||
);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS &&
|
||||
is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
if (count($result->retval) == 1)
|
||||
{
|
||||
$person["svnr"] = $person["svnr"] . "v1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$person["svnr"] = $person["svnr"] . "v" . ($result->retval[0]->svnr{11} + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->PersonModel->update($person["person_id"], $person);
|
||||
$result = $this->PersonModel->updatePerson($person);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,26 +112,6 @@ class Person extends APIv1_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getCheckBewerbung()
|
||||
{
|
||||
$email = $this->get("email");
|
||||
$studiensemester_kurzbz = $this->get("studiensemester_kurzbz");
|
||||
|
||||
if (isset($email))
|
||||
{
|
||||
$result = $this->PersonModel->checkBewerbung($email, $studiensemester_kurzbz);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
private function _validate($person = NULL)
|
||||
{
|
||||
if (!isset($person))
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Ort extends APIv1_Controller
|
||||
{
|
||||
@@ -23,9 +23,7 @@ class Ort extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model OrtModel
|
||||
$this->load->model('ressource/ort_model', 'OrtModel');
|
||||
|
||||
|
||||
$this->load->model("ressource/ort_model", "OrtModel");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +31,7 @@ class Ort extends APIv1_Controller
|
||||
*/
|
||||
public function getOrt()
|
||||
{
|
||||
$ort_kurzbz = $this->get('ort_kurzbz');
|
||||
$ort_kurzbz = $this->get("ort_kurzbz");
|
||||
|
||||
if (isset($ort_kurzbz))
|
||||
{
|
||||
@@ -52,17 +50,11 @@ class Ort extends APIv1_Controller
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$raumtyp_kurzbz = $this->get('raumtyp_kurzbz');
|
||||
$raumtyp_kurzbz = $this->get("raumtyp_kurzbz");
|
||||
|
||||
$this->OrtModel->addOrder('ort_kurzbz');
|
||||
|
||||
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != '')
|
||||
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != "")
|
||||
{
|
||||
$result = $this->OrtModel->addJoin('public.tbl_ortraumtyp', 'ort_kurzbz');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->OrtModel->loadWhere(array('raumtyp_kurzbz' => $raumtyp_kurzbz));
|
||||
}
|
||||
$result = $this->OrtModel->getAll($raumtyp_kurzbz);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -79,9 +71,9 @@ class Ort extends APIv1_Controller
|
||||
{
|
||||
if ($this->_validate($this->post()))
|
||||
{
|
||||
if (isset($this->post()['ort_kurzbz']))
|
||||
if (isset($this->post()["ort_kurzbz"]))
|
||||
{
|
||||
$result = $this->OrtModel->update($this->post()['ort_kurzbz'], $this->post());
|
||||
$result = $this->OrtModel->update($this->post()["ort_kurzbz"], $this->post());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user