ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjSkillManagementGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Object/classes/class.ilObjectGUI.php");
6 
19 {
23  protected $rbacsystem;
24 
28  protected $error;
29 
33  protected $tabs;
34 
35  protected $skill_tree;
36 
42  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
43  {
44  global $DIC;
45 
46  $this->ctrl = $DIC->ctrl();
47  $this->rbacsystem = $DIC->rbac()->system();
48  $this->error = $DIC["ilErr"];
49  $this->access = $DIC->access();
50  $this->tabs = $DIC->tabs();
51  $this->lng = $DIC->language();
52  $this->settings = $DIC->settings();
53  $this->tpl = $DIC["tpl"];
54  $this->toolbar = $DIC->toolbar();
55  $this->user = $DIC->user();
56  $ilCtrl = $DIC->ctrl();
57 
58  $this->tool_context = $DIC->globalScreen()->tool()->context();
59 
60  $this->type = 'skmg';
61  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
62 
63  $this->lng->loadLanguageModule('skmg');
64 
65  include_once("./Services/Skill/classes/class.ilSkillTree.php");
66  $this->skill_tree = new ilSkillTree();
67 
68  $ilCtrl->saveParameter($this, "obj_id");
69  }
70 
77  public function executeCommand()
78  {
81  $ilTabs = $this->tabs;
82 
83  $next_class = $this->ctrl->getNextClass($this);
84  $cmd = $this->ctrl->getCmd();
85 
86  $this->prepareOutput();
87 
88 
89  if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
90  $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
91  }
92 
93  switch ($next_class) {
94  case 'ilskillrootgui':
95  include_once("./Services/Skill/classes/class.ilSkillRootGUI.php");
96  $skrt_gui = new ilSkillRootGUI((int) $_GET["obj_id"], $this);
97  $skrt_gui->setParentGUI($this);
98  $ret = $this->ctrl->forwardCommand($skrt_gui);
99  break;
100 
101  case 'ilskillcategorygui':
102  $this->tabs_gui->activateTab("skills");
103  include_once("./Services/Skill/classes/class.ilSkillCategoryGUI.php");
104  $scat_gui = new ilSkillCategoryGUI((int) $_GET["obj_id"]);
105  $scat_gui->setParentGUI($this);
106  $this->showTree(false, $scat_gui, "listItems");
107  $ret = $this->ctrl->forwardCommand($scat_gui);
108  break;
109 
110  case 'ilbasicskillgui':
111  $this->tabs_gui->activateTab("skills");
112  include_once("./Services/Skill/classes/class.ilBasicSkillGUI.php");
113  $skill_gui = new ilBasicSkillGUI((int) $_GET["obj_id"]);
114  $skill_gui->setParentGUI($this);
115  $this->showTree(false, $skill_gui, "edit");
116  $ret = $this->ctrl->forwardCommand($skill_gui);
117  break;
118 
119  case 'ilskilltemplatecategorygui':
120  $this->tabs_gui->activateTab("skill_templates");
121  include_once("./Services/Skill/classes/class.ilSkillTemplateCategoryGUI.php");
122  $sctp_gui = new ilSkillTemplateCategoryGUI((int) $_GET["obj_id"], (int) $_GET["tref_id"]);
123  $sctp_gui->setParentGUI($this);
124  $this->showTree(((int) $_GET["tref_id"] == 0), $sctp_gui, "listItems");
125  $ret = $this->ctrl->forwardCommand($sctp_gui);
126  break;
127 
128  case 'ilbasicskilltemplategui':
129  $this->tabs_gui->activateTab("skill_templates");
130  include_once("./Services/Skill/classes/class.ilBasicSkillTemplateGUI.php");
131  $sktp_gui = new ilBasicSkillTemplateGUI((int) $_GET["obj_id"], (int) $_GET["tref_id"]);
132  $sktp_gui->setParentGUI($this);
133  $this->showTree(((int) $_GET["tref_id"] == 0), $sktp_gui, "edit");
134  $ret = $this->ctrl->forwardCommand($sktp_gui);
135  break;
136 
137  case 'ilskilltemplatereferencegui':
138  $this->tabs_gui->activateTab("skills");
139  include_once("./Services/Skill/classes/class.ilSkillTemplateReferenceGUI.php");
140  $sktr_gui = new ilSkillTemplateReferenceGUI((int) $_GET["tref_id"]);
141  $sktr_gui->setParentGUI($this);
142  $this->showTree(false, $sktr_gui, "listItems");
143  $ret = $this->ctrl->forwardCommand($sktr_gui);
144  break;
145 
146  case "ilskillprofilegui":
147  $ilTabs->activateTab("profiles");
148  include_once("./Services/Skill/classes/class.ilSkillProfileGUI.php");
149  $skprof_gui = new ilSkillProfileGUI();
150  $ret = $this->ctrl->forwardCommand($skprof_gui);
151  break;
152 
153  case 'ilpermissiongui':
154  $this->tabs_gui->activateTab('permissions');
155  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
156  $perm_gui = new ilPermissionGUI($this);
157  $ret = $this->ctrl->forwardCommand($perm_gui);
158  break;
159 
160  case "ilexportgui":
161  $this->tabs_gui->activateTab('export');
162  include_once("./Services/Export/classes/class.ilExportGUI.php");
163  $exp_gui = new ilExportGUI($this);
164  $exp_gui->addFormat("xml");
165  //$exp_gui->addFormat("html", "", $this, "exportHTML");
166  $ret = $this->ctrl->forwardCommand($exp_gui);
167  break;
168 
169  default:
170  if (!$cmd || $cmd == 'view') {
171  $cmd = "editSkills";
172  }
173 
174  if ($cmd == "showTree") {
175  $this->showTree($_GET["templates_tree"]);
176  } else {
177  $this->$cmd();
178  }
179  break;
180  }
181  return true;
182  }
183 
190  public function getAdminTabs()
191  {
193  $ilAccess = $this->access;
194  $lng = $this->lng;
195 
196  if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
197  $this->tabs_gui->addTab(
198  "skills",
199  $lng->txt("skmg_skills"),
200  $this->ctrl->getLinkTarget($this, "editSkills")
201  );
202 
203  $this->tabs_gui->addTab(
204  "skill_templates",
205  $lng->txt("skmg_skill_templates"),
206  $this->ctrl->getLinkTarget($this, "editSkillTemplates")
207  );
208 
209  $this->tabs_gui->addTab(
210  "settings",
211  $lng->txt("settings"),
212  $this->ctrl->getLinkTarget($this, "editSettings")
213  );
214 
215  $this->tabs_gui->addTab(
216  "profiles",
217  $lng->txt("skmg_skill_profiles"),
218  $this->ctrl->getLinkTargetByClass("ilskillprofilegui")
219  );
220 
221  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
222  $this->tabs_gui->addTab(
223  "export",
224  $lng->txt("export"),
225  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
226  );
227  }
228 
229  if (DEVMODE == 1) {
230  $this->tabs_gui->addTab(
231  "test",
232  "Test (DEVMODE)",
233  $this->ctrl->getLinkTarget($this, "test")
234  );
235  }
236  }
237 
238  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
239  $this->tabs_gui->addTab(
240  "permissions",
241  $lng->txt("perm_settings"),
242  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
243  );
244  }
245  }
246 
250  public function editSettings()
251  {
253  $lng = $this->lng;
255  $ilTabs = $this->tabs;
256 
257  $ilTabs->activateTab("settings");
258 
259  include_once("./Services/Skill/classes/class.ilSkillManagementSettings.php");
260  $skmg_set = new ilSkillManagementSettings();
261  $enable_skmg = $skmg_set->isActivated();
262 
263  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
264  $form = new ilPropertyFormGUI();
265  $form->setFormAction($ilCtrl->getFormAction($this));
266  $form->setTitle($lng->txt("skmg_settings"));
267 
268  // Enable skill management
269  $cb_prop = new ilCheckboxInputGUI(
270  $lng->txt("skmg_enable_skmg"),
271  "enable_skmg"
272  );
273  $cb_prop->setValue("1");
274  $cb_prop->setChecked($enable_skmg);
275  $form->addItem($cb_prop);
276 
277  // Hide Competence Profile Data before Self-Assessment
278  $cb_prop = new ilCheckboxInputGUI(
279  $lng->txt("skmg_hide_profile_self_eval"),
280  "hide_profile_self_eval"
281  );
282  $cb_prop->setValue("1");
283  $cb_prop->setInfo($lng->txt("skmg_hide_profile_self_eval_info"));
284  $cb_prop->setChecked($skmg_set->getHideProfileBeforeSelfEval());
285  $form->addItem($cb_prop);
286 
287  // command buttons
288  if ($this->checkPermissionBool("write")) {
289  $form->addCommandButton("saveSettings", $lng->txt("save"));
290  }
291 
292  $this->tpl->setContent($form->getHTML());
293  }
294 
298  public function saveSettings()
299  {
302 
303  if (!$this->checkPermissionBool("write")) {
304  return;
305  }
306 
307  include_once("./Services/Skill/classes/class.ilSkillManagementSettings.php");
308  $skmg_set = new ilSkillManagementSettings();
309  $skmg_set->activate((int) $_POST["enable_skmg"]);
310  $skmg_set->setHideProfileBeforeSelfEval((int) $_POST["hide_profile_self_eval"]);
311 
312  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
313 
314  $ilCtrl->redirect($this, "editSettings");
315  }
316 
320  public function editSkills()
321  {
322  $tpl = $this->tpl;
323  $ilTabs = $this->tabs;
324  $lng = $this->lng;
326 
327  $ilTabs->activateTab("skills");
328 
329  $ilCtrl->setParameterByClass("ilobjskillmanagementgui", "obj_id", $this->skill_tree->getRootId());
330  $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
331  }
332 
333 
337  public function saveAllTitles($a_succ_mess = true)
338  {
340  $lng = $this->lng;
341 
342  if (is_array($_POST["title"])) {
343  include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
344  foreach ($_POST["title"] as $id => $title) {
345  $node_obj = ilSkillTreeNodeFactory::getInstance($id);
346  if (is_object($node_obj)) {
347  // update title
349  }
350  }
351  if ($a_succ_mess) {
352  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
353  }
354  }
355  $ilCtrl->redirect($this, "editSkills");
356  }
357 
361  public function saveAllTemplateTitles($a_succ_mess = true)
362  {
364  $lng = $this->lng;
365 
366  if (is_array($_POST["title"])) {
367  include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
368  foreach ($_POST["title"] as $id => $title) {
369  $node_obj = ilSkillTreeNodeFactory::getInstance($id);
370  if (is_object($node_obj)) {
371  // update title
373  }
374  }
375  if ($a_succ_mess) {
376  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
377  }
378  }
379  $ilCtrl->redirect($this, "editSkillTemplates");
380  }
381 
382 
386  public function expandAll($a_redirect = true)
387  {
388  $_GET["skexpand"] = "";
389  $n_id = ($_GET["obj_id"] > 0)
390  ? $_GET["obj_id"]
391  : $this->skill_tree->readRootId();
392  $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
393  $n_arr = array();
394  foreach ($stree as $n) {
395  $n_arr[] = $n["child"];
396  $_SESSION["skexpand"] = $n_arr;
397  }
398  $this->saveAllTitles(false);
399  }
400 
404  public function collapseAll($a_redirect = true)
405  {
406  $_GET["skexpand"] = "";
407  $n_id = ($_GET["obj_id"] > 0)
408  ? $_GET["obj_id"]
409  : $this->skill_tree->readRootId();
410  $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
411  $old = $_SESSION["skexpand"];
412  foreach ($stree as $n) {
413  if (in_array($n["child"], $old) && $n["child"] != $n_id) {
414  $k = array_search($n["child"], $old);
415  unset($old[$k]);
416  }
417  }
418  $_SESSION["skexpand"] = $old;
419  $this->saveAllTitles(false);
420  }
421 
425  public function deleteNodes($a_gui)
426  {
427  $lng = $this->lng;
428  $tpl = $this->tpl;
430  $ilTabs = $this->tabs;
431  $ilToolbar = $this->toolbar;
432 
433  if (!isset($_POST["id"])) {
434  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
435  }
436 
437  $ilTabs->clearTargets();
438 
439  // check usages
440  $mode = "";
441  $cskill_ids = array();
442  foreach ($_POST["id"] as $id) {
443  if (in_array(ilSkillTreeNode::_lookupType($id), array("skll", "scat", "sktr"))) {
444  if ($mode == "templates") {
445  $this->ilias->raiseError("Skill Deletion - type mismatch.", $this->ilias->error_obj->MESSAGE);
446  }
447  $mode = "basic";
448  $skill_id = $id;
449  $tref_id = 0;
450  if (ilSkillTreeNode::_lookupType($id) == "sktr") {
451  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
453  $tref_id = $id;
454  }
455  $cskill_ids[] = array("skill_id" => $skill_id, "tref_id" => $tref_id);
456  }
457  if (in_array(ilSkillTreeNode::_lookupType($id), array("sktp", "sctp"))) {
458  if ($mode == "basic") {
459  $this->ilias->raiseError("Skill Deletion - type mismatch.", $this->ilias->error_obj->MESSAGE);
460  }
461  $mode = "templates";
462 
463  foreach (ilSkillTemplateReference::_lookupTrefIdsForTemplateId($id) as $tref_id) {
464  $cskill_ids[] = array("skill_id" => $id, "tref_id" => $tref_id);
465  }
466  }
467  // for cats, skills and template references, get "real" usages
468  // for skill and category templates check usage in references
469  }
470 
471  if ($mode == "basic" || $mode == "templates") {
472  include_once("./Services/Skill/classes/class.ilSkillUsage.php");
473  $u = new ilSkillUsage();
474  $usages = $u->getAllUsagesInfoOfSubtrees($cskill_ids);
475  if (count($usages) > 0) {
476  $html = "";
477  foreach ($usages as $k => $usage) {
478  include_once("./Services/Skill/classes/class.ilSkillUsageTableGUI.php");
479  $tab = new ilSkillUsageTableGUI($this, "showUsage", $k, $usage);
480  $html .= $tab->getHTML() . "<br/><br/>";
481  }
482  $tpl->setContent($html);
483  $ilCtrl->saveParameter($a_gui, "tmpmode");
484  $ilToolbar->addButton(
485  $lng->txt("back"),
486  $ilCtrl->getLinkTarget($a_gui, "cancelDelete")
487  );
488  ilUtil::sendFailure($lng->txt("skmg_cannot_delete_nodes_in_use"));
489  return;
490  }
491  } else {
492  $this->ilias->raiseError("Skill Deletion - type mismatch.", $this->ilias->error_obj->MESSAGE);
493  }
494 
495  // SAVE POST VALUES
496  $_SESSION["saved_post"] = $_POST["id"];
497 
498  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
499  $confirmation_gui = new ilConfirmationGUI();
500 
501  $ilCtrl->setParameter($a_gui, "tmpmode", $_GET["tmpmode"]);
502  $a_form_action = $this->ctrl->getFormAction($a_gui);
503  $confirmation_gui->setFormAction($a_form_action);
504  $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
505 
506  // Add items to delete
507  include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
508  foreach ($_POST["id"] as $id) {
509  if ($id != IL_FIRST_NODE) {
510  $node_obj = ilSkillTreeNodeFactory::getInstance($id);
511  $confirmation_gui->addItem(
512  "id[]",
513  $node_obj->getId(),
514  $node_obj->getTitle(),
515  ilUtil::getImagePath("icon_" . $node_obj->getType() . ".svg")
516  );
517  }
518  }
519 
520  $confirmation_gui->setCancel($lng->txt("cancel"), "cancelDelete");
521  $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
522 
523  $tpl->setContent($confirmation_gui->getHTML());
524  }
525 
529  public function cancelDelete()
530  {
531  $this->ctrl->redirect($this, "editSkills");
532  }
533 
537  public function confirmedDelete()
538  {
540 
541  // delete all selected objects
542  include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
543  foreach ($_POST["id"] as $id) {
544  if ($id != IL_FIRST_NODE) {
546  $node_data = $this->skill_tree->getNodeData($id);
547  if (is_object($obj)) {
548  $obj->delete();
549  }
550  if ($this->skill_tree->isInTree($id)) {
551  $this->skill_tree->deleteTree($node_data);
552  }
553  }
554  }
555 
556  // feedback
557  ilUtil::sendInfo($this->lng->txt("info_deleted"), true);
558  }
559 
560  //
561  //
562  // Test
563  //
564  //
565 
572  public function test()
573  {
574  $tpl = $this->tpl;
575  $lng = $this->lng;
577  $ilTabs = $this->tabs;
578 
579  $this->setTestSubTabs("test");
580 
581  $ilTabs->activateTab("test");
582 
583  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
584 
585  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
586  $this->form = new ilPropertyFormGUI();
587 
588  if ($this->rbacsystem->checkAccess('write', $_GET['ref_id'])) {
589  $this->form->addCommandButton("test", $lng->txt("execute"));
590  }
591 
592  $this->form->setTitle("getCompletionDateForTriggerRefId()");
593  $this->form->setFormAction($ilCtrl->getFormAction($this));
594 
595  // user id
596  $ti = new ilTextInputGUI("User ID(s)", "user_id");
597  $ti->setMaxLength(200);
598  $ti->setInfo("Separate multiple IDs by :");
599  $ti->setValue($_POST["user_id"]);
600  $this->form->addItem($ti);
601 
602  // ref id
603  $ti = new ilTextInputGUI("Ref ID(s)", "ref_id");
604  $ti->setMaxLength(200);
605  $ti->setInfo("Separate multiple IDs by :");
606  $ti->setValue($_POST["ref_id"]);
607  $this->form->addItem($ti);
608 
609  $result = "";
610  if (isset($_POST["user_id"])) {
611  $user_ids = explode(":", $_POST["user_id"]);
612  $ref_ids = explode(":", $_POST["ref_id"]);
613  if (count($user_ids) <= 1) {
614  $user_ids = $user_ids[0];
615  }
616  if (count($ref_ids) == 1) {
617  $ref_ids = $ref_ids[0];
618  } elseif (count($ref_ids) == 0) {
619  $ref_ids = null;
620  }
621 
622  $result = ilBasicSkill::getCompletionDateForTriggerRefId($user_ids, $ref_ids);
623  $result = "<br />Result:<br />" . var_export($result, true);
624  }
625 
626  $tpl->setContent($this->form->getHTML() . $result);
627  }
628 
635  public function testCert()
636  {
637  $tpl = $this->tpl;
638  $lng = $this->lng;
640  $ilTabs = $this->tabs;
641 
642  $this->setTestSubTabs("cert");
643  $ilTabs->activateTab("test");
644 
645  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
646 
647  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
648  $this->form = new ilPropertyFormGUI();
649 
650  if ($this->rbacsystem->checkAccess('write', $_GET['ref_id'])) {
651  $this->form->addCommandButton("testCert", $lng->txt("execute"));
652  }
653 
654  $this->form->setTitle("checkUserCertificateForTriggerRefId()");
655  $this->form->setFormAction($ilCtrl->getFormAction($this));
656 
657  // user id
658  $ti = new ilTextInputGUI("User ID(s)", "user_id");
659  $ti->setMaxLength(200);
660  $ti->setInfo("Separate multiple IDs by :");
661  $ti->setValue($_POST["user_id"]);
662  $this->form->addItem($ti);
663 
664  // ref id
665  $ti = new ilTextInputGUI("Ref ID(s)", "ref_id");
666  $ti->setMaxLength(200);
667  $ti->setInfo("Separate multiple IDs by :");
668  $ti->setValue($_POST["ref_id"]);
669  $this->form->addItem($ti);
670 
671  $result = "";
672  if (isset($_POST["user_id"])) {
673  $user_ids = explode(":", $_POST["user_id"]);
674  $ref_ids = explode(":", $_POST["ref_id"]);
675  if (count($user_ids) <= 1) {
676  $user_ids = $user_ids[0];
677  }
678  if (count($ref_ids) == 1) {
679  $ref_ids = $ref_ids[0];
680  } elseif (count($ref_ids) == 0) {
681  $ref_ids = null;
682  }
683 
684  $result = ilBasicSkill::checkUserCertificateForTriggerRefId($user_ids, $ref_ids);
685  $result = "<br />Result:<br />" . var_export($result, true);
686  }
687 
688  $tpl->setContent($this->form->getHTML() . $result);
689  }
690 
697  public function testAllCert()
698  {
699  $tpl = $this->tpl;
700  $lng = $this->lng;
702  $ilTabs = $this->tabs;
703 
704  $this->setTestSubTabs("all_cert");
705  $ilTabs->activateTab("test");
706 
707  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
708 
709  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
710  $this->form = new ilPropertyFormGUI();
711 
712  if ($this->rbacsystem->checkAccess('write', $_GET['ref_id'])) {
713  $this->form->addCommandButton("testAllCert", $lng->txt("execute"));
714  }
715 
716  $this->form->setTitle("getTriggerOfAllCertificates()");
717  $this->form->setFormAction($ilCtrl->getFormAction($this));
718 
719  // user id
720  $ti = new ilTextInputGUI("User ID(s)", "user_id");
721  $ti->setMaxLength(200);
722  $ti->setInfo("Separate multiple IDs by :");
723  $ti->setValue($_POST["user_id"]);
724  $this->form->addItem($ti);
725 
726  $result = "";
727  if (isset($_POST["user_id"])) {
728  $user_ids = explode(":", $_POST["user_id"]);
729  $ref_ids = explode(":", $_POST["ref_id"]);
730  if (count($user_ids) <= 1) {
731  $user_ids = $user_ids[0];
732  }
733 
734  $result = ilBasicSkill::getTriggerOfAllCertificates($user_ids);
735  $result = "<br />Result:<br />" . var_export($result, true);
736  }
737 
738  $tpl->setContent($this->form->getHTML() . $result);
739  }
740 
747  public function testLevels()
748  {
749  $tpl = $this->tpl;
750  $lng = $this->lng;
752  $ilTabs = $this->tabs;
753 
754  $this->setTestSubTabs("levels");
755  $ilTabs->activateTab("test");
756 
757  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
758 
759  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
760  $this->form = new ilPropertyFormGUI();
761 
762  if ($this->rbacsystem->checkAccess('write', $_GET['ref_id'])) {
763  $this->form->addCommandButton("testLevels", $lng->txt("execute"));
764  }
765 
766  $this->form->setTitle("getTriggerOfAllCertificates()");
767  $this->form->setFormAction($ilCtrl->getFormAction($this));
768 
769  // user id
770  $ti = new ilTextInputGUI("Ref ID", "ref_id");
771  $ti->setMaxLength(200);
772  $ti->setValue($_POST["ref_id"]);
773  $this->form->addItem($ti);
774 
775  $result = "";
776  if (isset($_POST["ref_id"])) {
777  $result = ilBasicSkill::getSkillLevelsForTrigger($_POST["ref_id"]);
778  $result = "<br />Result:<br />" . var_export($result, true);
779  }
780 
781  $tpl->setContent($this->form->getHTML() . $result);
782  }
783 
784 
791  public function setTestSubtabs($a_act)
792  {
793  $ilTabs = $this->tabs;
795 
796  $ilTabs->addSubtab(
797  "test",
798  "getCompletionDateForTriggerRefId",
799  $ilCtrl->getLinkTarget($this, "test")
800  );
801 
802  $ilTabs->addSubtab(
803  "cert",
804  "checkUserCertificateForTriggerRefId",
805  $ilCtrl->getLinkTarget($this, "testCert")
806  );
807 
808  $ilTabs->addSubtab(
809  "all_cert",
810  "getTriggerOfAllCertificates",
811  $ilCtrl->getLinkTarget($this, "testAllCert")
812  );
813 
814  $ilTabs->addSubtab(
815  "levels",
816  "getSkillLevelsForTrigger",
817  $ilCtrl->getLinkTarget($this, "testLevels")
818  );
819 
820  $ilTabs->activateSubtab($a_act);
821  }
822 
823  //
824  // Skill Templates
825  //
826 
830  public function editSkillTemplates()
831  {
832  $tpl = $this->tpl;
833  $ilTabs = $this->tabs;
834  $lng = $this->lng;
836 
837  $ilTabs->activateTab("skill_templates");
838  $ilCtrl->setParameterByClass("ilobjskillmanagementgui", "obj_id", $this->skill_tree->getRootId());
839  $ilCtrl->redirectByClass("ilskillrootgui", "listTemplates");
840  }
841 
842  //
843  // Tree
844  //
845 
849  public function showTree($a_templates, $a_gui = "", $a_gui_cmd = "")
850  {
852  $tpl = $this->tpl;
854  $lng = $this->lng;
855 
856  if ($a_templates) {
857  if ($_GET["obj_id"] == "" || $_GET["obj_id"] == 1) {
858  return;
859  }
860 
861  if ($_GET["obj_id"] > 1) {
862  $path = $this->skill_tree->getPathId($_GET["obj_id"]);
863  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
864  if (ilSkillTreeNode::_lookupType($path[1]) == "sktp") {
865  return;
866  }
867  }
868  }
869 
870  $ilCtrl->setParameter($this, "templates_tree", $a_templates);
871 
872  if ($a_templates) {
873  $this->tool_context->current()->addAdditionalData(ilSkillGSToolProvider::SHOW_TEMPLATE_TREE, true);
874  $exp = new ilSkillTemplateTreeExplorerGUI($this, "showTree");
875  } else {
876  $this->tool_context->current()->addAdditionalData(ilSkillGSToolProvider::SHOW_SKILL_TREE, true);
877  $exp = new ilSkillTreeExplorerGUI($this, "showTree");
878  }
879  if (!$exp->handleCommand()) {
880  $tpl->setLeftNavContent($exp->getHTML());
881  }
882  }
883 }
settings()
Definition: settings.php:2
Skill category GUI class.
Skill root GUI class.
Skill profile GUI class.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
showTree($a_templates, $a_gui="", $a_gui_cmd="")
Show Editing Tree.
static _writeTitle($a_obj_id, $a_title)
Write Title.
$_SESSION["AccountId"]
$result
This class represents a property form user interface.
Skill tree.
$_GET["client_id"]
static _lookupTrefIdsForTemplateId($a_tid)
Get all tref ids for a template id.
This class represents a checkbox property in a property form.
Explorer class that works on tree objects (Services/Tree)
user()
Definition: user.php:4
static _lookupType($a_obj_id)
Lookup Type.
global $ilCtrl
Definition: ilias.php:18
setTestSubtabs($a_act)
Set test subtabs.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Export User Interface Class.
prepareOutput($a_show_subobjects=true)
prepare output
confirmedDelete()
Delete chapters/scos/pages.
expandAll($a_redirect=true)
Expand all.
editSkillTemplates()
Edit skill templates.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilObjectGUI Basic methods of all Output classes.
Skill template reference GUI class.
const IL_FIRST_NODE
Definition: class.ilTree.php:5
setValue($a_value)
Set Value.
saveAllTemplateTitles($a_succ_mess=true)
Save all titles of chapters/scos/pages.
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
static _lookupTemplateId($a_obj_id)
Lookup template ID.
$n
Definition: RandomTest.php:85
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
test()
Test getCompletionDateForTriggerRefId.
testAllCert()
Test getTriggerOfAllCertificates.
TableGUI class for skill usages.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
saveSettings()
Save skill management settings.
testLevels()
Test getSkillLevelsForTrigger.
Skill template category GUI class.
collapseAll($a_redirect=true)
Collapse all.
testCert()
Test checkUserCertificateForTriggerRefId.
global $ilSetting
Definition: privfeed.php:17
__construct(Container $dic, ilPlugin $plugin)
$ret
Definition: parser.php:6
$DIC
Definition: xapitoken.php:46
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Explorer class that works on tree objects (Services/Tree)
Basic skill GUI class.
saveAllTitles($a_succ_mess=true)
Save all titles of chapters/scos/pages.
Skill usage.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
$_POST["username"]
Basic skill template GUI class.
deleteNodes($a_gui)
confirm deletion screen of skill tree nodes
Skill management main GUI class.
Confirmation screen class.