mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- Added permissions for table public.tbl_rt_person
- Added method postAddReihungstest to controller Prestudent - Added method getReihungstestByPersonID to controller Reihungstest - Fixed tables structure in the migration script 011_reihungstest.php - Added model RtPerson_model
This commit is contained in:
@@ -191,6 +191,7 @@ $config['fhc_acl'] = array
|
||||
'public.tbl_variable' => 'basis/variable',
|
||||
'public.tbl_vorlage' => 'system/vorlage',
|
||||
'public.tbl_vorlagestudiengang' => 'system/vorlagestudiengang',
|
||||
'public.tbl_rt_person' => 'basis/person',
|
||||
'public.vw_studiensemester' => 'basis/vw_studiensemester',
|
||||
'system.tbl_app' => 'system/app',
|
||||
'system.tbl_appdaten' => 'system/appdaten',
|
||||
|
||||
@@ -24,8 +24,6 @@ class Prestudent extends APIv1_Controller
|
||||
parent::__construct();
|
||||
// Load model PrestudentModel
|
||||
$this->load->model('crm/prestudent_model', 'PrestudentModel');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,8 +109,52 @@ class Prestudent extends APIv1_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function postAddReihungstest()
|
||||
{
|
||||
$ddReihungstest = $this->_parseData($this->post());
|
||||
|
||||
if ($this->_validateAddReihungstest($ddReihungstest))
|
||||
{
|
||||
$this->load->model('crm/RtPerson_model', 'RtPersonModel');
|
||||
|
||||
if(isset($ddReihungstest['new']) && $ddReihungstest['new'] === true)
|
||||
{
|
||||
// Remove new parameter to avoid DB insert errors
|
||||
unset($ddReihungstest['new']);
|
||||
|
||||
$result = $this->RtPersonModel->insert($ddReihungstest);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pksArray = array($ddReihungstest['person_id'], $ddReihungstest['rt_id']);
|
||||
|
||||
$result = $this->RtPersonModel->update($pksArray, $ddReihungstest);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
private function _validate($prestudent = NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function _validateAddReihungstest($ddReihungstest = NULL)
|
||||
{
|
||||
if (!isset($ddReihungstest['person_id']) || !isset($ddReihungstest['rt_id']) ||
|
||||
!isset($ddReihungstest['ort_kurzbz']))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,6 @@ class Reihungstest extends APIv1_Controller
|
||||
parent::__construct();
|
||||
// Load model ReihungstestModel
|
||||
$this->load->model('crm/reihungstest_model', 'ReihungstestModel');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +69,37 @@ class Reihungstest extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getReihungstestByPersonID()
|
||||
{
|
||||
$person_id = $this->get('person_id');
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->ReihungstestModel->addJoin('public.tbl_rt_person', 'reihungstest_id = rt_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->ReihungstestModel->addJoin('public.tbl_person', 'person_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->ReihungstestModel->addJoin('public.tbl_ort', 'tbl_ort.ort_kurzbz = tbl_rt_person.ort_kurzbz');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->ReihungstestModel->loadWhere(array('person_id' => $person_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
|
||||
@@ -42,7 +42,7 @@ class Migration_Reihungstest extends CI_Migration {
|
||||
$query= "CREATE TABLE public.tbl_rt_studienplan (
|
||||
reihungstest_id integer,
|
||||
stundenplan_id integer,
|
||||
PRIMARY KEY (reihungstest_id, stundenplan_id),
|
||||
CONSTRAINT pk_tbl_rt_studienplan PRIMARY KEY (reihungstest_id, stundenplan_id),
|
||||
CONSTRAINT fk_rt_studienplan_reihungstest_id FOREIGN KEY (reihungstest_id) REFERENCES public.tbl_reihungstest(reihungstest_id) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
CONSTRAINT fk_rt_studienplan_stundenplan_id FOREIGN KEY (stundenplan_id) REFERENCES lehre.tbl_stundenplan(stundenplan_id) ON UPDATE CASCADE ON DELETE RESTRICT
|
||||
);
|
||||
@@ -62,9 +62,9 @@ class Migration_Reihungstest extends CI_Migration {
|
||||
$query= "CREATE TABLE public.tbl_rt_person (
|
||||
person_id integer,
|
||||
rt_id integer,
|
||||
anmeldedatum date DEFAULT NOW(),
|
||||
anmeldedatum date,
|
||||
teilgenommen boolean DEFAULT FALSE,
|
||||
ort_kurzbz varchar(16),
|
||||
ort_kurzbz varchar(16) NOT NULL,
|
||||
CONSTRAINT pk_tbl_rt_person PRIMARY KEY (person_id, rt_id),
|
||||
CONSTRAINT fk_rt_person_ort_kurzbz FOREIGN KEY (ort_kurzbz) REFERENCES public.tbl_ort(ort_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
CONSTRAINT fk_rt_person_reihungstest_id FOREIGN KEY (rt_id) REFERENCES public.tbl_reihungstest(reihungstest_id) ON UPDATE CASCADE ON DELETE RESTRICT
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class RtPerson_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_rt_person';
|
||||
$this->pk = array('person_id', 'rt_id');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user