diff options
| author | Ron Lucke <lucke@elan-ev.de> | 2023-12-12 10:57:51 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2023-12-15 09:07:27 +0100 |
| commit | 9da159cf2cb977e13eb9760a3bfa66eec33eeab3 (patch) | |
| tree | 8fb711e02e3a36836e1b819bb06173dd4a13b3bf /lib/models/Courseware/StructuralElement.php | |
| parent | a7ff3e9218ff4c6ec9291dffe1eb118fd0b4a03f (diff) | |
TIC #3258
Merge request studip/studip!2342
Diffstat (limited to 'lib/models/Courseware/StructuralElement.php')
| -rw-r--r-- | lib/models/Courseware/StructuralElement.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/models/Courseware/StructuralElement.php b/lib/models/Courseware/StructuralElement.php index bb325db..34cef80 100644 --- a/lib/models/Courseware/StructuralElement.php +++ b/lib/models/Courseware/StructuralElement.php @@ -1168,4 +1168,26 @@ SQL; } } + + public function createChildrenFromCourseTopics() + { + if ($this->range_type === 'user') { + return null; + } + $topics = \CourseTopic::findBySeminar_id($this->course->id); + foreach($topics as $key => $topic) { + self::create([ + 'parent_id' => $this->id, + 'range_id' => $this->range_id, + 'range_type' => $this->range_type, + 'owner_id' => $this->owner_id, + 'editor_id' => $this->editor_id, + 'edit_blocker_id' => '', + 'title' => $topic->title, + 'purpose' => $this->purpose, + 'payload' => '', + 'position' => $key + ]); + } + } } |
