ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSkillGSToolProvider.php
Go to the documentation of this file.
1<?php
2
6
13{
14 const SHOW_SKILL_TREE = 'show_skill_tree';
15 const SHOW_TEMPLATE_TREE = 'show_template_tree';
16
17
22 {
23 return $this->context_collection->main()->desktop();
24 }
25
26
30 public function getToolsForContextStack(CalledContexts $called_contexts) : array
31 {
32 $lang = $this->dic->language();
33
34 $lang->loadLanguageModule("skill");
35
36 $title = $lang->txt("skmg_skills");
37
38 $tools = [];
39
40 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_skmg.svg"), $title);
41
42
43 $additional_data = $called_contexts->current()->getAdditionalData();
44 if ($additional_data->is(self::SHOW_SKILL_TREE, true)) {
45 $iff = function ($id) {
46 return $this->identification_provider->contextAwareIdentifier($id);
47 };
48 $l = function (string $content) {
49 return $this->dic->ui()->factory()->legacy($content);
50 };
51 $tools[] = $this->factory->tool($iff("tree"))
52 ->withTitle($title)
53 ->withSymbol($icon)
54 ->withContentWrapper(function () use ($l) {
55 return $l($this->getSkillTree());
56 });
57 }
58
59 $title = $lang->txt("skmg_skill_templates");
60 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_skmg.svg"), $title);
61
62 if ($additional_data->is(self::SHOW_TEMPLATE_TREE, true)) {
63 $iff = function ($id) {
64 return $this->identification_provider->contextAwareIdentifier($id);
65 };
66 $l = function (string $content) {
67 return $this->dic->ui()->factory()->legacy($content);
68 };
69 $tools[] = $this->factory->tool($iff("tree"))
70 ->withTitle("Templates")
71 ->withSymbol($icon)
72 ->withContentWrapper(function () use ($l) {
73 return $l($this->getTemplateTree());
74 });
75 }
76 return $tools;
77 }
78
79
83 private function getSkillTree() : string
84 {
85 $exp = new ilSkillTreeExplorerGUI(["ilAdministrationGUI", "ilObjSkillManagementGUI"], "showTree");
86
87 return $exp->getHTML();
88 }
89
90
94 private function getTemplateTree() : string
95 {
96 $exp = new ilSkillTemplateTreeExplorerGUI(["ilAdministrationGUI", "ilObjSkillManagementGUI"], "showTree");
97
98 return $exp->getHTML();
99 }
100}
An exception for terminatinating execution or to throw for unit testing.
Workspace GS tool provider.
getToolsForContextStack(CalledContexts $called_contexts)
@inheritDoc
Explorer class that works on tree objects (Services/Tree)
Explorer class that works on tree objects (Services/Tree)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$lang
Definition: xapiexit.php:8