Compare commits

..

2 Commits

Author SHA1 Message Date
ma0068 765884b0dc add also insert statement for dashboard.tbl_dashboard_widget 2026-06-11 16:07:49 +02:00
ma0068 fe8cf9bc83 new widget CIS4 MA Widget
- db-update for new widget studstatus
- different view for stgL and stgA
- update phrases
2026-06-11 15:34:45 +02:00
9 changed files with 517 additions and 1 deletions
@@ -0,0 +1,145 @@
<?php
/**
* Copyright (C) 2026 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
class StudstatusAntraege extends FHCAPI_Controller
{
/**
* Object initialization
*/
public function __construct()
{
parent::__construct([
'getTodos' => self::PERM_LOGGED
]);
//load models
$this->load->model('education/Studierendenantrag_model', 'StudierendenantragModel');
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* gets all todos of antraegen of the user with stg leitungsfunction
* or list of open antraege for user with assistance function
* @access public
* @return array || []
*/
public function getTodos()
{
$uid = getAuthUID();
//at first get studiengang with leitungsfunktion
$result = $this->BenutzerfunktionModel->getSTGLByUID($uid);
if(hasData($result))
{
$funktionen = getData($result);
$studiengaenge = [];
foreach ($funktionen as $funktion) {
$studiengaenge[] = $funktion->studiengang_kz;
}
$dataAntrage = [];
$result = $this->StudierendenantragModel->getOpenAntraegeForStgl($studiengaenge);
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$dataAntrage[] = getData($result) ?: [];
$statusRole = 1;
$this->terminateWithSuccess([count($dataAntrage) > 0 ? $dataAntrage[0] : $dataAntrage, $statusRole]);
}
//TODO delete after check if needed or not
//get studiengaenge of assistance (regarding benutzerfunktion)
//$result = $this->BenutzerfunktionModel->getSTGAssByUID($uid);
/* if(hasData($result)) {
$statusRole = 2;
$funktionen = getData($result);
$studiengaenge = [];
foreach ($funktionen as $funktion) {
$studiengaenge[] = $funktion->studiengang_kz;
}
$ci->addMeta('stgAss', $studiengaenge);
$dataAntrage = [];
foreach ($studiengaenge as $studiengang)
{
$result = $this->StudierendenantragModel->getOpenAntraegeForAss($studiengang);
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
if(hasData($result)) {
$dataAntrage[] = getData($result);
$statusRole = 2;
}
}
}
else
{
$statusRole = 0;
$dataAntrage = [];
//$this->terminateWithSuccess([[], $statusRole]);
}*/
//get studiengaenge of assistance (regarding rights)
$stgAss = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
if(!is_array($stgAss))
{
$statusRole = 0;
$this->terminateWithSuccess([[], $statusRole]);
}
else {
$statusRole = 2;
$studiengaenge = [];
foreach ($stgAss as $stg) {
$studiengaenge[] = (int) $stg;
}
$dataAntrage = [];
$result = $this->StudierendenantragModel->getOpenAntraegeForAss($studiengaenge);
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
if(hasData($result)) {
$dataAntrage[] = getData($result);
$statusRole = 2;
}
$this->terminateWithSuccess([count($dataAntrage) > 0 ? $dataAntrage[0] : $dataAntrage, $statusRole]);
}
}
}
@@ -490,4 +490,75 @@ class Studierendenantrag_model extends DB_Model
return hasData($this->load());
}
/**
* Loads all todos for a certain studiengangsleiter
*
* @param integer $stg_kz
*
* @return stdClass
*/
public function getOpenAntraegeForStgl($stg_kz)
{
$qry = "
SELECT
studierendenantrag_id,
prestudent_id,
typ,
person.nachname,
person.vorname,
ps.studiengang_kz
FROM campus.tbl_studierendenantrag a
JOIN public.tbl_prestudent ps USING (prestudent_id)
JOIN public.tbl_person person USING (person_id)
WHERE studiengang_kz in ?
AND (
(typ IN ('Abmeldung', 'AbmeldungStgl', 'Unterbrechung')
AND campus.get_status_studierendenantrag(a.studierendenantrag_id) = 'Erstellt')
OR
(typ = 'Wiederholung'
AND campus.get_status_studierendenantrag(a.studierendenantrag_id) = 'Lvszugewiesen')
)
ORDER BY typ;
";
$params = array($stg_kz);
return $this->execQuery($qry, $params);
}
/**
* Lists all open antraege for a certain stg
*
* @param Array $stg_kz
*
* @return stdClass
*/
public function getOpenAntraegeForAss($stg_kz)
{
$qry = "
SELECT
UPPER(stg.typ) || UPPER(stg.kurzbz) || ' ' || stg.bezeichnung AS studiengang,
COUNT(*) AS anzahl
FROM campus.tbl_studierendenantrag
JOIN public.tbl_prestudent p USING (prestudent_id)
JOIN public.tbl_studiengang stg ON p.studiengang_kz=stg.studiengang_kz
JOIN campus.tbl_studierendenantrag_status as s ON campus.get_status_id_studierendenantrag(campus.tbl_studierendenantrag.studierendenantrag_id) = studierendenantrag_status_id
JOIN campus.tbl_studierendenantrag_statustyp as st USING (studierendenantrag_statustyp_kurzbz)
WHERE (
s.studierendenantrag_statustyp_kurzbz NOT IN('Zurueckgezogen', 'Genehmigt', 'Abgelehnt', 'EinspruchAbgelehnt', 'Abgemeldet', 'Pause', 'EmailVersandt')
OR (
s.studierendenantrag_statustyp_kurzbz = 'Genehmigt'
AND tbl_studierendenantrag.typ = 'AbmeldungStgl'
)
)
AND p.studiengang_kz IN ?
GROUP BY studiengang
ORDER BY studiengang
"
;
$params = array($stg_kz);
return $this->execQuery($qry, $params);
}
}
@@ -321,6 +321,40 @@ class Benutzerfunktion_model extends DB_Model
return $record;
}
/**
* Get active Assistenz(en) of the user by UID.
* @param $uid
*/
public function getSTGAssByUID($uid)
{
$query = '
SELECT
uid,
oe_kurzbz,
studiengang_kz,
typ,
tbl_studiengang.bezeichnung
FROM
public.tbl_benutzerfunktion
JOIN public.tbl_studiengang USING (oe_kurzbz)
WHERE
funktion_kurzbz = \'ass\'
AND (datum_von IS NULL OR datum_von <= now())
AND (datum_bis IS NULL OR datum_bis >= now())
AND uid = ?
ORDER BY
oe_kurzbz
';
$parameters_array = array();
if (is_string($uid))
{
$parameters_array[] = $uid;
}
return $this->execQuery($query, $parameters_array);
}
function updateBenutzerfunktion($funktionJson)
{
$funktionJson['updatevon'] = getAuthUID();
@@ -0,0 +1,25 @@
/**
* Copyright (C) 2026 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 {
getTodos() {
return {
method: 'get',
url: '/api/frontend/v1/StudstatusAntraege/getTodos'
};
},
};
@@ -0,0 +1,75 @@
import AbstractWidget from './Abstract.js';
import ApiStudstatus from '../../api/factory/widget/studstatus.js';
export default {
name: "WidgetStudstatus",
mixins: [AbstractWidget],
data(){
return {
statusData: [],
role: 0
};
},
mounted(){
this.getTodos();
},
computed: {
countTodosLeitung(){
return this.statusData.length;
},
countTodosAss(){
return this.statusData.reduce(
(sum, item) => sum + item.anzahl,
0
);
},
linkStudstatus(){
return (
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/lehre/Studierendenantrag/leitung/"
);
},
},
methods: {
getTodos(){
this.$api
.call(ApiStudstatus.getTodos())
.then(result => {
this.statusData = result.data[0];
this.role = result.data[1];
})
.catch(this.$fhcAlert.handleSystemError);
}
},
template:/*html*/`
<div class="p-3 w-100 h-100 overflow-auto" style="padding: 1rem 1rem;">
<div v-if="role== 0">
{{$p.t('dashboard','noPermissionStudstatus')}}
</div>
<div v-else-if="role==1 && countTodosLeitung">
<p><span class="fw-bold">{{countTodosLeitung}} {{$p.t('dashboard','antraegeToEdit')}}: </span> </p>
<div v-for="status in statusData">
<span class="fw-bold">{{status.typ}}</span> {{status.vorname}} {{status.nachname}} ({{status.prestudent_id}})
</div>
</div>
<div v-else-if="role==2 && countTodosAss">
<span class="fw-bold">{{countTodosAss}} {{$p.t('dashboard','antraegeOpen')}}:</span>
<br><br>
<div v-for="status in statusData">
{{status.studiengang}} ({{status.anzahl}})
</div>
</div>
<div v-else>
{{$p.t('dashboard','antraegeNoOpen')}}
</div>
<div v-if="role!=0" class="mt-3">
<a :href="linkStudstatus" target='blank'>{{$p.t('dashboard','linkVerwaltungStudstatus')}}</a>
</div>
</div>
`
};
@@ -21,7 +21,7 @@ export default {
studierendenantragId: Number,
infoArray: Array,
statusMsg: String,
statusSeverity: String
statusSeverity: String,
},
data() {
return {
+1
View File
@@ -95,6 +95,7 @@ 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/75888_reihungstest_mehrfachdurchfuehrung.php');
require_once('dbupdate_3.4/77048_cis4_mitarbeiter_studstatus_widget.php');
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
@@ -0,0 +1,63 @@
<?php
// neues widget mit widget_kurzbz = 'studstatus' als Zeile hinzufügen
if($result = @$db->db_query("SELECT 1 FROM dashboard.tbl_widget WHERE widget_kurzbz= 'studstatus';"))
{
if($db->db_num_rows($result) == 0)
{
$qry = "
INSERT INTO dashboard.tbl_widget (
widget_id,
widget_kurzbz,
beschreibung,
arguments,
setup
)
VALUES (
9,
'studstatus',
'Widget Todos Studierendenstatus',
'{
\"css\": \"d-flex justify-content-center align-items-center h-100\",
\"title\": \"Tasks Studstatus\"
}'::jsonb,
'{
\"file\": \"public/js/components/DashboardWidget/StudStatus.js\",
\"icon\": \"/skin/images/fh_technikum_wien_illustration_klein.png\",
\"name\": \"Studierendenstatus\",
\"width\": {
\"max\": 2,
\"min\": 1
},
\"height\": {
\"max\": 2,
\"min\": 1
},
\"hideFooter\": true
}'::jsonb
);";
if(!$db->db_query($qry))
echo '<strong>dashboard.tbl_widget: '.$db->db_last_error().'</strong><br>';
else
echo '<br>dashboard.tbl_widget: Widget studstatus hinzugefuegt!<br>';
}
}
// neuer eintrag in dashboard.tbl_dashboard_widget
if($result = @$db->db_query("SELECT 1 FROM dashboard.tbl_dashboard_widget WHERE dashboard_id= 1 AND widget_id = 9;"))
{
if($db->db_num_rows($result) == 0)
{
$qry = "
INSERT INTO
dashboard.tbl_dashboard_widget (dashboard_id, widget_id)
VALUES
(1, 9);
";
}
if(!$db->db_query($qry))
echo '<strong>dashboard.tbl_dashboard_widget: '.$db->db_last_error().'</strong><br>';
else
echo '<br>dashboard.tbl_dashboard_widget: Widget studstatus hinzugefuegt!<br>';
}
+102
View File
@@ -58177,6 +58177,108 @@ I have been informed that I am under no obligation to consent to the transmissio
)
),
// ### Phrases Dashboard Admin END
// ### Phrases Dashboard Studstatus Widget START
array(
'app' => 'core',
'category' => 'dashboard',
'phrase' => 'antraegeToEdit',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'zu bearbeitende Studierendenanträge',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Student applications to be processed',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'dashboard',
'phrase' => 'antraegeOpen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'offene Studierendenanträge',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'open student applications',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'dashboard',
'phrase' => 'antraegeNoOpen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Keine offenen Studierendenanträge',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'No open student applications',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'dashboard',
'phrase' => 'linkVerwaltungStudstatus',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zur Verwaltung des Studierendenstatus',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Link to the administration of the student status',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'dashboard',
'phrase' => 'noPermissionStudstatus',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Keine Berechtigung für Bearbeitung von Studierendenanträgen.',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'No permission to process student applications.',
'description' => '',
'insertvon' => 'system'
)
)
),
// ### Phrases Dashboard Studstatus Widget END
);