mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcd6cfd74b | |||
| c16cf342cb |
@@ -119,15 +119,6 @@ $config['navigation_header'] = array(
|
||||
'requiredPermissions' => array(
|
||||
'lehre/zgvpruefung:r'
|
||||
)
|
||||
),
|
||||
'ferien' => array(
|
||||
'link' => site_url('lehre/Ferienverwaltung'),
|
||||
'description' => 'Ferienverwaltung',
|
||||
'expand' => true,
|
||||
'sort' => 55,
|
||||
'requiredPermissions' => array(
|
||||
'basis/ferien:r'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
@@ -1,371 +0,0 @@
|
||||
<?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 CI3_Events as Events;
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the back-end
|
||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||
*/
|
||||
class Ferien extends FHCAPI_Controller
|
||||
{
|
||||
const DEFAULT_BERECHTIGUNG = 'basis/ferien';
|
||||
|
||||
/**
|
||||
* Calls the parent's constructor and prepares libraries and phrases
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'getFerien' => self::DEFAULT_BERECHTIGUNG.':r',
|
||||
'getDefaultVonBis' => self::DEFAULT_BERECHTIGUNG.':r',
|
||||
'getOe' => self::DEFAULT_BERECHTIGUNG.':r',
|
||||
'getStudienplaene' => self::DEFAULT_BERECHTIGUNG.':r',
|
||||
'getFerientypen' => self::DEFAULT_BERECHTIGUNG.':r',
|
||||
'insert' => self::DEFAULT_BERECHTIGUNG.':w',
|
||||
'update' => self::DEFAULT_BERECHTIGUNG.':w',
|
||||
'delete' => self::DEFAULT_BERECHTIGUNG.':w'
|
||||
]);
|
||||
|
||||
// Load models
|
||||
$this->load->model('organisation/Ferien_model', 'FerienModel');
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
|
||||
$this->load->library('PermissionLib');
|
||||
|
||||
|
||||
// Load language phrases
|
||||
$this->loadPhrases([
|
||||
'ui'
|
||||
]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Get Ferien
|
||||
*/
|
||||
public function getFerien()
|
||||
{
|
||||
$filterVonDatum = $this->input->get('filterVonDatum');
|
||||
$filterBisDatum = $this->input->get('filterBisDatum');
|
||||
|
||||
if (isset($filterVonDatum) && !is_valid_date($filterVonDatum))
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_invalid_date'), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
if (isset($filterBisDatum) && !is_valid_date($filterBisDatum))
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_invalid_date'), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->FerienModel->addSelect(
|
||||
'tbl_ferien.ferien_id, tbl_ferien.bezeichnung, tbl_ferien.vondatum, tbl_ferien.bisdatum,
|
||||
plan.studienplan_id, oe.oe_kurzbz, fetyp.ferientyp_kurzbz, oe.bezeichnung AS oe_bezeichnung,
|
||||
plan.studienplan_id, plan.bezeichnung AS studienplan_bezeichnung, fetyp.mitarbeiter AS mitarbeiterrelevant,
|
||||
fetyp.studierende AS studierendenrelevant, fetyp.lehre'
|
||||
);
|
||||
$this->FerienModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT');
|
||||
$this->FerienModel->addJoin('lehre.tbl_studienplan plan', 'studienplan_id', 'LEFT');
|
||||
$this->FerienModel->addJoin('public.tbl_organisationseinheit oe', 'tbl_ferien.oe_kurzbz = oe.oe_kurzbz', 'LEFT');
|
||||
$this->FerienModel->addJoin('lehre.tbl_ferientyp fetyp', 'ferientyp_kurzbz', 'LEFT');
|
||||
|
||||
if (isset($filterVonDatum))
|
||||
$this->FerienModel->db->where('tbl_ferien.bisdatum >=', $filterVonDatum);
|
||||
|
||||
if (isset($filterBisDatum))
|
||||
$this->FerienModel->db->where('tbl_ferien.vondatum <=', $filterBisDatum);
|
||||
|
||||
$this->FerienModel->addOrder('vondatum', 'DESC');
|
||||
$result = $this->FerienModel->load();
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets default dates (from - to) for filtering Ferien.
|
||||
*/
|
||||
public function getDefaultVonBis()
|
||||
{
|
||||
$defaultVonBis = ['defaultVon' => null, 'defaultBis' => null];
|
||||
|
||||
// get current Studienjahr
|
||||
$this->load->model('organisation/Studienjahr_model', 'StudienjahrModel');
|
||||
|
||||
$result = $this->StudienjahrModel->getAktOrNextStudienjahr(62);
|
||||
|
||||
if (isError($result)) return $this->terminateWithError(getError($result));
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$studienjahr = getData($result)[0];
|
||||
$defaultVonBis['defaultVon'] = $studienjahr->beginn;
|
||||
$defaultVonBis['defaultBis'] = $studienjahr->ende;
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($defaultVonBis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of Organisationseinheiten
|
||||
*/
|
||||
public function getOe()
|
||||
{
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
|
||||
//$this->StudiengangModel->addSelect(' tbl_studiengang.*, UPPER(typ::varchar(1) || kurzbz) AS kuerzel');
|
||||
$this->OrganisationseinheitModel->addOrder('organisationseinheittyp_kurzbz, oe_kurzbz');
|
||||
$result = $this->OrganisationseinheitModel->loadWhere(['aktiv' => true]);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of Studienplaene.
|
||||
* Studienplaene are returned by Organisationseinheit, von and bis datum.
|
||||
*/
|
||||
public function getStudienplaene()
|
||||
{
|
||||
// check input
|
||||
$oe_kurzbz = $this->input->get('oe_kurzbz');
|
||||
$vondatum = $this->input->get('vondatum');
|
||||
$bisdatum = $this->input->get('bisdatum');
|
||||
|
||||
if (!isset($oe_kurzbz) || isEmptyString($oe_kurzbz))
|
||||
return $this->terminateWithError($this->p->t('ferien', 'error_missingId', ['id' => 'Organisationseinheit']));
|
||||
|
||||
if (isset($vondatum) && !is_valid_date($vondatum))
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_invalid_date'), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
if (isset($bisdatum) && !is_valid_date($bisdatum))
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_invalid_date'), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
// get Studiengang from Oe
|
||||
$result = $this->StudiengangModel->loadWhere(['oe_kurzbz' => $oe_kurzbz]);
|
||||
|
||||
if (isError($result)) return $this->terminateWithError(getError($result));
|
||||
if (!hasData($result)) return $this->terminateWithSuccess([]);
|
||||
$studiengangKzArr = array_column(getData($result), 'studiengang_kz');
|
||||
|
||||
// load models
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||
|
||||
// get all Studiensemester in requested date range
|
||||
$result = $this->StudiensemesterModel->getByDateRange($vondatum, $bisdatum);
|
||||
if (isError($result)) return $this->terminateWithError(getError($result));
|
||||
if (!hasData($result)) return $this->terminateWithSuccess([]);
|
||||
$studiensemesterArr = array_column(getData($result), 'studiensemester_kurzbz');
|
||||
|
||||
$studienplaene = [];
|
||||
foreach ($studiengangKzArr as $studiengang_kz)
|
||||
{
|
||||
foreach ($studiensemesterArr as $studiensemester_kurzbz)
|
||||
{
|
||||
// get studienplaene for each Studiengang and Studiensemester
|
||||
$this->StudienplanModel->addDistinct("studienplan_id");
|
||||
$this->StudienplanModel->addSelect("lehre.tbl_studienplan.*");
|
||||
$this->StudienplanModel->addJoin("lehre.tbl_studienordnung", "studienordnung_id");
|
||||
$this->StudienplanModel->addJoin("lehre.tbl_studienplan_semester", "studienplan_id");
|
||||
|
||||
$whereArray = array(
|
||||
"tbl_studienplan.aktiv" => "TRUE",
|
||||
"tbl_studienordnung.studiengang_kz" => $studiengang_kz,
|
||||
"tbl_studienplan_semester.studiensemester_kurzbz" => $studiensemester_kurzbz
|
||||
);
|
||||
|
||||
$result = $this->StudienplanModel->loadWhere($whereArray);
|
||||
|
||||
if (isError($result)) return $this->terminateWithError(getError($result));
|
||||
if (!hasData($result)) continue;
|
||||
|
||||
foreach (getData($result) as $studienplan)
|
||||
{
|
||||
$studienplaene[$studienplan->studienplan_id] = $studienplan;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($studienplaene);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of Ferientypen
|
||||
*/
|
||||
public function getFerientypen()
|
||||
{
|
||||
$this->load->model('organisation/Ferientyp_model', 'FerientypModel');
|
||||
|
||||
$this->FerientypModel->addOrder('ferientyp_kurzbz');
|
||||
$result = $this->FerientypModel->load();
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Ferien
|
||||
*/
|
||||
public function insert()
|
||||
{
|
||||
$this->_validate();
|
||||
|
||||
$data = $this->_getData();
|
||||
|
||||
// check permissions for new Ferien
|
||||
if (!$this->permissionlib->isBerechtigt(self::DEFAULT_BERECHTIGUNG, 'suid', $data['oe_kurzbz']))
|
||||
return $this->terminateWithError($this->p->t('ui', 'keineBerechtigung'));
|
||||
|
||||
$data = array_merge($data, ['insertamum' => date('c'), 'insertvon' => getAuthUID()]);
|
||||
|
||||
$id = $this->getDataOrTerminateWithError($this->FerienModel->insert($data));
|
||||
|
||||
$this->terminateWithSuccess(hasData($id) ? getData($id) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Ferien
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$id = $this->input->post('ferien_id');
|
||||
|
||||
if (!is_numeric($id))
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Ferien Id']), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->_validate();
|
||||
|
||||
$data = $this->_getData();
|
||||
|
||||
// check permissions for existing Ferien
|
||||
$this->_validateBerechtigung('suid', $id);
|
||||
|
||||
// check permissions for new Ferien
|
||||
if (!$this->permissionlib->isBerechtigt(self::DEFAULT_BERECHTIGUNG, 'suid', $data['oe_kurzbz']))
|
||||
return $this->terminateWithError($this->p->t('ui', 'keineBerechtigung'));
|
||||
|
||||
if (isEmptyArray($data)) return $this->terminateWithSuccess(null);
|
||||
|
||||
$data = array_merge($data, ['ferien_id' => $id, 'updateamum' => date('c'), 'updatevon' => getAuthUID()]);
|
||||
|
||||
$result = $this->FerienModel->update($id, $data);
|
||||
|
||||
if (isError($result)) return $this->terminateWithError(getError($result));
|
||||
|
||||
$this->terminateWithSuccess($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Ferien
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('ferien_id', 'Ferien Id', 'required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$ferien_id = $this->input->post('ferien_id');
|
||||
|
||||
$this->_validateBerechtigung('suid', $ferien_id);
|
||||
|
||||
$this->FerienModel->addSelect('ferien_id');
|
||||
$result = $this->FerienModel->load($ferien_id);
|
||||
|
||||
if (!hasData($result)) return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['ferien_id' => $ferien_id]));
|
||||
|
||||
$result = $this->getDataOrTerminateWithError($this->FerienModel->delete($ferien_id));
|
||||
|
||||
$this->terminateWithSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ferien post input.
|
||||
*/
|
||||
private function _validate()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('vondatum', 'Von Datum', 'required|is_valid_date');
|
||||
$this->form_validation->set_rules('bisdatum', 'Bis Datum', 'required|is_valid_date');
|
||||
$this->form_validation->set_rules('bezeichnung', 'Bezeichnung', 'required|max_length[128]');
|
||||
$this->form_validation->set_rules('oe_kurzbz', 'Organisationseinheit', 'max_length[32]');
|
||||
$this->form_validation->set_rules('studienplan_id', 'Studienplan', 'numeric');
|
||||
$this->form_validation->set_rules('ferientyp_kurzbz', 'Ferientyp', 'max_length[64]');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks permission for oe of Ferien. Terminates if unauthorized.
|
||||
* @param typ permission type suid
|
||||
* @param ferien_id
|
||||
* @return void
|
||||
*/
|
||||
private function _validateBerechtigung($typ, $ferien_id)
|
||||
{
|
||||
if (isset($ferien_id))
|
||||
{
|
||||
$this->FerienModel->addSelect('oe_kurzbz');
|
||||
$result = $this->FerienModel->load($ferien_id);
|
||||
|
||||
if (isError($result)) return $this->terminateWithError(getError($result));
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$ferien = getData($result)[0];
|
||||
|
||||
if ($this->permissionlib->isBerechtigt(self::DEFAULT_BERECHTIGUNG, $typ, $ferien->oe_kurzbz)) return;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->terminateWithError($this->p->t('ui', 'keineBerechtigung'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Ferien data from post input.
|
||||
*/
|
||||
private function _getData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$allowed = [
|
||||
'vondatum',
|
||||
'bisdatum',
|
||||
'bezeichnung',
|
||||
'oe_kurzbz',
|
||||
'studienplan_id',
|
||||
'ferientyp_kurzbz'
|
||||
];
|
||||
|
||||
foreach ($allowed as $field)
|
||||
{
|
||||
$data[$field] = $this->input->post($field);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Overview on cronjob logs
|
||||
*/
|
||||
class Ferienverwaltung extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => ['basis/ferien:r']
|
||||
)
|
||||
);
|
||||
|
||||
// Loads WidgetLib
|
||||
//$this->load->library('WidgetLib');
|
||||
|
||||
// Loads phrases system
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui'
|
||||
//'ferien'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Everything has a beginning
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('lehre/ferienverwaltung.php');
|
||||
}
|
||||
}
|
||||
@@ -382,7 +382,11 @@ class StundenplanLib
|
||||
|
||||
$tz = new DateTimeZone($this->_ci->config->item('timezone'));
|
||||
|
||||
$ferienEvents = $this->_ci->FerienModel->getByDateRange($start_date, $end_date, $studiengang_kz);
|
||||
$ferienEvents = $this->_ci->FerienModel->execReadOnlyQuery("
|
||||
SELECT *
|
||||
FROM lehre.tbl_ferien
|
||||
WHERE (bisdatum >= ? AND vondatum < ?) AND (studiengang_kz = 0 OR studiengang_kz = ?)
|
||||
", [$start_date, $end_date, $studiengang_kz]);
|
||||
|
||||
if (isError($ferienEvents))
|
||||
return $ferienEvents;
|
||||
|
||||
@@ -9,52 +9,6 @@ class Ferien_model extends DB_Model
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_ferien';
|
||||
$this->pk = 'ferien_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all Ferien between two dates.
|
||||
* @param $vondatum
|
||||
* @param $bisdatum
|
||||
* @param $studiengang_kz by default, loads only Ferien from oe of 0 Studiengang (and parents)
|
||||
* @return object success or error
|
||||
*/
|
||||
public function getByDateRange($vondatum, $bisdatum, $studiengang_kz = 0)
|
||||
{
|
||||
if (!is_numeric($studiengang_kz)) return error("Invalid Studiengang Kz");
|
||||
if (!is_valid_date($vondatum)) return error("Invalid von date");
|
||||
if (!is_valid_date($bisdatum)) return error("Invalid bis date");
|
||||
|
||||
// get oe from studiengang
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$result = $this->StudiengangModel->loadWhere(['studiengang_kz' => $studiengang_kz]);
|
||||
|
||||
if (isError($result)) return $result;
|
||||
if (!hasData($result)) return success([]);
|
||||
|
||||
$oe_kurzbz = getData($result)[0]->oe_kurzbz;
|
||||
|
||||
// get all parents oes
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
$result = $this->OrganisationseinheitModel->getParents($oe_kurzbz);
|
||||
|
||||
if (isError($result)) return $result;
|
||||
if (!hasData($result)) return success([]);
|
||||
|
||||
$parents = array_column(getData($result), 'oe_kurzbz');
|
||||
|
||||
// get ferien - use oe_kurzbz
|
||||
$qry = "
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
lehre.tbl_ferien
|
||||
WHERE
|
||||
bisdatum >= ? AND vondatum < ?
|
||||
AND (oe_kurzbz IS NULL OR oe_kurzbz IN ?)
|
||||
ORDER BY
|
||||
vondatum";
|
||||
|
||||
return $this->execReadOnlyQuery($qry, [$vondatum, $bisdatum, $parents]);
|
||||
$this->pk = array('studiengang_kz', 'bezeichnung');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
class Ferientyp_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_ferientyp';
|
||||
$this->pk = 'ferientyp_kurzbz';
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
@@ -53,9 +53,11 @@ class Studienjahr_model extends DB_Model
|
||||
* @param int $days
|
||||
* @return array|stdClass|null
|
||||
*/
|
||||
public function getLastOrAktStudienjahr($days = 0)
|
||||
public function getLastOrAktStudienjahr($days = 60)
|
||||
{
|
||||
$days = is_numeric($days) ? $this->escape($days) : 0;
|
||||
if (!is_numeric($days)) {
|
||||
$days = 60;
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT *
|
||||
@@ -75,25 +77,19 @@ class Studienjahr_model extends DB_Model
|
||||
* @param int $days
|
||||
* @return array|stdClass|null
|
||||
*/
|
||||
public function getAktOrNextStudienjahr($days = 0)
|
||||
public function getAktOrNextStudienjahr($days = 62)
|
||||
{
|
||||
$days = is_numeric($days) ? $this->escape($days) : 0;
|
||||
if (!is_numeric($days)) {
|
||||
$days = 62;
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
jahr.*, MIN(sem.start) AS beginn, MAX(sem.ende) AS ende
|
||||
FROM
|
||||
public.tbl_studienjahr jahr
|
||||
JOIN public.tbl_studiensemester sem using(studienjahr_kurzbz)
|
||||
GROUP BY
|
||||
studienjahr_kurzbz
|
||||
) jahre
|
||||
WHERE
|
||||
ende >= NOW() + \'' . $days . ' DAYS\'::INTERVAL
|
||||
ORDER BY
|
||||
ende
|
||||
LIMIT 1
|
||||
SELECT *
|
||||
FROM public.tbl_studienjahr
|
||||
JOIN public.tbl_studiensemester using(studienjahr_kurzbz)
|
||||
WHERE start < NOW() + \'' . $days . ' DAYS\'::INTERVAL
|
||||
ORDER by start DESC
|
||||
LIMIT 1
|
||||
';
|
||||
|
||||
return $this->execQuery($query);
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
$includesArray = array(
|
||||
'title' => 'Ferienverwaltung',
|
||||
'axios027' => true,
|
||||
'bootstrap5' => true,
|
||||
'fontawesome6' => true,
|
||||
'vue3' => true,
|
||||
'filtercomponent' => true,
|
||||
'navigationcomponent' => true,
|
||||
'tabulator6' => true,
|
||||
'primevue3' => true,
|
||||
//'vuedatepicker11' => true,
|
||||
'customJSModules' => array('public/js/apps/lehre/Ferienverwaltung/Ferienverwaltung.js'),
|
||||
'customCSSs' => array('vendor/vuejs/vuedatepicker_css/main.css')
|
||||
);
|
||||
|
||||
$this->load->view('templates/FHC-Header', $includesArray);
|
||||
?>
|
||||
|
||||
<div id="main">
|
||||
<div>
|
||||
<ferienverwaltung></ferienverwaltung>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
* @create 07-12-2006
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/organisationseinheit.class.php');
|
||||
|
||||
class ferien extends basis_db
|
||||
{
|
||||
@@ -63,50 +62,8 @@ class ferien extends basis_db
|
||||
$this->errormsg = 'Studiengang_kz ist ungültig';
|
||||
return false;
|
||||
}
|
||||
|
||||
// get oe from studiengang
|
||||
$sql_query="
|
||||
SELECT
|
||||
oe_kurzbz
|
||||
FROM
|
||||
public.tbl_studiengang
|
||||
WHERE
|
||||
studiengang_kz=".$this->db_add_param($stg_kz, FHC_INTEGER)."
|
||||
ORDER BY
|
||||
studiengang_kz";
|
||||
|
||||
if (!$this->db_query($sql_query))
|
||||
{
|
||||
$this->errormsg = $this->db_last_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
$oe_kurzbz = '';
|
||||
while ($row = $this->db_fetch_object())
|
||||
{
|
||||
$oe_kurzbz = $row->oe_kurzbz;
|
||||
}
|
||||
|
||||
// get all parents oes
|
||||
$organisationseinheit = new organisationseinheit();
|
||||
$parents = $organisationseinheit->getParents($oe_kurzbz);
|
||||
|
||||
if (!$parents)
|
||||
{
|
||||
$this->errormsg = $parents->errormsg;
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql_query="
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
lehre.tbl_ferien
|
||||
WHERE
|
||||
oe_kurzbz IS NULL
|
||||
OR oe_kurzbz IN (".$this->implode4SQL($parents).")
|
||||
ORDER BY
|
||||
vondatum";
|
||||
$sql_query="SELECT * FROM lehre.tbl_ferien WHERE studiengang_kz=0 OR studiengang_kz=".$this->db_add_param($stg_kz, FHC_INTEGER)." ORDER BY vondatum;";
|
||||
|
||||
if (!$this->db_query($sql_query))
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@import './SvgIcons.css';
|
||||
@import './components/searchbar/searchbar.css';
|
||||
@import './components/verticalsplit.css';
|
||||
@import './components/horizontalsplit.css';
|
||||
@import './components/FilterComponent.css';
|
||||
@import './components/Tabs.css';
|
||||
@import './components/Notiz.css';
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
:root {
|
||||
--fhc-horizontalsplit-hsplitter-bg-color: var(--fhc-background, #eee);
|
||||
--fhc-horizontalsplit-hsplitter-border-color: var(--fhc-border, #eee);
|
||||
--fhc-horizontalsplit-hsplitter-splitactions-color: var(--fhc-dark, #000);
|
||||
}
|
||||
|
||||
.horizontalsplit-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
max-height: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.horizontalsplitted {
|
||||
overflow: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.horizontalsplitter {
|
||||
flex-shrink: 0;
|
||||
width: 16px;
|
||||
cursor: col-resize;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.horizontalsplitter.left {
|
||||
border-left: solid 3px var(--fhc-horizontalsplit-hsplitter-border-color);
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.horizontalsplitter.right {
|
||||
border-right: solid 3px var(--fhc-horizontalsplit-hsplitter-border-color);
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.splitactions.horizontal {
|
||||
background-color: var(--fhc-horizontalsplit-hsplitter-bg-color);
|
||||
color: var(--fhc-horizontalsplit-hsplitter-splitactions-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 5px 0 5px 0;
|
||||
}
|
||||
|
||||
.splitactions.horizontal.left {
|
||||
border-radius: 0 40% 40% 0;
|
||||
}
|
||||
|
||||
.splitactions.horizontal.right {
|
||||
border-radius: 40% 0 0 40%;
|
||||
}
|
||||
|
||||
.splitactions.horizontal .splitaction {
|
||||
width: 14px;
|
||||
height: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.splitactions.horizontal .splitaction.resize {
|
||||
cursor: col-resize;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
||||
#content > div:first-child {
|
||||
margin-top: 30px;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2025 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 {
|
||||
getFerien(filterVonDatum, filterBisDatum) {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/education/ferien/getFerien',
|
||||
params: {
|
||||
filterVonDatum,
|
||||
filterBisDatum
|
||||
}
|
||||
};
|
||||
},
|
||||
getOe() {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/education/ferien/getOe'
|
||||
};
|
||||
},
|
||||
getStudienplaene(oe_kurzbz, vondatum, bisdatum) {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/education/ferien/getStudienplaene',
|
||||
params: {
|
||||
oe_kurzbz,
|
||||
vondatum,
|
||||
bisdatum
|
||||
}
|
||||
};
|
||||
},
|
||||
getFerientypen() {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/education/ferien/getFerientypen'
|
||||
};
|
||||
},
|
||||
getDefaultVonBis() {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/education/ferien/getDefaultVonBis'
|
||||
};
|
||||
},
|
||||
insert(params) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/education/ferien/insert',
|
||||
params
|
||||
};
|
||||
},
|
||||
update(params) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/education/ferien/update',
|
||||
params
|
||||
};
|
||||
},
|
||||
delete(ferien_id) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/education/ferien/delete',
|
||||
params: { ferien_id }
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
import Ferienverwaltung from '../../../components/Ferienverwaltung/Ferienverwaltung.js';
|
||||
import PluginsPhrasen from '../../../plugins/Phrasen.js';
|
||||
|
||||
const app = Vue.createApp({
|
||||
name: 'FerienverwaltungApp',
|
||||
components: {
|
||||
Ferienverwaltung
|
||||
}
|
||||
});
|
||||
app
|
||||
.use(PluginsPhrasen)
|
||||
.mount('#main');
|
||||
@@ -1,295 +0,0 @@
|
||||
import {CoreFilterCmpt} from "../filter/Filter.js";
|
||||
import {CoreNavigationCmpt} from "../navigation/Navigation.js";
|
||||
import FormInput from "../Form/Input.js";
|
||||
import FerienModal from "./Modal.js";
|
||||
|
||||
import ApiFerienverwaltung from '../../api/factory/ferienverwaltung/ferienverwaltung.js';
|
||||
|
||||
export default {
|
||||
name: "Ferienverwaltung",
|
||||
components: {
|
||||
CoreFilterCmpt,
|
||||
CoreNavigationCmpt,
|
||||
FormInput,
|
||||
FerienModal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
filterVonDatum: null,
|
||||
filterBisDatum: null,
|
||||
loading: false,
|
||||
sideMenuEntries: {},
|
||||
headerMenuEntries: {},
|
||||
tabulatorOptions: {
|
||||
ajaxURL: 'dummy',
|
||||
ajaxRequestFunc: () => this.$api.call(
|
||||
ApiFerienverwaltung.getFerien(this.filterVonDatum, this.filterBisDatum)
|
||||
),
|
||||
ajaxResponse: (url, params, response) => response.data,
|
||||
columns: [
|
||||
{title:"Ferien Id", field:"ferien_id", visible: false, headerFilter: true},
|
||||
{
|
||||
title:"Datum von",
|
||||
field:"vondatum",
|
||||
headerFilter: true,
|
||||
formatter: function (cell) {
|
||||
const dateStr = cell.getValue();
|
||||
if (!dateStr) return "";
|
||||
|
||||
const date = new Date(dateStr);
|
||||
return date.toLocaleString("de-DE", {
|
||||
day: "2-digit",
|
||||
month: "2-digit",
|
||||
year: "numeric",
|
||||
hour12: false
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"Datum bis",
|
||||
field:"bisdatum",
|
||||
headerFilter: true,
|
||||
formatter: function (cell) {
|
||||
const dateStr = cell.getValue();
|
||||
if (!dateStr) return "";
|
||||
|
||||
const date = new Date(dateStr);
|
||||
return date.toLocaleString("de-DE", {
|
||||
day: "2-digit",
|
||||
month: "2-digit",
|
||||
year: "numeric",
|
||||
hour12: false
|
||||
});
|
||||
}
|
||||
},
|
||||
{title:"Bezeichnung", field:"bezeichnung", headerFilter: true},
|
||||
{title:"Organisationseinheit Kurzbezeichnung", field:"oe_kurzbz", visible: false, headerFilter: true},
|
||||
{title:"Organisationseinheit", field:"oe_bezeichnung", headerFilter: true},
|
||||
{title:"Studienplan", field:"studienplan_bezeichnung", visible: false, headerFilter: true},
|
||||
{title:"Ferientyp Kurzbezeichnung", field:"ferientyp_kurzbz", visible: false, headerFilter: true},
|
||||
{
|
||||
title:"Mitarbeiterrelevant",
|
||||
field:"mitarbeiterrelevant",
|
||||
visible: false,
|
||||
headerFilter: true,
|
||||
hozAlign: "center",
|
||||
formatter:'tickCross', formatterParams: {
|
||||
tickElement: '<i class="fas fa-check text-success"></i>',
|
||||
crossElement: '<i class="fas fa-times text-danger"></i>'
|
||||
},
|
||||
headerFilter:"tickCross", headerFilterParams: {
|
||||
"tristate":true, elementAttributes:{"value":"true"}
|
||||
},
|
||||
headerFilterEmptyCheck:function(value){return value === null}
|
||||
},
|
||||
{
|
||||
title:"Studierendenrelevant",
|
||||
field:"studierendenrelevant",
|
||||
visible: false,
|
||||
headerFilter: true,
|
||||
hozAlign: "center",
|
||||
formatter:'tickCross', formatterParams: {
|
||||
tickElement: '<i class="fas fa-check text-success"></i>',
|
||||
crossElement: '<i class="fas fa-times text-danger"></i>'
|
||||
},
|
||||
headerFilter:"tickCross", headerFilterParams: {
|
||||
"tristate":true, elementAttributes:{"value":"true"}
|
||||
},
|
||||
headerFilterEmptyCheck:function(value){return value === null}
|
||||
},
|
||||
{
|
||||
title:"Lehre planbar",
|
||||
field:"lehre",
|
||||
visible: false,
|
||||
headerFilter: true,
|
||||
hozAlign: "center",
|
||||
formatter:'tickCross', formatterParams: {
|
||||
tickElement: '<i class="fas fa-check text-success"></i>',
|
||||
crossElement: '<i class="fas fa-times text-danger"></i>'
|
||||
},
|
||||
headerFilter:"tickCross", headerFilterParams: {
|
||||
"tristate":true, elementAttributes:{"value":"true"}
|
||||
},
|
||||
headerFilterEmptyCheck:function(value){return value === null}
|
||||
},
|
||||
{title:"Aktionen", field: "actions",
|
||||
minWidth: 150, // Ensures Action-buttons will be always fully displayed
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
let container = document.createElement('div');
|
||||
container.className = "d-flex gap-2";
|
||||
|
||||
let button = document.createElement('button');
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
button.innerHTML = '<i class="fa fa-edit"></i>';
|
||||
button.title = this.$p.t('person', 'ferien_edit');
|
||||
button.addEventListener('click', (event) =>
|
||||
this.$refs.modal.open(JSON.parse(JSON.stringify(cell.getData()))) // deep copy
|
||||
);
|
||||
container.append(button);
|
||||
|
||||
button = document.createElement('button');
|
||||
button.className = 'btn btn-outline-secondary';
|
||||
button.innerHTML = '<i class="fa fa-trash"></i>';
|
||||
button.addEventListener('click', evt => {
|
||||
evt.stopPropagation();
|
||||
this.$fhcAlert
|
||||
.confirmDelete()
|
||||
.then(result => result ? cell.getData().ferien_id : Promise.reject({handled:true}))
|
||||
.then(ferien_id => this.$api.call(ApiFerienverwaltung.delete(ferien_id)))
|
||||
.then(() => {
|
||||
//cell.getRow().delete();
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete'));
|
||||
this.reload();
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
});
|
||||
container.append(button);
|
||||
|
||||
return container;
|
||||
},
|
||||
frozen: true
|
||||
}
|
||||
]
|
||||
},
|
||||
tabulatorEvents: [
|
||||
{
|
||||
event: 'tableBuilt',
|
||||
handler: async () => {
|
||||
|
||||
//await this.$p.loadCategory(['ferien', 'ui']);
|
||||
await this.$p.loadCategory(['global', 'ferien']);
|
||||
|
||||
let cm = this.$refs.table.tabulator.columnManager;
|
||||
|
||||
cm.getColumnByField('ferien_id').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'ferienId'),
|
||||
});
|
||||
cm.getColumnByField('vondatum').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'vondatum'),
|
||||
});
|
||||
cm.getColumnByField('bisdatum').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'bisdatum'),
|
||||
});
|
||||
cm.getColumnByField('bezeichnung').component.updateDefinition({
|
||||
title: this.$p.t('global', 'bezeichnung'),
|
||||
});
|
||||
cm.getColumnByField('oe_kurzbz').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'oeKurzbezeichnung'),
|
||||
});
|
||||
cm.getColumnByField('oe_bezeichnung').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'oeBezeichnung'),
|
||||
});
|
||||
cm.getColumnByField('studienplan_bezeichnung').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'studienplanBezeichnung'),
|
||||
});
|
||||
cm.getColumnByField('ferientyp_kurzbz').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'ferientypKurzbz'),
|
||||
});
|
||||
cm.getColumnByField('mitarbeiterrelevant').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'mitarbeiterrelevant'),
|
||||
});
|
||||
cm.getColumnByField('studierendenrelevant').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'studierendenrelevant'),
|
||||
});
|
||||
cm.getColumnByField('lehre').component.updateDefinition({
|
||||
title: this.$p.t('ferien', 'lehrePlanbar'),
|
||||
});
|
||||
cm.getColumnByField('actions').component.updateDefinition({
|
||||
title: this.$p.t('global', 'aktionen')
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
reload() {
|
||||
this.$refs.table.reloadTable();
|
||||
},
|
||||
actionNew() {
|
||||
this.$refs.modal.open();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
this.$api
|
||||
.call(ApiFerienverwaltung.getDefaultVonBis())
|
||||
.then(result => {
|
||||
this.filterVonDatum = result.data.defaultVon;
|
||||
this.filterBisDatum = result.data.defaultBis;
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
if (error)
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
},
|
||||
template: `
|
||||
|
||||
<core-navigation-cmpt
|
||||
v-bind:add-side-menu-entries="sideMenuEntries"
|
||||
v-bind:add-header-menu-entries="headerMenuEntries"
|
||||
>
|
||||
</core-navigation-cmpt>
|
||||
|
||||
<div class="h-100 d-flex flex-column">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-5">
|
||||
<form-input
|
||||
type="DatePicker"
|
||||
v-model="filterVonDatum"
|
||||
name="filtervondatum"
|
||||
:label="$p.t('ferien/vondatum')"
|
||||
:enable-time-picker="false"
|
||||
text-input
|
||||
format="dd.MM.yyyy"
|
||||
auto-apply
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<form-input
|
||||
type="DatePicker"
|
||||
v-model="filterBisDatum"
|
||||
name="filterbisdatum"
|
||||
:label="$p.t('ferien/bisdatum')"
|
||||
:enable-time-picker="false"
|
||||
text-input
|
||||
format="dd.MM.yyyy"
|
||||
auto-apply
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
<div class="col-1 align-self-end">
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
@click="reload()"
|
||||
:disabled="loading"
|
||||
>
|
||||
<i v-if="loading" class="fa fa-spinner fa-spin"></i>
|
||||
{{ $p.t('ui/anzeigen') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
table-only
|
||||
:side-menu="false"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
:tabulator-events="tabulatorEvents"
|
||||
reload
|
||||
:reload-btn-infotext="this.$p.t('table', 'reload')"
|
||||
new-btn-show
|
||||
:new-btn-label="$p.t('ui/neu')"
|
||||
@click:new="actionNew"
|
||||
>
|
||||
</core-filter-cmpt>
|
||||
<ferien-modal ref="modal" @saved="reload"></ferien-modal>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
};
|
||||
@@ -1,190 +0,0 @@
|
||||
import BsModal from "../Bootstrap/Modal.js";
|
||||
import BsConfirm from "../Bootstrap/Confirm.js";
|
||||
import CoreForm from "../Form/Form.js";
|
||||
import FormValidation from "../Form/Validation.js";
|
||||
import FormInput from "../Form/Input.js";
|
||||
|
||||
import ApiFerien from '../../api/factory/ferienverwaltung/ferienverwaltung.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BsModal,
|
||||
CoreForm,
|
||||
FormValidation,
|
||||
FormInput
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
oeList: [],
|
||||
studienplaeneList: [],
|
||||
ferientypList: [],
|
||||
loading: false,
|
||||
data: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
this.$refs.form.clearValidation();
|
||||
this.loading = true;
|
||||
|
||||
let saveFunc = this.data.ferien_id ? ApiFerien.update : ApiFerien.insert;
|
||||
|
||||
this.$refs.form
|
||||
.call(saveFunc(this.data))
|
||||
.then(result => {
|
||||
this.$emit('saved', result.data);
|
||||
this.loading = false;
|
||||
this.$refs.modal.hide();
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui/gespeichert'));
|
||||
})
|
||||
.catch(error => {
|
||||
if (error)
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
open(data) {
|
||||
this.$refs.form.clearValidation();
|
||||
this.data = data ?? {
|
||||
oe_kurzbz: null,
|
||||
bezeichnung: '',
|
||||
vondatum: null,
|
||||
bisdatum: null,
|
||||
studienplan_id: null
|
||||
};
|
||||
|
||||
this.$api
|
||||
.call(ApiFerien.getOe())
|
||||
.then(result => {
|
||||
this.oeList = result.data;
|
||||
//this.loading = false;
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
if (error)
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
//this.loading = false;
|
||||
});
|
||||
|
||||
|
||||
this.getStudienplaene();
|
||||
|
||||
this.$api
|
||||
.call(ApiFerien.getFerientypen())
|
||||
.then(result => {
|
||||
this.ferientypList = result.data;
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
if (error)
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
|
||||
this.$refs.modal.show();
|
||||
},
|
||||
getStudienplaene() {
|
||||
if (!this.data.oe_kurzbz) return;
|
||||
|
||||
this.$api
|
||||
.call(ApiFerien.getStudienplaene(this.data.oe_kurzbz, this.data.vondatum, this.data.bisdatum))
|
||||
.then(result => {
|
||||
this.studienplaeneList = result.data;
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
if (error)
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
},
|
||||
preventCloseOnLoading(ev) {
|
||||
if (this.loading)
|
||||
ev.returnValue = false;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<core-form ref="form" class="stv-details-ferien-edit" @submit.prevent="save">
|
||||
<bs-modal ref="modal" @hide-bs-modal="preventCloseOnLoading">
|
||||
<form-validation></form-validation>
|
||||
|
||||
<fieldset :disabled="loading">
|
||||
<form-input
|
||||
type="DatePicker"
|
||||
v-model="data.vondatum"
|
||||
name="vondatum"
|
||||
:label="$p.t('ferien/vondatum')"
|
||||
:enable-time-picker="false"
|
||||
text-input
|
||||
format="dd.MM.yyyy"
|
||||
auto-apply
|
||||
>
|
||||
</form-input>
|
||||
|
||||
<form-input
|
||||
type="DatePicker"
|
||||
v-model="data.bisdatum"
|
||||
name="bisdatum"
|
||||
:label="$p.t('ferien/bisdatum')"
|
||||
:enable-time-picker="false"
|
||||
text-input
|
||||
format="dd.MM.yyyy"
|
||||
auto-apply
|
||||
>
|
||||
</form-input>
|
||||
|
||||
<form-input
|
||||
v-model="data.bezeichnung"
|
||||
name="bezeichnung"
|
||||
:label="$p.t('global/bezeichnung')"
|
||||
>
|
||||
</form-input>
|
||||
|
||||
<form-input
|
||||
type="select"
|
||||
v-model="data.oe_kurzbz"
|
||||
name="oe_kurzbz"
|
||||
:label="$p.t('ferien/organisationseinheit')"
|
||||
@change="getStudienplaene"
|
||||
>
|
||||
<option :value="null">-- {{ $p.t('ui/alle') }} --</option>
|
||||
<option v-for="oe in oeList" :key="oe.oe_kurzbz" :value="oe.oe_kurzbz">
|
||||
{{ oe.organisationseinheittyp_kurzbz + ' ' + oe.bezeichnung }}
|
||||
</option>
|
||||
</form-input>
|
||||
|
||||
<form-input
|
||||
type="select"
|
||||
v-model="data.studienplan_id"
|
||||
name="studienplan_id"
|
||||
:label="$p.t('ferien/studienplan')"
|
||||
>
|
||||
<option :value="null">-- {{ $p.t('ui/keineAuswahl') }} --</option>
|
||||
<option v-for="studienplan in studienplaeneList" :key="studienplan.studienplan_id" :value="studienplan.studienplan_id">
|
||||
{{ studienplan.bezeichnung }}
|
||||
</option>
|
||||
</form-input>
|
||||
|
||||
<form-input
|
||||
type="select"
|
||||
v-model="data.ferientyp_kurzbz"
|
||||
name="ferientyp_kurzbz"
|
||||
:label="$p.t('ferien/ferientypKurzbz')"
|
||||
>
|
||||
<option :value="null">-- {{ $p.t('ui/keineAuswahl') }} --</option>
|
||||
<option v-for="ferientyp in ferientypList" :key="ferientyp.ferientyp_kurzbz" :value="ferientyp.ferientyp_kurzbz">
|
||||
{{ ferientyp.ferientyp_kurzbz }}
|
||||
</option>
|
||||
</form-input>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<template #footer>
|
||||
<button type="submit" class="btn btn-primary" :disabled="loading">
|
||||
<i v-if="loading" class="fa fa-spinner fa-spin"></i>
|
||||
{{ $p.t('ui/speichern') }}
|
||||
</button>
|
||||
</template>
|
||||
</bs-modal>
|
||||
</core-form>`
|
||||
};
|
||||
@@ -18,6 +18,7 @@
|
||||
import CoreSearchbar from "../searchbar/searchbar.js";
|
||||
import NavLanguage from "../navigation/Language.js";
|
||||
import VerticalSplit from "../verticalsplit/verticalsplit.js";
|
||||
import HorizontalSplit from "../horizontalsplit/horizontalsplit.js";
|
||||
import AppMenu from "../AppMenu.js";
|
||||
import AppConfig from "../AppConfig.js";
|
||||
import StvVerband from "./Studentenverwaltung/Verband.js";
|
||||
@@ -37,6 +38,7 @@ export default {
|
||||
CoreSearchbar,
|
||||
NavLanguage,
|
||||
VerticalSplit,
|
||||
HorizontalSplit,
|
||||
AppMenu,
|
||||
AppConfig,
|
||||
StvVerband,
|
||||
@@ -235,6 +237,10 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sidebarCollapsed(newVal) {
|
||||
if(newVal) this.$refs.hSplit.collapseLeft()
|
||||
else this.$refs.hSplit.showBoth()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -632,23 +638,30 @@ export default {
|
||||
</app-menu>
|
||||
</div>
|
||||
</aside>
|
||||
<nav id="sidebarMenu" class="bg-light offcanvas offcanvas-start col-md p-md-0 h-100">
|
||||
<div class="offcanvas-header justify-content-end px-1 d-md-none">
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" :aria-label="$p.t('ui/schliessen')"></button>
|
||||
</div>
|
||||
<stv-verband :preselectedKey="studiengangKz ? '' + studiengangKz : null" :endpoint="verbandEndpoint" @select-verband="onSelectVerband" class="col" style="height:0%"></stv-verband>
|
||||
<stv-studiensemester v-model:studiensemester-kurzbz="studiensemesterKurzbz" @update:studiensemester-kurzbz="studiensemesterChanged"></stv-studiensemester>
|
||||
</nav>
|
||||
<main class="col-md-8 ms-sm-auto col-lg-9 col-xl-10">
|
||||
<vertical-split>
|
||||
<template #top>
|
||||
<stv-list ref="stvList" v-model:selected="selected" :studiengang-kz="studiengangKz" :studiensemester-kurzbz="studiensemesterKurzbz" @filterActive="handleCustomFilter"></stv-list>
|
||||
</template>
|
||||
<template #bottom>
|
||||
<stv-details ref="details" :students="selected" @reload="reloadList"></stv-details>
|
||||
</template>
|
||||
</vertical-split>
|
||||
</main>
|
||||
<horizontal-split ref="hSplit" :defaultRatio="[15, 85]">
|
||||
<template #left>
|
||||
<nav id="sidebarMenu" class="bg-light offcanvas offcanvas-start col-md p-md-0 h-100 w-100">
|
||||
<div class="offcanvas-header justify-content-end px-1 d-md-none">
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" :aria-label="$p.t('ui/schliessen')"></button>
|
||||
</div>
|
||||
<stv-verband :preselectedKey="studiengangKz ? '' + studiengangKz : null" :endpoint="verbandEndpoint" @select-verband="onSelectVerband" class="col" style="height:0%"></stv-verband>
|
||||
<stv-studiensemester v-model:studiensemester-kurzbz="studiensemesterKurzbz" @update:studiensemester-kurzbz="studiensemesterChanged"></stv-studiensemester>
|
||||
</nav>
|
||||
</template>
|
||||
<template #right>
|
||||
<main>
|
||||
<vertical-split :defaultRatio="[50, 50]">
|
||||
<template #top>
|
||||
<stv-list ref="stvList" v-model:selected="selected" :studiengang-kz="studiengangKz" :studiensemester-kurzbz="studiensemesterKurzbz" @filterActive="handleCustomFilter"></stv-list>
|
||||
</template>
|
||||
<template #bottom>
|
||||
<stv-details ref="details" :students="selected" @reload="reloadList"></stv-details>
|
||||
</template>
|
||||
</vertical-split>
|
||||
</main>
|
||||
</template>
|
||||
</horizontal-split>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<app-config ref="config" v-model="appconfig" :endpoints="configEndpoints"></app-config>
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
export default {
|
||||
name: 'HorizontalSplit',
|
||||
props: {
|
||||
defaultRatio: {
|
||||
type: Array,
|
||||
default: () => [50, 50]
|
||||
}
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
availWidth: 0,
|
||||
leftwidth: 0,
|
||||
rightwidth: 0,
|
||||
mousePosX: 0,
|
||||
resize: false,
|
||||
hsplitterOffset: 0,
|
||||
selfOffsetLeft: 0
|
||||
};
|
||||
},
|
||||
template: `
|
||||
<div ref="horizontalsplit" class="horizontalsplit-container">
|
||||
<div ref="leftpanel" class="horizontalsplitted"
|
||||
:style="{ width: this.leftwidthcss }">
|
||||
<slot name="left">
|
||||
<p>Left Panel</p>
|
||||
</slot>
|
||||
</div>
|
||||
<div ref="hsplitter" class="horizontalsplitter"
|
||||
:class="this.leftOrRightClass" @mousedown="this.dragStart">
|
||||
<div class="splitactions horizontal" :class="this.leftOrRightClass">
|
||||
<span @click="this.collapseRight" class="splitaction">
|
||||
<i class="fas fa-angle-right text-muted"></i>
|
||||
</span>
|
||||
<span @dblclick="this.showBoth" class="splitaction resize">
|
||||
<i class="fas fa-grip-lines-vertical text-muted"></i>
|
||||
</span>
|
||||
<span @click="this.collapseLeft" class="splitaction">
|
||||
<i class="fas fa-angle-left text-muted"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div ref="rightpanel" class="horizontalsplitted"
|
||||
:style="{ width: this.rightwidthcss }">
|
||||
<slot name="right">
|
||||
<p/>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
mounted: function () {
|
||||
this.calcWidths();
|
||||
this.trackHorizontalSplitterOffsetLeft();
|
||||
window.addEventListener('resize', this.calcWidths);
|
||||
},
|
||||
updated: function () {
|
||||
this.trackHorizontalSplitterOffsetLeft();
|
||||
},
|
||||
beforeDestroy: function () {
|
||||
window.removeEventListener('resize', this.calcWidths);
|
||||
},
|
||||
methods: {
|
||||
calcWidths: function () {
|
||||
var oldavailWidth = this.availWidth;
|
||||
this.selfOffsetLeft = this.$refs.horizontalsplit.offsetLeft;
|
||||
this.availWidth = this.$refs.horizontalsplit.offsetWidth - this.$refs.hsplitter.offsetWidth;
|
||||
|
||||
if ((this.leftwidth === 0 && this.rightwidth === 0) || oldavailWidth === 0) {
|
||||
this.leftwidth = Math.floor(this.availWidth * (this.defaultRatio[0] / 100));
|
||||
} else {
|
||||
this.leftwidth = Math.floor(((this.leftwidth * 100) / oldavailWidth) / 100 * this.availWidth);
|
||||
}
|
||||
this.rightwidth = this.availWidth - this.leftwidth;
|
||||
},
|
||||
collapseLeft: function () {
|
||||
this.calcWidths();
|
||||
this.leftwidth = 0;
|
||||
this.rightwidth = this.availWidth;
|
||||
},
|
||||
collapseRight: function () {
|
||||
this.calcWidths();
|
||||
this.leftwidth = this.availWidth;
|
||||
this.rightwidth = 0;
|
||||
},
|
||||
showBoth: function () {
|
||||
this.leftwidth = Math.floor(this.availWidth * (this.defaultRatio[0] / 100));
|
||||
this.rightwidth = this.availWidth - this.leftwidth;
|
||||
},
|
||||
isCollapsed: function () {
|
||||
if (this.leftwidth === 0) {
|
||||
return 'left';
|
||||
} else if (this.rightwidth === 0) {
|
||||
return 'right';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
dragStart: function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
window.addEventListener('mouseup', this.dragEnd);
|
||||
window.addEventListener('mousemove', this.drag);
|
||||
this.resize = true;
|
||||
this.mousePosX = e.clientX;
|
||||
},
|
||||
drag: function (e) {
|
||||
if (!this.resize) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var offsetX = e.clientX - this.mousePosX;
|
||||
this.leftwidth = this.leftwidth + offsetX;
|
||||
if (this.leftwidth < 0) {
|
||||
this.leftwidth = 0;
|
||||
}
|
||||
if (this.leftwidth > this.availWidth) {
|
||||
this.leftwidth = this.availWidth;
|
||||
}
|
||||
this.rightwidth = this.availWidth - this.leftwidth;
|
||||
this.mousePosX = e.clientX;
|
||||
},
|
||||
dragEnd: function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
window.removeEventListener('mousemove', this.drag);
|
||||
window.removeEventListener('mouseup', this.dragEnd);
|
||||
this.resize = false;
|
||||
this.mousePosX = e.clientX;
|
||||
},
|
||||
trackHorizontalSplitterOffsetLeft: function () {
|
||||
this.hsplitterOffset = this.$refs.hsplitter.offsetLeft;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
leftOrRightClass: function () {
|
||||
return ((this.hsplitterOffset - this.selfOffsetLeft) <= Math.floor(this.availWidth / 2))
|
||||
? 'left'
|
||||
: 'right';
|
||||
},
|
||||
leftwidthcss: function () {
|
||||
return this.leftwidth + 'px';
|
||||
},
|
||||
rightwidthcss: function () {
|
||||
return this.rightwidth + 'px';
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,11 @@
|
||||
export default {
|
||||
name: 'VerticalSplit',
|
||||
props: {
|
||||
defaultRatio: {
|
||||
type: Array,
|
||||
default: () => [50, 50]
|
||||
}
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
availHeight: 0,
|
||||
@@ -50,17 +56,22 @@ export default {
|
||||
updated: function() {
|
||||
this.trackVerticalSplitterOffsetTop();
|
||||
},
|
||||
beforeDestroy: function () {
|
||||
window.removeEventListener('resize', this.calcHeights);
|
||||
},
|
||||
methods: {
|
||||
calcHeights: function() {
|
||||
var windowheight = window.innerHeight;
|
||||
var oldavailHeight = this.availHeight;
|
||||
this.selfOffsetTop = this.$refs.verticalsplit.offsetTop;
|
||||
this.availHeight = windowheight - this.selfOffsetTop - this.$refs.vsplitter.offsetHeight;
|
||||
|
||||
if( (this.topheight === 0 && this.bottomheight === 0) || oldavailHeight === 0 ) {
|
||||
this.topheight = Math.floor(this.availHeight/2);
|
||||
this.topheight = Math.floor(this.availHeight * (this.defaultRatio[0] / 100));
|
||||
} else {
|
||||
this.topheight = Math.floor( ((((this.topheight * 100) / oldavailHeight) / 100) * this.availHeight) );
|
||||
}
|
||||
|
||||
this.bottomheight = this.availHeight - this.topheight;
|
||||
},
|
||||
collapseTop: function() {
|
||||
@@ -74,8 +85,8 @@ export default {
|
||||
this.bottomheight = 0;
|
||||
},
|
||||
showBoth: function() {
|
||||
this.topheight = Math.floor(this.availHeight/2);
|
||||
this.bottomheight = Math.floor(this.availHeight/2);
|
||||
this.topheight = Math.floor(this.availHeight * (this.defaultRatio[0] / 100));
|
||||
this.bottomheight = this.availHeight - this.topheight
|
||||
},
|
||||
isCollapsed: function() {
|
||||
if( this.topheight === 0 ) {
|
||||
|
||||
@@ -94,7 +94,6 @@ require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php');
|
||||
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
|
||||
require_once('dbupdate_3.4/71566_studienordnungsdokument_neuer_organisationseinheitstyp_programm.php');
|
||||
require_once('dbupdate_3.4/70376_lohnguide.php');
|
||||
require_once('dbupdate_3.4/71405_ferienzeiten.php');
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
@@ -257,7 +256,7 @@ $tabellen=array(
|
||||
"lehre.tbl_anrechnung_begruendung" => array("begruendung_id","bezeichnung"),
|
||||
"lehre.tbl_anrechnungszeitraum" => array("anrechnungszeitraum_id","studiensemester_kurzbz","anrechnungstart","anrechnungende", "insertamum", "insertvon"),
|
||||
"lehre.tbl_betreuerart" => array("betreuerart_kurzbz","beschreibung","aktiv"),
|
||||
"lehre.tbl_ferien" => array("ferien_id","bezeichnung","studiengang_kz","vondatum","bisdatum","oe_kurzbz","studienplan_id","ferientyp_kurzbz","insertamum","insertvon","updateamum","updatevon"),
|
||||
"lehre.tbl_ferien" => array("bezeichnung","studiengang_kz","vondatum","bisdatum"),
|
||||
"lehre.tbl_lehreinheit" => array("lehreinheit_id","lehrveranstaltung_id","studiensemester_kurzbz","lehrfach_id","lehrform_kurzbz","stundenblockung","wochenrythmus","start_kw","raumtyp","raumtypalternativ","sprache","lehre","anmerkung","unr","lvnr","updateamum","updatevon","insertamum","insertvon","ext_id","lehrfach_id_old","gewicht"),
|
||||
"lehre.tbl_lehreinheitgruppe" => array("lehreinheitgruppe_id","lehreinheit_id","studiengang_kz","semester","verband","gruppe","gruppe_kurzbz","updateamum","updatevon","insertamum","insertvon","ext_id"),
|
||||
"lehre.tbl_lehreinheitmitarbeiter" => array("lehreinheit_id","mitarbeiter_uid","lehrfunktion_kurzbz","semesterstunden","planstunden","stundensatz","faktor","anmerkung","bismelden","updateamum","updatevon","insertamum","insertvon","ext_id","standort_id","vertrag_id"),
|
||||
|
||||
@@ -1,206 +0,0 @@
|
||||
<?php
|
||||
if (! defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
//Add column ferien_id to lehre.tbl_ferien
|
||||
if(!@$db->db_query("SELECT ferien_id FROM lehre.tbl_ferien LIMIT 1"))
|
||||
{
|
||||
$qry = 'ALTER TABLE lehre.tbl_ferien ADD COLUMN ferien_id integer;';
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong> lehre.tbl_ferien '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>lehre.tbl_ferien: Neue Spalte ferien_id hinzugefügt';
|
||||
}
|
||||
|
||||
//Column ferien_id mit Werten befüllen
|
||||
if($result = @$db->db_query("SELECT ferien_id FROM lehre.tbl_ferien where ferien_id is not null LIMIT 1"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = 'UPDATE lehre.tbl_ferien et SET ferien_id =
|
||||
(SELECT rownumber FROM (SELECT ROW_NUMBER() OVER (ORDER BY bezeichnung, studiengang_kz)
|
||||
AS rownumber, t.* FROM lehre.tbl_ferien t ORDER BY bezeichnung, studiengang_kz) rn
|
||||
WHERE rn.bezeichnung = et.bezeichnung
|
||||
AND rn.studiengang_kz = et.studiengang_kz);
|
||||
';
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong> lehre.tbl_ferien '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>lehre.tbl_ferien: Spalte bis.tbl_ferien_id mit Werten aufgefüllt';
|
||||
}
|
||||
}
|
||||
|
||||
//Create Sequence lehre.tbl_ferien and grant Rights
|
||||
if ($result = @$db->db_query("SELECT * FROM pg_class WHERE relname = 'tbl_ferien_ferien_id_seq'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
if ($count = @$db->db_query("SELECT * FROM lehre.tbl_ferien"))
|
||||
{
|
||||
$count = $db->db_num_rows($count) + 1;
|
||||
$qry = 'CREATE SEQUENCE lehre.tbl_ferien_ferien_id_seq START ';
|
||||
$qry .= $count;
|
||||
if(!$db->db_query($qry))
|
||||
{
|
||||
echo '<strong> lehre.tbl_ferien '.$db->db_last_error().'</strong><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<br>lehre.tbl_ferien: Sequence lehre.tbl_ferien_ferien_id_seq mit Startwert ' . $count . ' erstellt';
|
||||
$qry2 = "GRANT SELECT, UPDATE ON lehre.tbl_ferien_ferien_id_seq TO vilesci;
|
||||
GRANT SELECT, UPDATE ON lehre.tbl_ferien_ferien_id_seq TO web;";
|
||||
if(!$db->db_query($qry2))
|
||||
{
|
||||
echo '<strong>lehre.tbl_ferien_ferien_id_seq Berechtigungen: '.$db->db_last_error().'</strong><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<br>lehre.tbl_ferien: Rechte auf lehre.tbl_ferien_ferien_id_seq fuer web user und vilesci gesetzt ';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//lehre.tbl_ferien auf NOT NULL setzen
|
||||
if ($result = @$db->db_query("SELECT is_nullable FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_ferien' AND column_name = 'ferien_id' and is_nullable = 'NO'"))
|
||||
{
|
||||
if($db->db_num_rows($result)==0)
|
||||
{
|
||||
$qry = 'ALTER TABLE lehre.tbl_ferien ALTER COLUMN ferien_id SET NOT NULL';
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong> lehre.tbl_ferien '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>lehre.tbl_ferien: Spalte bis.tbl_ferien_id auf NOT NULL gesetzt';
|
||||
}
|
||||
}
|
||||
|
||||
//lehre.tbl_ferien DEFAULT einstellen
|
||||
if ($result = @$db->db_query("SELECT column_default FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_ferien' AND column_name = 'ferien_id' and column_default is null"))
|
||||
{
|
||||
if($db->db_num_rows($result)==1)
|
||||
{
|
||||
$qry = "ALTER TABLE lehre.tbl_ferien ALTER COLUMN ferien_id SET DEFAULT nextval('lehre.tbl_ferien_ferien_id_seq'::regclass);";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong> lehre.tbl_ferien '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br> lehre.tbl_ferien: Defaultwert bei Spalte bis.tbl_ferien_id gesetzt';
|
||||
}
|
||||
}
|
||||
|
||||
//DELETE Constraint PRIMARY KEY pk_tbl_ferien (bezeichnung, studiengang_kz) entfernen
|
||||
if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'pk_tbl_ferien'"))
|
||||
{
|
||||
if($db->db_num_rows($result)==1)
|
||||
{
|
||||
$qry = "ALTER TABLE lehre.tbl_ferien DROP CONSTRAINT pk_tbl_ferien;";
|
||||
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>lehre.tbl_ferien: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>lehre.tbl_ferien: Primary Key pk_tbl_ferien (bezeichnung, studiengang_kz) entfernt ';
|
||||
}
|
||||
}
|
||||
|
||||
// ADD PRIMARY KEY tbl_ferien_pk to lehre.tbl_ferien
|
||||
if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'tbl_ferien_pk'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "ALTER TABLE lehre.tbl_ferien ADD CONSTRAINT tbl_ferien_pk PRIMARY KEY(ferien_id);";
|
||||
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>slehre.tbl_ferien: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>lehre.tbl_ferien: Primary Key tbl_ferien_pk (ferien_id) hinzugefügt';
|
||||
}
|
||||
}
|
||||
|
||||
// add new fields to tbl_ferien, migrate data (add oe_kurzbz data), mark studiengang_kz as deprecated
|
||||
if(!$result = @$db->db_query("SELECT oe_kurzbz FROM lehre.tbl_ferien LIMIT 1"))
|
||||
{
|
||||
$qry = "ALTER TABLE lehre.tbl_ferien
|
||||
ADD COLUMN IF NOT EXISTS oe_kurzbz VARCHAR(32),
|
||||
ADD COLUMN IF NOT EXISTS studienplan_id SMALLINT DEFAULT NULL,
|
||||
ADD CONSTRAINT tbl_ferien_studienplan_fk
|
||||
FOREIGN KEY (studienplan_id)
|
||||
REFERENCES lehre.tbl_studienplan(studienplan_id)
|
||||
ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
ADD CONSTRAINT tbl_ferien_oe_kurzbz_fk
|
||||
FOREIGN KEY (oe_kurzbz)
|
||||
REFERENCES public.tbl_organisationseinheit(oe_kurzbz)
|
||||
ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
ADD COLUMN IF NOT EXISTS insertamum timestamp DEFAULT NOW(),
|
||||
ADD COLUMN IF NOT EXISTS insertvon VARCHAR(32),
|
||||
ADD COLUMN IF NOT EXISTS updateamum timestamp,
|
||||
ADD COLUMN IF NOT EXISTS updatevon VARCHAR(32);
|
||||
UPDATE lehre.tbl_ferien
|
||||
SET oe_kurzbz = (
|
||||
SELECT
|
||||
CASE
|
||||
WHEN studiengang_kz = 0
|
||||
THEN NULL
|
||||
ELSE oe_kurzbz
|
||||
END
|
||||
FROM
|
||||
public.tbl_studiengang
|
||||
WHERE
|
||||
studiengang_kz = tbl_ferien.studiengang_kz
|
||||
)
|
||||
WHERE oe_kurzbz IS NULL AND studiengang_kz IS NOT NULL;
|
||||
ALTER TABLE lehre.tbl_ferien ALTER COLUMN studiengang_kz DROP NOT NULL;
|
||||
COMMENT ON COLUMN lehre.tbl_ferien.studiengang_kz IS 'DEPRECATED';";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>lehre.tbl_ferien: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>lehre.tbl_ferien columns oe_kurzbz, studienplan_id, insertamum, insertvon, updateamum, updatevon hinzugefuegt';
|
||||
}
|
||||
|
||||
// Creates table lehre.tbl_ferientyp if it doesn't exist and grants privileges
|
||||
if (!$result = @$db->db_query('SELECT 0 FROM lehre.tbl_ferientyp WHERE 0 = 1'))
|
||||
{
|
||||
$qry = 'CREATE TABLE lehre.tbl_ferientyp (
|
||||
ferientyp_kurzbz VARCHAR(64),
|
||||
beschreibung VARCHAR(256) NOT NULL,
|
||||
mitarbeiter boolean NOT NULL,
|
||||
studierende boolean NOT NULL,
|
||||
lehre boolean NOT NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE lehre.tbl_ferientyp IS \'Typ-Tabelle zum Speichern von Informationen zu Ferien.\';
|
||||
COMMENT ON COLUMN lehre.tbl_ferientyp.ferientyp_kurzbz IS \'Typ der Ferien.\';
|
||||
COMMENT ON COLUMN lehre.tbl_ferientyp.mitarbeiter IS \'Ob die Ferien für MitarbeiterInnen relevant sind.\';
|
||||
COMMENT ON COLUMN lehre.tbl_ferientyp.studierende IS \'Ob die Ferien für Studierende relevant sind.\';
|
||||
COMMENT ON COLUMN lehre.tbl_ferientyp.lehre IS \'Ob Lehre in den Ferien verplant werden kann.\';
|
||||
|
||||
ALTER TABLE lehre.tbl_ferientyp ADD CONSTRAINT pk_tbl_ferientyp PRIMARY KEY (ferientyp_kurzbz);
|
||||
|
||||
ALTER TABLE lehre.tbl_ferien ADD COLUMN IF NOT EXISTS ferientyp_kurzbz VARCHAR(64) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE lehre.tbl_ferien ADD CONSTRAINT tbl_lehre_ferien_ferientyp_kurzbz_fk FOREIGN KEY (ferientyp_kurzbz)
|
||||
REFERENCES lehre.tbl_ferientyp (ferientyp_kurzbz) MATCH FULL
|
||||
ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
INSERT INTO lehre.tbl_ferientyp (ferientyp_kurzbz, beschreibung, mitarbeiter, studierende, lehre)
|
||||
VALUES(\'Feiertag\', \'Gesetzliche und andere Feiertage\', true, true, false);
|
||||
INSERT INTO lehre.tbl_ferientyp (ferientyp_kurzbz, beschreibung, mitarbeiter, studierende, lehre)
|
||||
VALUES(\'Ferien\', \'Ferientage\', true, true, false);
|
||||
INSERT INTO lehre.tbl_ferientyp (ferientyp_kurzbz, beschreibung, mitarbeiter, studierende, lehre)
|
||||
VALUES(\'Info\', \'Weitere Zeiten für Ereignisse, z.B. Sportwoche, Ausgleichswoche... \', true, true, false);
|
||||
';
|
||||
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>lehre.tbl_ferientyp: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>lehre.tbl_ferientyp table created';
|
||||
|
||||
$qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE lehre.tbl_ferientyp TO vilesci;';
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>lehre.tbl_ferientyp: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br>Granted privileges to <strong>vilesci</strong> on lehre.tbl_ferientyp';
|
||||
}
|
||||
@@ -58177,288 +58177,6 @@ I have been informed that I am under no obligation to consent to the transmissio
|
||||
)
|
||||
),
|
||||
// ### Phrases Dashboard Admin END
|
||||
// ### Ferien START
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'ferienId',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Ferien Id',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Holiday Id',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'vondatum',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Datum von',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'From date',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'bisdatum',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Datum bis',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'To date',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'organisationseinheit',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => "Organisationseinheit",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => "Organisational unit",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'oeKurzbezeichnung',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => "Organisationseinheit Kurzbezeichung",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => "Organisational unit short name",
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'oeBezeichnung',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Organisationseinheit Bezeichnung',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Organizational unit name',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'studienplan',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Studienplan',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Study plan',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'studienplanBezeichnung',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Studienplan Bezeichnung',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Study plan name',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'ferientypKurzbz',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Ferientyp Bezeichnung',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Holiday type name',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'mitarbeiterrelevant',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Mitarbeiterrelevant',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Employee relevant',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'studierendenrelevant',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Studierendenrelevant',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Student relevant',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'lehrePlanbar',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Lehre planbar',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Classes assignable',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ferien',
|
||||
'phrase' => 'ferien_edit',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'edit holidays',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Ferien bearbeiten',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ui',
|
||||
'phrase' => 'keineAuswahl',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'keine Auswahl',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'no selection',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
)
|
||||
// ### Ferien END
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -125,13 +125,11 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_query="INSERT INTO lehre.tbl_ferien (studiengang_kz, bezeichnung, vondatum, bisdatum, oe_kurzbz) VALUES(
|
||||
$sql_query="INSERT INTO lehre.tbl_ferien (studiengang_kz, bezeichnung, vondatum, bisdatum) VALUES(
|
||||
".$db->db_add_param($_POST['studiengang_kz'], FHC_INTEGER).",
|
||||
".$db->db_add_param($_POST['bezeichnung']).",
|
||||
".$db->db_add_param($datum_obj->formatDatum($_POST['vondatum'],'Y-m-d')).",
|
||||
".$db->db_add_param($datum_obj->formatDatum($_POST['bisdatum'],'Y-m-d')).",
|
||||
CASE WHEN ".$db->db_add_param($_POST['studiengang_kz'], FHC_INTEGER)." = 0 THEN NULL
|
||||
ELSE (SELECT oe_kurzbz FROM public.tbl_studiengang WHERE studiengang_kz = ".$db->db_add_param($_POST['studiengang_kz'], FHC_INTEGER).") END);";
|
||||
".$db->db_add_param($datum_obj->formatDatum($_POST['bisdatum'],'Y-m-d')).");";
|
||||
//echo $sql_query;
|
||||
$db->db_query($sql_query);
|
||||
$stg_kz = $_POST['studiengang_kz'];
|
||||
@@ -253,7 +251,7 @@
|
||||
{
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.$db->convert_html_chars($stg_arr[$row->studiengang_kz] ?? '').'</td>
|
||||
<td>'.$db->convert_html_chars($stg_arr[$row->studiengang_kz]).'</td>
|
||||
<td>'.$db->convert_html_chars($row->vondatum).'</td>
|
||||
<td>'.$db->convert_html_chars($row->bisdatum).'</td>
|
||||
<td>'.$db->convert_html_chars($row->bezeichnung).'</td>';
|
||||
|
||||
Reference in New Issue
Block a user