aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/shared/modul.php
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2024-12-04 12:02:06 +0100
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-12-04 14:30:40 +0100
commitfcc7482d7d002ae4dcfd095d68ed25d68d0e0adc (patch)
tree459f52a42a239e5594538c62589642ab6dccd227 /app/controllers/shared/modul.php
parent96fa5cdec8a36b7fd6330cbe6580ec6b7f21d3b2 (diff)
Resolve "Sprachauswahl für Originalfassung der Modul(teil)-Deskriptoren", fixes #4261
Diffstat (limited to 'app/controllers/shared/modul.php')
-rw-r--r--app/controllers/shared/modul.php116
1 files changed, 53 insertions, 63 deletions
diff --git a/app/controllers/shared/modul.php b/app/controllers/shared/modul.php
index d1a6ecf..1f1e5ce 100644
--- a/app/controllers/shared/modul.php
+++ b/app/controllers/shared/modul.php
@@ -13,8 +13,6 @@
* @since 3.5
*/
-
-
class Shared_ModulController extends AuthenticatedController
{
@@ -30,96 +28,89 @@ class Shared_ModulController extends AuthenticatedController
$display_language = Request::option('display_language', $_SESSION['_language']);
ModuleManagementModel::setLanguage($display_language);
- $modul = Modul::find($modul_id);
- if (!$modul->hasPublicStatus()) {
+ $this->modul = Modul::find($modul_id);
+ if (!$this->modul->hasPublicStatus()) {
throw new AccessDeniedException();
}
- if ($modul) {
- $this->details_id = $modul->getId();
+ if ($this->modul) {
+ $this->details_id = $this->modul->getId();
$type = 1;
- if (count($modul->modulteile) == 1) {
- $modulteil = $modul->modulteile->first();
+ if (count($this->modul->modulteile) == 1) {
+ $modulteil = $this->modul->modulteile->first();
$type = 3;
if (count($modulteil->lvgruppen) > 0) {
$type = 2;
}
- } else if (count($modul->modulteile) == 0) {
+ } else if (count($this->modul->modulteile) == 0) {
$type = 3;
}
if (!$semester_id) {
- $currentSemester = Semester::findDefault();
+ $current_semester = Semester::findDefault();
} else {
- $currentSemester = Semester::find($semester_id);
+ $current_semester = Semester::find($semester_id);
}
$sws = 0;
- $institut = new Institute($modul->responsible_institute->institut_id);
- $modulTeileData = [];
- foreach ($modul->modulteile as $modulTeil) {
-
- $modulTeilDeskriptor = $modulTeil->getDeskriptor($display_language);
-
- $sws += (int) $modulTeil->sws;
-
- $num_bezeichnung = $GLOBALS['MVV_MODULTEIL']['NUM_BEZEICHNUNG']['values'][$modulTeil->num_bezeichnung]['name'] ?? '';
-
- $name_kurz = sprintf('%s %d', $num_bezeichnung, $modulTeil->nummer);
-
- $modulTeileData[$modulTeil->getId()] = [
- 'name' => $modulTeil->getDisplayName(),
+ $institut = new Institute($this->modul->responsible_institute->institut_id);
+ $modulteile_data = [];
+ foreach ($this->modul->modulteile as $modulteil) {
+ $modulteil_deskriptor = $modulteil->getDeskriptor();
+ $sws += (int) $modulteil->sws;
+ $num_bezeichnung = $GLOBALS['MVV_MODULTEIL']['NUM_BEZEICHNUNG']['values'][$modulteil->num_bezeichnung]['name'] ?? '';
+ $name_kurz = sprintf('%s %d', $num_bezeichnung, $modulteil->nummer);
+ $modulteile_data[$modulteil->getId()] = [
+ 'name' => $modulteil->getDisplayName(),
'name_kurz' => $name_kurz,
- 'voraussetzung' => $modulTeilDeskriptor->voraussetzung,
- 'pruef_leistung' => $modulTeilDeskriptor->pruef_leistung,
- 'pruef_vorleistung' => $modulTeilDeskriptor->pruef_vorleistung,
- 'kommentar' => $modulTeilDeskriptor->kommentar,
- 'kapazitaet' => $modulTeil->kapazitaet,
+ 'voraussetzung' => $modulteil_deskriptor->voraussetzung,
+ 'pruef_leistung' => $modulteil_deskriptor->pruef_leistung,
+ 'pruef_vorleistung' => $modulteil_deskriptor->pruef_vorleistung,
+ 'kommentar' => $modulteil_deskriptor->kommentar,
+ 'kapazitaet' => $modulteil->kapazitaet,
'lvGruppen' => []
];
- $lvGruppen = Lvgruppe::findByModulteil($modulTeil->getId());
+ $lvGruppen = Lvgruppe::findByModulteil($modulteil->getId());
foreach ($lvGruppen as $lvGruppe) {
- $ids = array_column($lvGruppe->getAssignedCoursesBySemester($currentSemester['semester_id'], $GLOBALS['user']->id), 'seminar_id');
+ $ids = array_column($lvGruppe->getAssignedCoursesBySemester($current_semester['semester_id'], $GLOBALS['user']->id), 'seminar_id');
$courses = Course::findMany($ids, 'order by Veranstaltungsnummer, Name');
- $modulTeileData[$modulTeil->getId()]['lvGruppen'][$lvGruppe->getId()] = [
+ $modulteile_data[$modulteil->getId()]['lvGruppen'][$lvGruppe->getId()] = [
'courses' => $courses,
'alt_texte' => $lvGruppe->alttext
];
}
}
- $this->modulTeile = $modulTeileData;
- $this->deskriptor = $modul->getDeskriptor($display_language);
+ $this->modulteile = $modulteile_data;
+ $this->deskriptor = $this->modul->getDeskriptor();
$this->institut = $institut;
- $this->semester = $currentSemester;
+ $this->semester = $current_semester;
$this->sws = $sws;
- $this->pruef_ebene = $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene]['name'] ?? null;
- $this->modul = $modul;
+ $this->pruef_ebene = $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$this->modul->pruef_ebene]['name'] ?? null;
$this->type = $type;
$this->self_url = $this->url_for('modul/show/' . $modul_id);
$this->detail_url = $this->url_for('modul/detail/' . $modul_id);
- $this->teilnahmeVoraussetzung = $modul->getDeskriptor()->voraussetzung;
- PageLayout::setTitle($modul->getDisplayName() . ' (' . _('Veranstaltungsübersicht') .')');
+ PageLayout::setTitle($this->modul->getDisplayName() . ' (' . _('Veranstaltungsübersicht') .')');
}
}
public function description_action($id)
{
- $modul = Modul::find($id);
- $perm = MvvPerm::get($modul);
- if (!($modul->hasPublicStatus() || $perm->haveObjectPerm(MvvPerm::PERM_READ))) {
+ $this->modul = Modul::find($id);
+ $perm = MvvPerm::get($this->modul);
+ if (!($this->modul->hasPublicStatus() || $perm->haveObjectPerm(MvvPerm::PERM_READ))) {
throw new AccessDeniedException();
}
- $type = 1;
- if (count($modul->modulteile) == 1) {
- $modulteil = $modul->modulteile->first();
- $type = 3;
+ $this->type = 1;
+ if (count($this->modul->modulteile) == 1) {
+ $modulteil = $this->modul->modulteile->first();
+ $this->type = 3;
if (count($modulteil->lvgruppen) > 0) {
- $type = 2;
+ $this->type = 2;
}
- } else if (count($modul->modulteile) == 0) {
- $type = 3;
+ } else if (count($this->modul->modulteile) == 0) {
+ $this->type = 3;
}
if (!Request::get('sem_select')) {
@@ -128,28 +119,27 @@ class Shared_ModulController extends AuthenticatedController
$currentSemester = Semester::find(Request::get('sem_select'));
}
- $display_language = Request::get('display_language', $_SESSION['_language']);
- ModuleManagementModel::setLanguage($display_language);
+ $this->display_language = Request::get('display_language', $this->modul->original_language);
+ ModuleManagementModel::setLanguage($this->display_language);
+ I18NString::setDefaultLanguage($this->modul->original_language);
+ I18NString::setContentLanguage($this->display_language);
$this->semesterSelector = Semester::getSemesterSelector(null, $currentSemester['semester_id'], 'semester_id', false);
- $this->modul = $modul;
- $this->pruefungsEbene = isset($GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene])
- ? $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$modul->pruef_ebene]['name']
+ $this->pruefungsEbene = isset($GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$this->modul->pruef_ebene])
+ ? $GLOBALS['MVV_MODUL']['PRUEF_EBENE']['values'][$this->modul->pruef_ebene]['name']
: null;
- $this->modulDeskriptor = $modul->getDeskriptor($display_language);
- $this->startSemester = Semester::findByTimestamp($modul->start);
+ $this->modulDeskriptor = $this->modul->getDeskriptor();
+ $this->startSemester = Semester::findByTimestamp($this->modul->start);
- if (!$modul->responsible_institute) {
+ if (!$this->modul->responsible_institute) {
$this->instituteName = null;
- } elseif ($modul->responsible_institute->institute) {
- $this->instituteName = $modul->responsible_institute->institute->name;
+ } elseif ($this->modul->responsible_institute->institute) {
+ $this->instituteName = $this->modul->responsible_institute->institute->name;
} else {
$this->instituteName = _('Unbekannte Einrichtung');
}
- $this->type = $type;
$this->semester = $currentSemester;
- $this->display_language = $display_language;
- PageLayout::setTitle($modul->getDisplayName() . ' (' . _('Vollständige Modulbeschreibung') .')');
+ PageLayout::setTitle($this->modul->getDisplayName() . ' (' . _('Vollständige Modulbeschreibung') .')');
}
public function mail_action($modul_id, $semester_id)