Skip to content

Commit

Permalink
help: multiple modules v
Browse files Browse the repository at this point in the history
  • Loading branch information
alex40724 committed Sep 28, 2023
1 parent fd640e4 commit 797e568
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
40 changes: 21 additions & 19 deletions Services/Help/Map/MapDBRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,27 @@ public function getChaptersForScreenId(
{
$sc_id = explode("/", $a_screen_id);
$chaps = array();
if ($sc_id[0] != "") {
if ($sc_id[1] == "") {
$sc_id[1] = "-";
}
if ($sc_id[2] == "") {
$sc_id[2] = "-";
}
$set = $this->db->query(
"SELECT chap, perm FROM help_map JOIN lm_tree" .
" ON (help_map.chap = lm_tree.child) " .
" WHERE (component = " . $this->db->quote($sc_id[0], "text") .
" OR component = " . $this->db->quote("*", "text") . ")" .
" AND screen_id = " . $this->db->quote($sc_id[1], "text") .
" AND screen_sub_id = " . $this->db->quote($sc_id[2], "text") .
" AND ". $this->db->in("module_id", $module_ids, false, "integer") .
" ORDER BY lm_tree.lft"
);
while ($rec = $this->db->fetchAssoc($set)) {
yield $rec;
foreach ($module_ids as $module_id) {
if ($sc_id[0] != "") {
if ($sc_id[1] == "") {
$sc_id[1] = "-";
}
if ($sc_id[2] == "") {
$sc_id[2] = "-";
}
$set = $this->db->query(
"SELECT chap, perm FROM help_map JOIN lm_tree" .
" ON (help_map.chap = lm_tree.child) " .
" WHERE (component = " . $this->db->quote($sc_id[0], "text") .
" OR component = " . $this->db->quote("*", "text") . ")" .
" AND screen_id = " . $this->db->quote($sc_id[1], "text") .
" AND screen_sub_id = " . $this->db->quote($sc_id[2], "text") .
" AND module_id = " . $this->db->quote($module_id, "integer") .
" ORDER BY lm_tree.lft"
);
while ($rec = $this->db->fetchAssoc($set)) {
yield $rec;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Services/Help/Module/ModuleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function upload(
$conf = $imp->getConfig("Services/Help");
$conf->setModuleId($id);
$new_id = $imp->importObject(null, $file["tmp_name"], $file["name"], "lm", "Modules/LearningModule"); //
$newObj = new ilObjLearningModule($new_id, false);
$newObj = new \ilObjLearningModule($new_id, false);

$this->repo->writeHelpModuleLmId($id, $newObj->getId());
} catch (\ilManifestFileNotFoundImportException $e) {
Expand Down
2 changes: 1 addition & 1 deletion Services/Help/Tooltips/TooltipsDBRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getTooltipPresentationText(
string $a_tt_id,
array $module_ids
): string {
$set = $this->db->query(
$set = $this->db->query($q =
"SELECT tt.tt_text FROM help_tooltip tt LEFT JOIN help_module hmod " .
" ON (tt.module_id = hmod.id) " .
" WHERE tt.tt_id = " . $this->db->quote($a_tt_id, "text") .
Expand Down
1 change: 0 additions & 1 deletion Services/Help/Tooltips/TooltipsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public function getTooltipPresentationText(
} else {
$module_ids = $this->domain->module()->getActiveModules();
}

return $this->repo->getTooltipPresentationText(
$a_tt_id,
$module_ids
Expand Down

0 comments on commit 797e568

Please sign in to comment.