diff --git a/application/controllers/api/frontend/v1/stv/Address.php b/application/controllers/api/frontend/v1/stv/Address.php
new file mode 100644
index 000000000..7685fcd04
--- /dev/null
+++ b/application/controllers/api/frontend/v1/stv/Address.php
@@ -0,0 +1,66 @@
+.
+ */
+
+if (! defined('BASEPATH')) exit('No direct script access allowed');
+
+/**
+ * This controller operates between (interface) the JS (GUI) and the back-end
+ * Provides data to the ajax get calls about addresses
+ * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
+ */
+class Address extends FHCAPI_Controller
+{
+ public function __construct()
+ {
+ parent::__construct([
+ 'getNations' => self::PERM_LOGGED,
+ 'getPlaces' => self::PERM_LOGGED
+ ]);
+ }
+
+ public function getNations()
+ {
+ $this->load->model('codex/Nation_model', 'NationModel');
+
+ $this->NationModel->addOrder('kurztext');
+
+ $result = $this->NationModel->load();
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+
+ public function getPlaces($plz)
+ {
+ $this->load->model('codex/Gemeinde_model', 'GemeindeModel');
+
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_data(['address.plz' => $plz]);
+
+ $this->form_validation->set_rules('address.plz', 'PLZ', 'numeric|less_than[10000]');
+
+ if (!$this->form_validation->run())
+ $this->terminateWithValidationErrors($this->form_validation->error_array());
+
+ $result = $this->GemeindeModel->getGemeindeByPlz($plz);
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+}
diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php
index 9aaf49651..d97c1a86b 100644
--- a/application/controllers/api/frontend/v1/stv/Config.php
+++ b/application/controllers/api/frontend/v1/stv/Config.php
@@ -31,7 +31,7 @@ class Config extends FHCAPI_Controller
public function __construct()
{
- // TODO(chris): access!
+ // TODO(chris): permissions
parent::__construct([
'student' => self::PERM_LOGGED,
'students' => self::PERM_LOGGED
diff --git a/application/controllers/api/frontend/v1/stv/Filter.php b/application/controllers/api/frontend/v1/stv/Filter.php
index d5ee44d13..dbf70e4fb 100644
--- a/application/controllers/api/frontend/v1/stv/Filter.php
+++ b/application/controllers/api/frontend/v1/stv/Filter.php
@@ -31,10 +31,9 @@ class Filter extends FHCAPI_Controller
*/
public function __construct()
{
- // TODO(chris): permissions
parent::__construct([
- 'getStg' => 'student/stammdaten:r',#self::PERM_LOGGED,
- 'setStg' => 'student/stammdaten:r'#self::PERM_LOGGED
+ 'getStg' => self::PERM_LOGGED,
+ 'setStg' => self::PERM_LOGGED
]);
// Load models
@@ -53,10 +52,7 @@ class Filter extends FHCAPI_Controller
{
$result = $this->VariableModel->getVariables(getAuthUID(), ['kontofilterstg']);
- #$data = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $data = $result->retval;
+ $data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data['kontofilterstg'] == 'true');
}
@@ -81,9 +77,7 @@ class Filter extends FHCAPI_Controller
$result = $this->VariableModel->setVariable(getAuthUID(), 'kontofilterstg', $studiengang_kz ? 'true' : 'false');
- #$this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess(true);
}
diff --git a/application/controllers/api/frontend/v1/stv/Konto.php b/application/controllers/api/frontend/v1/stv/Konto.php
index 4606f5abc..a4344889c 100644
--- a/application/controllers/api/frontend/v1/stv/Konto.php
+++ b/application/controllers/api/frontend/v1/stv/Konto.php
@@ -33,10 +33,9 @@ class Konto extends FHCAPI_Controller
*/
public function __construct()
{
- // TODO(chris): permissions
parent::__construct([
'get' => 'student/stammdaten:r',
- 'getBuchungstypen' => 'student/stammdaten:r', // alle?
+ 'getBuchungstypen' => self::PERM_LOGGED,
'checkDoubles' => ['admin:r', 'assistenz:r'],
'insert' => ['admin:w', 'assistenz:w'],
'counter' => ['admin:w', 'assistenz:w'],
@@ -82,10 +81,7 @@ class Konto extends FHCAPI_Controller
$result = $this->KontoModel->getAlleBuchungen($person_id, $studiengang_kz);
}
- #$result = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $result = $result->retval;
+ $result = $this->getDataOrTerminateWithError($result);
// sort into tree
$childs = [];
@@ -122,10 +118,7 @@ class Konto extends FHCAPI_Controller
$result = $this->BuchungstypModel->load();
- #$data = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $data = $result->retval;
+ $data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
@@ -163,10 +156,7 @@ class Konto extends FHCAPI_Controller
$result = $this->KontoModel->checkDoubleBuchung($person_ids, $this->input->post('studiensemester_kurzbz'), $buchungstypen[$buchung]);
- #$result = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $result = $result->retval;
+ $result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithSuccess(false);
@@ -441,9 +431,7 @@ class Konto extends FHCAPI_Controller
$result = $this->KontoModel->update($id, $data);
- #$this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $this->getDataOrTerminateWithError($result);
$result = null;
// TODO(chris): get as tree?
@@ -475,15 +463,13 @@ class Konto extends FHCAPI_Controller
$buchungsnr = $this->input->post('buchungsnr');
$result = $this->KontoModel->load($buchungsnr);
- #$result = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $result = $result->retval;
+
+ $result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('konto', 'error_missing', [
'buchungsnr' => $buchungsnr
- ]), self::ERROR_TYPE_GENERAL);
+ ]));
$_POST['studiengang_kz'] = current($result)->studiengang_kz;
@@ -500,8 +486,8 @@ class Konto extends FHCAPI_Controller
$result = $this->KontoModel->delete($buchungsnr);
if (isError($result)) {
if (getCode($result) != 42)
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $this->terminateWithError($this->p->t('konto', 'error_delete_level'), self::ERROR_TYPE_GENERAL);
+ $this->terminateWithError(getError($result));
+ $this->terminateWithError($this->p->t('konto', 'error_delete_level'));
}
$this->terminateWithSuccess();
diff --git a/application/controllers/api/frontend/v1/stv/Lists.php b/application/controllers/api/frontend/v1/stv/Lists.php
index 2a8335b7e..eceaf8c8c 100644
--- a/application/controllers/api/frontend/v1/stv/Lists.php
+++ b/application/controllers/api/frontend/v1/stv/Lists.php
@@ -27,10 +27,13 @@ class Lists extends FHCAPI_Controller
{
public function __construct()
{
- // TODO(chris): permissions
parent::__construct([
- 'getStudiensemester' => ['admin:r', 'assistenz:r', 'student/stammdaten:r'], // alle?
- 'getStgs' => ['admin:r', 'assistenz:r', 'student/stammdaten:r'] // alle?
+ 'getStudiensemester' => self::PERM_LOGGED,
+ 'getStgs' => self::PERM_LOGGED,
+ 'getSprachen' => self::PERM_LOGGED,
+ 'getGeschlechter' => self::PERM_LOGGED,
+ 'getAusbildungen' => self::PERM_LOGGED,
+ 'getOrgforms' => self::PERM_LOGGED
]);
}
@@ -42,10 +45,7 @@ class Lists extends FHCAPI_Controller
$result = $this->StudiensemesterModel->load();
- #$data = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $data = $result->retval;
+ $data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
@@ -62,11 +62,60 @@ class Lists extends FHCAPI_Controller
$result = $this->StudiengangModel->load();
- #$data = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $data = $result->retval;
+ $data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
+
+ public function getSprachen()
+ {
+ $this->load->model('system/Sprache_model', 'SpracheModel');
+
+ $this->SpracheModel->addOrder('sprache');
+
+ $result = $this->SpracheModel->load();
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+
+ public function getGeschlechter()
+ {
+ $this->load->model('person/Geschlecht_model', 'GeschlechtModel');
+
+ $this->GeschlechtModel->addOrder('sort');
+ $this->GeschlechtModel->addOrder('geschlecht');
+
+ $this->GeschlechtModel->addSelect('*');
+ $this->GeschlechtModel->addSelect("bezeichnung_mehrsprachig[(SELECT index FROM public.tbl_sprache WHERE sprache=" . $this->GeschlechtModel->escape(DEFAULT_LANGUAGE) . " LIMIT 1)] AS bezeichnung");
+
+ $result = $this->GeschlechtModel->load();
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+
+ public function getAusbildungen()
+ {
+ $this->load->model('codex/Ausbildung_model', 'AusbildungModel');
+
+ $this->AusbildungModel->addOrder('ausbildungcode');
+
+ $result = $this->AusbildungModel->load();
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+
+ public function getOrgforms()
+ {
+ $this->load->model('codex/Orgform_model', 'OrgformModel');
+
+ $this->OrgformModel->addOrder('bezeichnung');
+
+ $result = $this->OrgformModel->loadWhere(['rolle' => true]);
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
}
diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php
index 101d34863..31fc7075c 100644
--- a/application/controllers/api/frontend/v1/stv/Student.php
+++ b/application/controllers/api/frontend/v1/stv/Student.php
@@ -100,10 +100,7 @@ class Student extends FHCAPI_Controller
$result = $this->PrestudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
- #$student = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $student = $result->retval;
+ $student = $this->getDataOrTerminateWithError($result);
if (!$student)
return show_404();
@@ -136,10 +133,7 @@ class Student extends FHCAPI_Controller
$result = $this->udflib->getCiValidations($this->PersonModel, $this->input->post());
- #$fieldValidations = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result));
- $fieldvalidations = $result->retval;
+ $fieldValidations = $this->getDataOrTerminateWithError($result);
$this->form_validation->set_rules($fieldvalidations);
@@ -148,19 +142,13 @@ class Student extends FHCAPI_Controller
$result = $this->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
- #$student = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $student = $result->retval;
+ $student = $this->getDataOrTerminateWithError($result);
$uid = $student ? current($student)->student_uid : null;
$result = $this->PrestudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
- #$person = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result));
- $person = $result->retval;
+ $person = $this->getDataOrTerminateWithError($result);
$person_id = $person ? current($person)->person_id : null;
@@ -201,10 +189,7 @@ class Student extends FHCAPI_Controller
// add UDFs
$result = $this->udflib->getDefinitionForModel($this->PersonModel);
- #$definitions = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $definitions = $result->retval;
+ $definitions = $this->getDataOrTerminateWithError($result);
foreach ($definitions as $def)
$array_allowed_props_person[] = $def['name'];
@@ -242,9 +227,7 @@ class Student extends FHCAPI_Controller
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'student_uid' => $uid
], $update_lehrverband);
- #$this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $this->getDataOrTerminateWithError($result);
}
if (count($update_person)) {
@@ -252,9 +235,7 @@ class Student extends FHCAPI_Controller
$person_id,
$update_person
);
- #$this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $this->getDataOrTerminateWithError($result);
}
@@ -263,9 +244,7 @@ class Student extends FHCAPI_Controller
[$uid],
$update_student
);
- #$this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ $this->getDataOrTerminateWithError($result);
}
$this->terminateWithSuccess(array_fill_keys(array_merge(
@@ -308,10 +287,7 @@ class Student extends FHCAPI_Controller
$result = $this->PersonModel->load();
- #$data = $this->getDataOrTerminateWithError($result);
- if (isError($result))
- $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
- $data = $result->retval;
+ $data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
@@ -413,9 +389,7 @@ class Student extends FHCAPI_Controller
$data['staatsbuergerschaft'] = $this->input->post('staatsbuergerschaft');
$result = $this->PersonModel->insert($data);
- if (isError($result))
- return $result;
- $person_id = getData($result);
+ $person_id = $this->getDataOrTerminateWithError($result);
}
// Addresse anlegen
@@ -438,17 +412,15 @@ class Student extends FHCAPI_Controller
$result = $this->AdresseModel->loadWhere([
'person_id' => $person_id
]);
- if (isError($result))
- return $result;
- if (hasData($result)) {
- $address = current(getData($result));
+ $address = $this->getDataOrTerminateWithError($result);
+ if ($address) {
+ $address = current($address);
$data['updateamum'] = date('c');
$data['updatevon'] = getAuthUID();
$result = $this->AdresseModel->update($address->adresse_id, $data);
- if (isError($result))
- return $result;
+ $this->getDataOrTerminateWithError($result);
} else {
//Wenn keine Adrese vorhanden ist dann eine neue Anlegen
$anlegen = 1;
@@ -463,8 +435,7 @@ class Student extends FHCAPI_Controller
$data['heimatadresse'] = !$this->input->post('person_id');
$result = $this->AdresseModel->insert($data);
- if (isError($result))
- return $result;
+ $this->getDataOrTerminateWithError($result);
}
}
@@ -488,8 +459,7 @@ class Student extends FHCAPI_Controller
'insertvon' => getAuthUID()
];
$result = $this->KontaktModel->insert($data);
- if (isError($result))
- return $result;
+ $this->getDataOrTerminateWithError($result);
}
}
@@ -517,10 +487,9 @@ class Student extends FHCAPI_Controller
$result = $this->PrestudentModel->loadWhere([
'person_id' => $person_id
]);
- if (isError($result))
- return $result;
- if (hasData($result)) {
- $prestudent = current(getData($result));
+ $prestudent = $this->getDataOrTerminateWithError($result);
+ if ($prestudent) {
+ $prestudent = current($prestudent);
if ($prestudent->zgv_code) {
$data['zgv_code'] = $prestudent->zgv_code;
$data['zgvort'] = $prestudent->zgvort;
@@ -533,9 +502,7 @@ class Student extends FHCAPI_Controller
}
// Prestudent speichern
$result = $this->PrestudentModel->insert($data);
- if (isError($result))
- return $result;
- $prestudent_id = getData($result);
+ $prestudent_id = $this->getDataOrTerminateWithError($result);
// Prestudent Rolle Anlegen
$data = [
@@ -550,8 +517,7 @@ class Student extends FHCAPI_Controller
'insertvon' => getAuthUID()
];
$result = $this->PrestudentstatusModel->insert($data);
- if (isError($result))
- return $result;
+ $this->getDataOrTerminateWithError($result);
if ($incoming) {
// TODO(chris): IMPLEMENT!
@@ -569,7 +535,7 @@ class Student extends FHCAPI_Controller
return $result;
}*/
- return success(true);
+ $this->terminateWithSuccess(true);
}
public function requiredIfNotPersonId($value)
diff --git a/application/controllers/components/stv/Verband.php b/application/controllers/api/frontend/v1/stv/Verband.php
similarity index 86%
rename from application/controllers/components/stv/Verband.php
rename to application/controllers/api/frontend/v1/stv/Verband.php
index 18ce5c999..5a7960fd5 100644
--- a/application/controllers/components/stv/Verband.php
+++ b/application/controllers/api/frontend/v1/stv/Verband.php
@@ -1,17 +1,41 @@
.
+ */
if (! defined('BASEPATH')) exit('No direct script access allowed');
-class Verband extends FHC_Controller
+/**
+ * This controller operates between (interface) the JS (GUI) and the back-end
+ * Provides data to the ajax get calls about verbände
+ * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
+ */
+class Verband extends FHCAPI_Controller
{
public function __construct()
{
- // TODO(chris): access!
- parent::__construct();
-
+ // TODO(chris): permissions
+ $permissions = [];
+ $router = load_class('Router');
+ $permissions[$router->method] = self::PERM_LOGGED;
+ parent::__construct($permissions);
+
+ // Load Models
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
}
-
/**
* Remap calls:
* /
@@ -75,12 +99,9 @@ class Verband extends FHC_Controller
$this->StudiengangModel->addOrder('kurzbz');
$result = $this->StudiengangModel->loadWhere(['v.aktiv' => true]);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- return $this->outputJson(getError($result));
- }
- $list = getData($result) ?: [];
+ $list = $this->getDataOrTerminateWithError($result);
+
$list[] = [
'name' => 'International',
'link' => 'inout',
@@ -102,7 +123,7 @@ class Verband extends FHC_Controller
]
]
];
- $this->outputJson($list);
+ $this->terminateWithSuccess($list);
}
/**
@@ -139,12 +160,8 @@ class Verband extends FHC_Controller
'v.studiengang_kz' => $studiengang_kz,
'v.aktiv' => true
]);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- return $this->outputJson(getError($result));
- }
+ $list = $this->getDataOrTerminateWithError($result);
- $list = getData($result) ?: [];
array_unshift($list, [
'name' => 'PreStudent',
'link' => $link . 'prestudent',
@@ -154,12 +171,9 @@ class Verband extends FHC_Controller
if ($org_form === null) {
// NOTE(chris): if mischform show orgforms
$result = $this->StudiengangModel->load($studiengang_kz);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- return $this->outputJson(getError($result));
- }
- if (hasData($result)) {
- if (current(getData($result))->mischform) {
+ $result = $this->getDataOrTerminateWithError($result);
+ if ($result) {
+ if (current($result)->mischform) {
$this->load->model('organisation/Studienordnung_model', 'StudienordnungModel');
$this->StudienordnungModel->addDistinct();
@@ -175,18 +189,14 @@ class Verband extends FHC_Controller
'studiengang_kz' => $studiengang_kz,
'p.orgform_kurzbz !=' => 'DDP'
]);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- return $this->outputJson(getError($result));
- }
+ $result = $this->getDataOrTerminateWithError($result);
- if (hasData($result))
- $list = array_merge($list, getData($result));
+ $list = array_merge($list, $result);
}
}
}
- $this->outputJson($list);
+ $this->terminateWithSuccess($list);
}
/**
@@ -231,13 +241,8 @@ class Verband extends FHC_Controller
$where['orgform_kurzbz'] = $org_form;
$result = $this->GruppeModel->loadWhere($where);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- return $this->outputJson(getError($result));
- }
-
- $list = getData($result) ?: [];
+ $list = $this->getDataOrTerminateWithError($result);
$this->StudiengangModel->addJoin('public.tbl_lehrverband v', 'studiengang_kz');
@@ -263,14 +268,11 @@ class Verband extends FHC_Controller
$where['v.orgform_kurzbz'] = $org_form;
$result = $this->StudiengangModel->loadWhere($where);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- return $this->outputJson(getError($result));
- }
+ $result = $this->getDataOrTerminateWithError($result);
- $list = array_merge($list, getData($result) ?: []);
+ $list = array_merge($list, $result);
- $this->outputJson($list);
+ $this->terminateWithSuccess($list);
}
/**
@@ -313,14 +315,10 @@ class Verband extends FHC_Controller
$where['v.orgform_kurzbz'] = $org_form;
$result = $this->StudiengangModel->loadWhere($where);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- return $this->outputJson(getError($result));
- }
- $list = getData($result) ?: [];
+ $list = $this->getDataOrTerminateWithError($result);
- $this->outputJson($list);
+ $this->terminateWithSuccess($list);
}
/**
@@ -341,13 +339,8 @@ class Verband extends FHC_Controller
* - then: $stsem_obj->getPlusMinus(NULL, $number_displayed_past_studiensemester, 'ende ASC');
*/
$result = $this->StudiensemesterModel->load();
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- $this->outputJson(getError($result));
- exit;
- }
- $studiensemester = getData($result) ?: [];
+ $studiensemester = $this->getDataOrTerminateWithError($result);
$result = [];
foreach ($studiensemester as $sem) {
diff --git a/application/controllers/components/stv/Address.php b/application/controllers/components/stv/Address.php
deleted file mode 100644
index c0e34c0c3..000000000
--- a/application/controllers/components/stv/Address.php
+++ /dev/null
@@ -1,47 +0,0 @@
-load->model('codex/Nation_model', 'NationModel');
-
- $this->NationModel->addOrder('kurztext');
-
- $result = $this->NationModel->load();
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-
- public function getPlaces($plz)
- {
- $this->load->model('codex/Gemeinde_model', 'GemeindeModel');
-
- $this->load->library('form_validation');
-
- $this->form_validation->set_data(['address.plz' => $plz]);
-
- $this->form_validation->set_rules('address.plz', 'PLZ', 'numeric|less_than[10000]');
-
- if ($this->form_validation->run() == false) {
- $this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST);
- return $this->outputJsonError($this->form_validation->error_array());
- }
-
- $result = $this->GemeindeModel->getGemeindeByPlz($plz);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-}
diff --git a/application/controllers/components/stv/Lists.php b/application/controllers/components/stv/Lists.php
deleted file mode 100644
index 959de7a12..000000000
--- a/application/controllers/components/stv/Lists.php
+++ /dev/null
@@ -1,85 +0,0 @@
-load->model('system/Sprache_model', 'SpracheModel');
-
- $this->SpracheModel->addOrder('sprache');
-
- $result = $this->SpracheModel->load();
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-
- public function getGeschlechter()
- {
- $this->load->model('person/Geschlecht_model', 'GeschlechtModel');
-
- $this->GeschlechtModel->addOrder('sort');
- $this->GeschlechtModel->addOrder('geschlecht');
-
- $this->GeschlechtModel->addSelect('*');
- $this->GeschlechtModel->addSelect("bezeichnung_mehrsprachig[(SELECT index FROM public.tbl_sprache WHERE sprache=" . $this->GeschlechtModel->escape(DEFAULT_LANGUAGE) . " LIMIT 1)] AS bezeichnung");
-
- $result = $this->GeschlechtModel->load();
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-
- public function getAusbildungen()
- {
- $this->load->model('codex/Ausbildung_model', 'AusbildungModel');
-
- $this->AusbildungModel->addOrder('ausbildungcode');
-
- $result = $this->AusbildungModel->load();
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-
- public function getStgs()
- {
- $this->load->model('organisation/Studiengang_model', 'StudiengangModel');
-
- $this->StudiengangModel->addSelect('*');
- $this->StudiengangModel->addSelect('UPPER(typ || kurzbz) AS kuerzel');
-
- $this->StudiengangModel->addOrder('typ');
- $this->StudiengangModel->addOrder('kurzbz');
-
- $result = $this->StudiengangModel->loadWhere(['aktiv' => true]);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-
- public function getOrgforms()
- {
- $this->load->model('codex/Orgform_model', 'OrgformModel');
-
- $this->OrgformModel->addOrder('bezeichnung');
-
- $result = $this->OrgformModel->loadWhere(['rolle' => true]);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-}
diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php
index 54354578e..8993053b3 100644
--- a/application/views/Studentenverwaltung.php
+++ b/application/views/Studentenverwaltung.php
@@ -5,7 +5,7 @@
'bootstrap5' => true,
'fontawesome6' => true,
'vue3' => true,
- #'primevue3' => true,
+ 'primevue3' => true,
#'filtercomponent' => true,
'tabulator5' => true,
'tinymce5' => true,
diff --git a/public/js/apps/Studentenverwaltung.js b/public/js/apps/Studentenverwaltung.js
index 9b24008e3..fbbee8e1d 100644
--- a/public/js/apps/Studentenverwaltung.js
+++ b/public/js/apps/Studentenverwaltung.js
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2022 fhcomplete.org
+ * Copyright (C) 2024 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,33 +20,28 @@ import fhcapifactory from "./api/fhcapifactory.js";
import Phrasen from "../plugin/Phrasen.js";
-//import PrimeVue form "../../../../index.ci.php/public/js/components/primevue/config/config.esm.min.js");
-//const PrimeVue = await import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/public/js/components/primevue/config/config.esm.min.js").default;
-import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/public/js/components/primevue/config/config.esm.min.js").then(result => result.default).then(PrimeVue => {
- Vue.$fhcapi = fhcapifactory;
- const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
+const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
- const router = VueRouter.createRouter({
- history: VueRouter.createWebHistory(),
- routes: [
- { path: `/${ciPath}/studentenverwaltung`, component: FhcStudentenverwaltung },
- { path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id`, component: FhcStudentenverwaltung },
- { path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id/:tab`, component: FhcStudentenverwaltung },
- { path: `/${ciPath}/studentenverwaltung/student/:id`, component: FhcStudentenverwaltung },
- { path: `/${ciPath}/studentenverwaltung/person/:person_id`, component: FhcStudentenverwaltung }
- ]
- });
-
- const app = Vue.createApp();
-
- app
- .use(router)
- .use(PrimeVue, {
- zIndex: {
- overlay: 1100
- }
- })
- .use(Phrasen)
- .mount('#main');
+const router = VueRouter.createRouter({
+ history: VueRouter.createWebHistory(),
+ routes: [
+ { path: `/${ciPath}/studentenverwaltung`, component: FhcStudentenverwaltung },
+ { path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id`, component: FhcStudentenverwaltung },
+ { path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id/:tab`, component: FhcStudentenverwaltung },
+ { path: `/${ciPath}/studentenverwaltung/student/:id`, component: FhcStudentenverwaltung },
+ { path: `/${ciPath}/studentenverwaltung/person/:person_id`, component: FhcStudentenverwaltung }
+ ]
});
+
+const app = Vue.createApp();
+
+app
+ .use(router)
+ .use(primevue.config.default, {
+ zIndex: {
+ overlay: 1100
+ }
+ })
+ .use(Phrasen)
+ .mount('#main');
diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js
index 69fa03dee..2fe6c9713 100644
--- a/public/js/components/Stv/Studentenverwaltung.js
+++ b/public/js/components/Stv/Studentenverwaltung.js
@@ -21,7 +21,6 @@ import StvVerband from "./Studentenverwaltung/Verband.js";
import StvList from "./Studentenverwaltung/List.js";
import StvDetails from "./Studentenverwaltung/Details.js";
import StvStudiensemester from "./Studentenverwaltung/Studiensemester.js";
-import {CoreRESTClient} from '../../RESTClient.js';
export default {
@@ -107,46 +106,38 @@ export default {
this.studiengangKz = studiengang_kz;
this.$refs.stvList.updateUrl(link);
},
- searchfunction(searchsettings) {
- return Vue.$fhcapi.Search.search(searchsettings);
- },
studiensemesterChanged(v) {
this.studiensemesterKurzbz = v;
this.$refs.stvList.updateUrl();
this.$refs.details.reload();
},
reloadList() {
- console.log('reloadList2');
this.$refs.stvList.reload();
}
},
created() {
- CoreRESTClient
- .get('components/stv/Address/getNations')
- .then(result => CoreRESTClient.getData(result.data) || [])
+ this.$fhcApi
+ .get('api/frontend/v1/stv/address/getNations')
.then(result => {
- this.lists.nations = result;
+ this.lists.nations = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
- CoreRESTClient
- .get('components/stv/Lists/getSprachen')
- .then(result => CoreRESTClient.getData(result.data) || [])
+ this.$fhcApi
+ .get('api/frontend/v1/stv/lists/getSprachen')
.then(result => {
- this.lists.sprachen = result;
+ this.lists.sprachen = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
- CoreRESTClient
- .get('components/stv/Lists/getGeschlechter')
- .then(result => CoreRESTClient.getData(result.data) || [])
+ this.$fhcApi
+ .get('api/frontend/v1/stv/lists/getGeschlechter')
.then(result => {
- this.lists.geschlechter = result;
+ this.lists.geschlechter = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
- CoreRESTClient
- .get('components/stv/Lists/getAusbildungen')
- .then(result => CoreRESTClient.getData(result.data) || [])
+ this.$fhcApi
+ .get('api/frontend/v1/stv/lists/getAusbildungen')
.then(result => {
- this.lists.ausbildungen = result;
+ this.lists.ausbildungen = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
this.$fhcApi
@@ -156,11 +147,10 @@ export default {
this.lists.active_stgs = this.lists.stgs.filter(stg => stg.aktiv);
})
.catch(this.$fhcAlert.handleSystemError);
- CoreRESTClient
- .get('components/stv/Lists/getOrgforms')
- .then(result => CoreRESTClient.getData(result.data) || [])
+ this.$fhcApi
+ .get('api/frontend/v1/stv/lists/getOrgforms')
.then(result => {
- this.lists.orgforms = result;
+ this.lists.orgforms = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
this.$fhcApi
@@ -191,7 +181,7 @@ export default {