aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/coursewizardsteps/BasicDataWizardStep.php
diff options
context:
space:
mode:
authorRasmus Fuhse <fuhse@data-quest.de>2025-01-10 12:13:24 +0000
committerRasmus Fuhse <fuhse@data-quest.de>2025-01-10 12:13:24 +0000
commit39745c9aa8bb099e8bda1f4d775ed229dbe97be4 (patch)
treea2a96deecf48e62d995507c5c8b39eea9ae9293d /lib/classes/coursewizardsteps/BasicDataWizardStep.php
parent03e8e1d8f9100cf9bfcb111b63ac4077f510a026 (diff)
Resolve "Studiengruppen erweitern" - Hauptbronch
Closes #3616 Merge request studip/studip!2509
Diffstat (limited to 'lib/classes/coursewizardsteps/BasicDataWizardStep.php')
-rw-r--r--lib/classes/coursewizardsteps/BasicDataWizardStep.php50
1 files changed, 48 insertions, 2 deletions
diff --git a/lib/classes/coursewizardsteps/BasicDataWizardStep.php b/lib/classes/coursewizardsteps/BasicDataWizardStep.php
index 4b401ee..18892f0 100644
--- a/lib/classes/coursewizardsteps/BasicDataWizardStep.php
+++ b/lib/classes/coursewizardsteps/BasicDataWizardStep.php
@@ -30,7 +30,7 @@ class BasicDataWizardStep implements CourseWizardStep
// Load template from step template directory.
$factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
if (!empty($values[__CLASS__]['studygroup'])) {
- $tpl = $factory->open('basicdata/index_studygroup');
+ $tpl = $factory->open('studygroups/index');
$values[__CLASS__]['lecturers'][$GLOBALS['user']->id] = 1;
} else {
$tpl = $factory->open('basicdata/index');
@@ -428,7 +428,7 @@ class BasicDataWizardStep implements CourseWizardStep
$course->name = new I18NString($values['name'], $values['name_i18n'] ?? []);
$course->veranstaltungsnummer = $values['number'] ?? null;
$course->beschreibung = new I18NString($values['description'], $values['description_i18n'] ?? []);
- $course->start_semester = Semester::find($values['start_semester']);
+ $course->start_semester = isset($values['start_semester']) ? Semester::find($values['start_semester']) : Semester::findCurrent();
$course->institut_id = $values['institute'];
$semclass = $course->getSemClass();
@@ -455,6 +455,7 @@ class BasicDataWizardStep implements CourseWizardStep
break;
}
}
+
if (!$course->store()) {
return false;
}
@@ -506,6 +507,51 @@ class BasicDataWizardStep implements CourseWizardStep
self::copyParticipantsAndGroups($course, $source_id, $copy_participants, $copy_groups, $copy_members);
}
+ if (in_array($values['coursetype'], studygroup_sem_types())) {
+ if (!empty($values['lv_course_id'])) {
+ StudygroupModel::proposeAsStudygroupTo($course, $values['lv_course_id']);
+ }
+ }
+
+ if (!empty($values['exp_date'])) {
+ $exp_date = strtotime($values['exp_date']);
+ if ($exp_date) {
+ CourseConfig::get($course->id)->store('STUDYGROUP_EXPIRATION_DATE', $exp_date);
+ }
+ }
+ if (!empty($values['tags'])) {
+ foreach ($values['tags'] as $name) {
+ if ($tag = Tag::findOneByName($name)) {
+ if (!$tag->active) {
+ continue;
+ }
+ } else {
+ $tag = Tag::create(['name' => $name]);
+ }
+
+ $relation = TagRelation::findOneBySQL(
+ "`range_id` = :course_id AND `range_type` = 'course' AND `tag_id` = :tag_id",
+ [
+ 'tag_id' => $tag->id,
+ 'course_id' => $course->id
+ ]
+ );
+ if (!$relation) {
+ $relation = TagRelation::create([
+ 'range_id' => $course->id,
+ 'range_type' => 'course',
+ 'tag_id' => $tag->id
+ ]);
+ }
+ }
+ }
+
+
+ if (!empty($values['stgteil_id'])) {
+ $studiengangteil = StudiengangTeil::find($values['stgteil_id']);
+ $studiengangteil->addStudygroup($course);
+ }
+
return $course;
}