Studstatus => FhcApi

This commit is contained in:
cgfhtw
2024-03-21 15:45:55 +01:00
parent 69803cdb0d
commit c4942cc70e
26 changed files with 1895 additions and 2044 deletions
@@ -0,0 +1,161 @@
<?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 (FAS) and the AntragLib (back-end)
* This controller works with calls on the HTTP GET or POST and the output is always RDF
*/
class Wiederholung extends Auth_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct([
'getLvs' => ['student/studierendenantrag:r', 'student/noten:r'],
'moveLvsToZeugnis' => ['student/studierendenantrag:w', 'student/noten:w']
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'global',
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
public function getLvs($prestudent_id)
{
// header für no cache
$this->output->set_header("Cache-Control: no-cache");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$this->output->set_header("Pragma: no-cache");
$this->output->set_header("Content-type: application/xhtml+xml");
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
$sem_akt = $this->variablelib->getVar('semester_aktuell');
$result = $this->antraglib->getLvsForPrestudent($prestudent_id, $sem_akt);
$lvs = $this->getDataOrTerminateWithError($result) ?: [];
$rdf_url = 'http://www.technikum-wien.at/antragnote';
$this->load->view('lehre/Antrag/Wiederholung/getLvs.rdf.php', [
'url' => $rdf_url,
'lvs' => $lvs
]);
}
public function moveLvsToZeugnis()
{
$anzahl = $this->input->post('anzahl');
$student_uid = $this->input->post('student_uid');
$this->load->model('education/Studierendenantraglehrveranstaltung_model', 'StudierendenantraglehrveranstaltungModel');
$this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
$errormsg = array();
for($i=0; $i<$anzahl; $i++)
{
$id = $this->input->post('studierendenantrag_lehrveranstaltung_id_' . $i);
$result =$this->StudierendenantraglehrveranstaltungModel->load($id);
if(isError($result))
{
$errormsg[] = getError($result);
}
elseif(!hasData($result))
{
$errormsg[] = $this->p->t('studierendenantrag', 'error_no_lv_in_application');
}
else
{
$antragLv = getData($result)[0];
$result= $this->ZeugnisnoteModel->load([
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz
]);
if(isError($result))
{
$errormsg[] = getError($result);
}
else
{
if (hasData($result))
{
$result = $this->ZeugnisnoteModel->update(
[
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz
],
[
'note'=> $antragLv->note,
'uebernahmedatum' => date('c'),
'benotungsdatum' => $antragLv->insertamum,
'updateamum' => date('c'),
'bemerkung'=>$antragLv->anmerkung,
'updatevon'=>getAuthUID()
]
);
}
else
{
$result = $this->ZeugnisnoteModel->insert([
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz,
'note'=> $antragLv->note,
'uebernahmedatum' => date('c'),
'benotungsdatum' => $antragLv->insertamum,
'insertamum' => date('c'),
'bemerkung'=>$antragLv->anmerkung,
'insertvon'=>getAuthUID()
]);
}
if(isError($result))
{
$errormsg[] = getError($result);
}
}
}
}
if($errormsg)
$return = false;
else
$return = true;
$this->load->view('lehre/Antrag/Wiederholung/moveLvs.rdf.php', [
'return' => $return,
'errormsg' => $errormsg
]);
}
}
@@ -0,0 +1,187 @@
<?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');
use \REST_Controller as REST_Controller;
use \Studierendenantrag_model as Studierendenantrag_model;
/**
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Abmeldung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the AntragLib
*/
public function __construct()
{
parent::__construct([
'getDetailsForNewAntrag' => self::PERM_LOGGED,
'getDetailsForAntrag' => self::PERM_LOGGED,
'createAntrag' => self::PERM_LOGGED,
'cancelAntrag' => self::PERM_LOGGED
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Retrieves data of the current studiengang for the current user
*/
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, true))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->getPrestudentAbmeldeBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_student'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -3) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_stg_blacklist'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -1) {
$result = $this->antraglib->getDetailsForLastAntrag(
$prestudent_id,
[
Studierendenantrag_model::TYP_ABMELDUNG,
Studierendenantrag_model::TYP_ABMELDUNG_STGL
]
);
$data = $this->getDataOrTerminateWithError($result);
$data->canCancel = (
$data->status == Studierendenantragstatus_model::STATUS_CREATED &&
$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id)
);
$this->terminateWithSuccess($data);
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getDetailsForAntrag($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToShowAntrag($studierendenantrag_id))
return show_404();
$result = $this->antraglib->getDetailsForAntrag($studierendenantrag_id);
$data = $this->getDataOrTerminateWithError($result);
if ($data->typ !== Studierendenantrag_model::TYP_ABMELDUNG_STGL && $data->typ !== Studierendenantrag_model::TYP_ABMELDUNG)
return show_404();
$data->canCancel = (
$data->status == Studierendenantragstatus_model::STATUS_CREATED &&
$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id)
);
$this->terminateWithSuccess($data);
}
public function createAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('studiensemester', 'Studiensemester', 'required');
$this->form_validation->set_rules('prestudent_id', 'Prestudent ID', 'required');
$this->form_validation->set_rules('grund', 'Grund', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$grund = $this->input->post('grund');
$studiensemester = $this->input->post('studiensemester');
$prestudent_id = $this->input->post('prestudent_id');
$result = $this->antraglib->getPrestudentAbmeldeBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
elseif ($result == -3)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_stg_blacklist'), self::ERROR_TYPE_GENERAL);
elseif ($result < 0)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_exists'), self::ERROR_TYPE_GENERAL);
$result = $this->antraglib->createAbmeldung($prestudent_id, $studiensemester, getAuthUID(), $grund);
$data = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($data);
if (!hasData($result))
return $this->terminateWithSuccess(true);
$data = getData($result);
$data->canCancel = (boolean)$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id);
$this->terminateWithSuccess($data);
}
public function cancelAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('antrag_id', 'Antrag ID', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$antrag_id = $this->input->post('antrag_id');
if (!$this->antraglib->isEntitledToCancelAntrag($antrag_id))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->cancelAntrag($antrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antrag_id);
if (!hasData($result))
$this->terminateWithSuccess($antrag_id);
$data = getData($result);
$this->terminateWithSuccess($data);
}
}
@@ -0,0 +1,428 @@
<?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');
use \stdClass as stdClass;
use \Studierendenantrag_model as Studierendenantrag_model;
/**
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Leitung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the AntragLib
*/
public function __construct()
{
parent::__construct([
'getActiveStgs' => ['student/antragfreigabe:r', 'student/studierendenantrag:r'],
'getAntraege' => ['student/antragfreigabe:r', 'student/studierendenantrag:r'],
'getHistory' => ['student/antragfreigabe:r', 'student/studierendenantrag:r'],
'getPrestudents' => 'student/studierendenantrag:w',
'approveAntrag' => 'student/antragfreigabe:w',
'rejectAntrag' => 'student/antragfreigabe:w',
'reopenAntrag' => 'student/studierendenantrag:w',
'pauseAntrag' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'unpauseAntrag' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'objectAntrag' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'approveObjection' => ['student/antragfreigabe:w', 'student/studierendenantrag:w'],
'denyObjection' => ['student/antragfreigabe:w', 'student/studierendenantrag:w']
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
public function getActiveStgs()
{
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/antragfreigabe') ?: [];
$studiengaenge = array_merge($studiengaenge, $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag') ?: []);
$result = $this->StudierendenantragModel->loadStgsWithAntraege($studiengaenge);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getAntraege($studiengang = null, $extra = null)
{
if ($studiengang && $studiengang == 'todo') {
$studiengang = $extra;
$extra = true;
} else {
$extra = false;
}
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/antragfreigabe');
if(!is_array($studiengaenge))
$studiengaenge = [];
$stgsNeuanlage = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
if(!is_array($stgsNeuanlage))
$stgsNeuanlage = [];
$studiengaenge = array_unique(array_merge($studiengaenge, $stgsNeuanlage));
if ($studiengang) {
if (!in_array($studiengang, $studiengaenge))
$this->terminateWithError(
'Forbidden',
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
$studiengaenge = [$studiengang];
}
$antraege = [];
if ($studiengaenge) {
$result = $extra
? $this->StudierendenantragModel->loadActiveForStudiengaenge($studiengaenge)
: $this->StudierendenantragModel->loadForStudiengaenge($studiengaenge);
$antraege = $this->getDataOrTerminateWithError($result);
}
$this->terminateWithSuccess($antraege ?: []);
}
public function getHistory($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToSeeHistoryForAntrag($studierendenantrag_id))
$this->terminateWithError(
'Forbidden',
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
$result = $this->antraglib->getAntragHistory($studierendenantrag_id);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data ?: []);
}
public function getPrestudents()
{
$query = $this->input->post('query');
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
$result = $this->antraglib->getAktivePrestudentenInStgs($studiengaenge, $query);
$result = $this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($result ?: []);
}
public function approveAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToApproveAntrag', [$this->antraglib, 'isEntitledToApproveAntrag']],
],
[
'isEntitledToApproveAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
$this->form_validation->set_rules(
'typ',
'Typ',
'required|in_list[' . implode(',', [
Studierendenantrag_model::TYP_ABMELDUNG,
Studierendenantrag_model::TYP_ABMELDUNG_STGL,
Studierendenantrag_model::TYP_UNTERBRECHUNG,
Studierendenantrag_model::TYP_WIEDERHOLUNG
]) . ']'
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
switch ($this->input->post('typ')) {
case Studierendenantrag_model::TYP_ABMELDUNG:
case Studierendenantrag_model::TYP_ABMELDUNG_STGL:
$result = $this->antraglib->approveAbmeldung([$studierendenantrag_id], getAuthUID());
break;
case Studierendenantrag_model::TYP_UNTERBRECHUNG:
$result = $this->antraglib->approveUnterbrechung([$studierendenantrag_id], getAuthUID());
break;
case Studierendenantrag_model::TYP_WIEDERHOLUNG:
$result = $this->antraglib->approveWiederholung($studierendenantrag_id, getAuthUID());
break;
}
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function rejectAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToRejectAntrag', [$this->antraglib, 'isEntitledToRejectAntrag']],
],
[
'isEntitledToRejectAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
$this->form_validation->set_rules('grund', 'Grund', 'required');
$this->form_validation->set_rules(
'typ',
'Typ',
'required|in_list[' . implode(',', [
Studierendenantrag_model::TYP_UNTERBRECHUNG
]) . ']'
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$grund = $this->input->post('grund');
$result = $this->antraglib->rejectUnterbrechung([$studierendenantrag_id], getAuthUID(), $grund);
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function reopenAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToReopenAntrag', [$this->antraglib, 'isEntitledToReopenAntrag']],
],
[
'isEntitledToReopenAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
$this->form_validation->set_rules(
'typ',
'Typ',
'required|in_list[' . implode(',', [
Studierendenantrag_model::TYP_WIEDERHOLUNG
]) . ']'
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->reopenWiederholung($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function pauseAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToPauseAntrag', [$this->antraglib, 'isEntitledToPauseAntrag']],
['antragCanBeManualPaused', [$this->antraglib, 'antragCanBeManualPaused']]
],
[
'isEntitledToPauseAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'antragCanBeManualPaused' => $this->p->t(
'studierendenantrag',
'error_not_pauseable',
['id' => $this->input->post('studierendenantrag_id')]
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->pauseAntrag($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function unpauseAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToUnpauseAntrag', [$this->antraglib, 'isEntitledToUnpauseAntrag']],
['antragCanBeManualUnpaused', [$this->antraglib, 'antragCanBeManualUnpaused']]
],
[
'isEntitledToUnpauseAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'antragCanBeManualUnpaused' => $this->p->t(
'studierendenantrag',
'error_not_paused',
['id' => $this->input->post('studierendenantrag_id')]
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->unpauseAntrag($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function objectAntrag()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToObjectAntrag', [$this->antraglib, 'isEntitledToObjectAntrag']],
['canBeObjected', function ($a) {
return $this->antraglib->hasType($a, Studierendenantrag_model::TYP_ABMELDUNG_STGL);
}]
],
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'canBeObjected' => $this->p->t(
'studierendenantrag',
'error_no_objection'
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->objectAbmeldung($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function approveObjection()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToObjectAntrag', [$this->antraglib, 'isEntitledToObjectAntrag']],
['isObjected', function ($a) {
return $this->antraglib->hasStatus($a, Studierendenantragstatus_model::STATUS_OBJECTED);
}]
],
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'isObjected' => $this->p->t(
'studierendenantrag',
'error_not_objected'
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->cancelAntrag($studierendenantrag_id, getAuthUID());
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
public function denyObjection()
{
$this->load->library('form_validation');
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
['isEntitledToObjectAntrag', [$this->antraglib, 'isEntitledToObjectAntrag']],
['isObjected', function ($a) {
return $this->antraglib->hasStatus($a, Studierendenantragstatus_model::STATUS_OBJECTED);
}]
],
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'isObjected' => $this->p->t(
'studierendenantrag',
'error_not_objected'
)
]
);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$grund = $this->input->post('grund');
$result = $this->antraglib->denyObjectionAbmeldung($studierendenantrag_id, getAuthUID(), $grund);
$this->getDataOrTerminateWithError($result);
return $this->terminateWithSuccess($studierendenantrag_id);
}
}
@@ -1,4 +1,20 @@
<?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');
@@ -6,23 +22,28 @@ use \Studierendenantrag_model as Studierendenantrag_model;
use \DateTime as DateTime;
/**
*
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Unterbrechung extends FHC_Controller
class Unterbrechung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
* Calls the parent's constructor and loads the AntragLib
*/
public function __construct()
{
parent::__construct();
parent::__construct([
'getDetailsForNewAntrag' => self::PERM_LOGGED,
'getDetailsForAntrag' => self::PERM_LOGGED,
'createAntrag' => self::PERM_LOGGED,
'cancelAntrag' => self::PERM_LOGGED
]);
// Configs
$this->load->config('studierendenantrag');
// Libraries
$this->load->library('AuthLib');
$this->load->library('AntragLib');
// Load language phrases
@@ -38,74 +59,62 @@ class Unterbrechung extends FHC_Controller
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, false)) {
$this->output->set_status_header(403);
return $this->outputJsonError('Forbidden');
}
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, false))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->getPrestudentUnterbrechungsBerechtigt($prestudent_id);
if (isError($result)) {
$this->output->set_status_header(500);
return $this->outputJsonError(getError($result));
}
$result = $result->retval;
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->output->set_status_header(403);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_no_student'));
}
elseif ($result == -1)
{
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_student'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -1) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id, Studierendenantrag_model::TYP_UNTERBRECHUNG);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$data = $this->getDataOrTerminateWithError($result);
return $this->outputJsonSuccess(getData($result));
}
elseif ($result == -2)
{
return $this->terminateWithSuccess($data);
} elseif ($result == -2) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$result = getData($result);
$this->output->set_status_header(400);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_antrag_pending', [
$data = $this->getDataOrTerminateWithError($result);
return $this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_pending', [
'typ' => $this->p->t('studierendenantrag', 'antrag_typ_' . $result->typ)
]));
}
elseif ($result == -3)
{
$this->output->set_status_header(403);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_stg_blacklist'));
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
} elseif ($result == -3) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_stg_blacklist'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
}
$data = getData($result);
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
$data->studiensemester = $this->antraglib->getSemesterForUnterbrechung($prestudent_id, null);
$this->outputJsonSuccess($data);
$this->terminateWithSuccess($data);
}
public function getDetailsForAntrag($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToShowAntrag($studierendenantrag_id)) return show_404();
if (!$this->antraglib->isEntitledToShowAntrag($studierendenantrag_id))
return show_404();
$result = $this->antraglib->getDetailsForAntrag($studierendenantrag_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$data = getData($result);
$data = $this->getDataOrTerminateWithError($result);
if ($data->typ !== Studierendenantrag_model::TYP_UNTERBRECHUNG)
return show_404();
$this->outputJsonSuccess($data);
$this->terminateWithSuccess($data);
}
public function createAntrag()
@@ -125,9 +134,8 @@ class Unterbrechung extends FHC_Controller
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
if (!$this->form_validation->run()) {
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$grund = $this->input->post('grund');
@@ -137,25 +145,17 @@ class Unterbrechung extends FHC_Controller
$dms_id = null;
$result = $this->antraglib->getPrestudentUnterbrechungsBerechtigt($prestudent_id, $studiensemester, $datum_wiedereinstieg);
if (isError($result)) {
return $this->outputJsonError(['db' => getError($result)]);
}
$result = $result->retval;
if (!$result)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_no_student')]);
}
elseif ($result == -3)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_stg_blacklist')]);
}
elseif ($result < 0)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_antrag_exists')]);
}
if(isset($_FILES['attachment']) && (!isset($_FILES['attachment']['error']) || $_FILES['attachment']['error'] != UPLOAD_ERR_NO_FILE))
{
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
elseif ($result == -3)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_stg_blacklist'), self::ERROR_TYPE_GENERAL);
elseif ($result < 0)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_exists'), self::ERROR_TYPE_GENERAL);
if (isset($_FILES['attachment']) && (!isset($_FILES['attachment']['error']) || $_FILES['attachment']['error'] != UPLOAD_ERR_NO_FILE)) {
$this->load->library('DmsLib');
$dms = $this->config->item('unterbrechung_dms');
@@ -167,53 +167,46 @@ class Unterbrechung extends FHC_Controller
$allowed_filetypes = $this->config->item('unterbrechung_dms_filetypes') ?: ['*'];
$result = $this->dmslib->upload($dms, 'attachment', $allowed_filetypes);
if(isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
$dms_id = getData($result)['dms_id'];
$data = $this->getDataOrTerminateWithError($result);
$dms_id = $data['dms_id'];
}
$result = $this->antraglib->createUnterbrechung($prestudent_id, $studiensemester, getAuthUID(), $grund, $datum_wiedereinstieg, $dms_id);
if(isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
$antragId = getData($result);
$antragId = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antragId);
if(!hasData($result))
return $this->outputJsonSuccess($antragId);
$this->outputJsonSuccess(getData($result));
if (!hasData($result))
$this->terminateWithSuccess($antragId);
$this->terminateWithSuccess(getData($result));
}
public function cancelAntrag()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules('antrag_id', 'Antrag ID', 'required');
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
if (!$this->form_validation->run()) {
$this->terminateWithValidationErrors($this->form_validation->error_array());
}
$antrag_id = $this->input->post('antrag_id');
$result = $this->antraglib->cancelAntrag($antrag_id, getAuthUID());
if (isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
$this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antrag_id);
if (!hasData($result))
return $this->outputJsonSuccess($antrag_id);
$this->outputJsonSuccess(getData($result));
return $this->terminateWithSuccess($antrag_id);
$this->terminateWithSuccess(getData($result));
}
public function isValidDate($date)
@@ -0,0 +1,258 @@
<?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');
use \REST_Controller as REST_Controller;
use \Studierendenantragstatus_model as Studierendenantragstatus_model;
/**
* This controller operates between (interface) the JS (GUI) and the AntragLib (back-end)
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Wiederholung extends FHCAPI_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct([
'getDetailsForNewAntrag' => self::PERM_LOGGED,
'createAntrag' => self::PERM_LOGGED,
'cancelAntrag' => self::PERM_LOGGED,
'getLvs' => self::PERM_LOGGED,
'saveLvs' => ['student/studierendenantrag:w']
]);
// Libraries
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'global',
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Retrieves data of the current studiengang for the current user
*/
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, false))
$this->terminateWithError('Forbidden', self::ERROR_TYPE_AUTH, REST_Controller::HTTP_FORBIDDEN);
$result = $this->antraglib->getPrestudentWiederholungsBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_student_no_failed_exam'),
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
} elseif ($result == -1) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id, Studierendenantrag_model::TYP_WIEDERHOLUNG);
$data = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id, $data->datum, $data->studiensemester_kurzbz);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->terminateWithSuccess($data);
} elseif ($result == -2) {
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_antrag_pending', [
'typ' => $this->p->t('studierendenantrag', 'antrag_typ_' . $result->typ)
]),
self::ERROR_TYPE_GENERAL,
REST_Controller::HTTP_BAD_REQUEST
);
} elseif ($result == -3) {
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_stg_blacklist'),
self::ERROR_TYPE_GENERAL,
REST_Controller::HTTP_BAD_REQUEST
);
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->terminateWithSuccess($data);
}
public function createAntrag()
{
$this->createAntragWithStatus(true);
}
public function cancelAntrag()
{
$this->createAntragWithStatus(false);
}
protected function createAntragWithStatus($repeat)
{
$this->load->library('form_validation');
$this->form_validation->set_rules('prestudent_id', 'Prestudent ID', 'required');
$this->form_validation->set_rules('studiensemester', 'Studiensemester', 'required');
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$prestudent_id = $this->input->post('prestudent_id');
$studiensemester = $this->input->post('studiensemester');
$result = $this->antraglib->getPrestudentWiederholungsBerechtigt($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result) {
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
} elseif ($result == -1) {
$result = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
$result = $this->getDataOrTerminateWithError($result);
if (!$result)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_prestudentstatus', [
'prestudent_id' => $prestudent_id
]), self::ERROR_TYPE_GENERAL);
if (!in_array(current($result)->status_kurzbz, $this->config->item('antrag_prestudentstatus_whitelist')))
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student'), self::ERROR_TYPE_GENERAL);
} elseif ($result == -2) {
$this->terminateWithError($this->p->t('studierendenantrag', 'error_antrag_exists'), self::ERROR_TYPE_GENERAL);
} elseif ($result == -3) {
$this->terminateWithError($this->p->t('studierendenantrag', 'error_stg_blacklist'), self::ERROR_TYPE_GENERAL);
}
$result = $this->antraglib->createWiederholung($prestudent_id, $studiensemester, getAuthUID(), $repeat);
$antragId = $this->getDataOrTerminateWithError($result);
$result = $this->antraglib->getDetailsForAntrag($antragId);
if (!hasData($result))
$this->terminateWithSuccess(true);
$data = getData($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->terminateWithSuccess($data);
}
public function getLvs($antrag_id)
{
$result = $this->antraglib->getLvsForAntrag($antrag_id);
if (isError($result)) {
$error = getError($result);
if ($error == 'Forbidden')
$this->terminateWithError(
$error,
self::ERROR_TYPE_AUTH,
REST_Controller::HTTP_FORBIDDEN
);
$this->terminateWithError(
$error,
self::ERROR_TYPE_GENERAL
);
}
$lvs = getData($result);
$this->terminateWithSuccess($lvs);
}
public function saveLvs()
{
$forbiddenLvs = $this->input->post('forbiddenLvs');
$mandatoryLvs = $this->input->post('mandatoryLvs');
$antragsLvs = array_merge($forbiddenLvs, $mandatoryLvs);
if (!$antragsLvs)
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_lv'), self::ERROR_TYPE_GENERAL);
$insert = array_map(function ($lv) {
return [
'studierendenantrag_id' => $lv['studierendenantrag_id'],
'lehrveranstaltung_id' => $lv['lehrveranstaltung_id'],
'note' => $lv['zugelassen']
? ($lv['zugelassen'] == 1 ? 0 : $this->config->item('wiederholung_note_angerechnet'))
: $this->config->item('wiederholung_note_nicht_zugelassen'),
'anmerkung' => $lv['anmerkung'],
'insertvon' => getAuthUID(),
'studiensemester_kurzbz' => $lv['studiensemester_kurzbz']
];
}, $antragsLvs);
$antrag_ids = array_unique(array_map(function ($lv) {
return $lv['studierendenantrag_id'];
}, $insert));
foreach ($antrag_ids as $antrag_id) {
$result = $this->StudierendenantragModel->loadIdAndStatusWhere([
'studierendenantrag_id' => $antrag_id
]);
$antrag = $this->getDataOrTerminateWithError($result);
if (!$antrag)
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_no_antrag_found', ['id' => $antrag_id]),
self::ERROR_TYPE_GENERAL
);
$antrag = current($antrag);
if ($antrag->status != Studierendenantragstatus_model::STATUS_CREATED
&& $antrag->status != Studierendenantragstatus_model::STATUS_LVSASSIGNED)
$this->terminateWithError(
$this->p->t('studierendenantrag', 'error_antrag_locked'),
self::ERROR_TYPE_GENERAL
);
}
$result = $this->antraglib->saveLvs($insert);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
}
@@ -1,218 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \Studierendenantrag_model as Studierendenantrag_model;
/**
*
*/
class Abmeldung extends FHC_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct();
// Libraries
$this->load->library('AuthLib');
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Retrieves data of the current studiengang for the current user
*/
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, true)) {
$this->output->set_status_header(403);
return $this->outputJsonError('Forbidden');
}
$result = $this->antraglib->getPrestudentAbmeldeBerechtigt($prestudent_id);
if (isError($result)) {
$this->output->set_status_header(500);
return $this->outputJsonError(getError($result));
}
$result = $result->retval;
if (!$result) {
$this->output->set_status_header(403);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_no_student'));
}
elseif ($result == -3)
{
$this->output->set_status_header(403);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_stg_blacklist'));
}
elseif ($result == -1)
{
$result = $this->antraglib->getDetailsForLastAntrag(
$prestudent_id,
[
Studierendenantrag_model::TYP_ABMELDUNG,
Studierendenantrag_model::TYP_ABMELDUNG_STGL
]
);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$data = getData($result);
$data->canCancel = (
$data->status == Studierendenantragstatus_model::STATUS_CREATED &&
$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id)
);
return $this->outputJsonSuccess($data);
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$this->outputJsonSuccess(getData($result));
}
public function getDetailsForAntrag($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToShowAntrag($studierendenantrag_id)) return show_404();
$result = $this->antraglib->getDetailsForAntrag($studierendenantrag_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$data = getData($result);
if ($data->typ !== Studierendenantrag_model::TYP_ABMELDUNG_STGL && $data->typ !== Studierendenantrag_model::TYP_ABMELDUNG)
return show_404();
$data->canCancel = (
$data->status == Studierendenantragstatus_model::STATUS_CREATED &&
$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id)
);
$this->outputJsonSuccess($data);
}
public function createAntrag()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules('studiensemester', 'Studiensemester', 'required');
$this->form_validation->set_rules('prestudent_id', 'Prestudent ID', 'required');
$this->form_validation->set_rules('grund', 'Grund', 'required');
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$grund = $this->input->post('grund');
$studiensemester = $this->input->post('studiensemester');
$prestudent_id = $this->input->post('prestudent_id');
$result = $this->antraglib->getPrestudentAbmeldeBerechtigt($prestudent_id);
if (isError($result)) {
return $this->outputJsonError(['db' => getError($result)]);
}
$result = $result->retval;
if (!$result)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_no_student')]);
}
elseif ($result == -3)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_stg_blacklist')]);
}
elseif ($result < 0)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_antrag_exists')]);
}
$result = $this->antraglib->createAbmeldung($prestudent_id, $studiensemester, getAuthUID(), $grund);
if (isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
$result = $this->antraglib->getDetailsForAntrag(getData($result));
if (!hasData($result))
return $this->outputJsonSuccess(true);
$data = getData($result);
$data->canCancel = (boolean)$this->antraglib->isEntitledToCancelAntrag($data->studierendenantrag_id);
$this->outputJsonSuccess($data);
}
public function cancelAntrag()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules('antrag_id', 'Antrag ID', 'required');
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$antrag_id = $this->input->post('antrag_id');
if(!$this->antraglib->isEntitledToCancelAntrag($antrag_id))
{
$this->output->set_status_header(403);
return $this->outputJsonError('Forbidden');
}
$result = $this->antraglib->cancelAntrag($antrag_id, getAuthUID());
if(isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
$result = $this->antraglib->getDetailsForAntrag($antrag_id);
if (!hasData($result))
return $this->outputJsonSuccess($antrag_id);
$this->outputJsonSuccess(getData($result));
}
public function getStudiengaengeAssistenz()
{
$this->load->library('PermissionLib');
$_POST = json_decode($this->input->raw_input_stream, true);
$query = $this->input->post('query');
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
$result = $this->antraglib->getAktivePrestudentenInStgs($studiengaenge, $query);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$result = getData($result);
if (!$result) {
return $this->outputJsonSuccess([]);
}
return $this->outputJsonSuccess($result);
}
}
@@ -1,479 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \stdClass as stdClass;
/**
*
*/
class Leitung extends FHC_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct();
// Libraries
$this->load->library('AuthLib');
$this->load->library('AntragLib');
// Load language phrases
$this->loadPhrases([
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
public function getActiveStgs()
{
$studiengaenge = $this->permissionlib->getSTG_isEntitledFor('student/antragfreigabe') ?: [];
$studiengaenge = array_merge($studiengaenge, $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag') ?: []);
$result = $this->StudierendenantragModel->loadStgsWithAntraege($studiengaenge);
if (isError($result)) {
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
}
$this->outputJson($result);
}
public function getAntraege($studiengang = null, $extra = null)
{
if ($studiengang && $studiengang == 'todo') {
$studiengang = $extra;
$extra = true;
} else {
$extra = false;
}
if ($studiengang) {
$studiengaenge = [$studiengang];
} else {
$studiengaenge =$this->permissionlib->getSTG_isEntitledFor('student/antragfreigabe');
if(!is_array($studiengaenge))
$studiengaenge = [];
$stgsNeuanlage = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
if(!is_array($stgsNeuanlage))
$stgsNeuanlage = [];
$studiengaenge = array_unique(array_merge($studiengaenge, $stgsNeuanlage));
}
$antraege = [];
if ($studiengaenge) {
$result = $extra
? $this->StudierendenantragModel->loadActiveForStudiengaenge($studiengaenge)
: $this->StudierendenantragModel->loadForStudiengaenge($studiengaenge);
if (isError($result)) {
$this->output->set_status_header(500);
return $this->outputJson('Internal Server Error');
}
if(hasData($result))
{
$antraege = getData($result);
}
}
$this->outputJson($antraege);
}
public function reopenAntrag()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToReopenAntrag',
[
'isEntitledToReopenAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->reopenWiederholung($studierendenantrag_id, getAuthUID());
if (isError($result))
return $this->outputJsonError(['studierendenantrag_id' => getError($result)]);
$this->outputJsonSuccess($studierendenantrag_id);
}
public function pauseAntrag()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
[
'isEntitledToPauseAntrag',
[$this->antraglib, 'isEntitledToPauseAntrag']
],
[
'antragCanBeManualPaused',
[$this->antraglib, 'antragCanBeManualPaused']
]
],
[
'isEntitledToPauseAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'antragCanBeManualPaused' => $this->p->t(
'studierendenantrag',
'error_not_pauseable',
['id' => $this->input->post('studierendenantrag_id')]
)
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->pauseAntrag($studierendenantrag_id, getAuthUID());
if (isError($result))
return $this->outputJsonError(['studierendenantrag_id' => getError($result)]);
$this->outputJsonSuccess($studierendenantrag_id);
}
public function unpauseAntrag()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
[
'required',
[
'isEntitledToUnpauseAntrag',
[$this->antraglib, 'isEntitledToUnpauseAntrag']
],
[
'antragCanBeManualUnpaused',
[$this->antraglib, 'antragCanBeManualUnpaused']
]
],
[
'isEntitledToUnpauseAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'antragCanBeManualUnpaused' => $this->p->t(
'studierendenantrag',
'error_not_paused',
['id' => $this->input->post('studierendenantrag_id')]
)
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->unpauseAntrag($studierendenantrag_id, getAuthUID());
if (isError($result))
return $this->outputJsonError(['studierendenantrag_id' => getError($result)]);
$this->outputJsonSuccess($studierendenantrag_id);
}
public function objectAntrag()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToObjectAntrag|callback_canBeObjected',
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'canBeObjected' => $this->p->t('studierendenantrag', 'error_no_objection')
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->objectAbmeldung($studierendenantrag_id, getAuthUID());
if (isError($result))
return $this->outputJsonError(['studierendenantrag_id' => getError($result)]);
$this->outputJsonSuccess($studierendenantrag_id);
}
public function objectionDeny()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToObjectAntrag|callback_isObjected',
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'isObjected' => $this->p->t('studierendenantrag', 'error_not_objected')
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$grund = $this->input->post('grund');
$result = $this->antraglib->denyObjectionAbmeldung($studierendenantrag_id, getAuthUID(), $grund);
if (isError($result))
return $this->outputJsonError(['studierendenantrag_id' => getError($result)]);
$this->outputJsonSuccess($studierendenantrag_id);
}
public function objectionApprove()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToObjectAntrag|callback_isObjected',
[
'isEntitledToObjectAntrag' => $this->p->t('studierendenantrag', 'error_no_right'),
'isObjected' => $this->p->t('studierendenantrag', 'error_not_objected')
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->cancelAntrag($studierendenantrag_id, getAuthUID());
if (isError($result))
return $this->outputJsonError(['studierendenantrag_id' => getError($result)]);
$this->outputJsonSuccess($studierendenantrag_id);
}
public function isEntitledToReopenAntrag($studierendenantrag_id)
{
return $this->antraglib->isEntitledToReopenAntrag($studierendenantrag_id);
}
public function isEntitledToObjectAntrag($studierendenantrag_id)
{
return $this->antraglib->isEntitledToObjectAntrag($studierendenantrag_id);
}
public function isEntitledToRejectAntrag($studierendenantrag_id)
{
return $this->antraglib->isEntitledToRejectAntrag($studierendenantrag_id);
}
public function canBeObjected($studierendenantrag_id)
{
return $this->antraglib->hasType($studierendenantrag_id, Studierendenantrag_model::TYP_ABMELDUNG_STGL);
}
public function isObjected($studierendenantrag_id)
{
return $this->antraglib->hasStatus($studierendenantrag_id, Studierendenantragstatus_model::STATUS_OBJECTED);
}
public function approveAbmeldung()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToApproveAntrag',
[
'isEntitledToApproveAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->approveAbmeldung([$studierendenantrag_id], getAuthUID());
if (isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
return $this->outputJsonSuccess($studierendenantrag_id);
}
public function approveAbmeldungStgl()
{
return $this->approveAbmeldung();
}
public function approveUnterbrechung()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToApproveAntrag',
[
'isEntitledToApproveAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->approveUnterbrechung([$studierendenantrag_id], getAuthUID());
if (isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
return $this->outputJsonSuccess($studierendenantrag_id);
}
public function rejectUnterbrechung()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToRejectAntrag',
[
'isEntitledToRejectAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
$this->form_validation->set_rules('grund', 'Grund', 'required');
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$grund = $this->input->post('grund');
$result = $this->antraglib->rejectUnterbrechung([$studierendenantrag_id], getAuthUID(), $grund);
if (isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
return $this->outputJsonSuccess($studierendenantrag_id);
}
public function approveWiederholung()
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules(
'studierendenantrag_id',
'Studierenden Antrag',
'required|callback_isEntitledToApproveAntrag',
[
'isEntitledToApproveAntrag' => $this->p->t('studierendenantrag', 'error_no_right')
]
);
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$studierendenantrag_id = $this->input->post('studierendenantrag_id');
$result = $this->antraglib->approveWiederholung($studierendenantrag_id, getAuthUID());
if (isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
return $this->outputJsonSuccess($studierendenantrag_id);
}
public function isEntitledToApproveAntrag($studierendenantrag_id)
{
return $this->antraglib->isEntitledToApproveAntrag($studierendenantrag_id);
}
public function getHistory($studierendenantrag_id)
{
if (!$this->antraglib->isEntitledToSeeHistoryForAntrag($studierendenantrag_id)) {
$this->output->set_status_header(403);
return $this->outputJson('Forbidden');
}
$result = $this->antraglib->getAntragHistory($studierendenantrag_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$this->outputJsonSuccess(getData($result) ?: []);
}
}
@@ -1,384 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \REST_Controller as REST_Controller;
/**
*
*/
class Wiederholung extends FHC_Controller
{
/**
* Calls the parent's constructor and loads the FilterCmptLib
*/
public function __construct()
{
parent::__construct();
// Configs
$this->load->config('studierendenantrag');
// Libraries
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
$this->load->library('AntragLib');
$requiredPermissions = [
'saveLvs' => ['student/studierendenantrag:w'],
'getLvsAsRdf' => ['student/studierendenantrag:r', 'student/noten:r'],
'moveLvsToZeugnis' => ['student/studierendenantrag:w', 'student/noten:w']
];
if (isset($requiredPermissions[$this->router->method])) {
if (!$this->permissionlib->isEntitled($requiredPermissions, $this->router->method)) {
$this->output->set_status_header(REST_Controller::HTTP_FORBIDDEN);
$this->outputJson('Forbidden');
exit;
}
}
// Load language phrases
$this->loadPhrases([
'global',
'studierendenantrag'
]);
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Retrieves data of the current studiengang for the current user
*/
public function getDetailsForNewAntrag($prestudent_id)
{
if (!$this->antraglib->isEntitledToCreateAntragFor($prestudent_id, false)) {
$this->output->set_status_header(REST_Controller::HTTP_FORBIDDEN);
return $this->outputJsonError('Forbidden');
}
$result = $this->antraglib->getPrestudentWiederholungsBerechtigt($prestudent_id);
if (isError($result)) {
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJsonError(getError($result));
}
$result = $result->retval;
if (!$result) {
$this->output->set_status_header(REST_Controller::HTTP_FORBIDDEN);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_no_student_no_failed_exam'));
}
elseif ($result == -1)
{
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id, Studierendenantrag_model::TYP_WIEDERHOLUNG);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$data = getData($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id, $data->datum, $data->studiensemester_kurzbz);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
return $this->outputJsonSuccess($data);
}
elseif ($result == -2)
{
$result = $this->antraglib->getDetailsForLastAntrag($prestudent_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$result = getData($result);
$this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_antrag_pending', [
'typ' => $this->p->t('studierendenantrag', 'antrag_typ_' . $result->typ)
]));
}
elseif ($result == -3)
{
$this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST);
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_stg_blacklist'));
}
$result = $this->antraglib->getDetailsForNewAntrag($prestudent_id);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$data = getData($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->outputJsonSuccess($data);
}
public function createAntrag()
{
$this->createAntragWithStatus(true);
}
public function cancelAntrag()
{
$this->createAntragWithStatus(false);
}
protected function createAntragWithStatus($repeat)
{
$this->load->library('form_validation');
$_POST = json_decode($this->input->raw_input_stream, true);
$this->form_validation->set_rules('prestudent_id', 'Prestudent ID', 'required');
$this->form_validation->set_rules('studiensemester', 'Studiensemester', 'required');
if ($this->form_validation->run() == false)
{
return $this->outputJsonError($this->form_validation->error_array());
}
$prestudent_id = $this->input->post('prestudent_id');
$studiensemester = $this->input->post('studiensemester');
$result = $this->antraglib->getPrestudentWiederholungsBerechtigt($prestudent_id);
if (isError($result)) {
return $this->outputJsonError(['db' => getError($result)]);
}
$result = $result->retval;
if (!$result)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_no_student')]);
}
elseif ($result == -1)
{
$result = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
if (isError($result))
return $this->outputJsonError(['db' => getError($result)]);
if (!hasData($result))
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_no_prestudentstatus', [
'prestudent_id' => $prestudent_id
])]);
if (!in_array(current(getData($result))->status_kurzbz, $this->config->item('antrag_prestudentstatus_whitelist')))
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_no_student')]);
}
elseif ($result == -2)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_antrag_exists')]);
}
elseif ($result == -3)
{
return $this->outputJsonError(['db' => $this->p->t('studierendenantrag', 'error_stg_blacklist')]);
}
$result = $this->antraglib->createWiederholung($prestudent_id, $studiensemester, getAuthUID(), $repeat);
if(isError($result))
{
return $this->outputJsonError(['db' => getError($result)]);
}
$antragId = getData($result);
$result = $this->antraglib->getDetailsForAntrag($antragId);
if(!hasData($result))
return $this->outputJsonSuccess(true);
$data = getData($result);
$result = $this->antraglib->getFailedExamForPrestudent($prestudent_id);
// NOTE(chris): error handling for this function should already happenden in antraglib->getPrestudentWiederholungsBerechtigt()
$pruefungsdata = current(getData($result));
$data->studiensemester_kurzbz = $pruefungsdata->studiensemester_kurzbz;
$data->lvbezeichnung = $pruefungsdata->lvbezeichnung;
$data->pruefungsdatum = $pruefungsdata->datum;
$this->outputJsonSuccess($data);
}
public function getLvs($antrag_id)
{
$result = $this->antraglib->getLvsForAntrag($antrag_id);
if (isError($result)) {
$error = getError($result);
if ($error == 'Forbidden')
$this->output->set_status_header(REST_Controller::HTTP_FORBIDDEN);
return $this->outputJsonError(getError($result));
}
$lvs = getData($result);
$this->outputJsonSuccess($lvs);
}
public function saveLvs()
{
$result = $this->getPostJSON();
$antragsLvs = array_merge($result->forbiddenLvs, $result->mandatoryLvs);
$insert = array_map(function ($lv) {
return [
'studierendenantrag_id' => $lv->studierendenantrag_id,
'lehrveranstaltung_id' => $lv->lehrveranstaltung_id,
'note' => $lv->zugelassen
? ($lv->zugelassen == 1 ? 0 : $this->config->item('wiederholung_note_angerechnet'))
: $this->config->item('wiederholung_note_nicht_zugelassen'),
'anmerkung' => $lv->anmerkung,
'insertvon' => getAuthUID(),
'studiensemester_kurzbz' => $lv->studiensemester_kurzbz
];
}, $antragsLvs);
$antrag_ids = array_unique(array_map(function ($lv) {
return $lv['studierendenantrag_id'];
}, $insert));
foreach ($antrag_ids as $antrag_id) {
$result = $this->StudierendenantragModel->loadIdAndStatusWhere([
'studierendenantrag_id' => $antrag_id
]);
if (isError($result))
return $this->outputJsonError(getError($result));
if (!hasData($result))
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_no_antrag_found', ['id' => $antrag_id]));
$antrag = current(getData($result));
if ($antrag->status != Studierendenantragstatus_model::STATUS_CREATED
&& $antrag->status != Studierendenantragstatus_model::STATUS_LVSASSIGNED)
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_antrag_locked'));
}
if(!$antragsLvs)
return $this->outputJsonError($this->p->t('studierendenantrag', 'error_no_lv'));
$result = $this->antraglib->saveLvs($insert);
if (isError($result))
return $this->outputJsonError(getError($result));
$this->outputJsonSuccess(getData($result));
}
public function getLvsAsRdf($prestudent_id)
{
// header für no cache
$this->output->set_header("Cache-Control: no-cache");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$this->output->set_header("Pragma: no-cache");
$this->output->set_header("Content-type: application/xhtml+xml");
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
$sem_akt = $this->variablelib->getVar('semester_aktuell');
$result = $this->antraglib->getLvsForPrestudent($prestudent_id, $sem_akt);
if (isError($result)) {
return $this->outputJsonError(getError($result));
}
$lvs = getData($result) ?: [];
$rdf_url = 'http://www.technikum-wien.at/antragnote';
$this->load->view('lehre/Antrag/Wiederholung/getLvs.rdf.php', [
'url' => $rdf_url,
'lvs' => $lvs
]);
}
public function moveLvsToZeugnis()
{
$anzahl = $this->input->post('anzahl');
$student_uid = $this->input->post('student_uid');
$this->load->model('education/Studierendenantraglehrveranstaltung_model', 'StudierendenantraglehrveranstaltungModel');
$this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
$errormsg = array();
for($i=0; $i<$anzahl; $i++)
{
$id = $this->input->post('studierendenantrag_lehrveranstaltung_id_' . $i);
$result =$this->StudierendenantraglehrveranstaltungModel->load($id);
if(isError($result))
{
$errormsg[] = getError($result);
}
elseif(!hasData($result))
{
$errormsg[] = $this->p->t('studierendenantrag', 'error_no_lv_in_application');
}
else
{
$antragLv = getData($result)[0];
$result= $this->ZeugnisnoteModel->load([
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz
]);
if(isError($result))
{
$errormsg[] = getError($result);
}
else
{
if (hasData($result))
{
$result = $this->ZeugnisnoteModel->update(
[
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz
],
[
'note'=> $antragLv->note,
'uebernahmedatum' => date('c'),
'benotungsdatum' => $antragLv->insertamum,
'updateamum' => date('c'),
'bemerkung'=>$antragLv->anmerkung,
'updatevon'=>getAuthUID()
]
);
}
else
{
$result = $this->ZeugnisnoteModel->insert([
'lehrveranstaltung_id'=> $antragLv->lehrveranstaltung_id,
'student_uid'=> $student_uid,
'studiensemester_kurzbz' => $antragLv->studiensemester_kurzbz,
'note'=> $antragLv->note,
'uebernahmedatum' => date('c'),
'benotungsdatum' => $antragLv->insertamum,
'insertamum' => date('c'),
'bemerkung'=>$antragLv->anmerkung,
'insertvon'=>getAuthUID()
]);
}
if(isError($result))
{
$errormsg[] = getError($result);
}
}
}
}
if($errormsg)
$return = false;
else
$return = true;
$this->load->view('lehre/Antrag/Wiederholung/moveLvs.rdf.php', [
'return' => $return,
'errormsg' => $errormsg
]);
}
}
+1 -1
View File
@@ -2058,7 +2058,7 @@ class AntragLib
*/
public function isEntitledToUnpauseAntrag($antrag_id)
{
return $this->hasAccessToAntrag($antrag_id, 'student/studierendenantrag');
return ($this->hasAccessToAntrag($antrag_id, 'student/antragfreigabe') || $this->hasAccessToAntrag($antrag_id, 'student/studierendenantrag'));
}
/**
@@ -11,6 +11,7 @@ $sitesettings = array(
'customJSModules' => array('public/js/apps/lehre/Antrag.js'),
'customCSSs' => array(
'public/css/Fhc.css',
'public/css/components/primevue.css',
'vendor/vuejs/vuedatepicker_css/main.css'
),
'customJSs' => array(
@@ -20,7 +20,8 @@ $sitesettings = array(
),
'customJSModules' => array('public/js/apps/lehre/Antrag/Leitung.js'),
'customCSSs' => array(
'public/css/Fhc.css'
'public/css/Fhc.css',
'public/css/components/primevue.css',
),
'customJSs' => array(
)
@@ -10,7 +10,8 @@ $sitesettings = array(
),
'customJSModules' => array('public/js/apps/lehre/Antrag/Student.js'),
'customCSSs' => array(
'public/css/Fhc.css'
'public/css/Fhc.css',
'public/css/components/primevue.css',
),
'customJSs' => array(
)
@@ -14,6 +14,8 @@ $sitesettings = array(
),
'customJSModules' => array('public/js/apps/lehre/Antrag/Lvzuweisung.js'),
'customCSSs' => array(
'public/css/Fhc.css',
'public/css/components/primevue.css',
),
'customJSs' => array(
)
@@ -30,7 +32,7 @@ $this->load->view(
<h1 class="h2"><?= $this->p->t('studierendenantrag', 'title_lvzuweisen', ['name' => $antrag->name]);?></h1>
</div>
<div class="fhc-container row mt-3">
<lv-zuweisung antrag-id="<?= $antrag_id; ?>" initial-status-code="<?= $antrag->status; ?>" initial-status-msg="<?= $antrag->statustyp; ?>"<?= ($antrag->status != Studierendenantragstatus_model::STATUS_CREATED && $antrag->status != Studierendenantragstatus_model::STATUS_LVSASSIGNED) ? ' disabled' : ''; ?>></lv-zuweisung>
<lv-zuweisung :antrag-id="<?= $antrag_id; ?>" initial-status-code="<?= $antrag->status; ?>" initial-status-msg="<?= $antrag->statustyp; ?>"<?= ($antrag->status != Studierendenantragstatus_model::STATUS_CREATED && $antrag->status != Studierendenantragstatus_model::STATUS_LVSASSIGNED) ? ' disabled' : ''; ?>></lv-zuweisung>
</div>
</div>
+2 -2
View File
@@ -1658,7 +1658,7 @@ function StudentAuswahl()
var antragnotentree = document.getElementById('student-antragnoten-tree');
url='<?php echo APP_ROOT;?>index.ci.php/components/Antrag/Wiederholung/getLvsAsRdf/'+prestudent_id+"?"+gettimestamp();
url='<?php echo APP_ROOT;?>index.ci.php/api/frontend/fas/studstatus/Wiederholung/getLvs/'+prestudent_id+"?"+gettimestamp();
try
{
@@ -4764,7 +4764,7 @@ function StudentNotenMoveFromAntrag()
var paramList= '';
var i = 0;
var url = '<?php echo APP_ROOT ?>index.ci.php/components/Antrag/Wiederholung/moveLvsToZeugnis';
var url = '<?php echo APP_ROOT ?>index.ci.php/api/frontend/fas/studstatus/Wiederholung/moveLvsToZeugnis';
var req = new phpRequest(url,'','');
for (var t = 0; t < numRanges; t++)
+3 -1
View File
@@ -19,10 +19,12 @@ import search from "./search.js";
import phrasen from "./phrasen.js";
import navigation from "./navigation.js";
import filter from "./filter.js";
import studstatus from "./studstatus.js";
export default {
search,
phrasen,
navigation,
filter
filter,
studstatus
};
+220
View File
@@ -0,0 +1,220 @@
/**
* 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/>.
*/
export default {
abmeldung: {
getDetails(antrag_id, prestudent_id) {
const url = '/api/frontend/v1/studstatus/abmeldung/'
+ (antrag_id !== undefined ? 'getDetailsForAntrag/' + antrag_id : 'getDetailsForNewAntrag/' + prestudent_id);
return this.$fhcApi.get(url);
},
create(stdsem, prestudent_id, grund) {
return this.$fhcApi.post('/api/frontend/v1/studstatus/abmeldung/createAntrag', {
studiensemester: stdsem,
prestudent_id,
grund
}, {
errorHandling: 'strict'
});
},
cancel(antrag_id) {
if (!Array.isArray(antrag_id))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/abmeldung/cancelAntrag',
{ antrag_id }
);
return Promise.allSettled(antrag_id.map(antrag => this.$fhcApi.post(
'/api/frontend/v1/studstatus/abmeldung/cancelAntrag',
{ antrag_id: antrag.studierendenantrag_id },
{ errorHeader: '#' + antrag.studierendenantrag_id }
)));
}
},
unterbrechung: {
getDetails(antrag_id, prestudent_id) {
const url = '/api/frontend/v1/studstatus/unterbrechung/'
+ (antrag_id !== undefined ? 'getDetailsForAntrag/' + antrag_id : 'getDetailsForNewAntrag/' + prestudent_id);
return this.$fhcApi.get(url);
},
create(studiensemester, prestudent_id, grund, datum_wiedereinstieg, attachment) {
return this.$fhcApi.post('/api/frontend/v1/studstatus/unterbrechung/createAntrag', {
studiensemester,
prestudent_id,
grund,
datum_wiedereinstieg,
attachment
}, {
errorHandling: 'strict'
});
},
cancel(antrag_id) {
return this.$fhcApi.post('/api/frontend/v1/studstatus/unterbrechung/cancelAntrag', {
antrag_id
}, {
errorHandling: 'strict'
});
}
},
wiederholung: {
getDetails(prestudent_id) {
const url = '/api/frontend/v1/studstatus/wiederholung/getDetailsForNewAntrag/' + prestudent_id;
return this.$fhcApi.get(url)
},
getLvs(antrag_id) {
const url = '/api/frontend/v1/studstatus/wiederholung/getLvs/' + antrag_id;
return this.$fhcApi.get(url)
},
create(prestudent_id, studiensemester) {
return this.$fhcApi.post('/api/frontend/v1/studstatus/wiederholung/createAntrag', {
prestudent_id,
studiensemester
}, {
errorHandling: 'strict'
});
},
cancel(prestudent_id, studiensemester) {
return this.$fhcApi.post('/api/frontend/v1/studstatus/wiederholung/cancelAntrag', {
prestudent_id,
studiensemester
}, {
errorHandling: 'strict'
});
},
saveLvs(forbiddenLvs, mandatoryLvs) {
return this.$fhcApi.post('/api/frontend/v1/studstatus/wiederholung/saveLvs', {
forbiddenLvs,
mandatoryLvs
});
}
},
leitung: {
getStgs() {
return this.$fhcApi.get('/api/frontend/v1/studstatus/leitung/getActiveStgs');
},
getAntraege(url, config, params) {
return this.$fhcApi
.get('/api/frontend/v1/studstatus/leitung/getAntraege/' + url)
.then(res => res.data); // Return data for tabulator
},
getHistory(antrag_id) {
return this.$fhcApi.get('/api/frontend/v1/studstatus/leitung/getHistory/' + antrag_id)
},
getPrestudents(query, signal) {
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/getPrestudents',
{ query },
{ signal }
);
},
approve(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/approveAntrag',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/approveAntrag',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
},
reject(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/rejectAntrag',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/rejectAntrag',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
},
reopen(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/reopenAntrag',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/reopenAntrag',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
},
pause(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/pauseAntrag',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/pauseAntrag',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
},
unpause(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/unpauseAntrag',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/unpauseAntrag',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
},
object(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/objectAntrag',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/objectAntrag',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
},
approveObjection(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/approveObjection',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/approveObjection',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
},
denyObjection(antrag) {
if (!Array.isArray(antrag))
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/denyObjection',
antrag
);
return Promise.allSettled(antrag.map(a => this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/denyObjection',
a,
{ errorHeader: '#' + a.studierendenantrag_id }
)));
}
}
};
-2
View File
@@ -1,12 +1,10 @@
import StudierendenantragAntrag from "../../components/Studierendenantrag/Antrag.js";
import StudierendenantragStatus from "../../components/Studierendenantrag/Status.js";
import StudierendenantragInfoblock from "../../components/Studierendenantrag/Infoblock.js";
import VueDatePicker from "../../components/vueDatepicker.js.php";
import Phrasen from '../../plugin/Phrasen.js';
const app = Vue.createApp({
components: {
VueDatePicker,
StudierendenantragAntrag,
StudierendenantragStatus,
StudierendenantragInfoblock
@@ -1,10 +1,16 @@
import {CoreFetchCmpt} from '../../Fetch.js';
import CoreForm from '../../Form/Form.js';
import FormValidation from '../../Form/Validation.js';
import FormInput from '../../Form/Input.js';
var _uuid = 0;
export default {
components: {
CoreFetchCmpt
CoreFetchCmpt,
CoreForm,
FormValidation,
FormInput
},
emits: [
'setInfos',
@@ -18,9 +24,8 @@ export default {
return {
data: null,
saving: false,
errors: {
grund: [],
default: []
formData: {
grund: ''
}
}
},
@@ -34,24 +39,14 @@ export default {
case 'Genehmigt': return 'success';
default: return 'warning';
}
},
loadUrl() {
if (this.studierendenantragId)
return '/components/Antrag/Abmeldung/getDetailsForAntrag/'+
this.studierendenantragId;
return '/components/Antrag/Abmeldung/getDetailsForNewAntrag/' +
this.prestudentId;
}
},
methods: {
load() {
return axios.get(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
this.loadUrl
).then(
result => {
this.data = result.data.retval;
return this.$fhcApi.factory
.studstatus.abmeldung.getDetails(this.studierendenantragId, this.prestudentId)
.then(result => {
this.data = result.data;
if (this.data.status) {
const msg = (this.data.status == 'Pause' && this.data.status_insertvon == "Studienabbruch") ? Vue.computed(() => {
let status = this.$p.t('studierendenantrag/status_stop');
@@ -63,8 +58,7 @@ export default {
});
}
return result;
}
);
});
},
createAntrag() {
bootstrap.Modal.getOrCreateInstance(this.$refs.modal).hide();
@@ -73,52 +67,39 @@ export default {
severity: 'warning'
});
this.saving = true;
for(var k in this.errors)
this.errors[k] = [];
axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Abmeldung/createAntrag/', {
studiensemester: this.data.studiensemester_kurzbz,
prestudent_id: this.data.prestudent_id,
grund: this.$refs.grund.value
}
).then(
result => {
if (result.data.error)
{
for (var k in result.data.retval)
{
if (this.errors[k] !== undefined)
this.errors[k].push(result.data.retval[k]);
else
this.errors.default.push(result.data.retval[k]);
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
this.$refs.form.clearValidation();
this.$refs.form.factory
.studstatus.abmeldung.create(
this.data.studiensemester_kurzbz,
this.data.prestudent_id,
this.formData.grund
)
.then(result => {
if (result.data === true)
document.location += "";
this.data = result.data;
if (this.data.status)
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
{
if (result.data.retval === true)
document.location += "";
this.data = result.data.retval;
if (this.data.status) {
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_open')})),
severity:'success'
});
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_open')})),
severity:'success'
});
this.saving = false;
}
);
})
.catch(error => {
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
this.saving = false;
this.$fhcAlert.handleSystemError(error);
});
},
cancelAntrag() {
this.$emit('setStatus', {
@@ -126,51 +107,37 @@ export default {
severity: 'warning'
});
this.saving = true;
for(var k in this.errors)
this.errors[k] = [];
axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Abmeldung/cancelAntrag/', {
antrag_id: this.data.studierendenantrag_id
}
).then(
result => {
if (result.data.error)
{
for (var k in result.data.retval)
{
if (this.errors[k] !== undefined)
this.errors[k].push(result.data.retval[k]);
else
this.errors.default.push(result.data.retval[k]);
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity:'danger'
this.$refs.form.clearValidation();
this.$refs.form.factory
.studstatus.abmeldung.cancel(
this.data.studierendenantrag_id
)
.then(result => {
if (Number.isInteger(result.data))
document.location = document.location.replace(/abmeldung\/([0-9]*)\/[0-9]*[\/]?$/, 'abmeldung/$1') + "/" + result.data;
this.data = result.data;
if (this.data.status)
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
{
if (Number.isInteger(result.data.retval)) {
document.location = document.location.replace(/abmeldung\/([0-9]*)\/[0-9]*[\/]?$/, 'abmeldung/$1') + "/" + result.data.retval;
}
this.data = result.data.retval;
if (this.data.status) {
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_cancelled')})),
severity: 'danger'
});
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_cancelled')})),
severity: 'danger'
});
this.saving = false;
}
);
})
.catch(error => {
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
this.saving = false;
this.$fhcAlert.handleSystemError(error);
});
}
},
created() {
@@ -179,10 +146,9 @@ export default {
template: `
<div class="studierendenantrag-form-abmeldung">
<core-fetch-cmpt :api-function="load">
<div class="row">
<core-form ref="form" class="row">
<div class="col-12">
<div v-for="error in errors.default" class="alert alert-danger" role="alert" v-html="error">
</div>
<form-validation></form-validation>
<table class="table">
<tr>
<th>{{$p.t('lehre', 'studiengang')}}</th>
@@ -219,19 +185,16 @@ export default {
<pre>{{data.grund}}</pre>
</div>
<div v-else class="col-sm-6 mb-3">
<label :for="'studierendenantrag-form-abmeldung-' + uuid + '-grund'" class="form-label">Grund:</label>
<textarea
class="form-control"
:class="{'is-invalid': errors.grund.length}"
:id="'studierendenantrag-form-abmeldung-' + uuid + '-grund'"
<form-input
type="textarea"
label="Grund:"
v-model="formData.grund"
name="grund"
rows="5"
:disabled="saving"
ref="grund"
required
></textarea>
<div v-if="errors.grund.length" class="invalid-feedback">
{{errors.grund.join(".")}}
</div>
>
</form-input>
</div>
<div class="col-12 text-end">
<button
@@ -286,13 +249,13 @@ export default {
</div>
</div>
</div>
</div>
</core-form>
<template v-slot:error="{errorMessage}">
<div class="alert alert-danger m-0" role="alert">
{{ errorMessage }}
</div>
</template>
</core-fetch-cmpt>
</div>
`
</div>`
}
@@ -1,10 +1,16 @@
import {CoreFetchCmpt} from '../../Fetch.js';
import CoreForm from '../../Form/Form.js';
import FormValidation from '../../Form/Validation.js';
import FormInput from '../../Form/Input.js';
var _uuid = 0;
export default {
components: {
CoreFetchCmpt
CoreFetchCmpt,
CoreForm,
FormValidation,
FormInput
},
emits: [
'setInfos',
@@ -18,9 +24,8 @@ export default {
return {
data: null,
saving: false,
errors: {
grund: [],
default: []
formData: {
grund: ''
}
}
},
@@ -35,24 +40,14 @@ export default {
case 'Abgemeldet': return 'success';
default: return 'warning';
}
},
loadUrl() {
if (this.studierendenantragId)
return '/components/Antrag/Abmeldung/getDetailsForAntrag/'+
this.studierendenantragId;
return '/components/Antrag/Abmeldung/getDetailsForNewAntrag/' +
this.prestudentId;
}
},
methods: {
load() {
return axios.get(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
this.loadUrl
).then(
result => {
this.data = result.data.retval;
return this.$fhcApi.factory
.studstatus.abmeldung.getDetails(this.studierendenantragId, this.prestudentId)
.then(result => {
this.data = result.data;
if (this.data.status) {
const msg = (this.data.status == 'Pause' && this.data.status_insertvon == "Studienabbruch") ? Vue.computed(() => {
let status = this.$p.t('studierendenantrag/status_stop');
@@ -64,8 +59,7 @@ export default {
});
}
return result;
}
);
});
},
createAntrag() {
bootstrap.Modal.getOrCreateInstance(this.$refs.modal).hide();
@@ -74,63 +68,44 @@ export default {
severity: 'warning'
});
this.saving = true;
for(var k in this.errors)
this.errors[k] = [];
axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Abmeldung/createAntrag/', {
studiensemester: this.data.studiensemester_kurzbz,
prestudent_id: this.data.prestudent_id,
grund: this.$refs.grund.value
}
).then(
result => {
if (result.data.error)
{
for (var k in result.data.retval)
{
if (this.errors[k] !== undefined)
this.errors[k].push(result.data.retval[k]);
else
this.errors.default.push(result.data.retval[k]);
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
}
else
{
if (result.data.retval === true)
document.location += "";
this.data = result.data.retval;
if (this.data.status) {
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_open')})),
severity:'success'
});
}
this.saving = false;
}
);
},
appendDropDownText(event){
let templateText = this.$refs.grund;
if(event.target.value)
{
let templateT= this.$p.t('studierendenantrag', event.target.value);
templateText.value = templateT;
}
else
templateText.value = '';
this.$refs.form.clearValidation();
this.$refs.form.factory
.studstatus.abmeldung.create(
this.data.studiensemester_kurzbz,
this.data.prestudent_id,
this.formData.grund
)
.then(result => {
if (result.data === true)
document.location += "";
this.data = result.data;
if (this.data.status)
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
else
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_open')})),
severity:'success'
});
this.saving = false;
})
.catch(error => {
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
this.saving = false;
this.$fhcAlert.handleSystemError(error);
});
},
appendDropDownText(event) {
this.formData.grund = event.target.value
? this.$p.t('studierendenantrag', event.target.value)
: '';
},
},
created() {
@@ -139,8 +114,9 @@ export default {
template: `
<div class="studierendenantrag-form-abmeldung">
<core-fetch-cmpt :api-function="load">
<div class="row">
<core-form ref="form" class="row">
<div class="col-12">
<form-validation></form-validation>
<table class="table">
<tr>
<th>{{$p.t('lehre', 'studiengang')}}</th>
@@ -181,8 +157,7 @@ export default {
<div v-else class="col-sm-6 mb-3">
<label :for="'studierendenantrag-form-abmeldung-' + uuid + '-grund'" class="form-label">Grund:</label>
<div class="mb-2">
<select name="grundAv" @change="appendDropDownText
($event)">
<select name="grundAv" class="form-select" @change="appendDropDownText">
<option value="" > --- bitte auswählen, sofern zutreffend ---- </option>
<option value="textLong_NichtantrittStudium">{{$p.t('studierendenantrag', 'dropdown_NichtantrittStudium')}}
</option>
@@ -199,19 +174,17 @@ export default {
<option value="textLong_MissingZgv">{{$p.t('studierendenantrag', 'dropdown_MissingZgv')}}
</option>
</select>
</div>
<textarea
class="form-control"
:class="{'is-invalid': errors.grund.length}"
</div>
<form-input
type="textarea"
v-model="formData.grund"
name="grund"
:id="'studierendenantrag-form-abmeldung-' + uuid + '-grund'"
rows="5"
:disabled="saving"
ref="grund"
required
></textarea>
<div v-if="errors.grund.length" class="invalid-feedback">
{{errors.grund.join(".")}}
</div>
>
</form-input>
</div>
<div class="col-12 text-end">
@@ -257,7 +230,7 @@ export default {
</div>
</div>
</div>
</div>
</core-form>
<template v-slot:error="{errorMessage}">
<div class="alert alert-danger m-0" role="alert">
@@ -265,6 +238,5 @@ export default {
</div>
</template>
</core-fetch-cmpt>
</div>
`
</div>`
}
@@ -1,12 +1,15 @@
import {CoreFetchCmpt} from '../../Fetch.js';
import VueDatepicker from '../../vueDatepicker.js.php';
import CoreForm from '../../Form/Form.js';
import FormValidation from '../../Form/Validation.js';
import FormInput from '../../Form/Input.js';
var _uuid = 0;
export default {
components: {
CoreFetchCmpt,
VueDatepicker
CoreForm,
FormValidation,
FormInput
},
emits: [
'setInfos',
@@ -20,12 +23,7 @@ export default {
return {
data: null,
saving: false,
errors: {
grund: [],
studiensemester: [],
datum_wiedereinstieg: [],
default: []
},
attachment: [],
stsem: null,
currentWiedereinstieg: '',
siteUrl: FHC_JS_DATA_STORAGE_OBJECT.app_root +
@@ -45,13 +43,6 @@ export default {
default: return 'warning';
}
},
loadUrl() {
if (this.studierendenantragId)
return '/components/Antrag/Unterbrechung/getDetailsForAntrag/'+
this.studierendenantragId;
return '/components/Antrag/Unterbrechung/getDetailsForNewAntrag/' +
this.prestudentId;
},
datumWsFormatted() {
let datumUnformatted = '';
@@ -81,26 +72,24 @@ export default {
},
methods: {
load() {
return axios.get(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
this.loadUrl
).then(
result => {
this.data = result.data.retval;
if (this.data.status) {
const msg = (this.data.status == 'Pause' && this.data.status_insertvon == "Studienabbruch") ? Vue.computed(() => {
let status = this.$p.t('studierendenantrag/status_stop');
return this.$p.t('studierendenantrag', 'status_x', {status});
}) : Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp}));
this.$emit("setStatus", {
msg,
severity: this.statusSeverity
});
return this.$fhcApi.factory
.studstatus.unterbrechung.getDetails(this.studierendenantragId, this.prestudentId)
.then(
result => {
this.data = result.data;
if (this.data.status) {
const msg = (this.data.status == 'Pause' && this.data.status_insertvon == "Studienabbruch") ? Vue.computed(() => {
let status = this.$p.t('studierendenantrag/status_stop');
return this.$p.t('studierendenantrag', 'status_x', {status});
}) : Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp}));
this.$emit("setStatus", {
msg,
severity: this.statusSeverity
});
}
return result;
}
return result;
}
);
);
},
createAntrag() {
this.$emit('setStatus', {
@@ -108,63 +97,41 @@ export default {
severity: 'warning'
});
this.saving = true;
for(var k in this.errors)
this.errors[k] = [];
var formData = new FormData();
var attachment = this.$refs.attachment;
formData.append("attachment", attachment.files[0]);
formData.append("studiensemester", this.stsem !== null && this.data.studiensemester[this.stsem].studiensemester_kurzbz);
formData.append("prestudent_id", this.data.prestudent_id);
formData.append("grund", this.$refs.grund.value);
formData.append("datum_wiedereinstieg", this.stsem !== null && this.currentWiedereinstieg);
this.$refs.form.clearValidation();
this.$refs.form.factory
.studstatus.unterbrechung.create(
this.stsem !== null && this.data.studiensemester[this.stsem].studiensemester_kurzbz,
this.data.prestudent_id,
this.data.grund,
this.stsem !== null && this.currentWiedereinstieg,
this.attachment
)
.then(result => {
if (Number.isInteger(result.data))
document.location += "/" + result.data;
axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Unterbrechung/createAntrag/',
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
}
}
).then(
result => {
if (result.data.error)
{
for (var k in result.data.retval)
{
if (this.errors[k] !== undefined)
this.errors[k].push(result.data.retval[k]);
else
this.errors.default.push(result.data.retval[k]);
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
this.data = result.data;
if (this.data.status)
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
{
if (Number.isInteger(result.data.retval))
document.location += "/" + result.data.retval;
this.data = result.data.retval;
if (this.data.status) {
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_created')})),
severity: 'info'
});
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_created')})),
severity: 'info'
});
this.saving = false;
}
);
})
.catch(error => {
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
this.saving = false;
this.$fhcAlert.handleSystemError(error);
});
},
cancelAntrag() {
this.$emit('setStatus', {
@@ -172,63 +139,45 @@ export default {
severity: 'warning'
});
this.saving = true;
for(var k in this.errors)
this.errors[k] = [];
axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Unterbrechung/cancelAntrag/', {
antrag_id: this.data.studierendenantrag_id
}
).then(
result => {
if (result.data.error)
{
for (var k in result.data.retval)
{
if (this.errors[k] !== undefined)
this.errors[k].push(result.data.retval[k]);
else
this.errors.default.push(result.data.retval[k]);
}
this.$refs.form.clearValidation();
this.$refs.form.factory
.studstatus.unterbrechung.cancel(
this.data.studierendenantrag_id
)
.then(result => {
if (Number.isInteger(result.data))
document.location = document.location.replace(/unterbrechung\/([0-9]*)\/[0-9]*[\/]?$/, 'unterbrechung/$1') + "/" + result.data;
this.data = result.data;
if (this.data.status)
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
else
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_cancelled')})),
severity: 'danger'
});
}
else
{
if (Number.isInteger(result.data.retval)) {
document.location = document.location.replace(/unterbrechung\/([0-9]*)\/[0-9]*[\/]?$/, 'unterbrechung/$1') + "/" + result.data.retval;
}
this.data = result.data.retval;
if (this.data.status) {
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
else
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_cancelled')})),
severity: 'danger'
});
}
this.saving = false;
}
);
})
.catch(error => {
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
this.saving = false;
this.$fhcAlert.handleSystemError(error);
});
}
},
created() {
this.uuid = _uuid++;
},
template: `
<div class="studierendenantrag-form-unterbrechung">
<core-fetch-cmpt :api-function="load">
<div class="row">
<core-form ref="form" class="row">
<div class="col-12">
<div v-for="error in errors.default" class="alert alert-danger" role="alert" v-html="error">
</div>
<form-validation></form-validation>
<table class="table">
<tr>
<th>{{$p.t('lehre', 'studiengang')}}</th>
@@ -260,93 +209,99 @@ export default {
</div>
<div class="col-sm-6 mb-3">
<label :for="'studierendenantrag-form-abmeldung-' + uuid + '-stsem'" class="form-label">
{{$p.t('lehre', 'studiensemester')}}
</label>
<div v-if="data.studierendenantrag_id">
{{data.studiensemester_kurzbz}}
</div>
<div v-else>
<select
class="form-select"
:class="{'is-invalid': errors.studiensemester.length}"
v-model="stsem"
required
:id="'studierendenantrag-form-abmeldung-' + uuid + '-stsem'"
@input="currentWiedereinstieg = ''"
>
<option v-for="(stsem, index) in data.studiensemester" :key="index" :value="index" :disabled="stsem.disabled">
{{stsem.studiensemester_kurzbz}}
</option>
</select>
<div v-if="errors.studiensemester.length" class="invalid-feedback">
{{errors.studiensemester.join(".")}}
<label class="form-label">
{{$p.t('lehre', 'studiensemester')}}
</label>
<div>
{{data.studiensemester_kurzbz}}
</div>
</div>
<form-input
v-else
type="select"
v-model="stsem"
name="studiensemester"
:label="$p.t('lehre', 'studiensemester')"
required
@input="currentWiedereinstieg = ''"
>
<option v-for="(stsem, index) in data.studiensemester" :key="index" :value="index" :disabled="stsem.disabled">
{{stsem.studiensemester_kurzbz}}
</option>
</form-input>
</div>
<div class="col-sm-6 mb-3">
<label class="form-label">
{{$p.t('studierendenantrag', 'antrag_datum_wiedereinstieg')}}
</label>
<div v-if="data.studierendenantrag_id">
{{datumWsFormatted}}
</div>
<div v-else-if="stsem === null">
<select class="form-select" disabled>
<option selected>{{$p.t('ui/select_studiensemester')}}</option>
</select>
</div>
<div v-else>
<select v-model="currentWiedereinstieg" class="form-select">
<option v-for="sem in data.studiensemester[stsem].wiedereinstieg" :key="sem.studiensemester_kurzbz" :value="sem.start" :disabled="sem.disabled">
{{sem.studiensemester_kurzbz}}
</option>
</select>
</div>
<div v-if="errors.datum_wiedereinstieg.length" class="invalid-feedback d-block">
{{errors.datum_wiedereinstieg.join(".")}}
<label class="form-label">
{{$p.t('studierendenantrag', 'antrag_datum_wiedereinstieg')}}
</label>
<div>
{{datumWsFormatted}}
</div>
</div>
<form-input
v-else-if="stsem === null"
type="select"
:label="$p.t('studierendenantrag', 'antrag_datum_wiedereinstieg')"
modelValue=""
name="datum_wiedereinstieg"
disabled
>
<template #default>
<option value="" selected disabled hidden>{{$p.t('ui/select_studiensemester')}}</option>
</template>
</form-input>
<form-input
v-else
type="select"
:label="$p.t('studierendenantrag', 'antrag_datum_wiedereinstieg')"
v-model="currentWiedereinstieg"
name="datum_wiedereinstieg"
>
<option v-for="sem in data.studiensemester[stsem].wiedereinstieg" :key="sem.studiensemester_kurzbz" :value="sem.start" :disabled="sem.disabled">
{{sem.studiensemester_kurzbz}}
</option>
</form-input>
</div>
<div v-if="data.studierendenantrag_id" class="mb-3">
<h5>{{$p.t('studierendenantrag', 'antrag_grund')}}:</h5>
<textarea class="form-control" rows="5" readonly>{{data.grund}}</textarea>
</div>
<div v-else class="col-sm-6 mb-3">
<label :for="'studierendenantrag-form-abmeldung-' + uuid + '-grund'" class="form-label">Grund:</label>
<textarea
class="form-control"
:class="{'is-invalid': errors.grund.length}"
:id="'studierendenantrag-form-abmeldung-' + uuid + '-grund'"
<div class="col-sm-6 mb-3">
<form-input
v-if="data.studierendenantrag_id"
type="textarea"
:label="$p.t('studierendenantrag', 'antrag_grund') + ':'"
v-model="data.grund"
name="grund"
rows="5"
:disabled="saving"
readonly
>
</form-input>
<form-input
v-else
ref="grund"
type="textarea"
:label="$p.t('studierendenantrag', 'antrag_grund') + ':'"
v-model="data.grund"
name="grund"
:disabled="saving"
rows="5"
required
></textarea>
<div v-if="errors.grund.length" class="invalid-feedback">
{{errors.grund.join(".")}}
</div>
>
</form-input>
</div>
<div class="col-12 mb-3">
<div v-if="data.studierendenantrag_id">
<a v-if="data.dms_id" target="_blank" :href="siteUrl + '/lehre/Antrag/Attachment/Show/' + data.dms_id"> {{$p.t('studierendenantrag', 'antrag_dateianhaenge')}} </a>
<span v-else>{{$p.t('studierendenantrag', 'no_attachments')}}</span>
</div>
<div v-else>
<label
:for="'studierendenantrag-form-abmeldung-' + uuid + '-attachment'"
class="form-label">
{{$p.t('studierendenantrag', 'antrag_dateianhaenge')}}
</label>
<input
class="form-control"
type="file"
ref="attachment"
:id="'studierendenantrag-form-abmeldung-' + uuid + '-attachment'"
name="attachment">
</div>
<form-input
v-else
ref="attachment"
type="uploadfile"
:label="$p.t('studierendenantrag', 'antrag_dateianhaenge')"
v-model="attachment"
name="attachment"
>
</form-input>
</div>
<div class="col-12 text-end">
<button
@@ -368,13 +323,12 @@ export default {
{{$p.t('studierendenantrag', 'btn_cancel')}}
</button>
</div>
</div>
</core-form>
<template v-slot:error="{errorMessage}">
<div class="alert alert-danger m-0" role="alert">
{{ errorMessage }}
</div>
</template>
</core-fetch-cmpt>
</div>
`
</div>`
}
@@ -1,12 +1,13 @@
import {CoreFetchCmpt} from '../../Fetch.js';
import VueDatepicker from '../../vueDatepicker.js.php';
import CoreForm from '../../Form/Form.js';
import FormValidation from '../../Form/Validation.js';
var _uuid = 0;
export default {
components: {
CoreFetchCmpt,
VueDatepicker
CoreForm,
FormValidation
},
emits: [
'setInfos',
@@ -22,12 +23,6 @@ export default {
return {
data: null,
saving: false,
errors: {
grund: [],
default: []
},
siteUrl: FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router,
infos: []
}
},
@@ -45,10 +40,6 @@ export default {
default: return 'warning';
}
},
loadUrl() {
return '/components/Antrag/Wiederholung/getDetailsForNewAntrag/' +
this.prestudentId;
},
datumPruefungFormatted() {
if(!this.data.pruefungsdatum)
return '';
@@ -58,13 +49,12 @@ export default {
},
methods: {
load() {
return axios.get(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
this.loadUrl
).then(
result => {
this.data = result.data.retval;
return this.$fhcApi.factory
.studstatus.wiederholung.getDetails(
this.prestudentId
)
.then(result => {
this.data = result.data;
if (!this.data.status || this.data.status == 'ErsteAufforderungVersandt' || this.data.status == 'ZweiteAufforderungVersandt') {
this.data.status = 'Offen';
this.data.statustyp = this.$p.t('studierendenantrag', 'status_open');
@@ -79,8 +69,7 @@ export default {
severity: this.statusSeverity
});
return result;
}
);
});
},
createAntrag() {
this.createAntragWithStatus(true);
@@ -89,7 +78,7 @@ export default {
this.createAntragWithStatus(false);
},
createAntragWithStatus(repeat) {
let func = repeat ? 'createAntrag' : 'cancelAntrag';
let func = repeat ? 'create' : 'cancel';
let nextState = repeat ? 'Erstellt' : 'Verzichtet';
this.$emit('setStatus', {
@@ -97,54 +86,36 @@ export default {
severity: 'warning'
});
this.saving = true;
for(var k in this.errors)
this.errors[k] = [];
axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Wiederholung/' + func + '/',
{
prestudent_id: this.data.prestudent_id,
studiensemester: this.data.studiensemester_kurzbz
}
).then(
result => {
if (result.data.error)
{
for (var k in result.data.retval)
{
if (this.errors[k] !== undefined)
this.errors[k].push(result.data.retval[k]);
else
this.errors.default.push(result.data.retval[k]);
}
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
}
else
{
if (result.data.retval === true)
document.location += "";
this.data = result.data.retval;
if (!this.data.status)
this.data.status = nextState;
this.$emit('update:status', this.data.status);
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
}
this.$refs.form.factory
.studstatus.wiederholung[func](
this.data.prestudent_id,
this.data.studiensemester_kurzbz
)
.then(result => {
if (result.data === true)
document.location += "";
this.data = result.data;
if (!this.data.status)
this.data.status = nextState;
this.$emit('update:status', this.data.status);
this.$emit("setStatus", {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.data.statustyp})),
severity: this.statusSeverity
});
this.saving = false;
}
);
})
.catch(error => {
this.$emit('setStatus', {
msg: Vue.computed(() => this.$p.t('studierendenantrag', 'status_x', {status: this.$p.t('studierendenantrag', 'status_error')})),
severity: 'danger'
});
this.saving = false;
this.$fhcAlert.handleSystemError(error);
});
}
},
created() {
this.uuid = _uuid++;
},
mounted() {
this.infos = [...Array(5).keys()].map(n => ({
body: Vue.computed(() => this.$p.t('studierendenantrag', 'infotext_Wiederholung_' + n))
@@ -154,10 +125,9 @@ export default {
template: `
<div class="studierendenantrag-form-wiederholung">
<core-fetch-cmpt :api-function="load">
<div class="row">
<core-form ref="form" class="row">
<div class="col-12">
<div v-for="error in errors.default" class="alert alert-danger" role="alert" v-html="error">
</div>
<form-validation></form-validation>
<table class="table">
<tr>
<th>{{$p.t('lehre', 'studiengang')}}</th>
@@ -206,7 +176,7 @@ export default {
{{$p.t('studierendenantrag/antrag_Wiederholung_button_no')}}
</button>-->
</div>
</div>
</core-form>
<template v-slot:error="{errorMessage}">
<div class="alert alert-danger m-0" role="alert">
{{ errorMessage }}
@@ -39,15 +39,10 @@ export default {
},
methods: {
loadFilter() {
axios.get(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/getActiveStgs'
).then(result => {
this.stgs = result.data.retval;
}).catch(error => {
console.error(error);
});
this.$fhcApi.factory
.studstatus.leitung.getStgs()
.then(result => this.stgs = result.data)
.catch(this.$fhcAlert.handleSystemError);
},
changeFilter(filter) {
this.filter = filter || undefined;
@@ -103,21 +98,9 @@ export default {
}
} else {
this.$refs.loader.show();
axios
.all(
oks.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/approve' + antrag.typ,
{
studierendenantrag_id: antrag.studierendenantrag_id
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.approve(oks)
.then(this.showResults);
}
},
actionReject(evt, gruende) {
@@ -147,99 +130,38 @@ export default {
.catch(() => {});
} else {
this.$refs.loader.show();
axios
.all(
gruende.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/reject' + antrag.typ,
{
studierendenantrag_id: antrag.studierendenantrag_id,
grund: antrag.grund
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.reject(gruende)
.then(this.showResults);
}
},
actionReopen(evt) {
var antraege = evt || this.selectedData;
this.$refs.loader.show();
axios
.all(
antraege.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/reopenAntrag/',
{
studierendenantrag_id: antrag.studierendenantrag_id
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.reopen(gruende)
.then(this.showResults);
},
actionPause(evt) {
var antraege = evt || this.selectedData;
this.$refs.loader.show();
axios
.all(
antraege.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/pauseAntrag/',
{
studierendenantrag_id: antrag.studierendenantrag_id
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.pause(antraege)
.then(this.showResults);
},
actionUnpause(evt) {
var antraege = evt || this.selectedData;
this.$refs.loader.show();
axios
.all(
antraege.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/unpauseAntrag/',
{
studierendenantrag_id: antrag.studierendenantrag_id
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.unpause(antraege)
.then(this.showResults);
},
actionObject(evt) {
var antraege = evt || this.selectedData;
this.$refs.loader.show();
axios
.all(
antraege.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/objectAntrag/',
{
studierendenantrag_id: antrag.studierendenantrag_id
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.object(antraege)
.then(this.showResults);
},
actionoObjectionDeny(evt, gruende) {
var antraege = evt || this.selectedData;
@@ -267,84 +189,31 @@ export default {
.catch(() => {});
} else {
this.$refs.loader.show();
axios
.all(
gruende.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/objectionDeny/',
{
studierendenantrag_id: antrag.studierendenantrag_id,
grund: antrag.grund
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.denyObjection(gruende)
.then(this.showResults);
}
},
actionObjectionApprove(evt, gruende) {
var antraege = evt || this.selectedData;
this.$refs.loader.show();
axios
.all(
antraege.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/objectionApprove/',
{
studierendenantrag_id: antrag.studierendenantrag_id
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.leitung.approveObjection(antraege)
.then(this.showResults);
},
actionCancel(evt) {
var antraege = evt || this.selectedData;
this.$refs.loader.show();
axios
.all(
antraege.map(
antrag => axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Abmeldung/cancelAntrag/',
{
antrag_id: antrag.studierendenantrag_id
}
)
)
)
.then(this.showValidation)
.catch(this.showError);
this.$fhcApi.factory
.studstatus.abmeldung.cancel(antraege)
.then(this.showResults);
},
showValidation(results) {
var errors = results.filter(res => res.data.error);
showResults(results) {
let fulfilled = results.filter(res => res.status == 'fulfilled');
this.$refs.loader.hide();
if (errors.length) {
let errorMsg = errors.map(
error =>
'Antrag ' +
JSON.parse(error.config.data).studierendenantrag_id +
'\n' +
Object.values(error.data.retval).join('\n')
).join('\n');
BsAlert.popup(errorMsg, {dialogClass: 'alert alert-danger'});
}
this.reload();
},
showError(error) {
this.$refs.loader.hide();
let msg = error.response.data;
if (msg.replace(/^\s+/, '').substr(0, 9) == '<!DOCTYPE' || msg.replace(/^\s+/, '').substr(0, 4).toLowerCase() == '<div')
msg = error.message;
BsAlert.popup(msg, {dialogClass: 'alert alert-danger'});
//fulfilled.forEach(a => this.$fhcAlert.alertDefault('success', '#' + a.value.data, 'Approved, ...'));
if (fulfilled.length)
this.reload();
}
},
created() {
@@ -39,24 +39,12 @@ export default {
this.abortController.abort();
this.abortController = new AbortController();
axios.post(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Abmeldung/getStudiengaengeAssistenz/',
evt,
{
signal: this.abortController.signal
}
).then(
result => {
if (result.data.error) {
BsAlert.popup(result.data.retval, {dialogClass: 'alert alert-danger'});
} else {
this.data = result.data.retval;
}
return result;
}
).catch(() => {});
this.$fhcApi.factory
.studstatus.leitung.getPrestudents(evt.query, this.abortController.signal)
.then(result => {
this.data = result.data;
})
.catch(this.$fhcApi.handleSystemError);
}
},
template: `
@@ -36,21 +36,17 @@ export default {
},
methods: {
setlvs(param) {
if(param.error) {
this.$refs.fetchCompt.error = true;
this.$refs.fetchCompt.errorMessage = param.retval;
} else {
this.repeat_last = !!param.retval.repeat_last;
if (this.repeat_last) {
delete param.retval.repeat_last;
}
this.lvs = param.retval;
this.repeat_last = !!param.repeat_last;
if (this.repeat_last) {
delete param.repeat_last;
}
this.lvs = param;
},
loadlvs() {
if (!this.antragId)
return new Promise(() => {});
return axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Antrag/Wiederholung/getLvs/' + this.antragId);
return this.$fhcApi.factory
.studstatus.wiederholung.getLvs(this.antragId);
},
submit(result) {
this.result = [result, this.check];
@@ -31,9 +31,6 @@ export default {
],
data() {
return {
ajaxUrl: FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/getAntraege/',
table: null,
lastHistoryClickedId: null,
historyData: [],
@@ -42,7 +39,7 @@ export default {
},
methods: {
reload(stg) {
this.table.setData(this.ajaxUrl + (stg || ''));
this.table.setData('/' + (stg || ''));
},
download() {
this.table.download("csv", "data.csv", {
@@ -53,14 +50,12 @@ export default {
getHistory() {
if (this.lastHistoryClickedId === null)
return null;
return axios.get(
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/components/Antrag/Leitung/getHistory/' +
this.lastHistoryClickedId
).then(res => {
this.historyData = res.data.retval.sort((a, b) => a.insertamum > b.insertamum);
});
return this.$fhcApi.factory
.studstatus.leitung.getHistory(this.lastHistoryClickedId)
.then(res => {
this.historyData = res.data.sort((a, b) => a.insertamum > b.insertamum);
})
.catch(this.$fhcApi.handleSystemError);
},
getHistoryStatus(data, index) {
if (data.insertvon == 'Studienabbruch')
@@ -116,7 +111,8 @@ export default {
movableColumns: true,
height: '65vh',
layout: "fitDataFill",
ajaxURL: this.ajaxUrl + (this.filter || ''),
ajaxURL: '/' + (this.filter || ''),
ajaxRequestFunc: this.$fhcApi.factory.studstatus.leitung.getAntraege,
persistence: { // NOTE(chris): do not store column titles
sort: true, //persist column sorting
filter: true, //persist filters
@@ -56,39 +56,19 @@ export default {
anmerkung: lv.antrag_anmerkung || "",
studiensemester_kurzbz: this.lvs2sem
}));
axios.post(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Antrag/Wiederholung/saveLvs/', {forbiddenLvs, mandatoryLvs})
this.$fhcApi.factory
.studstatus.wiederholung.saveLvs(forbiddenLvs, mandatoryLvs)
.then(response => {
if(!response.data.error) {
this.addAlert('Speichern erfolgreich', 'alert-success');
this.statusCode = response.data.retval[0].studierendenantrag_statustyp_kurzbz;
this.statusMsg = response.data.retval[0].typ;
} else {
this.addAlert(response.data.retval.message || response.data.retval, 'alert-danger');
this.statusCode = 0;
this.statusMsg = 'Error';
}
this.$fhcAlert.alertSuccess('Speichern erfolgreich');
this.statusCode = response.data[0].studierendenantrag_statustyp_kurzbz;
this.statusMsg = response.data[0].typ;
this.isloading = false;
}).catch(error => {
this.addAlert(error.message, 'alert-danger');
})
.catch(error => {
this.statusCode = 0;
this.statusMsg = 'Error';
this.isloading = false;
}).finally(() => {
window.scrollTo(0, 0);
});
},
addAlert(text, type) {
const para = document.createElement("p");
para.innerText = text;
para.className = "alert " + type + " alert-dismissible fade show";
const btn = document.createElement("button");
btn.className = "btn-close";
btn.type = "button";
btn.setAttribute("aria-label", "Close");
btn.setAttribute("data-bs-dismiss", "alert");
para.appendChild(btn);
this.$refs.alertbox.appendChild(para);
}
},
created() {
@@ -96,149 +76,141 @@ export default {
this.statusMsg = this.initialStatusMsg;
},
mounted() {
axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Antrag/Wiederholung/getLvs/' + this.antragId).then(
result => {
if(result.data.error)
{
this.addAlert(result.data.retval, 'alert-danger');
this.isloading = true;
}
else
{
let res = {};
this.$p
.loadCategory(['ui', 'lehre', 'studierendenantrag', 'global'])
.then(() => {
for (var k in result.data.retval) {
if (k === 'repeat_last')
continue;
if (result.data.retval[k] === null) {
const alert = document.createElement('div');
alert.innerHTML = this.$p.t('studierendenantrag', 'error_stg_last_semester');
alert.className = 'alert alert-warning';
alert.role = 'alert';
this.$refs["lvtable" + k.substr(0,1)].append(alert);
continue;
this.$p
.loadCategory(['ui', 'lehre', 'studierendenantrag', 'global'])
.then(() => this.antragId)
.then(this.$fhcApi.factory.studstatus.wiederholung.getLvs)
.then(result => {
let res = {};
for (var k in result.data) {
if (k === 'repeat_last')
continue;
if (result.data[k] === null) {
const alert = document.createElement('div');
alert.innerHTML = this.$p.t('studierendenantrag', 'error_stg_last_semester');
alert.className = 'alert alert-warning';
alert.role = 'alert';
this.$refs["lvtable" + k.substr(0,1)].append(alert);
continue;
}
let lvs = result.data[k].reduce((obj,lv) => {
obj[lv.studienplan_lehrveranstaltung_id] = lv;
return obj;
}, {});
for (var lv of Object.values(lvs)) {
if (!lv.studienplan_lehrveranstaltung_id_parent)
continue;
if (!lvs[lv.studienplan_lehrveranstaltung_id_parent])
console.error('parent not available');
else {
if (!lvs[lv.studienplan_lehrveranstaltung_id_parent]._children)
lvs[lv.studienplan_lehrveranstaltung_id_parent]._children = [];
lvs[lv.studienplan_lehrveranstaltung_id_parent]._children.push(lv);
}
}
res[k] = Object.values(lvs).filter(lv => !lv.studienplan_lehrveranstaltung_id_parent);
let current = res[k];
let index = k.substr(0,1);
const options = {
data: current,
dataTree: true,
dataTreeStartExpanded: true, //start with an expanded tree
dataTreeChildIndent: 15,
layout: "fitDataStretch",
columns: [
{title: this.$p.t('ui', 'bezeichnung'), field: "bezeichnung"},
{title: this.$p.t('lehre','lehrform'), field: "lehrform_kurzbz"},
{title: "ECTS", field: "ects"},
{title: this.$p.t('lehre','note'), field: "note", formatter:(cell, formatterParams, onRendered) => cell.getValue() || "---"},
{
title: index == 1 && !result.data.repeat_last ? this.$p.t('studierendenantrag','lv_nicht_zulassen') : this.$p.t('studierendenantrag','lv_wiederholen'),
field: "antrag_zugelassen",
formatter: (cell, formatterParams, onRendered) => {
let data = cell.getData();
if (data._children || !data.zeugnis)
return "";
let input = document.createElement('input');
input.className = "form-check-input";
input.type = "checkbox";
input.role = "switch";
input.checked = cell.getValue();
input.addEventListener('input', () => {
lvs[data.studienplan_lehrveranstaltung_id].antrag_zugelassen = input.checked;
cell.getRow().reformat();
});
if (this.disabled) {
input.disabled = true;
}
let div = document.createElement('div');
div.className = 'form-check form-switch';
div.append(input);
return div;
}
let lvs = result.data.retval[k].reduce((obj,lv) => {
obj[lv.studienplan_lehrveranstaltung_id] = lv;
return obj;
}, {});
for (var lv of Object.values(lvs)) {
if (!lv.studienplan_lehrveranstaltung_id_parent)
continue;
if (!lvs[lv.studienplan_lehrveranstaltung_id_parent])
console.error('parent not available');
else {
if (!lvs[lv.studienplan_lehrveranstaltung_id_parent]._children)
lvs[lv.studienplan_lehrveranstaltung_id_parent]._children = [];
lvs[lv.studienplan_lehrveranstaltung_id_parent]._children.push(lv);
},
{
title: this.$p.t('global','anmerkung'),
field: "antrag_anmerkung",
headerSort:false,
titleFormatter:(cell, formatterParams, onRendered)=>{
let link = document.createElement('a');
link.addEventListener('click', (e) => {
e.preventDefault();
});
link.href ="#";
link.title = this.$p.t('studierendenantrag','anmerkung_tooltip');
new bootstrap.Tooltip(link);
let tooltip = document.createElement('span');
tooltip.innerHTML = this.$p.t('global','anmerkung') + " ";
tooltip.append(link);
let icon = document.createElement('i');
link.append(icon);
icon.className = "fa fa-info-circle";
icon.setAttribute("aria-hidden", "true");
icon.style.minWidth = '1em';
return tooltip;
},
formatter: (cell, formatterParams, onRendered) => {
if (this.disabled) {
return cell.getValue() || "";
}
var data = cell.getData();
if (lvs[data.studienplan_lehrveranstaltung_id].antrag_zugelassen)
{
let input = document.createElement('input');
input.className = "form-control";
input.type = "text";
input.value = cell.getValue() || "";
input.addEventListener('input', () => {
lvs[data.studienplan_lehrveranstaltung_id].antrag_anmerkung = input.value;
});
return input;
}
else
{
return "";
}
}
res[k] = Object.values(lvs).filter(lv => !lv.studienplan_lehrveranstaltung_id_parent);
let current = res[k];
let index = k.substr(0,1);
const options = {
data: current,
dataTree: true,
dataTreeStartExpanded: true, //start with an expanded tree
dataTreeChildIndent: 15,
layout: "fitDataStretch",
columns: [
{title: this.$p.t('ui', 'bezeichnung'), field: "bezeichnung"},
{title: this.$p.t('lehre','lehrform'), field: "lehrform_kurzbz"},
{title: "ECTS", field: "ects"},
{title: this.$p.t('lehre','note'), field: "note", formatter:(cell, formatterParams, onRendered)=>cell.getValue() || "---"},
{
title: index == 1 && !result.data.retval.repeat_last ? this.$p.t('studierendenantrag','lv_nicht_zulassen') : this.$p.t('studierendenantrag','lv_wiederholen'),
field: "antrag_zugelassen",
formatter: (cell, formatterParams, onRendered) => {
let data = cell.getData();
if(data._children || !data.zeugnis)
return "";
let input = document.createElement('input');
input.className = "form-check-input";
input.type = "checkbox";
input.role = "switch";
input.checked = cell.getValue();
input.addEventListener('input', () => {
lvs[data.studienplan_lehrveranstaltung_id].antrag_zugelassen = input.checked;
cell.getRow().reformat();
});
if (this.disabled) {
input.disabled = true;
}
let div = document.createElement('div');
div.className = 'form-check form-switch';
div.append(input);
return div;
}
},
{
title: this.$p.t('global','anmerkung'),
field: "antrag_anmerkung",
headerSort:false,
titleFormatter:(cell, formatterParams, onRendered)=>{
let link = document.createElement('a');
link.addEventListener('click', (e) => {
e.preventDefault();
});
link.href ="#";
link.title = this.$p.t('studierendenantrag','anmerkung_tooltip');
new bootstrap.Tooltip(link);
let tooltip = document.createElement('span');
tooltip.innerHTML = this.$p.t('global','anmerkung') + " ";
tooltip.append(link);
let icon = document.createElement('i');
link.append(icon);
icon.className = "fa fa-info-circle";
icon.setAttribute("aria-hidden", "true");
icon.style.minWidth = '1em';
return tooltip;
},
formatter: (cell, formatterParams, onRendered) => {
if (this.disabled) {
return cell.getValue() || "";
}
var data = cell.getData();
if (lvs[data.studienplan_lehrveranstaltung_id].antrag_zugelassen)
{
let input = document.createElement('input');
input.className = "form-control";
input.type = "text";
input.value = cell.getValue() || "";
input.addEventListener('input', () => {
lvs[data.studienplan_lehrveranstaltung_id].antrag_anmerkung = input.value;
});
return input;
}
else
{
return "";
}
}
}
]
};
var table = new Tabulator(this.$refs["lvtable" + k.substr(0,1)], options);
}
this.lvs = result.data.retval;
});
]
};
var table = new Tabulator(this.$refs["lvtable" + k.substr(0,1)], options);
}
}
);
this.lvs = result.data;
})
.catch(error => {
this.$fhcAlert.handleSystemError(error);
this.isloading = true;
});
},
template: `
<div class="col-sm-10">
<div ref="alertbox"></div>
<span class="d-flex justify-content-between h4">
<span>{{lvs.repeat_last ? $p.t('studierendenantrag', 'title_lv_wiederholen') : $p.t('studierendenantrag', 'title_lv_nicht_zugelassen')}}</span>
<span>{{lvs1sem}}</span>