ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilSkillTreeAdminGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 // only after ilCtrl is able to handle namespaces
23 //namespace ILIAS\Skill\Tree;
24 
33 
41 {
42  protected ilCtrl $ctrl;
45  protected ilLanguage $lng;
46  protected \ILIAS\UI\Factory $ui_fac;
47  protected \ILIAS\UI\Renderer $ui_ren;
48  protected \ILIAS\Data\Factory $df;
50  protected int $requested_ref_id = 0;
51  protected ilTabsGUI $tabs;
54  protected Tree\SkillTreeManager $skill_tree_manager;
55  protected Tree\SkillTreeFactory $skill_tree_factory;
57  protected Table\TableManager $table_manager;
58 
59  public function __construct(SkillInternalManagerService $skill_manager)
60  {
61  global $DIC;
62 
63  $this->toolbar = $DIC->toolbar();
64  $this->ctrl = $DIC->ctrl();
65  $this->main_tpl = $DIC->ui()->mainTemplate();
66  $this->lng = $DIC->language();
67  $this->ui_fac = $DIC->ui()->factory();
68  $this->ui_ren = $DIC->ui()->renderer();
69  $this->df = new \ILIAS\Data\Factory();
70  $this->request = $DIC->http()->request();
71  $this->tabs = $DIC->tabs();
72  $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
73 
74  $this->requested_ref_id = $this->admin_gui_request->getRefId();
75 
76  $this->skill_manager = $skill_manager;
77  $this->skill_tree_manager = $this->skill_manager->getTreeManager();
78  $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
79  $this->skill_management_access_manager = $this->skill_manager->getManagementAccessManager($this->requested_ref_id);
80  $this->table_manager = $DIC->skills()->internal()->manager()->getTableManager();
81  }
82 
83  public function executeCommand(): void
84  {
85  $ctrl = $this->ctrl;
86 
87  $next_class = $ctrl->getNextClass($this);
88  $cmd = $ctrl->getCmd("listTrees");
89 
90  switch ($next_class) {
91  case "ilobjskilltreegui":
92  $this->tabs->clearTargets();
93  $gui = new ilObjSkillTreeGUI([], $this->requested_ref_id, true, false);
94  $gui->init($this->skill_manager);
95  $ctrl->forwardCommand($gui);
96  break;
97 
98  default:
99  if (in_array($cmd, ["listTrees", "createSkillTree", "updateTree", "createTree"])) {
100  $this->$cmd();
101  }
102  }
103  }
104 
105  protected function listTrees(): void
106  {
107  $mtpl = $this->main_tpl;
108  $toolbar = $this->toolbar;
109  $lng = $this->lng;
110  $ctrl = $this->ctrl;
111 
112  $add_tree_button = $this->ui_fac->button()->standard(
113  $lng->txt("skmg_add_skill_tree"),
114  $ctrl->getLinkTargetByClass("ilobjskilltreegui", "create")
115  );
116 
117  if ($this->skill_management_access_manager->hasCreateTreePermission()) {
118  $toolbar->addComponent($add_tree_button);
119  }
120 
121  $table = $this->table_manager->getTreeTable($this->requested_ref_id)->getComponent();
122 
123  $mtpl->setContent($this->ui_ren->render($table));
124  }
125 }
ilGlobalTemplateInterface $main_tpl
Table TableManager $table_manager
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Skill tree gui class.
Skill tree administration.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getCmd(string $fallback_command=null)
Request wrapper for guis in skill administration.
addComponent(\ILIAS\UI\Component\Component $a_comp)
SkillManagementAccess $skill_management_access_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
SkillAdminGUIRequest $admin_gui_request
SkillInternalManagerService $skill_manager
__construct(SkillInternalManagerService $skill_manager)
forwardCommand(object $a_gui_object)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
getNextClass($a_gui_class=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Tree SkillTreeManager $skill_tree_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Tree SkillTreeFactory $skill_tree_factory