Merge branch 'feature-30660/FHC4_StudierendenGUI_Prototyp' of github.com:FH-Complete/FHC-Core into feature-30660/FHC4_StudierendenGUI_Prototyp

This commit is contained in:
ma0068
2024-05-02 11:32:30 +02:00
15 changed files with 282 additions and 373 deletions
@@ -0,0 +1,66 @@
<?php
/**
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -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
@@ -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);
}
@@ -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();
@@ -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);
}
}
@@ -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)
@@ -1,17 +1,41 @@
<?php
/**
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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) {
@@ -1,47 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Address extends FHC_Controller
{
public function __construct()
{
// TODO(chris): access!
parent::__construct();
}
public function getNations()
{
$this->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);
}
}
@@ -1,85 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Lists extends FHC_Controller
{
public function __construct()
{
// TODO(chris): access!
parent::__construct();
}
public function getSprachen()
{
$this->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);
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
'bootstrap5' => true,
'fontawesome6' => true,
'vue3' => true,
#'primevue3' => true,
'primevue3' => true,
#'filtercomponent' => true,
'tabulator5' => true,
'tinymce5' => true,
+23 -28
View File
@@ -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');
+16 -26
View File
@@ -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 {
<header class="navbar navbar-expand-lg navbar-dark bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-4 col-lg-3 col-xl-2 me-0 px-3" :href="stvRoot">FHC 4.0</a>
<button class="navbar-toggler d-md-none m-1 collapsed" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" :aria-label="$p.t('ui/toggle_nav')"><span class="navbar-toggler-icon"></span></button>
<core-searchbar :searchoptions="searchbaroptions" :searchfunction="searchfunction" class="searchbar w-100"></core-searchbar>
<core-searchbar :searchoptions="searchbaroptions" :searchfunction="$fhcApi.factory.search.search" class="searchbar w-100"></core-searchbar>
</header>
<div class="container-fluid overflow-hidden">
<div class="row h-100">
@@ -1,5 +1,4 @@
import {CoreFilterCmpt} from "../../../../filter/Filter.js";
import {CoreRESTClient} from "../../../../../RESTClient";
import PvAutoComplete from "../../../../../../../index.ci.php/public/js/components/primevue/autocomplete/autocomplete.esm.min.js";
import FhcFormValidation from '../../../../Form/Validation.js';
import BsModal from "../../../../Bootstrap/Modal.js";
@@ -17,7 +16,7 @@ export default{
data() {
return{
tabulatorOptions: {
ajaxURL: 'api/frontend/v1/stv/Kontakt/getAdressen/' + this.uid,
ajaxURL: 'api/frontend/v1/stv/kontakt/getAdressen/' + this.uid,
ajaxRequestFunc: this.$fhcApi.get,
ajaxResponse: (url, params, response) => response.data,
//autoColumns: true,
@@ -169,21 +168,21 @@ export default{
}
},
watch: {
uid(){
uid() {
this.$refs.table.tabulator.setData('api/frontend/v1/stv/Kontakt/getAdressen/' + this.uid);
}
},
methods:{
actionNewAdress(){
actionNewAdress() {
this.$refs.newAdressModal.show();
},
actionEditAdress(adress_id){
actionEditAdress(adress_id) {
this.loadAdress(adress_id).then(() => {
if(this.addressData.adresse_id)
this.$refs.editAdressModal.show();
});
},
actionDeleteAdress(adress_id){
actionDeleteAdress(adress_id) {
this.loadAdress(adress_id).then(() => {
if(this.addressData.adresse_id)
if(this.addressData.heimatadresse)
@@ -205,10 +204,10 @@ export default{
this.reload();
});
},
reload(){
reload() {
this.$refs.table.reloadTable();
},
loadAdress(adress_id){
loadAdress(adress_id) {
return this.$fhcApi.get('api/frontend/v1/stv/kontakt/loadAddress/' + adress_id)
.then(result => {
this.addressData = result.data;
@@ -216,7 +215,7 @@ export default{
})
.catch(this.$fhcAlert.handleSystemError);
},
updateAddress(adress_id){
updateAddress(adress_id) {
this.$fhcApi.post('api/frontend/v1/stv/kontakt/updateAddress/' + adress_id,
this.addressData
).then(response => {
@@ -229,7 +228,7 @@ export default{
this.reload();
});
},
deleteAddress(adress_id){
deleteAddress(adress_id) {
this.$fhcApi.post('api/frontend/v1/stv/kontakt/deleteAddress/' + adress_id)
.then(response => {
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete'));
@@ -247,13 +246,12 @@ export default{
return;
this.abortController.places = new AbortController();
CoreRESTClient
.get('components/stv/address/getPlaces/' + this.addressData.plz, undefined, {
this.$fhcApi
.get('api/frontend/v1/stv/address/getPlaces/' + this.addressData.plz, undefined, {
signal: this.abortController.places.signal
})
.then(result => CoreRESTClient.getData(result.data) || [])
.then(result => {
this.places = result;
this.places = result.data;
});
/* .catch(error => {
if (error.code == 'ERR_BAD_REQUEST') {
@@ -271,20 +269,19 @@ export default{
this.filteredFirmen = result.data.retval;
});
},
hideModal(modalRef){
hideModal(modalRef) {
this.$refs[modalRef].hide();
},
resetModal(){
resetModal() {
this.addressData = {};
this.addressData = this.initData;
},
},
created(){
CoreRESTClient
.get('components/stv/Address/getNations')
.then(result => CoreRESTClient.getData(result.data) || [])
created() {
this.$fhcApi
.get('api/frontend/v1/stv/address/getNations')
.then(result => {
this.nations = result;
this.nations = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
this.$fhcApi
@@ -130,21 +130,21 @@ export default {
this.abortController.places = new AbortController();
this.$refs.form
.send(CoreRESTClient.get(
'components/stv/address/getPlaces/' + this.formData.address.plz,
.get(
'api/frontend/v1/stv/address/getPlaces/' + this.formData.address.plz,
undefined,
{
signal: this.abortController.places.signal
}
))
)
.then(result => {
this.places = result
this.places = result.data
})
.catch(error => {
if (error.code != "ERR_CANCELED")
window.setTimeout(this.loadPlaces, 100);
else
console.error(error);
this.$fhcAlert.handleSystemError(error);
});
},
loadStudienplaene() {
@@ -53,8 +53,8 @@ export default {
});
this.loading = true;
CoreRESTClient
.get("components/stv/verband/" + node.data.link)
this.$fhcApi
.get('api/frontend/v1/stv/verband/' + node.data.link)
.then(result => result.data)
.then(result => {
const subNodes = result.map(this.mapResultToTreeData);
@@ -128,7 +128,12 @@ export default {
let promises = [];
for (let parent in sortedInParents)
promises.push(CoreRESTClient.get("components/stv/verband/" + (parent == '_' ? '' : parent)).then(res => res.data).then(res => res.filter(node => sortedInParents[parent].includes(node.link + ''))));
promises.push(
this.$fhcApi
.get('api/frontend/v1/stv/verband/' + (parent == '_' ? '' : parent))
.then(res => res.data)
.then(res => res.filter(node => sortedInParents[parent].includes(node.link + '')))
);
// NOTE(chris): merge the resulting arrays and transform them to an associative one
let result = [].concat.apply([], await Promise.all(promises)).reduce((o, node) => {
@@ -171,8 +176,8 @@ export default {
}
},
mounted() {
CoreRESTClient
.get("components/stv/verband")
this.$fhcApi
.get('api/frontend/v1/stv/verband')
.then(result => result.data)
.then(result => {
this.nodes = result.map(this.mapResultToTreeData);