diff --git a/app/controllers/course/study_areas.php b/app/controllers/course/study_areas.php index e7365f1cb63f2cf798ebb239e1bf826feee70066..3643309d4bc74d565d43ceb5114ff2eb4675c258 100644 --- a/app/controllers/course/study_areas.php +++ b/app/controllers/course/study_areas.php @@ -71,7 +71,8 @@ class Course_StudyAreasController extends AuthenticatedController if (Request::get('open_node')) { $this->values[get_class($this->step)]['open_node'] = Request::get('open_node'); } - $this->must_have_studyareas = $this->is_required(); + $this->is_activated = $this->is_activated(); + $this->is_required = $this->is_required(); $this->values[get_class($this->step)]['locked'] = $this->locked; $this->tree = $this->step->getStepTemplate($this->values, 0, 0); @@ -122,7 +123,6 @@ class Course_StudyAreasController extends AuthenticatedController $msg = $this->unassign(); } - } else { $studyareas = Request::getArray('studyareas'); @@ -131,13 +131,12 @@ class Course_StudyAreasController extends AuthenticatedController $this->redirect($url); return; } - if (!empty($studyareas) && !$this->is_required()) { + if (!empty($studyareas) && !$this->is_activated()) { PageLayout::postError(_('Sie dürfen keine Studienbereiche zuweisen.')); $this->redirect($url); return; } - try { $this->course->setStudyAreas($studyareas); } catch (UnexpectedValueException $e) { @@ -200,6 +199,21 @@ class Course_StudyAreasController extends AuthenticatedController * @return boolean True if required. */ private function is_required() + { + $sem_class = $this->course->getSemClass(); + if (get_class($this->step) === 'StudyAreasLVGroupsCombinedWizardStep') { + if ($sem_class['module']) { + $lv_gruppen = Lvgruppe::findBySeminar($this->course->id); + if (count($lv_gruppen)) { + return false; + } + } + } + + return (bool) $sem_class['bereiche']; + } + + private function is_activated() { $sem_class = $this->course->getSemClass(); return (bool) $sem_class['bereiche']; diff --git a/app/views/course/study_areas/show.php b/app/views/course/study_areas/show.php index a56521c1630f564d381daab45e4b2fca8309ef6c..efec1b45025f976c0c0a39ffefb036cc84b568dc 100644 --- a/app/views/course/study_areas/show.php +++ b/app/views/course/study_areas/show.php @@ -3,8 +3,10 @@ <? endif?> <?= $tree ?> <div style="text-align: center;"> - <? if ($must_have_studyareas) : ?> - <?= _("Die Veranstaltung muss <b>mindestens einen</b> Studienbereich haben.") ?> + <? if ($is_activated) : ?> + <? if ($is_required) : ?> + <?= _("Die Veranstaltung muss <b>mindestens einen</b> Studienbereich haben.") ?> + <? endif ?> <? else : ?> <?= _("Die Veranstaltung darf <b>keine</b> Studienbereiche haben.") ?> <? endif ?>