aboutsummaryrefslogtreecommitdiff
path: root/lib/models/Courseware/StructuralElement.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/Courseware/StructuralElement.php')
-rw-r--r--lib/models/Courseware/StructuralElement.php22
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
+ ]);
+ }
+ }
}