testing/implementing more config flags; dont select on certain cols; certain cols only available with certain flags;

This commit is contained in:
Johann Hoffmann
2026-02-05 16:49:26 +01:00
parent 17f11fa871
commit 6cf7093293
5 changed files with 369 additions and 261 deletions
@@ -18,18 +18,9 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
//require_once('../../../include/studiengang.class.php');
//require_once('../../../include/student.class.php');
//require_once('../../../include/datum.class.php');
//require_once('../../../include/mail.class.php');
//require_once('../../../include/benutzerberechtigung.class.php');
//require_once('../../../include/phrasen.class.php');
//require_once('../../../include/projektarbeit.class.php');
//require_once('../../../include/projektbetreuer.class.php');
class Lehre extends FHCAPI_Controller
{
/**
* Object initialization
*/
@@ -38,39 +29,57 @@ class Lehre extends FHCAPI_Controller
parent::__construct([
'lvStudentenMail' => self::PERM_LOGGED,
'LV' => self::PERM_LOGGED,
'Pruefungen' => self::PERM_LOGGED
'Pruefungen' => self::PERM_LOGGED,
'getZugewieseneLv' => self::PERM_LOGGED,
'getLeForLv' => self::PERM_LOGGED
]);
$this->load->library('PhrasesLib');
$this->loadPhrases(
array(
'global',
'ui',
'abgabetool'
)
);
$this->load->helper('hlp_sancho_helper');
require_once(FHCPATH . 'include/studiengang.class.php');
require_once(FHCPATH . 'include/student.class.php');
require_once(FHCPATH . 'include/projektarbeit.class.php');
require_once(FHCPATH . 'include/projektbetreuer.class.php');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
/**
* constructs the emails of the groups from a lehrveranstaltung
*/
public function lvStudentenMail()
public function lvStudentenMail()
{
$lehreinheit_id = $this->input->get("lehreinheit_id",TRUE);
// return early if the required parameter is missing
if(!isset($lehreinheit_id))
{
$this->terminateWithError('Missing required parameter', self::ERROR_TYPE_GENERAL);
}
$lehreinheit_id = $this->input->get("lehreinheit_id",TRUE);
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
$studentenMails = $this->LehreinheitModel->getStudentenMail($lehreinheit_id);
// return early if the required parameter is missing
if(!isset($lehreinheit_id))
{
$this->terminateWithError('Missing required parameter', self::ERROR_TYPE_GENERAL);
}
$studentenMails = $this->getDataOrTerminateWithError($studentenMails);
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
$studentenMails = $this->LehreinheitModel->getStudentenMail($lehreinheit_id);
$studentenMails = $this->getDataOrTerminateWithError($studentenMails);
//convert array of objects into array of strings
$studentenMails = array_map(function($element){
return $element->mail;
}, $studentenMails);
$this->terminateWithSuccess($studentenMails);
$this->terminateWithSuccess($studentenMails);
}
public function LV($studiensemester_kurzbz, $lehrveranstaltung_id)
@@ -80,13 +89,13 @@ class Lehre extends FHCAPI_Controller
$result = $this->LehrveranstaltungModel->getLvsByStudentWithGrades(getAuthUID(), $studiensemester_kurzbz, getUserLanguage(), $lehrveranstaltung_id);
$result = current($this->getDataOrTerminateWithError($result));
$this->terminateWithSuccess($result);
}
/**
* fetches all Pruefungen of a student for a specific lehrveranstaltung
* if the student passed the Pruefung on the first attempt, no information about the Pruefungen is stored in the database
* if the student passed the Pruefung on the first attempt, no information about the Pruefungen is stored in the database
* @param mixed $lehrveranstaltung_id
* @return void
*/
@@ -100,5 +109,46 @@ class Lehre extends FHCAPI_Controller
$this->terminateWithSuccess($result);
}
}
/**
* fetches all assigned lehrveranstaltungen of a mitarbeiter for a given semester
* @param mixed $uid
* @param mixed $sem_kurzbz
* @return void
*/
public function getZugewieseneLv() {
$uid = $this->input->get("uid",TRUE);
$sem_kurzbz = $this->input->get("sem_kurzbz",TRUE);
// TODO: error messages
if(!isset($sem_kurzbz) || isEmptyString($sem_kurzbz))
$this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general');
if (!isset($uid) || isEmptyString($uid))
$uid = getAuthUID();
// querying other ma_uids data requires admin permission
if($uid !== getAuthUID()) {
$this->load->library('PermissionLib');
$isAdmin = $this->permissionlib->isBerechtigt('admin');
if(!$isAdmin) $this->terminateWithError($this->p->t('ui', 'keineBerechtigung'), 'general');
}
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->getLvForLektorInSemester($sem_kurzbz, $uid);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getLeForLv() {
$lv_id = $this->input->get("lv_id",TRUE);
$sem_kurzbz = $this->input->get("sem_kurzbz",TRUE);
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
// $this->terminateWithSuccess($this->LehreinheitModel->getLesForLv($lv_id, $sem_kurzbz));
$this->terminateWithSuccess($this->LehreinheitModel->getAllLehreinheitenForLvaAndMaUid($lv_id, getAuthUID(), $sem_kurzbz));
}
}
@@ -53,7 +53,6 @@ class Noten extends FHCAPI_Controller
'lehre',
'ui'
]);
require_once(FHCPATH . 'include/mobilitaet.class.php');
$this->load->model('education/LePruefung_model', 'LePruefungModel');
$this->load->model('education/Lvgesamtnote_model', 'LvgesamtnoteModel');
@@ -72,45 +71,38 @@ class Noten extends FHCAPI_Controller
public function getCisConfig() {
$this->terminateWithSuccess(
array(
// TODO
// Punkte bei der Noteneingabe anzeigen
'CIS_GESAMTNOTE_PUNKTE' => CIS_GESAMTNOTE_PUNKTE,
// TODO
// basically on/of toggle for the points/grade col and the arrow button
// Gibt an ob der Lektor erneut eine LVNote eintragen kann wenn bereits eine Zeugnisnote vorhanden ist (true | false) DEFAULT true
'CIS_GESAMTNOTE_UEBERSCHREIBEN' => CIS_GESAMTNOTE_UEBERSCHREIBEN,
// only relevant in punkte calculation in backend
// // Gewichtung der Lehreinheiten bei Noteneintragung true|false
// 'CIS_GESAMTNOTE_GEWICHTUNG' => CIS_GESAMTNOTE_GEWICHTUNG,
// this one should always be set true since fh prüfungsordnung requires at least 3 antritte (t1+t2+kP)
// Bei Gesamtnote eine zusaetzliche Spalte fuer den 2. Termin anzeigen
// 'CIS_GESAMTNOTE_PRUEFUNG_TERMIN2' => CIS_GESAMTNOTE_PRUEFUNG_TERMIN2,
// TODO
// should in 99% of cases be kept true to enable 4 antritte in total, but if a certain
// fh still works with 3 antritte per note this can limit the max number of pruefungen accordingly
// Bei Gesamtnote eine zusaetzliche Spalte fuer den 3. Termin anzeigen
// Erfordert den Eintrag "Termin3" in der Tabelle lehre.tbl_pruefungstyp
'CIS_GESAMTNOTE_PRUEFUNG_TERMIN3' => CIS_GESAMTNOTE_PRUEFUNG_TERMIN3,
// used to toggle availability of kommPruef type pruefungen
// Bei Gesamtnote eine zusaetzliche Spalte fuer die kommissionelle Pruefung anlegen
'CIS_GESAMTNOTE_PRUEFUNG_KOMMPRUEF' => CIS_GESAMTNOTE_PRUEFUNG_KOMMPRUEF,
//technically exists but is never used
// // Bei Gesamtnote die Spalte fuer die Quelle der Noten anzeigen (Moodle oder LE)
//technically exists but is never used, could be LE pendant to next flag
// 'CIS_GESAMTNOTE_PRUEFUNG_MOODLE_NOTE' => CIS_GESAMTNOTE_PRUEFUNG_MOODLE_NOTE,
// basically a toggle for "use teilnoten" and the source is always moodle
// Bei Gesamtnote die Spalte fuer die Quelle der Noten anzeigen (Moodle oder LE)
// setting this to false breaks legacy tool and if that was fixed it wouldnt render any table at all
// anyway so not sure why this even is a config at all. placebo at best
// TODO: do we really need this?
'CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE' => CIS_GESAMTNOTE_PRUEFUNG_MOODLE_LE_NOTE,
// Gibt an ob die Note im Notenfreigabemail enthalten ist oder nicht
// send a mail when approving grades
'CIS_GESAMTNOTE_FREIGABEMAIL_NOTE' => CIS_GESAMTNOTE_FREIGABEMAIL_NOTE
)
);
@@ -263,7 +255,7 @@ class Noten extends FHCAPI_Controller
// get all prüfungen with noten held in that semester in that lva
$pruefungen = $this->LePruefungModel->getPruefungenByLvStudiensemester($lv_id, $sem_kurzbz);
$pruefungenData = getData($pruefungen);
$this->terminateWithSuccess(array($studentenData, $pruefungenData, DOMAIN, $grades, $anwresult));
}
@@ -348,6 +340,9 @@ class Noten extends FHCAPI_Controller
<td><b>" . $this->p->t('lehre','studiengang') . "</b></td>\n
<td><b>" . $this->p->t('benotungstool','c4nachname') . "</b></td>\n
<td><b>" . $this->p->t('benotungstool','c4vorname') . "</b></td>\n";
if(defined(CIS_GESAMTNOTE_PUNKTE) && CIS_GESAMTNOTE_PUNKTE) {
$studlist .= "<td><b>" . $this->p->t('benotungstool','c4punkte') . "</b></td>\n";
}
$studlist .= "<td><b>" . $this->p->t('benotungstool','c4grade') . "</b></td>\n";
$studlist .= "<td><b>" . $this->p->t('ui','bearbeitetVon') . "</b></td></tr>\n";
} else {
@@ -391,7 +386,9 @@ class Noten extends FHCAPI_Controller
$studlist .= "<td>" . trim($note->nachname) . "</td>";
$studlist .= "<td>" . trim($note->vorname) . "</td>";
// TODO: if defined(CIS_PUNKTE) ...
if(defined(CIS_GESAMTNOTE_PUNKTE) && CIS_GESAMTNOTE_PUNKTE) {
$studlist .= "<td>" . trim($lvgesamtnote->punkte) . "</td>";
}
$studlist .= "<td>" .$note->noteBezeichnung. "</td>";
$studlist .= "<td>" . $lvgesamtnote->mitarbeiter_uid;
@@ -407,13 +404,13 @@ class Noten extends FHCAPI_Controller
$studlist .= "</table>";
// always send the mail, config toggles data contents
$this->sendEmail($lektorFullName, $lvaFullName, count($result->noten), $emails, $studlist, $betreff);
$this->sendFreigabeEmail($lektorFullName, $lvaFullName, count($result->noten), $emails, $studlist, $betreff);
$this->terminateWithSuccess($ret);
}
private function sendEmail($lektorFullName, $lvaFullName, $notenCount, $emailAdressen, $studlist, $betreff)
private function sendFreigabeEmail($lektorFullName, $lvaFullName, $notenCount, $emailAdressen, $studlist, $betreff)
{
$emailAdressen[] = getAuthUID() . "@" . DOMAIN; // also send mail to lektors own adress
$adressen = implode(";", $emailAdressen);
@@ -984,7 +981,7 @@ class Noten extends FHCAPI_Controller
$student_uid = $student->uid;
$typ = $student->typ;
$note = 9; //$result->note; // TODO: parameterize for import maybe
$punkte = ''; // new pruefungen never have punkte, TODO: check if null or '' prefered
$punkte = null; // new pruefungen never have punkte,
$lehreinheit_id = $student->lehreinheit_id;
$ret[$student->uid] = $this->savePruefungstermin($typ, $student_uid, $lva_id, $stsem, $lehreinheit_id, $note, $punkte, $datum);
@@ -1017,7 +1014,7 @@ class Noten extends FHCAPI_Controller
$typ = $pruefung->typ;
$note = $pruefung->note; // TODO: parameterize for import maybe
$datum = $pruefung->datum;
$punkte = ''; // TODO: check punkte feature
$punkte = null;
$lehreinheit_id = $pruefung->lehreinheit_id;
$ret[$student_uid] = $this->savePruefungstermin($typ, $student_uid, $lv_id, $sem_kurzbz, $lehreinheit_id, $note, $punkte, $datum);