ILIAS  release_8 Revision v8.24
class.ilObjSkillTreeGUI.php
Go to the documentation of this file.
1<?php
2
27
35{
40 protected ilTabsGUI $tabs;
50 protected UIServices $ui;
54 protected int $requested_node_id = 0;
55 protected int $requested_tref_id = 0;
56 protected int $requested_templates_tree = 0;
57 protected string $requested_skexpand = "";
58 protected int $requested_tmpmode = 0;
59
63 protected array $requested_titles = [];
64
68 protected array $requested_node_ids = [];
69
76 public function __construct(
77 $a_data,
78 int $a_id,
79 bool $a_call_by_reference = true,
80 bool $a_prepare_output = true
81 ) {
82 global $DIC;
83
84 $this->ctrl = $DIC->ctrl();
85 $this->rbacsystem = $DIC->rbac()->system();
86 $this->error = $DIC["ilErr"];
87 $this->access = $DIC->access();
88 $this->tabs = $DIC->tabs();
89 $this->lng = $DIC->language();
90 $this->settings = $DIC->settings();
91 $this->tpl = $DIC["tpl"];
92 $this->toolbar = $DIC->toolbar();
93 $this->user = $DIC->user();
94 $ilCtrl = $DIC->ctrl();
95 $this->ui = $DIC->ui();
96 $this->main_tpl = $DIC->ui()->mainTemplate();
97 $this->locator = $DIC["ilLocator"];
98 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
99
100 $this->type = "skee";
101 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
102
103 $this->lng->loadLanguageModule('skmg');
104
105 $this->skill_tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
106 $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
107 $this->skill_tree = $this->skill_tree_factory->getTreeById($this->object->getId());
108
109 $ilCtrl->saveParameter($this, "node_id");
110
111 $this->tool_context = $DIC->globalScreen()->tool()->context();
112
113 $this->requested_node_id = $this->admin_gui_request->getNodeId();
114 $this->requested_tref_id = $this->admin_gui_request->getTrefId();
115 $this->requested_templates_tree = $this->admin_gui_request->getTemplatesTree();
116 $this->requested_skexpand = $this->admin_gui_request->getSkillExpand();
117 $this->requested_tmpmode = $this->admin_gui_request->getTemplateMode();
118 $this->requested_titles = $this->admin_gui_request->getTitles();
119 $this->requested_node_ids = $this->admin_gui_request->getNodeIds();
120 }
121
122 public function init(Service\SkillInternalManagerService $skill_manager): void
123 {
124 $this->skill_tree_manager = $skill_manager->getTreeManager();
125 $this->skill_tree_node_manager = $skill_manager->getTreeNodeManager($this->object->getId());
126 $this->skill_tree_access_manager = $skill_manager->getTreeAccessManager($this->object->getRefId());
127 $this->skill_management_access_manager = $skill_manager->getManagementAccessManager(
128 $this->skill_tree_manager->getSkillManagementRefId()
129 );
130 $this->profile_manager = $skill_manager->getProfileManager();
131 $this->profile_completion_manager = $skill_manager->getProfileCompletionManager();
132 }
133
134 public function executeCommand(): void
135 {
138 $ilTabs = $this->tabs;
139
140 $next_class = $this->ctrl->getNextClass($this);
141 $cmd = $this->ctrl->getCmd();
142
143 $this->prepareOutput();
144 $this->showLocator();
145
146
147 if (!$this->skill_tree_access_manager->hasReadTreePermission()) {
148 $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
149 }
150
151 switch ($next_class) {
152 case 'ilskillrootgui':
153 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
154 return;
155 }
156 $skrt_gui = new ilSkillRootGUI(
157 $this->skill_tree_node_manager,
158 $this->requested_node_id
159 );
160 $skrt_gui->setParentGUI($this);
161 $ret = $this->ctrl->forwardCommand($skrt_gui);
162 break;
163
164 case 'ilskillcategorygui':
165 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
166 return;
167 }
168 $this->tabs_gui->activateTab("skills");
169 $scat_gui = new ilSkillCategoryGUI(
170 $this->skill_tree_node_manager,
171 $this->requested_node_id
172 );
173 $scat_gui->setParentGUI($this);
174 $this->showTree(false, $scat_gui, "listItems");
175 $ret = $this->ctrl->forwardCommand($scat_gui);
176 break;
177
178 case 'ilbasicskillgui':
179 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
180 return;
181 }
182 $this->tabs_gui->activateTab("skills");
183 $skill_gui = new ilBasicSkillGUI(
184 $this->skill_tree_node_manager,
185 $this->requested_node_id
186 );
187 $skill_gui->setParentGUI($this);
188 $this->showTree(false, $skill_gui, "edit");
189 $ret = $this->ctrl->forwardCommand($skill_gui);
190 break;
191
192 case 'ilskilltemplatecategorygui':
193 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
194 return;
195 }
196 $this->tabs_gui->activateTab("skill_templates");
197 $sctp_gui = new ilSkillTemplateCategoryGUI(
198 $this->skill_tree_node_manager,
199 $this->requested_node_id,
200 $this->requested_tref_id
201 );
202 $sctp_gui->setParentGUI($this);
203 $this->showTree(($this->requested_tref_id == 0), $sctp_gui, "listItems");
204 $ret = $this->ctrl->forwardCommand($sctp_gui);
205 break;
206
207 case 'ilbasicskilltemplategui':
208 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
209 return;
210 }
211 $this->tabs_gui->activateTab("skill_templates");
212 $sktp_gui = new ilBasicSkillTemplateGUI(
213 $this->skill_tree_node_manager,
214 $this->requested_node_id,
215 $this->requested_tref_id
216 );
217 $sktp_gui->setParentGUI($this);
218 $this->showTree(($this->requested_tref_id == 0), $sktp_gui, "edit");
219 $ret = $this->ctrl->forwardCommand($sktp_gui);
220 break;
221
222 case 'ilskilltemplatereferencegui':
223 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
224 return;
225 }
226 $this->tabs_gui->activateTab("skills");
227 $sktr_gui = new ilSkillTemplateReferenceGUI(
228 $this->skill_tree_node_manager,
229 $this->requested_tref_id
230 );
231 $sktr_gui->setParentGUI($this);
232 $this->showTree(false, $sktr_gui, "listItems");
233 $ret = $this->ctrl->forwardCommand($sktr_gui);
234 break;
235
236 case "ilskillprofilegui":
237 if (!$this->skill_tree_access_manager->hasReadProfilesPermission()) {
238 return;
239 }
240 $ilTabs->activateTab("profiles");
241 $skprof_gui = new ilSkillProfileGUI(
242 $this->skill_tree_access_manager,
243 $this->skill_tree->getTreeId()
244 );
245 $ret = $this->ctrl->forwardCommand($skprof_gui);
246 break;
247
248 case "ilskillprofileuploadhandlergui":
249 $skprof_upl_gui = new ilSkillProfileUploadHandlerGUI();
250 $ret = $this->ctrl->forwardCommand($skprof_upl_gui);
251 break;
252
253 case 'ilpermissiongui':
254 if (!$this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
255 return;
256 }
257 $this->tabs_gui->activateTab('permissions');
258 $perm_gui = new ilPermissionGUI($this);
259 $ret = $this->ctrl->forwardCommand($perm_gui);
260 break;
261
262 case "ilexportgui":
263 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
264 return;
265 }
266 $this->tabs_gui->activateTab('export');
267 $exp_gui = new ilExportGUI($this);
268 $exp_gui->addFormat("xml");
269 //$exp_gui->addFormat("html", "", $this, "exportHTML");
270 $this->object->setType("skmg");
271 $ret = $this->ctrl->forwardCommand($exp_gui);
272 $this->object->setType("skee");
273 break;
274
275 default:
276 if (!$cmd || $cmd == 'view') {
277 $cmd = "editSkills";
278 }
279
280 if ($cmd == "showTree") {
281 $this->showTree((bool) $this->requested_templates_tree);
282 } else {
283 $this->$cmd();
284 }
285 break;
286 }
287 }
288
289 protected function showLocator(): void
290 {
293
295
297 "ilobjsystemfoldergui",
298 "ref_id",
300 );
302 $this->lng->txt("administration"),
303 $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), "")
304 );
306 $this->lng->txt("obj_skmg"),
307 $this->getSkillManagementLink()
308 );
309
310 /*
311 if ($this->object && ($this->object->getRefId() != SYSTEM_FOLDER_ID && !$a_do_not_add_object)) {
312 $ilLocator->addItem(
313 $this->object->getTitle(),
314 $this->ctrl->getLinkTarget($this, "view")
315 );
316 }*/
317 }
318
319 protected function getSkillManagementLink(): string
320 {
321 $this->ctrl->clearParametersByClass("ilobjskillmanagementgui");
322 $this->ctrl->setParameterByClass(
323 "ilobjskillmanagementgui",
324 "ref_id",
325 $this->skill_tree_manager->getSkillManagementRefId()
326 );
327 return $this->ctrl->getLinkTargetByClass("ilobjskillmanagementgui", "");
328 }
329
330 protected function create(): void
331 {
334 $mtpl = $this->main_tpl;
335 $ui = $this->ui;
336
339 $lng->txt("back"),
340 $this->getSkillManagementLink()
341 );
342
343 $mtpl->setContent($ui->renderer()->render($this->initTreeForm()));
344 }
345
346 protected function edit(): void
347 {
349 $tabs->activateTab("settings");
350 $mtpl = $this->main_tpl;
351 $ui = $this->ui;
352
353 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
354 return;
355 }
356
357 $mtpl->setContent($ui->renderer()->render($this->initTreeForm(true)));
358 }
359
360 public function initTreeForm(bool $edit = false): Form\Standard
361 {
362 $ui = $this->ui;
363 $f = $ui->factory();
366
367 $fields["title"] = $f->input()->field()->text($lng->txt("title"))->withRequired(true);
368 if ($edit) {
369 $fields["title"] = $fields["title"]->withValue($this->object->getTitle());
370 }
371
372 $fields["description"] = $f->input()->field()->textarea($lng->txt("description"));
373 if ($edit) {
374 $fields["description"] = $fields["description"]->withValue($this->object->getDescription());
375 }
376
377 // section
378 $section1 = $f->input()->field()->section($fields, $lng->txt("skmg_add_skill_tree"));
379
380 if ($edit) {
381 $form_action = $ctrl->getLinkTarget($this, "update");
382 } else {
383 $form_action = $ctrl->getLinkTarget($this, "save");
384 }
385 return $f->input()->container()->form()->standard($form_action, ["props" => $section1]);
386 }
387
388 public function save(): void
389 {
391 $form = $this->initTreeForm();
394 $tabs = $this->tabs;
396 $ui = $this->ui;
397
398 if ($request->getMethod() == "POST") {
399 $form = $form->withRequest($request);
400 $data = $form->getData();
401 if (isset($data["props"]) && is_array($data["props"])) {
402 $props = $data["props"];
403 $this->skill_tree_manager->createTree(
404 $props["title"],
405 $props["description"]
406 );
407 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
408 } else {
409 $tpl->setContent($ui->renderer()->render($form));
412 $lng->txt("back"),
413 $this->getSkillManagementLink()
414 );
415 return;
416 }
417 }
418 $ctrl->redirectByClass("ilskillrootgui", "listSkills");
419 }
420
421 public function update(): void
422 {
424 $form = $this->initTreeForm();
427
428 if ($request->getMethod() == "POST") {
429 $form = $form->withRequest($request);
430 $data = $form->getData();
431 if (isset($data["props"]) && is_array($data["props"])) {
432 $props = $data["props"];
434 $obj = $this->object;
435 $this->skill_tree_manager->updateTree(
436 $obj,
437 $props["title"],
438 $props["description"]
439 );
440 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
441 }
442 }
443 $ctrl->redirect($this, "edit");
444 }
445
446 public function delete(): void
447 {
449
450 $this->deleteNodes($this);
451 }
452
453 public function getAdminTabs(): void
454 {
456 $ilAccess = $this->access;
458
459
460 $this->tabs_gui->setBackTarget(
461 $lng->txt("skmg_skill_trees"),
462 $this->getSkillManagementLink()
463 );
464
465 if ($this->skill_tree_access_manager->hasReadTreePermission()) {
466 if ($this->skill_tree_access_manager->hasReadCompetencesPermission()) {
467 $this->tabs_gui->addTab(
468 "skills",
469 $lng->txt("skmg_skills"),
470 $this->ctrl->getLinkTarget($this, "editSkills")
471 );
472 $this->tabs_gui->addTab(
473 "skill_templates",
474 $lng->txt("skmg_skill_templates"),
475 $this->ctrl->getLinkTarget($this, "editSkillTemplates")
476 );
477 }
478
479 if ($this->skill_tree_access_manager->hasReadProfilesPermission()) {
480 $this->tabs_gui->addTab(
481 "profiles",
482 $lng->txt("skmg_skill_profiles"),
483 $this->ctrl->getLinkTargetByClass("ilskillprofilegui")
484 );
485 }
486
487 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
488 $this->tabs_gui->addTab(
489 "settings",
490 $lng->txt("settings"),
491 $this->ctrl->getLinkTarget($this, "edit")
492 );
493 }
494
495 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
496 $this->tabs_gui->addTab(
497 "export",
498 $lng->txt("export"),
499 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
500 );
501 }
502 }
503
504 if ($this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
505 $this->tabs_gui->addTab(
506 "permissions",
507 $lng->txt("perm_settings"),
508 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
509 );
510 }
511 }
512
513 public function editSkills(): void
514 {
516 $ilTabs = $this->tabs;
518 $ilCtrl = $this->ctrl;
519
520 $ilTabs->activateTab("skills");
521
522 $ilCtrl->setParameterByClass("ilobjskilltreegui", "node_id", $this->skill_tree->readRootId());
523 $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
524 }
525
526 public function saveAllTitles(bool $a_succ_mess = true): void
527 {
528 $ilCtrl = $this->ctrl;
530
531 if (!count($this->requested_titles) == 0) {
532 foreach ($this->requested_titles as $id => $title) {
534 if (is_object($node_obj)) {
535 // update title
537 }
538 }
539 if ($a_succ_mess) {
540 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
541 }
542 }
543 $ilCtrl->redirect($this, "editSkills");
544 }
545
546 public function saveAllTemplateTitles(bool $a_succ_mess = true): void
547 {
548 $ilCtrl = $this->ctrl;
550
551 if (!count($this->requested_titles) == 0) {
552 foreach ($this->requested_titles as $id => $title) {
554 if (is_object($node_obj)) {
555 // update title
557 }
558 }
559 if ($a_succ_mess) {
560 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
561 }
562 }
563 $ilCtrl->redirect($this, "editSkillTemplates");
564 }
565
566 public function expandAll(bool $a_redirect = true): void
567 {
568 $this->requested_skexpand = "";
569 $n_id = ($this->requested_node_id > 0)
570 ? $this->requested_node_id
571 : $this->skill_tree->readRootId();
572 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
573 $n_arr = [];
574 foreach ($stree as $n) {
575 $n_arr[] = $n["child"];
576 ilSession::set("skexpand", $n_arr);
577 }
578 $this->saveAllTitles(false);
579 }
580
581 public function collapseAll(bool $a_redirect = true): void
582 {
583 $this->requested_skexpand = "";
584 $n_id = ($this->requested_node_id > 0)
585 ? $this->requested_node_id
586 : $this->skill_tree->readRootId();
587 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
588 $old = ilSession::get("skexpand");
589 foreach ($stree as $n) {
590 if (in_array($n["child"], $old) && $n["child"] != $n_id) {
591 $k = array_search($n["child"], $old);
592 unset($old[$k]);
593 }
594 }
595 ilSession::set("skexpand", $old);
596 $this->saveAllTitles(false);
597 }
598
599 public function deleteNodes(object $a_gui): void
600 {
603 $ilCtrl = $this->ctrl;
604 $ilTabs = $this->tabs;
605 $ilToolbar = $this->toolbar;
606
607 if (empty($this->requested_node_ids)) {
608 $tpl->setOnScreenMessage("info", $lng->txt("no_checkbox"), true);
609 $ilCtrl->redirectByClass("ilskilltreeadmingui", "listTrees");
610 }
611
612 $ilTabs->clearTargets();
613
614 // check usages
615 $mode = "";
616 $tree_ids = [];
617 $cskill_ids = [];
618 foreach ($this->requested_node_ids as $id) {
619 if (ilSkillTreeNode::_lookupType($id) == "skrt") {
620 if (!$this->skill_management_access_manager->hasCreateTreePermission()) {
621 return;
622 }
623 $mode = "tree";
624 $tree_node_id = $id;
625 $tree_ids[] = $tree_node_id;
626 }
627 if (in_array(ilSkillTreeNode::_lookupType($id), array("skll", "scat", "sktr"))) {
628 if ($mode == "templates") {
629 $tpl->setOnScreenMessage("failure", "Skill Deletion - type mismatch.", true);
630 $ilCtrl->redirectByClass("ilskilltreeadmingui", "listTrees");
631 }
632 $mode = "basic";
633 $skill_id = $id;
634 $tref_id = 0;
635 if (ilSkillTreeNode::_lookupType($id) == "sktr") {
637 $tref_id = $id;
638 }
639 $cskill_ids[] = array("skill_id" => $skill_id, "tref_id" => $tref_id);
640 }
641 if (in_array(ilSkillTreeNode::_lookupType($id), array("sktp", "sctp"))) {
642 if ($mode == "basic") {
643 $tpl->setOnScreenMessage("failure", "Skill Deletion - type mismatch.", true);
644 $ilCtrl->redirectByClass("ilskilltreeadmingui", "listTrees");
645 }
646 $mode = "templates";
647
649 $cskill_ids[] = array("skill_id" => $id, "tref_id" => $tref_id);
650 }
651 }
652 // for cats, skills and template references, get "real" usages
653 // for skill and category templates check usage in references
654 }
655
656 $u = new ilSkillUsage();
657 $usages = [];
658 if ($mode == "tree") {
659 $usages = $u->getAllUsagesInfoOfTrees($tree_ids);
660 } elseif ($mode == "basic" || $mode == "templates") {
661 $usages = $u->getAllUsagesInfoOfSubtrees($cskill_ids);
662 } else {
663 $tpl->setOnScreenMessage("failure", "Skill Deletion - type mismatch.", true);
664 $ilCtrl->redirectByClass("ilskilltreeadmingui", "listTrees");
665 }
666
667 if (count($usages) > 0) {
668 $html = "";
669 foreach ($usages as $k => $usage) {
670 $tab = new ilSkillUsageTableGUI($this, "showUsage", $k, $usage, $mode);
671 $html .= $tab->getHTML() . "<br/><br/>";
672 }
674 $ilCtrl->saveParameter($a_gui, "tmpmode");
675 $ilToolbar->addButton(
676 $lng->txt("back"),
677 $ilCtrl->getLinkTarget($a_gui, "cancelDelete")
678 );
679 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("skmg_cannot_delete_nodes_in_use"));
680 return;
681 }
682
683 // SAVE POST VALUES
684 ilSession::set("saved_post", $this->requested_node_ids);
685
686 $confirmation_gui = new ilConfirmationGUI();
687
688 $ilCtrl->setParameter($a_gui, "tmpmode", $this->requested_tmpmode);
689 $a_form_action = $this->ctrl->getFormAction($a_gui);
690 $confirmation_gui->setFormAction($a_form_action);
691 $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
692
693 // Add items to delete
694 foreach ($this->requested_node_ids as $id) {
697 if ($mode == "tree") {
698 $tree_id = $this->skill_tree_repo->getTreeIdForNodeId($id);
699 $tree_obj = $this->skill_tree_manager->getTree($tree_id);
700 $obj_title = $tree_obj->getTitle();
701 } else {
702 $obj_title = (!in_array($node_obj->getType(), ["sktp", "sctp"]))
703 ? $node_obj->getTitle()
704 : $node_obj->getTitle() .
705 " (" .
706 $this->lng->txt("skmg_count_references") . " " .
708 ")";
709 }
710 $confirmation_gui->addItem(
711 "id[]",
712 $node_obj->getId(),
713 $obj_title,
714 ilUtil::getImagePath("icon_" . $node_obj->getType() . ".svg")
715 );
716 }
717 }
718
719 $confirmation_gui->setCancel($lng->txt("cancel"), "cancelDelete");
720 if ($mode == "tree") {
721 $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDeleteTrees");
722 } else {
723 $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
724 }
725
726 $tpl->setContent($confirmation_gui->getHTML());
727 }
728
729 public function cancelDelete(): void
730 {
731 $this->ctrl->redirectByClass("ilobjskillmanagementgui", "");
732 }
733
734 public function confirmedDeleteTrees(): void
735 {
737
738 // delete all selected trees
739 foreach ($this->requested_node_ids as $id) {
742 $tree = $this->skill_tree_repo->getTreeForNodeId($id);
743 $tree_obj = $this->skill_tree_manager->getTree($tree->getTreeId());
744 $node_data = $tree->getNodeData($id);
745
746 // delete competence profiles of tree
747 $tree_profiles = $this->profile_manager->getProfilesForSkillTree($tree->getTreeId());
748 foreach ($tree_profiles as $profile) {
749 $this->profile_manager->delete((int) $profile["id"]);
750 $this->profile_completion_manager->deleteEntriesForProfile((int) $profile["id"]);
751 }
752
753 if (is_object($obj)) {
754 $obj->delete();
755 }
756 if ($tree->isInTree($id)) {
757 $tree->deleteTree($node_data);
758 }
759 $this->skill_tree_manager->deleteTree($tree_obj);
760 }
761 }
762
763 // feedback
764 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt("info_deleted"), true);
765 $ctrl->redirectByClass("ilobjskillmanagementgui", "");
766 }
767
768 public function confirmedDelete(): void
769 {
770 // delete all selected objects
771 foreach ($this->requested_node_ids as $id) {
774 $node_data = $this->skill_tree->getNodeData($id);
775 if (is_object($obj)) {
776 $obj->delete();
777 }
778 if ($this->skill_tree->isInTree($id)) {
779 $this->skill_tree->deleteTree($node_data);
780 }
781 }
782 }
783
784 // feedback
785 $this->main_tpl->setOnScreenMessage('info', $this->lng->txt("info_deleted"), true);
786 }
787
788 //
789 // Skill Templates
790 //
791
792 public function editSkillTemplates(): void
793 {
795 $ilTabs = $this->tabs;
797 $ilCtrl = $this->ctrl;
798
799 $ilTabs->activateTab("skill_templates");
800 $ilCtrl->setParameterByClass("ilobjskilltreegui", "node_id", $this->skill_tree->readRootId());
801 $ilCtrl->redirectByClass("ilskillrootgui", "listTemplates");
802 }
803
804 //
805 // Tree
806 //
807
808 public function showTree(bool $a_templates, $a_gui = "", $a_gui_cmd = ""): void
809 {
812 $ilCtrl = $this->ctrl;
814
815 if ($a_templates) {
816 if ($this->requested_node_id == 0 || $this->requested_node_id == $this->skill_tree->readRootId()) {
817 return;
818 }
819
820 if ($this->requested_node_id != $this->skill_tree->readRootId()) {
821 $path = $this->skill_tree->getPathId($this->requested_node_id);
822 if (ilSkillTreeNode::_lookupType($path[1]) == "sktp") {
823 return;
824 }
825 }
826 }
827
828 $ilCtrl->setParameter($this, "templates_tree", (int) $a_templates);
829
830 if ($a_templates) {
831 $this->tool_context->current()->addAdditionalData(ilSkillGSToolProvider::SHOW_TEMPLATE_TREE, true);
832 $this->tool_context->current()->addAdditionalData(ilSkillGSToolProvider::SKILL_TREE_ID, $this->object->getId());
833 $exp = new ilSkillTemplateTreeExplorerGUI($this, "showTree", $this->object->getId());
834 } else {
835 $this->tool_context->current()->addAdditionalData(ilSkillGSToolProvider::SHOW_SKILL_TREE, true);
836 $this->tool_context->current()->addAdditionalData(ilSkillGSToolProvider::SKILL_TREE_ID, $this->object->getId());
837 $exp = new ilSkillTreeExplorerGUI($this, "showTree", $this->object->getId());
838 }
839 if (!$exp->handleCommand()) {
840 $tpl->setLeftNavContent($exp->getHTML());
841 }
842 }
843}
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
renderer()
Get a renderer for UI components.
Definition: UIServices.php:43
factory()
Get the factory that crafts UI components.
Definition: UIServices.php:35
Request wrapper for guis in skill administration.
error(string $a_errmsg)
Basic skill GUI class.
Basic skill template GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
Error Handling & global info handling uses PEAR error class.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
Skill tree gui class.
Tree SkillTreeFactory $skill_tree_factory
saveAllTitles(bool $a_succ_mess=true)
Profile SkillProfileCompletionManager $profile_completion_manager
init(Service\SkillInternalManagerService $skill_manager)
initTreeForm(bool $edit=false)
expandAll(bool $a_redirect=true)
ScreenContext ContextServices $tool_context
Tree SkillTreeManager $skill_tree_manager
getAdminTabs()
administration tabs show only permissions and trash folder
Tree SkillTreeNodeManager $skill_tree_node_manager
Profile SkillProfileManager $profile_manager
ilGlobalTemplateInterface $main_tpl
collapseAll(bool $a_redirect=true)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
ilSkillTreeRepository $skill_tree_repo
showTree(bool $a_templates, $a_gui="", $a_gui_cmd="")
Access SkillManagementAccess $skill_management_access_manager
saveAllTemplateTitles(bool $a_succ_mess=true)
Access SkillTreeAccess $skill_tree_access_manager
Service SkillAdminGUIRequest $admin_gui_request
Class ilObjectGUI Basic methods of all Output classes.
ilAccessHandler $access
ilGlobalTemplateInterface $tpl
ilToolbarGUI $toolbar
prepareOutput(bool $show_sub_objects=true)
ServerRequestInterface $request
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
Skill category GUI class.
Skill profile GUI class.
Class ilSkillProfileUploadHandlerGUI.
Skill root GUI class.
Skill template category GUI class.
Skill template reference GUI class.
static _lookupTrefIdsForTopTemplateId(int $a_template_id)
Explorer class that works on tree objects (Services/Tree)
Explorer class that works on tree objects (Services/Tree)
static _writeTitle(int $a_obj_id, string $a_title)
static _lookupType(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
TableGUI class for skill usages.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setBackTarget(string $a_title, string $a_target, string $a_frame="")
clearTargets()
clear all targets
activateTab(string $a_id)
isInTree(?int $a_node_id)
get all information of a node.
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
deleteTree(array $a_node)
delete node and the whole subtree under this node
const POS_FIRST_NODE
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const SYSTEM_FOLDER_ID
Definition: constants.php:35
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
This describes commonalities between all forms.
Definition: Form.php:33
This describes a standard form.
Definition: Standard.php:27
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLeftNavContent(string $a_content)
Sets content of left navigation column.
setContent(string $a_html)
Sets content for standard template.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
Interface ilSkillTreeRepository.
$path
Definition: ltiservices.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
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...
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...
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...
Definition: Factory.php:21
$ilErr
Definition: raiseError.php:17