Skip to content

Commit

Permalink
LSO: 42591, copy intro and extro content page if learning sequence is…
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastocker authored and klees committed Nov 28, 2024
1 parent 61937e3 commit bd38fb7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Modules/LearningSequence/classes/class.ilObjLearningSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree =
$this->cloneSettings($new_obj);
$this->cloneLPSettings($new_obj->getId());
$this->cloneActivation($new_obj, $copy_id);
$this->cloneIntroAndExtroContentPages($new_obj, [self::CP_INTRO, self::CP_EXTRO]);

$roles = $new_obj->getLSRoles();
$roles->addLSMember(
Expand All @@ -147,6 +148,21 @@ public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree =
return $new_obj;
}

protected function cloneIntroAndExtroContentPages(ilObjLearningSequence $new_obj, array $cp_types): void
{
foreach ($cp_types as $type) {
$old_intro_page_id = $this->getContentPageId($type);
if (ilContainerPage::_exists(
"cont",
$old_intro_page_id
)) {
$new_obj->createContentPage($type);
$new_copg_id = $new_obj->getContentPageId($type);
$original_page = new \ilContainerPage($old_intro_page_id);
$original_page->copy($new_copg_id, "cont", $new_copg_id);
}
}
}

protected function cloneAutoGeneratedRoles(ilObjLearningSequence $new_obj): bool
{
Expand Down

0 comments on commit bd38fb7

Please sign in to comment.