5 include_once(
"./Services/Object/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(((
int) $_GET[
"tref_id"] == 0), $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(((
int) $_GET[
"tref_id"] == 0), $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 "ilskillprofilegui":
117 $ilTabs->activateTab(
"profiles");
118 include_once(
"./Services/Skill/classes/class.ilSkillProfileGUI.php");
120 $ret = $this->ctrl->forwardCommand($skprof_gui);
123 case 'ilpermissiongui':
124 $this->tabs_gui->activateTab(
'permissions');
125 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
127 $ret = $this->ctrl->forwardCommand($perm_gui);
136 if (
$cmd ==
"showTree")
138 $this->
showTree($_GET[
"templates_tree"]);
157 global $rbacsystem, $ilAccess,
$lng;
159 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
161 $this->tabs_gui->addTab(
"skills",
162 $lng->txt(
"skmg_skills"),
163 $this->ctrl->getLinkTarget($this,
"editSkills"));
165 $this->tabs_gui->addTab(
"skill_templates",
166 $lng->txt(
"skmg_skill_templates"),
167 $this->ctrl->getLinkTarget($this,
"editSkillTemplates"));
169 $this->tabs_gui->addTab(
"settings",
170 $lng->txt(
"settings"),
171 $this->ctrl->getLinkTarget($this,
"editSettings"));
173 $this->tabs_gui->addTab(
"profiles",
174 $lng->txt(
"skmg_skill_profiles"),
175 $this->ctrl->getLinkTargetByClass(
"ilskillprofilegui"));
179 $this->tabs_gui->addTab(
"test",
181 $this->ctrl->getLinkTarget($this,
"test"));
185 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
187 $this->tabs_gui->addTab(
"permissions",
188 $lng->txt(
"perm_settings"),
189 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"));
200 $ilTabs->activateTab(
"settings");
202 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
204 $enable_skmg = $skmg_set->isActivated();
206 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
208 $form->setFormAction($ilCtrl->getFormAction($this));
209 $form->setTitle($lng->txt(
"skmg_settings"));
215 $cb_prop->setChecked($enable_skmg);
216 $form->addItem($cb_prop);
219 $form->addCommandButton(
"saveSettings", $lng->txt(
"save"));
221 $this->tpl->setContent($form->getHTML());
231 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
233 $skmg_set->activate((
int)
$_POST[
"enable_skmg"]);
237 $ilCtrl->redirect($this,
"editSettings");
247 $ilTabs->activateTab(
"skills");
249 $ilCtrl->setParameterByClass(
"ilobjskillmanagementgui",
"obj_id", $this->skill_tree->getRootId());
250 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
262 if (is_array(
$_POST[
"title"]))
264 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
265 foreach(
$_POST[
"title"] as $id => $title)
268 if (is_object($node_obj))
279 $ilCtrl->redirect($this,
"editSkills");
289 if (is_array(
$_POST[
"title"]))
291 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
292 foreach(
$_POST[
"title"] as $id => $title)
295 if (is_object($node_obj))
306 $ilCtrl->redirect($this,
"editSkillTemplates");
315 $_GET[
"skexpand"] =
"";
316 $n_id = (
$_GET[
"obj_id"] > 0)
318 : $this->skill_tree->readRootId();
319 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
321 foreach ($stree as
$n)
323 $n_arr[] = $n[
"child"];
334 $_GET[
"skexpand"] =
"";
335 $n_id = (
$_GET[
"obj_id"] > 0)
337 : $this->skill_tree->readRootId();
338 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
340 foreach ($stree as
$n)
342 if (in_array($n[
"child"], $old) && $n[
"child"] != $n_id)
344 $k = array_search($n[
"child"], $old);
361 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
364 $ilTabs->clearTargets();
368 $cskill_ids = array();
369 foreach(
$_POST[
"id"] as $id)
373 if ($mode ==
"templates")
375 $this->ilias->raiseError(
"Skill Deletion - type mismatch.",$this->ilias->error_obj->MESSAGE);
382 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
386 $cskill_ids[] = array(
"skill_id" => $skill_id,
"tref_id" => $tref_id);
390 if ($mode ==
"basic")
392 $this->ilias->raiseError(
"Skill Deletion - type mismatch.",$this->ilias->error_obj->MESSAGE);
398 $cskill_ids[] = array(
"skill_id" => $id,
"tref_id" => $tref_id);
405 if ($mode ==
"basic" || $mode ==
"templates")
407 include_once(
"./Services/Skill/classes/class.ilSkillUsage.php");
409 $usages = $u->getAllUsagesInfoOfSubtrees($cskill_ids);
410 if (count($usages) > 0)
413 foreach ($usages as $k => $usage)
415 include_once(
"./Services/Skill/classes/class.ilSkillUsageTableGUI.php");
417 $html.=
$tab->getHTML().
"<br/><br/>";
419 $tpl->setContent($html);
420 $ilToolbar->addButton($lng->txt(
"back"),
421 $ilCtrl->getLinkTarget($a_gui,
"cancelDelete"));
428 $this->ilias->raiseError(
"Skill Deletion - type mismatch.",$this->ilias->error_obj->MESSAGE);
434 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
437 $ilCtrl->setParameter($a_gui,
"tmpmode",
$_GET[
"tmpmode"]);
438 $a_form_action = $this->ctrl->getFormAction($a_gui);
439 $confirmation_gui->setFormAction($a_form_action);
440 $confirmation_gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
443 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
444 foreach(
$_POST[
"id"] as $id)
449 $confirmation_gui->addItem(
"id[]", $node_obj->getId(),
454 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"cancelDelete");
455 $confirmation_gui->setConfirm($lng->txt(
"confirm"),
"confirmedDelete");
457 $tpl->setContent($confirmation_gui->getHTML());
465 $this->ctrl->redirect($this,
"editSkills");
476 include_once(
"./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
477 foreach (
$_POST[
"id"] as $id)
482 $node_data = $this->skill_tree->getNodeData($id);
487 if($this->skill_tree->isInTree($id))
489 $this->skill_tree->deleteTree($node_data);
514 $this->setTestSubTabs(
"test");
516 $ilTabs->activateTab(
"test");
518 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
520 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
523 $this->form->addCommandButton(
"test", $lng->txt(
"execute"));
525 $this->form->setTitle(
"getCompletionDateForTriggerRefId()");
526 $this->form->setFormAction($ilCtrl->getFormAction($this));
530 $ti->setMaxLength(200);
531 $ti->setInfo(
"Separate multiple IDs by :");
532 $ti->setValue(
$_POST[
"user_id"]);
533 $this->form->addItem($ti);
537 $ti->setMaxLength(200);
538 $ti->setInfo(
"Separate multiple IDs by :");
539 $ti->setValue(
$_POST[
"ref_id"]);
540 $this->form->addItem($ti);
543 if (isset(
$_POST[
"user_id"]))
545 $user_ids = explode(
":",
$_POST[
"user_id"]);
546 $ref_ids = explode(
":",
$_POST[
"ref_id"]);
547 if (count($user_ids) <= 1)
549 $user_ids = $user_ids[0];
551 if (count($ref_ids) == 1)
553 $ref_ids = $ref_ids[0];
555 else if (count($ref_ids) == 0)
564 $tpl->setContent($this->form->getHTML().$result);
578 $this->setTestSubTabs(
"cert");
579 $ilTabs->activateTab(
"test");
581 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
583 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
586 $this->form->addCommandButton(
"testCert", $lng->txt(
"execute"));
588 $this->form->setTitle(
"checkUserCertificateForTriggerRefId()");
589 $this->form->setFormAction($ilCtrl->getFormAction($this));
593 $ti->setMaxLength(200);
594 $ti->setInfo(
"Separate multiple IDs by :");
595 $ti->setValue(
$_POST[
"user_id"]);
596 $this->form->addItem($ti);
600 $ti->setMaxLength(200);
601 $ti->setInfo(
"Separate multiple IDs by :");
602 $ti->setValue(
$_POST[
"ref_id"]);
603 $this->form->addItem($ti);
606 if (isset(
$_POST[
"user_id"]))
608 $user_ids = explode(
":",
$_POST[
"user_id"]);
609 $ref_ids = explode(
":",
$_POST[
"ref_id"]);
610 if (count($user_ids) <= 1)
612 $user_ids = $user_ids[0];
614 if (count($ref_ids) == 1)
616 $ref_ids = $ref_ids[0];
618 else if (count($ref_ids) == 0)
627 $tpl->setContent($this->form->getHTML().$result);
641 $this->setTestSubTabs(
"all_cert");
642 $ilTabs->activateTab(
"test");
644 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
646 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
649 $this->form->addCommandButton(
"testAllCert", $lng->txt(
"execute"));
651 $this->form->setTitle(
"getTriggerOfAllCertificates()");
652 $this->form->setFormAction($ilCtrl->getFormAction($this));
656 $ti->setMaxLength(200);
657 $ti->setInfo(
"Separate multiple IDs by :");
658 $ti->setValue(
$_POST[
"user_id"]);
659 $this->form->addItem($ti);
662 if (isset(
$_POST[
"user_id"]))
664 $user_ids = explode(
":",
$_POST[
"user_id"]);
665 $ref_ids = explode(
":",
$_POST[
"ref_id"]);
666 if (count($user_ids) <= 1)
668 $user_ids = $user_ids[0];
675 $tpl->setContent($this->form->getHTML().$result);
689 $this->setTestSubTabs(
"levels");
690 $ilTabs->activateTab(
"test");
692 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
694 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
697 $this->form->addCommandButton(
"testLevels", $lng->txt(
"execute"));
699 $this->form->setTitle(
"getTriggerOfAllCertificates()");
700 $this->form->setFormAction($ilCtrl->getFormAction($this));
704 $ti->setMaxLength(200);
705 $ti->setValue(
$_POST[
"ref_id"]);
706 $this->form->addItem($ti);
709 if (isset(
$_POST[
"ref_id"]))
715 $tpl->setContent($this->form->getHTML().$result);
730 $ilTabs->addSubtab(
"test",
731 "getCompletionDateForTriggerRefId",
732 $ilCtrl->getLinkTarget($this,
"test"));
734 $ilTabs->addSubtab(
"cert",
735 "checkUserCertificateForTriggerRefId",
736 $ilCtrl->getLinkTarget($this,
"testCert"));
738 $ilTabs->addSubtab(
"all_cert",
739 "getTriggerOfAllCertificates",
740 $ilCtrl->getLinkTarget($this,
"testAllCert"));
742 $ilTabs->addSubtab(
"levels",
743 "getSkillLevelsForTrigger",
744 $ilCtrl->getLinkTarget($this,
"testLevels"));
746 $ilTabs->activateSubtab($a_act);
761 $ilTabs->activateTab(
"skill_templates");
762 $ilCtrl->setParameterByClass(
"ilobjskillmanagementgui",
"obj_id", $this->skill_tree->getRootId());
763 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listTemplates");
774 function showTree($a_templates, $a_gui =
"", $a_gui_cmd =
"")
780 if (
$_GET[
"obj_id"] ==
"" ||
$_GET[
"obj_id"] == 1)
785 if (
$_GET[
"obj_id"] > 1)
787 $path = $this->skill_tree->getPathId(
$_GET[
"obj_id"]);
788 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
796 $ilCtrl->setParameter($this,
"templates_tree", $a_templates);
800 include_once(
"./Services/Skill/classes/class.ilSkillTemplateTreeExplorerGUI.php");
805 include_once(
"./Services/Skill/classes/class.ilSkillTreeExplorerGUI.php");
808 if (!$exp->handleCommand())
810 $tpl->setLeftNavContent($exp->getHTML());