3 declare(strict_types=1);
91 bool $a_call_by_reference =
true,
92 bool $a_prepare_output =
true 96 $this->
ctrl = $DIC->ctrl();
97 $this->rbacsystem = $DIC->rbac()->system();
98 $this->error = $DIC[
"ilErr"];
99 $this->
access = $DIC->access();
100 $this->
tabs = $DIC->tabs();
101 $this->
lng = $DIC->language();
103 $this->tpl = $DIC[
"tpl"];
104 $this->
toolbar = $DIC->toolbar();
105 $this->
user = $DIC->user();
106 $ilCtrl = $DIC->ctrl();
107 $this->
ui = $DIC->ui();
108 $this->main_tpl = $DIC->ui()->mainTemplate();
109 $this->
locator = $DIC[
"ilLocator"];
110 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
111 $this->skill_ui_service = $DIC->skills()->ui();
113 $this->type =
"skee";
116 $this->
lng->loadLanguageModule(
'skmg');
118 $this->skill_tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
119 $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
120 $this->skill_tree = $this->skill_tree_factory->getTreeById($this->
object->getId());
122 $ilCtrl->saveParameter($this,
"node_id");
124 $this->tool_context = $DIC->globalScreen()->tool()->context();
126 $this->requested_node_id = $this->admin_gui_request->getNodeId();
127 $this->requested_tref_id = $this->admin_gui_request->getTrefId();
128 $this->requested_templates_tree = $this->admin_gui_request->getTemplatesTree();
129 $this->requested_skexpand = $this->admin_gui_request->getSkillExpand();
130 $this->requested_tmpmode = $this->admin_gui_request->getTemplateMode();
131 $this->requested_titles = $this->admin_gui_request->getTitles();
132 $this->requested_node_ids = $this->admin_gui_request->getNodeIds();
133 $this->requested_table_action = $this->admin_gui_request->getTableTreeAction();
134 $this->requested_table_tree_ids = $this->admin_gui_request->getTableTreeIds();
139 $this->skill_tree_manager = $skill_manager->getTreeManager();
140 $this->skill_tree_node_manager = $skill_manager->getTreeNodeManager($this->
object->getId());
141 $this->skill_tree_access_manager = $skill_manager->getTreeAccessManager($this->
object->getRefId());
142 $this->skill_management_access_manager = $skill_manager->getManagementAccessManager(
143 $this->skill_tree_manager->getSkillManagementRefId()
145 $this->skill_deletion_manager = $skill_manager->getDeletionManager();
146 $this->skill_usage_manager = $skill_manager->getUsageManager();
155 $next_class = $this->
ctrl->getNextClass($this);
156 $cmd = $this->
ctrl->getCmd();
162 if (!$this->skill_tree_access_manager->hasReadTreePermission()) {
166 switch ($next_class) {
167 case 'ilskillrootgui':
168 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
172 $this->skill_tree_node_manager,
173 $this->requested_node_id
175 $skrt_gui->setParentGUI($this);
176 $ret = $this->
ctrl->forwardCommand($skrt_gui);
179 case 'ilskillcategorygui':
180 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
183 $this->tabs_gui->activateTab(
"skills");
185 $this->skill_tree_node_manager,
186 $this->requested_node_id
188 $scat_gui->setParentGUI($this);
189 $this->
showTree(
false, $scat_gui,
"listItems");
190 $ret = $this->
ctrl->forwardCommand($scat_gui);
193 case 'ilbasicskillgui':
194 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
197 $this->tabs_gui->activateTab(
"skills");
199 $this->skill_tree_node_manager,
200 $this->requested_node_id
202 $skill_gui->setParentGUI($this);
203 $this->
showTree(
false, $skill_gui,
"edit");
204 $ret = $this->
ctrl->forwardCommand($skill_gui);
207 case 'ilskilltemplatecategorygui':
208 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
211 $this->tabs_gui->activateTab(
"skill_templates");
213 $this->skill_tree_node_manager,
214 $this->requested_node_id,
215 $this->requested_tref_id
217 $sctp_gui->setParentGUI($this);
218 $this->
showTree(($this->requested_tref_id == 0), $sctp_gui,
"listItems");
219 $ret = $this->
ctrl->forwardCommand($sctp_gui);
222 case 'ilbasicskilltemplategui':
223 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
226 $this->tabs_gui->activateTab(
"skill_templates");
228 $this->skill_tree_node_manager,
229 $this->requested_node_id,
230 $this->requested_tref_id
232 $sktp_gui->setParentGUI($this);
233 $this->
showTree(($this->requested_tref_id == 0), $sktp_gui,
"edit");
234 $ret = $this->
ctrl->forwardCommand($sktp_gui);
237 case 'ilskilltemplatereferencegui':
238 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
241 $this->tabs_gui->activateTab(
"skills");
243 $this->skill_tree_node_manager,
244 $this->requested_tref_id
246 $sktr_gui->setParentGUI($this);
247 $this->
showTree(
false, $sktr_gui,
"listItems");
248 $ret = $this->
ctrl->forwardCommand($sktr_gui);
251 case "ilskillprofilegui":
252 if (!$this->skill_tree_access_manager->hasReadProfilesPermission()) {
255 $ilTabs->activateTab(
"profiles");
257 $this->skill_tree_access_manager,
258 $this->skill_tree->getTreeId()
260 $ret = $this->
ctrl->forwardCommand($skprof_gui);
263 case "ilskillprofileuploadhandlergui":
265 $ret = $this->
ctrl->forwardCommand($skprof_upl_gui);
268 case 'ilpermissiongui':
269 if (!$this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
272 $this->tabs_gui->activateTab(
'permissions');
274 $ret = $this->
ctrl->forwardCommand($perm_gui);
278 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
281 $this->tabs_gui->activateTab(
'export');
283 $exp_gui->addFormat(
"xml");
285 $this->
object->setType(
"skmg");
286 $ret = $this->
ctrl->forwardCommand($exp_gui);
287 $this->
object->setType(
"skee");
291 if (!$cmd || $cmd ==
'view') {
295 if ($cmd ==
"showTree") {
296 $this->
showTree((
bool) $this->requested_templates_tree);
312 "ilobjsystemfoldergui",
317 $this->
lng->txt(
"administration"),
318 $this->
ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjsystemfoldergui"),
"")
321 $this->
lng->txt(
"obj_skmg"),
336 $this->
ctrl->clearParametersByClass(
"ilobjskillmanagementgui");
337 $this->
ctrl->setParameterByClass(
338 "ilobjskillmanagementgui",
340 $this->skill_tree_manager->getSkillManagementRefId()
342 return $this->
ctrl->getLinkTargetByClass(
"ilobjskillmanagementgui",
"");
361 protected function edit(): void
368 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
382 $fields[
"title"] =
$f->input()->field()->text(
$lng->
txt(
"title"))->withRequired(
true);
384 $fields[
"title"] = $fields[
"title"]->withValue($this->
object->getTitle());
387 $fields[
"description"] =
$f->input()->field()->textarea(
$lng->
txt(
"description"));
389 $fields[
"description"] = $fields[
"description"]->withValue($this->
object->getDescription());
393 $section1 =
$f->input()->field()->section($fields,
$lng->
txt(
"skmg_add_skill_tree"));
400 return $f->input()->container()->form()->standard(
$form_action, [
"props" => $section1]);
413 if (
$request->getMethod() ==
"POST") {
414 $form = $form->withRequest(
$request);
415 $data = $form->getData();
416 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
417 $props =
$data[
"props"];
418 $this->skill_tree_manager->createTree(
420 $props[
"description"]
422 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
436 public function update():
void 443 if (
$request->getMethod() ==
"POST") {
444 $form = $form->withRequest(
$request);
445 $data = $form->getData();
446 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
447 $props =
$data[
"props"];
450 $this->skill_tree_manager->updateTree(
453 $props[
"description"]
455 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
461 public function delete():
void 465 if ($this->requested_table_action ===
"deleteTrees" 466 && !empty($this->requested_table_tree_ids)
467 && $this->requested_table_tree_ids[0] ===
"ALL_OBJECTS" 469 $all_trees = $this->skill_tree_manager->getTrees();
470 foreach ($all_trees as $tree_obj) {
471 $tree = $this->skill_tree_factory->getTreeById($tree_obj->getId());
474 } elseif ($this->requested_table_action ===
"deleteTrees") {
475 $this->requested_node_ids =
array_map(
"intval", $this->requested_table_tree_ids);
488 $this->tabs_gui->setBackTarget(
493 if ($this->skill_tree_access_manager->hasReadTreePermission()) {
494 if ($this->skill_tree_access_manager->hasReadCompetencesPermission()) {
495 $this->tabs_gui->addTab(
498 $this->
ctrl->getLinkTarget($this,
"editSkills")
500 $this->tabs_gui->addTab(
502 $lng->
txt(
"skmg_skill_templates"),
503 $this->
ctrl->getLinkTarget($this,
"editSkillTemplates")
507 if ($this->skill_tree_access_manager->hasReadProfilesPermission()) {
508 $this->tabs_gui->addTab(
510 $lng->
txt(
"skmg_skill_profiles"),
511 $this->
ctrl->getLinkTargetByClass(
"ilskillprofilegui")
515 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
516 $this->tabs_gui->addTab(
519 $this->
ctrl->getLinkTarget($this,
"edit")
523 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
524 $this->tabs_gui->addTab(
527 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
532 if ($this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
533 $this->tabs_gui->addTab(
536 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
548 $ilTabs->activateTab(
"skills");
551 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
559 if (!count($this->requested_titles) == 0) {
560 foreach ($this->requested_titles as
$id => $title) {
562 if (is_object($node_obj)) {
568 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
571 $ilCtrl->redirect($this,
"editSkills");
579 if (!count($this->requested_titles) == 0) {
580 foreach ($this->requested_titles as
$id => $title) {
582 if (is_object($node_obj)) {
588 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
591 $ilCtrl->redirect($this,
"editSkillTemplates");
594 public function expandAll(
bool $a_redirect =
true): void
596 $this->requested_skexpand =
"";
597 $n_id = ($this->requested_node_id > 0)
598 ? $this->requested_node_id
599 : $this->skill_tree->readRootId();
600 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
602 foreach ($stree as $n) {
603 $n_arr[] = $n[
"child"];
611 $this->requested_skexpand =
"";
612 $n_id = ($this->requested_node_id > 0)
613 ? $this->requested_node_id
614 : $this->skill_tree->readRootId();
615 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
617 foreach ($stree as $n) {
618 if (in_array($n[
"child"], $old) && $n[
"child"] != $n_id) {
619 $k = array_search($n[
"child"], $old);
634 if (empty($this->requested_node_ids)) {
636 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
639 $ilTabs->clearTargets();
645 foreach ($this->requested_node_ids as
$id) {
647 if (!$this->skill_management_access_manager->hasCreateTreePermission()) {
652 $tree_ids[] = $tree_node_id;
655 if ($mode ==
"templates") {
657 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
666 $cskill_ids[] = array(
"skill_id" => $skill_id,
"tref_id" => $tref_id);
669 if ($mode ==
"basic") {
671 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
676 $cskill_ids[] = array(
"skill_id" => $id,
"tref_id" => $tref_id);
684 if ($mode ==
"tree") {
685 $usages = $this->skill_usage_manager->getAllUsagesInfoOfTrees($tree_ids);
686 } elseif ($mode ==
"basic" || $mode ==
"templates") {
687 $usages = $this->skill_usage_manager->getAllUsagesInfoOfSubtrees($cskill_ids);
690 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
694 if (count($usages) > 0) {
695 foreach ($usages as $k => $usage) {
696 $usages_ui = $this->skill_ui_service->getUsagesUI($k, $usage, $mode);
697 $usage_html .= $usages_ui->render() .
"<br/><br/>";
699 $ilCtrl->saveParameter($a_gui,
"tmpmode");
707 $ilCtrl->setParameter($a_gui,
"tmpmode", (
int) $this->requested_tmpmode);
708 $a_form_action = $this->
ctrl->getFormAction($a_gui);
709 $confirmation_gui->setFormAction($a_form_action);
710 if (count($usages) > 0) {
711 $confirmation_text = $this->
lng->txt(
"skmg_delete_warning");
713 $confirmation_text = $this->
lng->txt(
"info_delete_sure");
715 $confirmation_gui->setHeaderText($confirmation_text);
718 foreach ($this->requested_node_ids as $id) {
721 if ($mode ==
"tree") {
722 $tree_id = $this->skill_tree_repo->getTreeIdForNodeId($id);
723 $tree_obj = $this->skill_tree_manager->getTree($tree_id);
724 $obj_title = $tree_obj->getTitle();
726 $obj_title = (!in_array($node_obj->getType(), [
"sktp",
"sctp"]))
727 ? $node_obj->getTitle()
728 : $node_obj->getTitle() .
730 $this->
lng->txt(
"skmg_count_references") .
" " .
734 $confirmation_gui->addItem(
736 (
string) $node_obj->getId(),
743 $confirmation_gui->setCancel(
$lng->
txt(
"cancel"),
"cancelDelete");
744 if ($mode ==
"tree") {
745 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDeleteTrees");
747 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDelete");
755 $this->
ctrl->redirectByClass(
"ilobjskillmanagementgui",
"");
763 foreach ($this->requested_node_ids as
$id) {
764 $this->skill_deletion_manager->deleteTree($id);
768 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
775 foreach ($this->requested_node_ids as
$id) {
776 $this->skill_deletion_manager->deleteNode($id, $this->skill_tree);
778 $this->skill_deletion_manager->updateProfileCompletions($this->skill_tree);
781 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
795 $ilTabs->activateTab(
"skill_templates");
796 $ilCtrl->
setParameter($this,
"node_id", $this->skill_tree->readRootId());
797 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listTemplates");
804 public function showTree(
bool $a_templates, $a_gui =
"", $a_gui_cmd =
""): void
812 if ($this->requested_node_id == 0 || $this->requested_node_id == $this->skill_tree->readRootId()) {
816 if ($this->requested_node_id != $this->skill_tree->readRootId()) {
817 $path = $this->skill_tree->getPathId($this->requested_node_id);
824 $ilCtrl->setParameter($this,
"templates_tree", (
int) $a_templates);
835 if (!$exp->handleCommand()) {
int $requested_templates_tree
Tree SkillTreeManager $skill_tree_manager
static _lookupTemplateId(int $a_obj_id)
static get(string $a_var)
Access SkillManagementAccess $skill_management_access_manager
Node SkillTreeNodeManager $skill_tree_node_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Skill category GUI class.
saveAllTemplateTitles(bool $a_succ_mess=true)
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
Class ilSkillProfileUploadHandlerGUI.
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
Service SkillAdminGUIRequest $admin_gui_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveAllTitles(bool $a_succ_mess=true)
prepareOutput(bool $show_sub_objects=true)
Usage SkillUsageManager $skill_usage_manager
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
showTree(bool $a_templates, $a_gui="", $a_gui_cmd="")
Explorer class that works on tree objects (Services/Tree)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
string $requested_skexpand
string $requested_table_action
expandAll(bool $a_redirect=true)
static _lookupType(int $a_obj_id)
initTreeForm(bool $edit=false)
static getInstance(int $a_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $requested_table_tree_ids
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Access SkillTreeAccess $skill_tree_access_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides fluid interface to RBAC services.
static _lookupTrefIdsForTemplateId(int $a_tid)
init(Service\SkillInternalManagerService $skill_manager)
static _lookupTrefIdsForTopTemplateId(int $a_template_id)
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $main_tpl
Skill internal manager service.
ServerRequestInterface $request
renderer()
Get a renderer for UI components.
Class ilObjectGUI Basic methods of all Output classes.
Skill template reference GUI class.
setBackTarget(string $a_title, string $a_target, string $a_frame="")
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
ScreenContext ContextServices $tool_context
clearTargets()
clear all targets
Skill template category GUI class.
Node SkillDeletionManager $skill_deletion_manager
Service SkillUIService $skill_ui_service
activateTab(string $a_id)
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
collapseAll(bool $a_redirect=true)
deleteNodes(object $a_gui)
Tree SkillTreeFactory $skill_tree_factory
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
factory()
Get the factory that crafts UI components.
Explorer class that works on tree objects (Services/Tree)
array $requested_node_ids
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeTitle(int $a_obj_id, string $a_title)
ilSkillTreeRepository $skill_tree_repo
static set(string $a_var, $a_val)
Set a value.
Basic skill template GUI class.
setLeftNavContent(string $a_content)
Sets content of left navigation column.