5 include_once(
"./classes/class.ilObjectGUI.php");
27 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
34 $this->lng->loadLanguageModule(
'skmg');
36 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
39 $ilCtrl->saveParameter($this,
"obj_id");
50 global $rbacsystem,
$ilErr, $ilAccess, $ilTabs;
52 $next_class = $this->ctrl->getNextClass($this);
53 $cmd = $this->ctrl->getCmd();
57 if(!$ilAccess->checkAccess(
'read',
'',$this->object->getRefId()))
59 $ilErr->raiseError($this->lng->txt(
'no_permission'),$ilErr->WARNING);
64 case 'ilskillrootgui':
65 include_once(
"./Services/Skill/classes/class.ilSkillRootGUI.php");
67 $skrt_gui->setParentGUI($this);
68 $ret = $this->ctrl->forwardCommand($skrt_gui);
71 case 'ilskillcategorygui':
72 $this->tabs_gui->activateTab(
"skills");
73 include_once(
"./Services/Skill/classes/class.ilSkillCategoryGUI.php");
75 $scat_gui->setParentGUI($this);
76 $this->
showTree(
false, $scat_gui,
"listItems");
77 $ret = $this->ctrl->forwardCommand($scat_gui);
80 case 'ilbasicskillgui':
81 $this->tabs_gui->activateTab(
"skills");
82 include_once(
"./Services/Skill/classes/class.ilBasicSkillGUI.php");
84 $skill_gui->setParentGUI($this);
85 $this->
showTree(
false, $skill_gui,
"edit");
86 $ret = $this->ctrl->forwardCommand($skill_gui);
89 case 'ilskilltemplatecategorygui':
90 $this->tabs_gui->activateTab(
"skill_templates");
91 include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategoryGUI.php");
93 $sctp_gui->setParentGUI($this);
94 $this->
showTree(
true, $sctp_gui,
"listItems");
95 $ret = $this->ctrl->forwardCommand($sctp_gui);
98 case 'ilbasicskilltemplategui':
99 $this->tabs_gui->activateTab(
"skill_templates");
100 include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplateGUI.php");
102 $sktp_gui->setParentGUI($this);
103 $this->
showTree(
true, $sktp_gui,
"edit");
104 $ret = $this->ctrl->forwardCommand($sktp_gui);
107 case 'ilskilltemplatereferencegui':
108 $this->tabs_gui->activateTab(
"skills");
109 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReferenceGUI.php");
111 $sktr_gui->setParentGUI($this);
112 $this->
showTree(
false, $sktr_gui,
"listItems");
113 $ret = $this->ctrl->forwardCommand($sktr_gui);
116 case 'ilpermissiongui':
117 $this->tabs_gui->activateTab(
'permissions');
118 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
120 $ret = $this->ctrl->forwardCommand($perm_gui);
143 global $rbacsystem, $ilAccess,
$lng;
145 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
147 $this->tabs_gui->addTab(
"skills",
148 $lng->txt(
"skmg_skills"),
149 $this->ctrl->getLinkTarget($this,
"editSkills"));
151 $this->tabs_gui->addTab(
"skill_templates",
152 $lng->txt(
"skmg_skill_templates"),
153 $this->ctrl->getLinkTarget($this,
"editSkillTemplates"));
155 $this->tabs_gui->addTab(
"settings",
156 $lng->txt(
"settings"),
157 $this->ctrl->getLinkTarget($this,
"editSettings"));
161 $this->tabs_gui->addTab(
"test",
163 $this->ctrl->getLinkTarget($this,
"test"));
167 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
169 $this->tabs_gui->addTab(
"permissions",
170 $lng->txt(
"perm_settings"),
171 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"));
182 $ilTabs->activateTab(
"settings");
185 $enable_skmg = $skmg_set->get(
"enable_skmg");
187 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
189 $form->setFormAction($ilCtrl->getFormAction($this));
190 $form->setTitle($lng->txt(
"skmg_settings"));
196 $cb_prop->setChecked($enable_skmg);
197 $form->addItem($cb_prop);
200 $form->addCommandButton(
"saveSettings", $lng->txt(
"save"));
202 $this->tpl->setContent($form->getHTML());
213 $skmg_set->set(
"enable_skmg",
$_POST[
"enable_skmg"]);
217 $ilCtrl->redirect($this,
"editSettings");
230 $ilTabs->activateTab(
"skills");
232 $ilCtrl->setParameterByClass(
"ilobjskillmanagementgui",
"obj_id", $this->skill_tree->getRootId());
233 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
235 $a_form_action = $ilCtrl->getFormAction($this);
236 $a_top_node = $this->skill_tree->getRootId();
239 $a_gui_cmd =
"editSkills";
243 include_once(
"./Services/Skill/classes/class.ilSkillHFormGUI.php");
245 $form_gui->setParentCommand($a_gui_obj, $a_gui_cmd);
246 $form_gui->setFormAction($a_form_action);
247 $form_gui->setTitle($lng->txt(
"skmg_skill_hierarchie"));
248 $form_gui->setTree($this->skill_tree);
249 $form_gui->setCurrentTopNodeId($a_top_node);
250 $form_gui->addMultiCommand($lng->txt(
"delete"),
"deleteNodes");
251 $form_gui->addMultiCommand($lng->txt(
"cut"),
"cutItems");
252 $form_gui->addMultiCommand($lng->txt(
"copy"),
"copyItems");
253 $form_gui->addCommand($lng->txt(
"skmg_save_all_titles"),
"saveAllTitles");
254 $form_gui->addCommand($lng->txt(
"expand_all"),
"expandAll");
255 $form_gui->addCommand($lng->txt(
"collapse_all"),
"collapseAll");
256 $form_gui->setTriggeredUpdateCommand(
"saveAllTitles");
259 if (
$_GET[
"highlight"] !=
"")
261 $hl = explode(
":",
$_GET[
"highlight"]);
262 $form_gui->setHighlightedNodes($hl);
263 $form_gui->setFocusId($hl[0]);
266 $tpl->setContent($form_gui->getHTML());
282 include_once(
"./Services/Skill/classes/class.ilSkillHFormGUI.php");
283 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
290 $parent_id = $this->skill_tree->getParentId($node_id);
295 $parent_id = $node_id;
298 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
300 $skill_ids = array();
301 for ($i = 1; $i <= $num; $i++)
304 $skill->setTitle($lng->txt(
"skmg_new_skill"));
307 $skill_ids[] = $skill->getId();
309 $skill_ids = array_reverse($skill_ids);
310 $skill_ids = implode($skill_ids,
":");
312 $ilCtrl->setParameter($this,
"highlight", $skill_ids);
313 $ilCtrl->redirect($this,
"editSkills",
"node_".$node_id);
326 include_once(
"./Services/Skill/classes/class.ilSkillHFormGUI.php");
327 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
334 $parent_id = $this->skill_tree->getParentId($node_id);
339 $parent_id = $node_id;
342 include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplate.php");
344 $skill_ids = array();
345 for ($i = 1; $i <= $num; $i++)
348 $skill->setTitle($lng->txt(
"skmg_new_skill_template"));
351 $skill_ids[] = $skill->getId();
353 $skill_ids = array_reverse($skill_ids);
354 $skill_ids = implode($skill_ids,
":");
356 $ilCtrl->setParameter($this,
"highlight", $skill_ids);
357 $ilCtrl->redirect($this,
"editSkillTemplates",
"node_".$node_id);
370 include_once(
"./Services/Skill/classes/class.ilSkillHFormGUI.php");
371 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
378 $parent_id = $this->skill_tree->getParentId($node_id);
383 $parent_id = $node_id;
386 include_once(
"./Services/Skill/classes/class.ilSkillCategory.php");
388 $skill_ids = array();
389 for ($i = 1; $i <= $num; $i++)
392 $skill->setTitle($lng->txt(
"skmg_new_skill_category"));
395 $skill_ids[] = $skill->getId();
397 $skill_ids = array_reverse($skill_ids);
398 $skill_ids = implode($skill_ids,
":");
400 $ilCtrl->setParameter($this,
"highlight", $skill_ids);
401 $ilCtrl->redirect($this,
"editSkills",
"node_".$node_id);
411 include_once(
"./Services/Skill/classes/class.ilSkillHFormGUI.php");
412 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
419 $parent_id = $this->skill_tree->getParentId($node_id);
424 $parent_id = $node_id;
427 include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategory.php");
429 $skill_ids = array();
430 for ($i = 1; $i <= $num; $i++)
433 $skill->setTitle($lng->txt(
"skmg_new_skill_template_category"));
436 $skill_ids[] = $skill->getId();
438 $skill_ids = array_reverse($skill_ids);
439 $skill_ids = implode($skill_ids,
":");
441 $ilCtrl->setParameter($this,
"highlight", $skill_ids);
442 $ilCtrl->redirect($this,
"editSkillTemplates",
"node_".$node_id);
452 if (is_array(
$_POST[
"title"]))
454 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
458 if (is_object($node_obj))
469 $ilCtrl->redirect($this,
"editSkills");
479 if (is_array(
$_POST[
"title"]))
481 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
485 if (is_object($node_obj))
496 $ilCtrl->redirect($this,
"editSkillTemplates");
505 $_GET[
"skexpand"] =
"";
506 $n_id = (
$_GET[
"obj_id"] > 0)
508 : $this->skill_tree->readRootId();
509 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
511 foreach ($stree as
$n)
513 $n_arr[] = $n[
"child"];
524 $_GET[
"skexpand"] =
"";
525 $n_id = (
$_GET[
"obj_id"] > 0)
527 : $this->skill_tree->readRootId();
528 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
530 foreach ($stree as
$n)
532 if (in_array($n[
"child"], $old) && $n[
"child"] != $n_id)
534 $k = array_search($n[
"child"], $old);
551 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
554 $ilTabs->clearTargets();
559 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
562 $ilCtrl->setParameter($a_gui,
"tmpmode",
$_GET[
"tmpmode"]);
563 $a_form_action = $this->ctrl->getFormAction($a_gui);
564 $confirmation_gui->setFormAction($a_form_action);
565 $confirmation_gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
568 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
569 foreach(
$_POST[
"id"] as $id)
574 $confirmation_gui->addItem(
"id[]", $node_obj->getId(),
579 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"cancelDelete");
580 $confirmation_gui->setConfirm($lng->txt(
"confirm"),
"confirmedDelete");
582 $tpl->setContent($confirmation_gui->getHTML());
590 $this->ctrl->redirect($this,
"editSkills");
601 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
602 foreach (
$_POST[
"id"] as $id)
607 $node_data = $this->skill_tree->getNodeData($id);
612 if($this->skill_tree->isInTree($id))
614 $this->skill_tree->deleteTree($node_data);
639 $this->setTestSubTabs(
"test");
641 $ilTabs->activateTab(
"test");
643 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
645 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
648 $this->form->addCommandButton(
"test", $lng->txt(
"execute"));
650 $this->form->setTitle(
"getCompletionDateForTriggerRefId()");
651 $this->form->setFormAction($ilCtrl->getFormAction($this));
655 $ti->setMaxLength(200);
656 $ti->setInfo(
"Separate multiple IDs by :");
657 $ti->setValue(
$_POST[
"user_id"]);
658 $this->form->addItem($ti);
662 $ti->setMaxLength(200);
663 $ti->setInfo(
"Separate multiple IDs by :");
664 $ti->setValue(
$_POST[
"ref_id"]);
665 $this->form->addItem($ti);
668 if (isset(
$_POST[
"user_id"]))
670 $user_ids = explode(
":",
$_POST[
"user_id"]);
671 $ref_ids = explode(
":",
$_POST[
"ref_id"]);
672 if (count($user_ids) <= 1)
674 $user_ids = $user_ids[0];
676 if (count($ref_ids) == 1)
678 $ref_ids = $ref_ids[0];
680 else if (count($ref_ids) == 0)
689 $tpl->setContent($this->form->getHTML().$result);
703 $this->setTestSubTabs(
"cert");
704 $ilTabs->activateTab(
"test");
706 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
708 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
711 $this->form->addCommandButton(
"testCert", $lng->txt(
"execute"));
713 $this->form->setTitle(
"checkUserCertificateForTriggerRefId()");
714 $this->form->setFormAction($ilCtrl->getFormAction($this));
718 $ti->setMaxLength(200);
719 $ti->setInfo(
"Separate multiple IDs by :");
720 $ti->setValue(
$_POST[
"user_id"]);
721 $this->form->addItem($ti);
725 $ti->setMaxLength(200);
726 $ti->setInfo(
"Separate multiple IDs by :");
727 $ti->setValue(
$_POST[
"ref_id"]);
728 $this->form->addItem($ti);
731 if (isset(
$_POST[
"user_id"]))
733 $user_ids = explode(
":",
$_POST[
"user_id"]);
734 $ref_ids = explode(
":",
$_POST[
"ref_id"]);
735 if (count($user_ids) <= 1)
737 $user_ids = $user_ids[0];
739 if (count($ref_ids) == 1)
741 $ref_ids = $ref_ids[0];
743 else if (count($ref_ids) == 0)
752 $tpl->setContent($this->form->getHTML().$result);
766 $this->setTestSubTabs(
"all_cert");
767 $ilTabs->activateTab(
"test");
769 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
771 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
774 $this->form->addCommandButton(
"testAllCert", $lng->txt(
"execute"));
776 $this->form->setTitle(
"getTriggerOfAllCertificates()");
777 $this->form->setFormAction($ilCtrl->getFormAction($this));
781 $ti->setMaxLength(200);
782 $ti->setInfo(
"Separate multiple IDs by :");
783 $ti->setValue(
$_POST[
"user_id"]);
784 $this->form->addItem($ti);
787 if (isset(
$_POST[
"user_id"]))
789 $user_ids = explode(
":",
$_POST[
"user_id"]);
790 $ref_ids = explode(
":",
$_POST[
"ref_id"]);
791 if (count($user_ids) <= 1)
793 $user_ids = $user_ids[0];
800 $tpl->setContent($this->form->getHTML().$result);
814 $this->setTestSubTabs(
"levels");
815 $ilTabs->activateTab(
"test");
817 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
819 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
822 $this->form->addCommandButton(
"testLevels", $lng->txt(
"execute"));
824 $this->form->setTitle(
"getTriggerOfAllCertificates()");
825 $this->form->setFormAction($ilCtrl->getFormAction($this));
829 $ti->setMaxLength(200);
830 $ti->setValue(
$_POST[
"ref_id"]);
831 $this->form->addItem($ti);
834 if (isset(
$_POST[
"ref_id"]))
840 $tpl->setContent($this->form->getHTML().$result);
855 $ilTabs->addSubtab(
"test",
856 "getCompletionDateForTriggerRefId",
857 $ilCtrl->getLinkTarget($this,
"test"));
859 $ilTabs->addSubtab(
"cert",
860 "checkUserCertificateForTriggerRefId",
861 $ilCtrl->getLinkTarget($this,
"testCert"));
863 $ilTabs->addSubtab(
"all_cert",
864 "getTriggerOfAllCertificates",
865 $ilCtrl->getLinkTarget($this,
"testAllCert"));
867 $ilTabs->addSubtab(
"levels",
868 "getSkillLevelsForTrigger",
869 $ilCtrl->getLinkTarget($this,
"testLevels"));
871 $ilTabs->activateSubtab($a_act);
886 $ilTabs->activateTab(
"skill_templates");
888 $ilCtrl->setParameterByClass(
"ilobjskillmanagementgui",
"obj_id", $this->skill_tree->getRootId());
889 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listTemplates");
891 $a_form_action = $ilCtrl->getFormAction($this);
892 $a_top_node = $this->skill_tree->getRootId();
895 $a_gui_cmd =
"editSkillTemplates";
897 include_once(
"./Services/Skill/classes/class.ilSkillTemplateHFormGUI.php");
899 $form_gui->setParentCommand($a_gui_obj, $a_gui_cmd);
900 $form_gui->setFormAction($a_form_action);
901 $form_gui->setTitle($lng->txt(
"skmg_skill_templates"));
902 $form_gui->setTree($this->skill_tree);
903 $form_gui->setCurrentTopNodeId($a_top_node);
904 $form_gui->addMultiCommand($lng->txt(
"delete"),
"deleteNodes");
905 $form_gui->addMultiCommand($lng->txt(
"cut"),
"cutItems");
906 $form_gui->addMultiCommand($lng->txt(
"copy"),
"copyItems");
907 $form_gui->addCommand($lng->txt(
"skmg_save_all_titles"),
"saveAllTemplateTitles");
908 $form_gui->addCommand($lng->txt(
"expand_all"),
"expandAllTemplates");
909 $form_gui->addCommand($lng->txt(
"collapse_all"),
"collapseAllTemplates");
910 $form_gui->setTriggeredUpdateCommand(
"saveAllTemplateTitles");
913 if (
$_GET[
"highlight"] !=
"")
915 $hl = explode(
":",
$_GET[
"highlight"]);
916 $form_gui->setHighlightedNodes($hl);
917 $form_gui->setFocusId($hl[0]);
920 $ilCtrl->setParameter($this,
"active_node",
$_GET[
"obj_id"]);
922 $tpl->setContent($form_gui->getHTML());
938 include_once(
"./Services/Skill/classes/class.ilSkillHFormGUI.php");
939 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
945 $parent_id = $this->skill_tree->getParentId($node_id);
950 $parent_id = $node_id;
953 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReferenceGUI.php");
954 $ilCtrl->setParameterByClass(
"ilskilltemplatereferencegui",
"parent_id", $parent_id);
955 $ilCtrl->setParameterByClass(
"ilskilltemplatereferencegui",
"target", $target);
956 $ilCtrl->redirectByClass(
"ilskilltemplatereferencegui",
"insert");
966 function showTree($a_templates, $a_gui, $a_gui_cmd)
975 require_once (
"./Services/Skill/classes/class.ilSkillExplorer.php");
983 $exp->setExpandTarget($this->ctrl->getLinkTarget($a_gui, $a_gui_cmd));
987 $exp->setExpandTarget($this->ctrl->getLinkTarget($a_gui, $a_gui_cmd));
990 if (
$_GET[
"skexpand"] ==
"")
992 $expanded = $this->skill_tree->readRootId();
996 $expanded =
$_GET[
"skexpand"];
999 if (
$_GET[
"obj_id"] > 0)
1001 $path = $this->skill_tree->getPathId(
$_GET[
"obj_id"]);
1002 $exp->setForceOpenPath(
$path);
1003 $exp->highlightNode(
$_GET[
"obj_id"]);
1007 $exp->highlightNode($this->skill_tree->readRootId());
1009 $exp->setExpand($expanded);
1012 $output = $exp->getOutput();
1015 if ($ilCtrl->isAsynch())
1030 $tpl->setLeftContent($output);