Skip to content

Commit 0ec2348

Browse files
committed
Fix SCORM issue with abusive auto-completion of parent items - refs #7191
1 parent a2bcf3f commit 0ec2348

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

main/newscorm/learnpath.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ public function autocomplete_parents($item)
814814
error_log('Found one incomplete child of ' . $parent_id . ': ' . $child . ' is ' . $this->items[$child]->get_status(), 0);
815815
}
816816
$completed = false;
817+
break;
817818
}
818819
}
819820
}
@@ -832,7 +833,7 @@ public function autocomplete_parents($item)
832833
}
833834
} else {
834835
if ($debug) {
835-
error_log("#$item is an item doesn't have parents");
836+
error_log("#$item is an item that doesn't have parents");
836837
}
837838
}
838839
}

main/newscorm/learnpathItem.class.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ public function __construct(
150150
$this->save_on_close = true;
151151
$this->db_id = $id;
152152

153+
// Load children list
154+
$sql = "SELECT id FROM $items_table WHERE c_id = $course_id AND lp_id = ".$this->lp_id." AND parent_item_id = $id";
155+
$res = Database::query($sql);
156+
if (Database::num_rows($res) < 1) {
157+
// Nothing to do (no children)
158+
} else {
159+
while ($row = Database::fetch_assoc($res)) {
160+
$this->children[] = $row['id'];
161+
}
162+
}
163+
153164
//$this->seriousgame_mode = $this->get_seriousgame_mode();
154165
$this->seriousgame_mode = 0;
155166

0 commit comments

Comments
 (0)