ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilPersonalSkillsGUI.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
5include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
6include_once("./Services/Skill/classes/class.ilSkillProfile.php");
7
19{
20 const LIST_SELECTED = "";
21 const LIST_PROFILES = "profiles";
22
23 protected $offline_mode;
24 protected $skill_tree;
25 public static $skill_tt_cnt = 1;
26 protected $actual_levels = array();
27 protected $gap_self_eval_levels = array();
28 protected $mode = "";
29 protected $history_view = false;
30 protected $trigger_objects_filter = array();
31 protected $intro_text = "";
32 protected $hidden_skills = array();
33
37 protected $ui;
38
42 protected $ctrl;
43
47 protected $lng;
48
52 protected $help;
53
57 protected $setting;
58
62 protected $user;
63
67 protected $tpl;
68
72 protected $tabs;
73
77 protected $toolbar;
78
82 protected $access;
83
87 protected $ui_fac;
88
92 protected $ui_ren;
93 protected $obj_id = 0;
94 protected $obj_skills = array();
95
99 protected $filter;
100
105
111 public function __construct()
112 {
113 global $DIC;
114
115 $this->ctrl = $DIC->ctrl();
116 $this->lng = $DIC->language();
117 $this->help = $DIC["ilHelp"];
118 $this->setting = $DIC["ilSetting"];
119 $this->user = $DIC->user();
120 $this->tpl = $DIC["tpl"];
121 $this->tabs = $DIC->tabs();
122 $this->toolbar = $DIC->toolbar();
123 $this->access = $DIC->access();
124 $this->ui_fac = $DIC->ui()->factory();
125 $this->ui_ren = $DIC->ui()->renderer();
126 $this->ui = $DIC->ui();
127
129 $ilHelp = $this->help;
132
133
134 $lng->loadLanguageModule('skmg');
135 $ilHelp->setScreenIdComponent("skill");
136
137 $ilCtrl->saveParameter($this, "skill_id");
138 $ilCtrl->saveParameter($this, "tref_id");
139 $ilCtrl->saveParameter($this, "profile_id");
140 $ilCtrl->saveParameter($this, "list_mode");
141
142 $this->list_mode = $_GET["list_mode"];
143
144 $this->user_profiles = ilSkillProfile::getProfilesOfUser($this->user->getId());
145
146 include_once("./Services/Skill/classes/class.ilSkillTree.php");
147 $this->skill_tree = new ilSkillTree();
148
149 $this->use_materials = !$ilSetting->get("disable_personal_workspace");
150
151 include_once("./Services/Skill/classes/class.ilSkillManagementSettings.php");
152 $this->skmg_settings = new ilSkillManagementSettings();
153
154 $this->filter = new ilPersonalSkillsFilterGUI();
155 }
156
162 protected function getFilter()
163 {
164 return $this->filter;
165 }
166
167
173 public function setProfileId($a_val)
174 {
175 $this->profile_id = $a_val;
176 }
177
183 public function getProfileId()
184 {
185 return $this->profile_id;
186 }
187
193 public function setGapAnalysisSelfEvalLevels(array $a_val)
194 {
195 $this->gap_self_eval_levels = $a_val;
196 }
197
204 {
206 }
207
213 public function setHistoryView($a_val)
214 {
215 $this->history_view = $a_val;
216 }
217
223 public function getHistoryView()
224 {
225 return $this->history_view;
226 }
227
231 public function getTriggerObjectsFilter()
232 {
234 }
235
240 {
241 $this->trigger_objects_filter = $trigger_objects_filter;
242 }
243
249 public function setIntroText($a_val)
250 {
251 $this->intro_text = $a_val;
252 }
253
259 public function getIntroText()
260 {
261 return $this->intro_text;
262 }
263
270 public function hideSkill($a_skill_id, $a_tref_id = 0)
271 {
272 $this->hidden_skills[] = $a_skill_id . ":" . $a_tref_id;
273 }
274
281 public function determineCurrentProfile()
282 {
284
285 if (count($this->user_profiles) == 0) {
286 return;
287 }
288 $current_prof_id = 0;
289 if ((int) $_GET["profile_id"] > 0) {
290 foreach ($this->user_profiles as $p) {
291 if ($p["id"] == (int) $_GET["profile_id"]) {
292 $current_prof_id = (int) $_GET["profile_id"];
293 }
294 }
295 }
296
297 if ($current_prof_id == 0 && !(is_array($this->obj_skills) && $this->obj_id > 0)) {
298 $current_prof_id = $this->user_profiles[0]["id"];
299 }
300 $ilCtrl->setParameter($this, "profile_id", $current_prof_id);
301 $this->setProfileId($current_prof_id);
302 }
303
310 public function setObjectSkills($a_obj_id, $a_skills = null)
311 {
312 $this->obj_id = $a_obj_id;
313 $this->obj_skills = $a_skills;
314 }
315
322 public function executeCommand()
323 {
328
329 $next_class = $ilCtrl->getNextClass($this);
330
331
332 // determin standard command
333 $std_cmd = "listSkills";
334
335 $cmd = $ilCtrl->getCmd($std_cmd);
336
337 //$tpl->setTitle($lng->txt("skills"));
338 //$tpl->setTitleIcon(ilUtil::getImagePath("icon_skmg.svg"));
339
340 switch ($next_class) {
341 default:
342 $this->$cmd();
343 break;
344 }
345 return true;
346 }
347
351 public function setTabs($a_activate)
352 {
355 $ilTabs = $this->tabs;
356
357 // list skills
358 $ilCtrl->setParameter($this, "list_mode", self::LIST_SELECTED);
359 $ilTabs->addTab(
360 "list_skills",
361 $lng->txt("skmg_selected_skills"),
362 $ilCtrl->getLinkTarget($this, "render")
363 );
364
365 if (count($this->user_profiles) > 0) {
366 $ilCtrl->setParameter($this, "list_mode", self::LIST_PROFILES);
367 $ilTabs->addTab(
368 "profile",
369 $lng->txt("skmg_assigned_profiles"),
370 $ilCtrl->getLinkTarget($this, "render")
371 );
372 }
373
374 $ilCtrl->clearParameterByClass(get_class($this), "list_mode");
375
376 // assign materials
377
378 $ilTabs->activateTab($a_activate);
379 }
380
381 public function setOfflineMode($a_file_path)
382 {
383 $this->offline_mode = $a_file_path;
384 }
385
389 protected function render()
390 {
391 switch ($this->list_mode) {
393 $this->listAssignedProfile();
394 break;
395
396 default:
397 $this->listSkills();
398 break;
399 }
400 }
401
402
406 public function listSkills()
407 {
411 $main_tpl = $this->tpl;
412 $ilToolbar = $this->toolbar;
413
414 $tpl = new ilTemplate("tpl.skill_filter.html", true, true, "Services/Skill");
415
416 $this->setTabs("list_skills");
417
418 include_once("./Services/Skill/classes/class.ilSkillTree.php");
419 $stree = new ilSkillTree();
420
421 // skill selection / add new personal skill
422 $ilToolbar->addFormButton(
423 $lng->txt("skmg_add_skill"),
424 "listSkillsForAdd"
425 );
426 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
427
428 $filter_toolbar = new ilToolbarGUI();
429 $filter_toolbar->setFormAction($ilCtrl->getFormAction($this));
430 $this->getFilter()->addToToolbar($filter_toolbar, false);
431
433 $html = "";
434 foreach ($skills as $s) {
435 $path = $stree->getSkillTreePath($s["skill_node_id"]);
436
437 // check draft
438 foreach ($path as $p) {
439 if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT) {
440 continue(2);
441 }
442 }
443 $html .= $this->getSkillHTML($s["skill_node_id"], 0, true);
444 }
445
446 // list skills
447 // include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
448 // $sktab = new ilPersonalSkillTableGUI($this, "listSkills");
449
450 if ($html != "") {
451 $filter_toolbar->addFormButton($this->lng->txt("skmg_refresh_view"), "applyFilter");
452 $tpl->setVariable("FILTER", $filter_toolbar->getHTML());
453 $html = $tpl->get() . $html;
454 }
455
456 $main_tpl->setContent($html);
457 }
458
462 protected function applyFilter()
463 {
464 $this->getFilter()->save();
465 $this->ctrl->redirect($this, "listSkills");
466 }
467
471 protected function applyFilterAssignedProfiles()
472 {
473 $this->getFilter()->save();
474 $this->ctrl->redirect($this, "listAssignedProfile");
475 }
476
477
486 public function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false, $a_tref_id = 0)
487 {
488 // user interface plugin slot + default rendering
489 include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
490 $uip = new ilUIHookProcessor(
491 "Services/Skill",
492 "personal_skill_html",
493 array("personal_skills_gui" => $this, "top_skill_id" => $a_top_skill_id, "user_id" => $a_user_id,
494 "edit" => $a_edit, "tref_id" => $a_tref_id)
495 );
496 if (!$uip->replaced()) {
497 $skill_html = $this->renderSkillHTML($a_top_skill_id, $a_user_id, $a_edit, $a_tref_id);
498 }
499 $skill_html = $uip->getHTML($skill_html);
500
501 return $skill_html;
502 }
503
510 public function renderSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false, $a_tref_id = 0)
511 {
515
516 $sub_panels = array();
517
518 if ($a_user_id == 0) {
519 $user = $ilUser;
520 } else {
521 $user = new ilObjUser($a_user_id);
522 }
523
524 $tpl = new ilTemplate("tpl.skill_pres.html", true, true, "Services/Skill");
525
526 include_once("./Services/Skill/classes/class.ilSkillTree.php");
527 $stree = new ilSkillTree();
528
529 include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
530 $vtree = new ilVirtualSkillTree();
531 $tref_id = $a_tref_id;
532 $skill_id = $a_top_skill_id;
533 if (ilSkillTreeNode::_lookupType($a_top_skill_id) == "sktr") {
534 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
535 $tref_id = $a_top_skill_id;
536 $skill_id = ilSkillTemplateReference::_lookupTemplateId($a_top_skill_id);
537 }
538 $b_skills = $vtree->getSubTreeForCSkillId($skill_id . ":" . $tref_id, true);
539
540 foreach ($b_skills as $bs) {
541 $bs["id"] = $bs["skill_id"];
542 $bs["tref"] = $bs["tref_id"];
543
544 $path = $stree->getSkillTreePath($bs["id"], $bs["tref"]);
545
546 $panel_comps = array();
547
548
549 // check draft
550 foreach ($path as $p) {
551 if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT) {
552 continue(2);
553 }
554 }
555 reset($path);
556
557 $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]);
558 $level_data = $skill->getLevelData();
559
560
561 $title = $sep = "";
562 $description = "";
563 $found = false;
564 foreach ($path as $p) {
565 if ($found) {
566 $title .= $sep . $p["title"];
567 $sep = " > ";
568 $description = $p["description"];
569 }
570 if ($a_top_skill_id == $p["child"]) {
571 $found = true;
572 }
573 }
574
575 // skill description
576 $panel_comps[] = $this->ui_fac->legacy($this->getBasicSkillDescription((string) $description));
577
578
579 // skill level description
580 $panel_comps[] = $this->ui_fac->legacy($this->getSkillLevelDescription($skill));
581
582
583 if ($this->getProfileId() > 0) {
584 if (!$this->skmg_settings->getHideProfileBeforeSelfEval() ||
585 ilBasicSkill::hasSelfEvaluated($user->getId(), $bs["id"], $bs["tref"])) {
586 if ($this->getFilter()->showTargetLevel()) {
587 $panel_comps[] = $this->ui_fac->legacy($this->getProfileTargetItem($this->getProfileId(), $level_data, $bs["tref"]));
588 }
589 }
590 }
591
592 if ($this->mode == "gap" && !$this->history_view) {
593 $panel_comps[] = $this->ui_fac->legacy($this->getActualGapItem($level_data, $bs["tref"]) . "");
594 $panel_comps[] = $this->ui_fac->legacy($this->getSelfEvalGapItem($level_data, $bs["tref"]) . "");
595 } else {
596 // get date of self evaluation
597 $se_date = ilPersonalSkill::getSelfEvaluationDate($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]);
598 $se_rendered = ($se_date == "")
599 ? true
600 : false;
601
602 // get all object triggered entries and render them
603 foreach ($skill->getAllHistoricLevelEntriesOfUser($bs["tref"], $user->getId(), ilBasicSkill::EVAL_BY_ALL) as $level_entry) {
604 if (count($this->getTriggerObjectsFilter()) && !in_array($level_entry['trigger_obj_id'], $this->getTriggerObjectsFilter())) {
605 continue;
606 }
607
608 // render the self evaluation at the correct position within the list of object triggered entries
609 if ($se_date > $level_entry["status_date"] && !$se_rendered) {
610 $se_rendered = true;
611 }
612 if ($this->getFilter()->isInRange($level_data, $level_entry)) {
613 $panel_comps[] = $this->ui_fac->legacy($this->getEvalItem($level_data, $level_entry));
614 }
615 }
616 }
617
618 // materials (new)
619 if ($this->mode != "gap") {
620 if ($this->getFilter()->showMaterialsRessources() && $this->use_materials) {
621 $mat = $this->getMaterials($level_data, $bs["tref"], $user->getId());
622 }
623 if ($mat != "") {
624 $panel_comps[] = $this->ui_fac->legacy($mat);
625 }
626 }
627
628 // suggested resources
629 if ($this->getFilter()->showMaterialsRessources()) {
630 $sugg = $this->getSuggestedResources($this->getProfileId(), $level_data, $bs["id"], $bs["tref"]);
631 }
632 if ($sugg != "") {
633 $panel_comps[] = $this->ui_fac->legacy($sugg);
634 }
635
636 $sub = $this->ui_fac->panel()->sub((string) $title, $panel_comps);
637 if ($a_edit) {
638 $actions = array();
639 $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id);
640 $ilCtrl->setParameterByClass("ilpersonalskillsgui", "tref_id", $bs["tref"]);
641 $ilCtrl->setParameterByClass("ilpersonalskillsgui", "basic_skill_id", $bs["id"]);
642 if ($this->use_materials) {
643 $actions[] = $this->ui_fac->button()->shy(
644 $lng->txt('skmg_assign_materials'),
645 $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials")
646 );
647 }
648 $actions[] = $this->ui_fac->button()->shy(
649 $lng->txt('skmg_self_evaluation'),
650 $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "selfEvaluation")
651 );
652 $sub = $sub->withActions($this->ui_fac->dropdown()->standard($actions)->withLabel($lng->txt("actions")));
653 }
654
655 $sub_panels[] = $sub;
656
657 $tpl->parseCurrentBlock();
658 }
659
660 $des = $this->getSkillCategoryDescription($skill_id, $tref_id);
661
662 //put the description of the skill category to the very top of the sub panels
663 $sub_panels = $this->ui_fac->legacy($des . $this->ui_ren->render($sub_panels));
664
665 $panel = $this->ui_fac->panel()->standard(
666 (string) ilSkillTreeNode::_lookupTitle($skill_id, $tref_id),
667 $sub_panels
668 );
669
670 if ($a_edit && $this->getProfileId() == 0) {
671 $actions = array();
672
673 $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id);
674 $actions[] = $this->ui_fac->button()->shy(
675 $lng->txt('skmg_remove_skill'),
676 $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "confirmSkillRemove")
677 );
678
679 $panel = $panel->withActions($this->ui_fac->dropdown()->standard($actions)->withLabel($lng->txt("actions")));
680 }
681
682 return $this->ui_ren->render($panel);
683 }
684
685
692 public function getMaterialInfo($a_wsp_id, $a_user_id)
693 {
694 if (!$this->ws_tree) {
695 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
696 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
697 $this->ws_tree = new ilWorkspaceTree($a_user_id);
698 $this->ws_access = new ilWorkspaceAccessHandler($caption);
699 }
700
701 $obj_id = $this->ws_tree->lookupObjectId($a_wsp_id);
703
704 if (!$this->offline_mode) {
705 $url = $this->ws_access->getGotoLink($a_wsp_id, $obj_id);
706 } else {
707 $url = $this->offline_mode . "file_" . $obj_id . "/";
708
709 // all possible material types for now
711 case "tstv":
712 include_once "Modules/Test/classes/class.ilObjTestVerification.php";
713 $obj = new ilObjTestVerification($obj_id, false);
714 $url .= $obj->getOfflineFilename();
715 break;
716
717 case "excv":
718 include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
719 $obj = new ilObjExerciseVerification($obj_id, false);
720 $url .= $obj->getOfflineFilename();
721 break;
722
723 case "crsv":
724 include_once "Modules/Course/classes/Verification/class.ilObjCourseVerification.php";
725 $obj = new ilObjCourseVerification($obj_id, false);
726 $url .= $obj->getOfflineFilename();
727 break;
728
729 case "cmxv":
730 $obj = new ilObjCmiXapiVerification($obj_id, false);
731 $url .= $obj->getOfflineFilename();
732 break;
733
734 case "ltiv":
735 $obj = new ilObjLTIConsumerVerification($obj_id, false);
736 $url .= $obj->getOfflineFilename();
737 break;
738
739 case "scov":
740 include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
741 $obj = new ilObjSCORMVerification($obj_id, false);
742 $url .= $obj->getOfflineFilename();
743 break;
744
745 case "file":
746 $file = new ilObjFile($obj_id, false);
747 $url .= $file->getFilename();
748 break;
749 }
750 }
751
752 return array($caption, $url);
753 }
754
758 public function addSkill()
759 {
763
764 ilPersonalSkill::addPersonalSkill($ilUser->getId(), (int) $_GET["obj_id"]);
765
766 ilUtil::sendSuccess($lng->txt("msg_object_modified"));
767 $ilCtrl->redirect($this, "listSkills");
768 }
769
770
771
775 public function confirmSkillRemove()
776 {
780
781 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
782 if ($_GET["skill_id"] > 0) {
783 $_POST["id"][] = $_GET["skill_id"];
784 }
785 if (!is_array($_POST["id"]) || count($_POST["id"]) == 0) {
786 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
787 $ilCtrl->redirect($this, "listSkills");
788 } else {
789 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
790 $cgui = new ilConfirmationGUI();
791 $cgui->setFormAction($ilCtrl->getFormAction($this));
792 $cgui->setHeaderText($lng->txt("skmg_really_remove_skills"));
793 $cgui->setCancel($lng->txt("cancel"), "listSkills");
794 $cgui->setConfirm($lng->txt("remove"), "removeSkills");
795
796 foreach ($_POST["id"] as $i) {
797 $cgui->addItem("id[]", $i, ilSkillTreeNode::_lookupTitle($i));
798 }
799
800 $tpl->setContent($cgui->getHTML());
801 }
802 }
803
807 public function removeSkills()
808 {
812
813 if (is_array($_POST["id"])) {
814 foreach ($_POST["id"] as $n_id) {
815 ilPersonalSkill::removeSkill($ilUser->getId(), $n_id);
816 }
817 }
818
819 ilUtil::sendSuccess($lng->txt("msg_object_modified"));
820 $ilCtrl->redirect($this, "listSkills");
821 }
822
823
824 //
825 // Materials assignments
826 //
827
834 public function assignMaterials()
835 {
839 $ilToolbar = $this->toolbar;
840 $ilTabs = $this->tabs;
841
842
843 $ilTabs->setBackTarget(
844 $lng->txt("back"),
845 $ilCtrl->getLinkTarget($this, "render")
846 );
847
848 $ilCtrl->saveParameter($this, "skill_id");
849 $ilCtrl->saveParameter($this, "basic_skill_id");
850 $ilCtrl->saveParameter($this, "tref_id");
851
852 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
853 $tpl->setTitle(ilSkillTreeNode::_lookupTitle((int) $_GET["skill_id"]));
854 $tpl->setTitleIcon(ilUtil::getImagePath("icon_" .
855 ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) .
856 ".svg"));
857
858 // basic skill selection
859 include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
860 $vtree = new ilVirtualSkillTree();
861 $tref_id = 0;
862 $skill_id = (int) $_GET["skill_id"];
863 if (ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) == "sktr") {
864 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
865 $tref_id = $_GET["skill_id"];
866 $skill_id = ilSkillTemplateReference::_lookupTemplateId($_GET["skill_id"]);
867 }
868 $bs = $vtree->getSubTreeForCSkillId($skill_id . ":" . $tref_id, true);
869
870 $options = array();
871 foreach ($bs as $b) {
872 //$options[$b["id"]] = ilSkillTreeNode::_lookupTitle($b["id"]);
873 $options[$b["skill_id"]] = ilSkillTreeNode::_lookupTitle($b["skill_id"]);
874 }
875
876 $cur_basic_skill_id = ((int) $_POST["basic_skill_id"] > 0)
877 ? (int) $_POST["basic_skill_id"]
878 : (((int) $_GET["basic_skill_id"] > 0)
879 ? (int) $_GET["basic_skill_id"]
880 : key($options));
881
882 $ilCtrl->setParameter($this, "basic_skill_id", $cur_basic_skill_id);
883
884 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
885 $si = new ilSelectInputGUI($lng->txt("skmg_skill"), "basic_skill_id");
886 $si->setOptions($options);
887 $si->setValue($cur_basic_skill_id);
888 $ilToolbar->addInputItem($si, true);
889 $ilToolbar->addFormButton(
890 $lng->txt("select"),
891 "assignMaterials"
892 );
893
894 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
895
896 // table
897 include_once("./Services/Skill/classes/class.ilSkillAssignMaterialsTableGUI.php");
899 $this,
900 "assignMaterials",
901 (int) $_GET["skill_id"],
902 (int) $_GET["tref_id"],
903 $cur_basic_skill_id
904 );
905
906 $tpl->setContent($tab->getHTML());
907 }
908
909
916 public function assignMaterial()
917 {
922 $ilTabs = $this->tabs;
924 $ui = $this->ui;
925
926 if (!$ilSetting->get("disable_personal_workspace")) {
927 $url = 'ilias.php?baseClass=ilDashboardGUI&amp;cmd=jumpToWorkspace';
928 $mbox = $ui->factory()->messageBox()->info($lng->txt("skmg_ass_materials_from_workspace"))
929 ->withLinks([$ui->factory()->link()->standard(
930 $lng->txt("personal_resources"),
931 $url
932 )]);
933 $message = $ui->renderer()->render($mbox);
934 }
935
936 $ilCtrl->saveParameter($this, "skill_id");
937 $ilCtrl->saveParameter($this, "level_id");
938 $ilCtrl->saveParameter($this, "tref_id");
939 $ilCtrl->saveParameter($this, "basic_skill_id");
940
941 $ilTabs->setBackTarget(
942 $lng->txt("back"),
943 $ilCtrl->getLinkTarget($this, "assignMaterials")
944 );
945
946
947 include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
948 $exp = new ilWorkspaceExplorerGUI($ilUser->getId(), $this, "assignMaterial", $this, "");
949 $exp->setTypeWhiteList(array("blog", "wsrt", "wfld", "file", "tstv", "excv"));
950 $exp->setSelectableTypes(array("file", "tstv", "excv"));
951 $exp->setSelectMode("wsp_id", true);
952 if ($exp->handleCommand()) {
953 return;
954 }
955
956 // fill template
957 $mtpl = new ilTemplate("tpl.materials_selection.html", true, true, "Services/Skill");
958 $mtpl->setVariable("EXP", $exp->getHTML());
959
960 // toolbars
961 $tb = new ilToolbarGUI();
962 $tb->addFormButton(
963 $lng->txt("select"),
964 "selectMaterial"
965 );
966 $tb->setFormAction($ilCtrl->getFormAction($this));
967 $tb->setOpenFormTag(true);
968 $tb->setCloseFormTag(false);
969 $mtpl->setVariable("TOOLBAR1", $tb->getHTML());
970 $tb->setOpenFormTag(false);
971 $tb->setCloseFormTag(true);
972 $mtpl->setVariable("TOOLBAR2", $tb->getHTML());
973
974 $tpl->setContent($message . $mtpl->get());
975 }
976
980 public function selectMaterial()
981 {
985
986
987 include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
988 if (is_array($_POST["wsp_id"])) {
989 foreach ($_POST["wsp_id"] as $w) {
991 $ilUser->getId(),
992 (int) $_GET["skill_id"],
993 (int) $_GET["tref_id"],
994 (int) $_GET["basic_skill_id"],
995 (int) $_GET["level_id"],
996 (int) $w
997 );
998 }
999 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1000 }
1001
1002 $ilCtrl->saveParameter($this, "skill_id");
1003 $ilCtrl->saveParameter($this, "level_id");
1004 $ilCtrl->saveParameter($this, "tref_id");
1005 $ilCtrl->saveParameter($this, "basic_skill_id");
1006
1007 $ilCtrl->redirect($this, "assignMaterials");
1008 }
1009
1010
1014 public function removeMaterial()
1015 {
1018 $lng = $this->lng;
1019
1020
1022 $ilUser->getId(),
1023 (int) $_GET["tref_id"],
1024 (int) $_GET["level_id"],
1025 (int) $_GET["wsp_id"]
1026 );
1027 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1028 $ilCtrl->redirect($this, "assignMaterials");
1029 }
1030
1031
1032 //
1033 // Self evaluation
1034 //
1035
1042 public function selfEvaluation()
1043 {
1045 $lng = $this->lng;
1046 $tpl = $this->tpl;
1047 $ilToolbar = $this->toolbar;
1048 $ilTabs = $this->tabs;
1049
1050
1051 $ilTabs->setBackTarget(
1052 $lng->txt("back"),
1053 $ilCtrl->getLinkTarget($this, "render")
1054 );
1055
1056 $ilCtrl->saveParameter($this, "skill_id");
1057 $ilCtrl->saveParameter($this, "basic_skill_id");
1058 $ilCtrl->saveParameter($this, "tref_id");
1059
1060 include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
1061 $tpl->setTitle(ilSkillTreeNode::_lookupTitle((int) $_GET["skill_id"]));
1062 $tpl->setTitleIcon(ilUtil::getImagePath("icon_" .
1063 ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) .
1064 ".svg"));
1065
1066 // basic skill selection
1067 include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
1068 $vtree = new ilVirtualSkillTree();
1069 $tref_id = 0;
1070 $skill_id = (int) $_GET["skill_id"];
1071 if (ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) == "sktr") {
1072 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
1073 $tref_id = $_GET["skill_id"];
1074 $skill_id = ilSkillTemplateReference::_lookupTemplateId($_GET["skill_id"]);
1075 }
1076 $bs = $vtree->getSubTreeForCSkillId($skill_id . ":" . $tref_id, true);
1077
1078
1079 $options = array();
1080 foreach ($bs as $b) {
1081 $options[$b["skill_id"]] = ilSkillTreeNode::_lookupTitle($b["skill_id"]);
1082 }
1083
1084 $cur_basic_skill_id = ((int) $_POST["basic_skill_id"] > 0)
1085 ? (int) $_POST["basic_skill_id"]
1086 : (((int) $_GET["basic_skill_id"] > 0)
1087 ? (int) $_GET["basic_skill_id"]
1088 : key($options));
1089
1090 $ilCtrl->setParameter($this, "basic_skill_id", $cur_basic_skill_id);
1091
1092 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1093 $si = new ilSelectInputGUI($lng->txt("skmg_skill"), "basic_skill_id");
1094 $si->setOptions($options);
1095 $si->setValue($cur_basic_skill_id);
1096 $ilToolbar->addInputItem($si, true);
1097 $ilToolbar->addFormButton(
1098 $lng->txt("select"),
1099 "selfEvaluation"
1100 );
1101
1102 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1103
1104 // table
1105 include_once("./Services/Skill/classes/class.ilSelfEvaluationSimpleTableGUI.php");
1107 $this,
1108 "selfEvaluation",
1109 (int) $_GET["skill_id"],
1110 (int) $_GET["tref_id"],
1111 $cur_basic_skill_id
1112 );
1113
1114 $tpl->setContent($tab->getHTML());
1115 }
1116
1120 public function saveSelfEvaluation()
1121 {
1124 $lng = $this->lng;
1125
1127 $ilUser->getId(),
1128 (int) $_GET["skill_id"],
1129 (int) $_GET["tref_id"],
1130 (int) $_GET["basic_skill_id"],
1131 (int) $_POST["se"]
1132 );
1133 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1134
1135 /* $ilCtrl->saveParameter($this, "skill_id");
1136 $ilCtrl->saveParameter($this, "level_id");
1137 $ilCtrl->saveParameter($this, "tref_id");
1138 $ilCtrl->saveParameter($this, "basic_skill_id");*/
1139
1140 $ilCtrl->redirect($this, "render");
1141 }
1142
1149 public function listSkillsForAdd()
1150 {
1152 $lng = $this->lng;
1153 $tpl = $this->tpl;
1154 $ilTabs = $this->tabs;
1155
1156
1157 $ilTabs->setBackTarget(
1158 $lng->txt("back"),
1159 $ilCtrl->getLinkTarget($this, "")
1160 );
1161
1162 include_once("./Services/Skill/classes/class.ilPersonalSkillExplorerGUI.php");
1163 $exp = new ilPersonalSkillExplorerGUI($this, "listSkillsForAdd", $this, "addSkill");
1164 if ($exp->getHasSelectableNodes()) {
1165 if (!$exp->handleCommand()) {
1166 $tpl->setContent($exp->getHTML());
1167 }
1168 ilUtil::sendInfo($lng->txt("skmg_select_skill"));
1169 } else {
1170 ilUtil::sendInfo($lng->txt("skmg_no_nodes_selectable"));
1171 }
1172 }
1173
1179 public function listProfilesForGap()
1180 {
1181 $tpl = $this->tpl;
1182
1183 //$a_user_id = $ilUser->getId();
1184
1185 //$profiles = ilSkillProfile::getProfilesOfUser($a_user_id);
1186
1187 if (count($this->user_profiles) == 0 && $this->obj_skills == null) {
1188 return;
1189 }
1190
1191 $this->determineCurrentProfile();
1193
1194 $tpl->setContent($this->getGapAnalysisHTML());
1195 }
1196
1197
1198
1203 {
1204 $ilToolbar = $this->toolbar;
1205 $lng = $this->lng;
1207
1208 $options = array();
1209 if (is_array($this->obj_skills) && $this->obj_id > 0) {
1210 $options[0] = $lng->txt("obj_" . ilObject::_lookupType($this->obj_id)) . ": " . ilObject::_lookupTitle($this->obj_id);
1211 }
1212
1213 foreach ($this->user_profiles as $p) {
1214 $options[$p["id"]] = $lng->txt("skmg_profile") . ": " . $p["title"];
1215 }
1216
1217 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1218 $si = new ilSelectInputGUI($lng->txt("skmg_profile"), "profile_id");
1219 $si->setOptions($options);
1220 $si->setValue($this->getProfileId());
1221 $ilToolbar->addInputItem($si, true);
1222 $ilToolbar->addFormButton(
1223 $lng->txt("select"),
1224 "selectProfile"
1225 );
1226 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1227 }
1228
1229
1235 public function setGapAnalysisActualStatusModePerType($a_type, $a_cat_title = "")
1236 {
1237 $this->gap_mode = "max_per_type";
1238 $this->gap_mode_type = $a_type;
1239 $this->gap_cat_title = $a_cat_title;
1240 $this->mode = "gap";
1241 }
1242
1248 public function setGapAnalysisActualStatusModePerObject($a_obj_id, $a_cat_title = "")
1249 {
1250 $this->gap_mode = "max_per_object";
1251 $this->gap_mode_obj_id = $a_obj_id;
1252 $this->gap_cat_title = $a_cat_title;
1253 $this->mode = "gap";
1254 }
1255
1262 protected function getActualLevels($skills, $user_id)
1263 {
1264 // get actual levels for gap analysis
1265 $this->actual_levels = array();
1266 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
1267 foreach ($skills as $sk) {
1268 $bs = new ilBasicSkill($sk["base_skill_id"]);
1269 if ($this->gap_mode == "max_per_type") {
1270 $max = $bs->getMaxLevelPerType($sk["tref_id"], $this->gap_mode_type, $user_id);
1271 $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
1272 } elseif ($this->gap_mode == "max_per_object") {
1273 $max = $bs->getMaxLevelPerObject($sk["tref_id"], $this->gap_mode_obj_id, $user_id);
1274 $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
1275 } else {
1276 $max = $bs->getMaxLevel($sk["tref_id"], $user_id);
1277 $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
1278 }
1279 }
1280 }
1281
1282
1290 public function getGapAnalysisHTML($a_user_id = 0, $a_skills = null)
1291 {
1293 $lng = $this->lng;
1294
1295
1296 if ($a_skills == null) {
1297 $a_skills = $this->obj_skills;
1298 }
1299
1300 include_once("./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
1301
1302 if ($this->getIntroText() != "") {
1303 $pan = ilPanelGUI::getInstance();
1304 $pan->setPanelStyle(ilPanelGUI::PANEL_STYLE_PRIMARY);
1305 $pan->setBody($this->getIntroText());
1306 $intro_html = $pan->getHTML();
1307 }
1308
1309 // $this->setTabs("list_skills");
1310
1311 if ($a_user_id == 0) {
1312 $user_id = $ilUser->getId();
1313 } else {
1314 $user_id = $a_user_id;
1315 }
1316
1317 $skills = array();
1318 if ($this->getProfileId() > 0) {
1319 $profile = new ilSkillProfile($this->getProfileId());
1320 $this->profile_levels = $profile->getSkillLevels();
1321
1322 foreach ($this->profile_levels as $l) {
1323 $skills[] = array(
1324 "base_skill_id" => $l["base_skill_id"],
1325 "tref_id" => $l["tref_id"],
1326 "level_id" => $l["level_id"]
1327 );
1328 }
1329 } elseif (is_array($a_skills)) {
1330 $skills = $a_skills;
1331 }
1332
1333 // get actual levels for gap analysis
1334 $this->getActualLevels($skills, $user_id);
1335
1336 $incl_self_eval = false;
1337 if (count($this->getGapAnalysisSelfEvalLevels()) > 0) {
1338 $incl_self_eval = true;
1339 $self_vals = $this->getGapAnalysisSelfEvalLevels();
1340 }
1341
1342 // output spider stuff
1343 $all_chart_html = "";
1344
1345 // determine skills that should be shown in the spider web
1346 $sw_skills = array();
1347 foreach ($skills as $sk) {
1348 if (!in_array($sk["base_skill_id"] . ":" . $sk["tref_id"], $this->hidden_skills)) {
1349 $sw_skills[] = $sk;
1350 }
1351 }
1352
1353 if (count($sw_skills) >= 3) {
1354 $skill_packages = array();
1355
1356 if (count($sw_skills) < 8) {
1357 $skill_packages[1] = $sw_skills;
1358 } else {
1359 $mod = count($sw_skills) % 7;
1360 $pkg_num = floor((count($sw_skills) - 1) / 7) + 1;
1361 $cpkg = 1;
1362 foreach ($sw_skills as $k => $s) {
1363 $skill_packages[$cpkg][$k] = $s;
1364 if ($mod < 3 && count($skill_packages) == ($pkg_num - 1) && count($skill_packages[$cpkg]) == 3 + $mod) {
1365 $cpkg += 1;
1366 } elseif (count($skill_packages[$cpkg]) == 7) {
1367 $cpkg += 1;
1368 }
1369 }
1370 }
1371
1372 $pkg_cnt = 0;
1373 foreach ($skill_packages as $pskills) {
1374 $pkg_cnt++;
1375 $max_cnt = 0;
1376 $leg_labels = array();
1377 //var_dump($this->profile_levels);
1378 //foreach ($this->profile_levels as $k => $l)
1379
1380 // write target, actual and self counter to skill array
1381 foreach ($pskills as $k => $l) {
1382 //$bs = new ilBasicSkill($l["base_skill_id"]);
1383 $bs = new ilBasicSkill($l["base_skill_id"]);
1384 $leg_labels[] = ilBasicSkill::_lookupTitle($l["base_skill_id"], $l["tref_id"]);
1385 $levels = $bs->getLevelData();
1386 $cnt = 0;
1387 foreach ($levels as $lv) {
1388 $cnt++;
1389 if ($l["level_id"] == $lv["id"]) {
1390 $pskills[$k]["target_cnt"] = $cnt;
1391 }
1392 if ($this->actual_levels[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"]) {
1393 $pskills[$k]["actual_cnt"] = $cnt;
1394 }
1395 if ($incl_self_eval) {
1396 if ($self_vals[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"]) {
1397 $pskills[$k]["self_cnt"] = $cnt;
1398 }
1399 }
1400 $max_cnt = max($max_cnt, $cnt);
1401 }
1402 }
1403
1404 include_once("./Services/Chart/classes/class.ilChart.php");
1405 $chart = ilChart::getInstanceByType(ilChart::TYPE_SPIDER, "gap_chart" . $pkg_cnt);
1406 $chart->setsize(800, 300);
1407 $chart->setYAxisMax($max_cnt);
1408 $chart->setLegLabels($leg_labels);
1409
1410 // target level
1411 $cd = $chart->getDataInstance();
1412 $cd->setLabel($lng->txt("skmg_target_level"));
1413 $cd->setFill(true, "#A0A0A0");
1414
1415 // other users
1416 $cd2 = $chart->getDataInstance();
1417 if ($this->gap_cat_title != "") {
1418 $cd2->setLabel($this->gap_cat_title);
1419 } elseif ($this->gap_mode == "max_per_type") {
1420 $cd2->setLabel($lng->txt("objs_" . $this->gap_mode_type));
1421 } elseif ($this->gap_mode == "max_per_object") {
1422 $cd2->setLabel(ilObject::_lookupTitle($this->gap_mode_obj_id));
1423 }
1424 //$cd2->setFill(true, "#dcb496");
1425 $cd2->setFill(true, "#FF8080");
1426 $cd2->setFill(true, "#cc8466");
1427
1428 // self evaluation
1429 if ($incl_self_eval) {
1430 $cd3 = $chart->getDataInstance();
1431 $cd3->setLabel($lng->txt("skmg_self_evaluation"));
1432 $cd3->setFill(true, "#6ea03c");
1433 }
1434
1435 // fill in data
1436 $cnt = 0;
1437 foreach ($pskills as $pl) {
1438 $cd->addPoint($cnt, (int) $pl["target_cnt"]);
1439 $cd2->addPoint($cnt, (int) $pl["actual_cnt"]);
1440 if ($incl_self_eval) {
1441 $cd3->addPoint($cnt, (int) $pl["self_cnt"]);
1442 }
1443 $cnt++;
1444 }
1445
1446 // add data to chart
1447 if ($this->getProfileId() > 0) {
1448 $chart->addData($cd);
1449 }
1450 $chart->addData($cd2);
1451 if ($incl_self_eval && count($this->getGapAnalysisSelfEvalLevels()) > 0) {
1452 $chart->addData($cd3);
1453 }
1454
1455 if ($pkg_cnt == 1) {
1456 $lg = new ilChartLegend();
1457 $chart->setLegend($lg);
1458 }
1459
1460 $chart_html = $chart->getHTML();
1461 $all_chart_html .= $chart_html;
1462 }
1463
1464 $pan = ilPanelGUI::getInstance();
1465 $pan->setPanelStyle(ilPanelGUI::PANEL_STYLE_PRIMARY);
1466 $pan->setBody($all_chart_html);
1467 $all_chart_html = $pan->getHTML();
1468 }
1469
1470 $stree = new ilSkillTree();
1471 $html = "";
1472
1473 // order skills per virtual skill tree
1474 include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
1475 $vtree = new ilVirtualSkillTree();
1476 $skills = $vtree->getOrderedNodeset($skills, "base_skill_id", "tref_id");
1477 foreach ($skills as $s) {
1478 $path = $stree->getSkillTreePath($s["base_skill_id"]);
1479
1480 // check draft
1481 foreach ($path as $p) {
1482 if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT) {
1483 continue(2);
1484 }
1485 }
1486 $html .= $this->getSkillHTML($s["base_skill_id"], $user_id, false, $s["tref_id"]);
1487 }
1488
1489 // list skills
1490 // include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
1491 // $sktab = new ilPersonalSkillTableGUI($this, "listSkills");
1492
1493 return $intro_html . $all_chart_html . $html;
1494 }
1495
1501 public function selectProfile()
1502 {
1504
1505 $ilCtrl->setParameter($this, "profile_id", $_POST["profile_id"]);
1506 if ($this->mode == "gap") {
1507 $ilCtrl->redirect($this, "listProfilesForGap");
1508 } else {
1509 $ilCtrl->redirect($this, "listAssignedProfile");
1510 }
1511 }
1512
1519 public function getMaterials($a_levels, $a_tref_id = 0, $a_user_id = 0)
1520 {
1522 $lng = $this->lng;
1523
1524 if ($a_user_id == 0) {
1525 $a_user_id = $ilUser->getId();
1526 }
1527
1528 // only render, if materials given
1529 $got_mat = false;
1530 foreach ($a_levels as $v) {
1532 $a_user_id,
1533 $a_tref_id,
1534 $v["id"]
1535 );
1536 if ($mat_cnt > 0) {
1537 $got_mat = true;
1538 }
1539 }
1540 if (!$got_mat) {
1541 return "";
1542 }
1543
1544 $tpl = new ilTemplate("tpl.skill_materials.html", true, true, "Services/Skill");
1545 foreach ($a_levels as $k => $v) {
1546 $got_mat = false;
1548 $a_user_id,
1549 $a_tref_id,
1550 $v["id"]
1551 ) as $item) {
1552 $tpl->setCurrentBlock("material");
1553 $mat_data = $this->getMaterialInfo($item["wsp_id"], $a_user_id);
1554 $tpl->setVariable("HREF_LINK", $mat_data[1]);
1555 $tpl->setVariable("TXT_LINK", $mat_data[0]);
1556 $tpl->parseCurrentBlock();
1557 $got_mat = true;
1558 }
1559 if ($got_mat) {
1560 $tpl->setCurrentBlock("level");
1561 $tpl->setVariable("LEVEL_VAL", $v["title"]);
1562 $tpl->parseCurrentBlock();
1563 }
1564 }
1565 $tpl->setVariable("TXT_MATERIAL", $lng->txt("skmg_materials"));
1566
1567 return $tpl->get();
1568 }
1569
1576 public function getProfileTargetItem($a_profile_id, $a_levels, $a_tref_id = 0)
1577 {
1578 $lng = $this->lng;
1579
1580 $profile = new ilSkillProfile($a_profile_id);
1581 $profile_levels = $profile->getSkillLevels();
1582
1583 $a_activated_levels = array();
1584
1585 foreach ($a_levels as $k => $v) {
1586 foreach ($profile_levels as $pl) {
1587 if ($pl["level_id"] == $v["id"] &&
1588 $pl["base_skill_id"] == $v["skill_id"] &&
1589 $a_tref_id == $pl["tref_id"]) {
1590 $a_activated_levels[] = $pl["level_id"];
1591 }
1592 }
1593 }
1594
1595 $tpl = new ilTemplate("tpl.skill_eval_item.html", true, true, "Services/Skill");
1596 $tpl->setVariable("SCALE_BAR", $this->getScaleBar($a_levels, $a_activated_levels));
1597
1598 $tpl->setVariable("TYPE", $lng->txt("skmg_target_level"));
1599 $tpl->setVariable("TITLE", "");
1600
1601 return $tpl->get();
1602 }
1603
1610 public function getActualGapItem($a_levels, $a_tref_id = 0)
1611 {
1612 $lng = $this->lng;
1613
1614 $a_activated_levels = array();
1615 foreach ($a_levels as $k => $v) {
1616 if ($this->actual_levels[$v["skill_id"]][$a_tref_id] == $v["id"]) {
1617 $a_activated_levels[] = $v["id"];
1618 }
1619 }
1620
1621 if ($this->gap_cat_title != "") {
1622 $title = $this->gap_cat_title;
1623 } elseif ($this->gap_mode == "max_per_type") {
1624 $title = $lng->txt("objs_" . $this->gap_mode_type);
1625 } elseif ($this->gap_mode == "max_per_object") {
1626 $title = ilObject::_lookupTitle($this->gap_mode_obj_id);
1627 }
1628
1629 $tpl = new ilTemplate("tpl.skill_eval_item.html", true, true, "Services/Skill");
1630 $tpl->setVariable("SCALE_BAR", $this->getScaleBar($a_levels, $a_activated_levels));
1631
1632 $type = 1;
1633 $tpl->setVariable("TYPE", $lng->txt("skmg_eval_type_" . $type));
1634 if ($type > 0) {
1635 $tpl->touchBlock("st" . $type);
1636 $tpl->touchBlock("stb" . $type);
1637 }
1638
1639 if ($title != $lng->txt("skmg_eval_type_" . $type)) {
1640 $tpl->setVariable("TITLE", $title);
1641 }
1642
1643 return $tpl->get();
1644 }
1645
1652 public function getSelfEvalGapItem($a_levels, $a_tref_id = 0)
1653 {
1654 $lng = $this->lng;
1655
1656 $self_vals = $this->getGapAnalysisSelfEvalLevels();
1657 if (count($self_vals) == 0) {
1658 return;
1659 }
1660
1661 $a_activated_levels = array();
1662 foreach ($a_levels as $k => $v) {
1663 if ($self_vals[$v["skill_id"]][$a_tref_id] == $v["id"]) {
1664 $a_activated_levels[] = $v["id"];
1665 }
1666 }
1667
1668 $tpl = new ilTemplate("tpl.skill_eval_item.html", true, true, "Services/Skill");
1669 $tpl->setVariable("SCALE_BAR", $this->getScaleBar($a_levels, $a_activated_levels));
1670
1671 $type = 3;
1672 $tpl->setVariable("TYPE", $lng->txt("skmg_eval_type_" . $type));
1673 if ($type > 0) {
1674 $tpl->touchBlock("st" . $type);
1675 $tpl->touchBlock("stb" . $type);
1676 }
1677
1678 return $tpl->get();
1679 }
1680
1681
1688 public function getScaleBar($a_levels, $a_activated_levels)
1689 {
1690 $vals = array();
1691
1692 if (!is_array($a_activated_levels)) {
1693 $a_activated_levels = array($a_activated_levels);
1694 }
1695
1696 foreach ($a_levels as $level) {
1697 $vals[$level["title"]] = (in_array($level["id"], $a_activated_levels));
1698 }
1699 $scale_bar = $this->ui_fac->chart()->scaleBar($vals);
1700
1701 return $this->ui_ren->render($scale_bar);
1702 }
1703
1710 public function getEvalItem($a_levels, $a_level_entry)
1711 {
1712 $lng = $this->lng;
1713 $ilAccess = $this->access;
1714
1715 $tpl = new ilTemplate("tpl.skill_eval_item.html", true, true, "Services/Skill");
1716 $tpl->setVariable("SCALE_BAR", $this->getScaleBar($a_levels, $a_level_entry["level_id"]));
1717
1718 include_once("./Services/Skill/classes/class.ilSkillEval.php");
1720
1721 if ($a_level_entry["self_eval"] == 1) {
1723 }
1724
1725 if ($a_level_entry["trigger_obj_type"] == "tst") {
1727 }
1728
1730 $title = ($a_level_entry["trigger_obj_id"] > 0)
1731 ? $a_level_entry["trigger_title"]
1732 : "";
1733
1734 if ($a_level_entry["trigger_ref_id"] > 0
1735 && $ilAccess->checkAccess("read", "", $a_level_entry["trigger_ref_id"])) {
1736 include_once("./Services/Link/classes/class.ilLink.php");
1737 $title = "<a href='" . ilLink::_getLink($a_level_entry["trigger_ref_id"]) . "'>" . $title . "</a>";
1738 }
1739
1740 $tpl->setVariable("TYPE", $lng->txt("skmg_eval_type_" . $type));
1741 if ($type > 0) {
1742 $tpl->touchBlock("st" . $type);
1743 $tpl->touchBlock("stb" . $type);
1744 }
1745 $tpl->setVariable("TITLE", $title);
1746 $tpl->setVariable(
1747 "DATE",
1748 ilDatePresentation::formatDate(new ilDate($a_level_entry["status_date"], IL_CAL_DATETIME))
1749 );
1750
1752
1753 return $tpl->get();
1754 }
1755
1764 protected function getSkillCategoryDescription(int $skill_id, int $tref_id) : string
1765 {
1766 $tpl = new ilTemplate("tpl.skill_description_category.html", true, true, "Services/Skill");
1767
1768 //if (ilSkillTreeNode::_lookupType($skill_id) == "scat") {
1769 $des = ilSkillTreeNode::_lookupDescription($skill_id);
1770 if (!is_null($des) && !empty($des)) {
1771 $tpl->setCurrentBlock("description_category");
1772 $tpl->setVariable("DESCRIPTION_CATEGORY", $des);
1773 $tpl->parseCurrentBlock();
1774 }
1775 //}
1776
1777 return $tpl->get();
1778 }
1779
1787 protected function getBasicSkillDescription(string $description) : string
1788 {
1789 $tpl = new ilTemplate("tpl.skill_description_basic.html", true, true, "Services/Skill");
1790
1791 if (!is_null($description) && !empty($description)) {
1792 $tpl->setCurrentBlock("description_basic");
1793 $tpl->setVariable("DESCRIPTION_BASIC", $description);
1794 $tpl->parseCurrentBlock();
1795 }
1796
1797 return $tpl->get();
1798 }
1799
1806 public function getSkillLevelDescription($skill)
1807 {
1808 $level_data = $skill->getLevelData();
1809 $tpl = new ilTemplate("tpl.skill_desc.html", true, true, "Services/Skill");
1810
1811 $desc_exists = false;
1812 foreach ($level_data as $l) {
1813 if ($l["description"] != "") {
1814 $desc_exists = true;
1815 }
1816 }
1817 reset($level_data);
1818 if ($desc_exists) {
1819 foreach ($level_data as $l) {
1820 $tpl->setCurrentBlock("level");
1821 $tpl->setVariable("LEVEL_VAL", $l["title"]);
1822 $tpl->setVariable("LEVEL_DESC", nl2br($l["description"]));
1823 $tpl->parseCurrentBlock();
1824 }
1825 }
1826
1827 return $tpl->get();
1828 }
1829
1836 public function getSuggestedResources($a_profile_id, $a_levels, $a_base_skill, $a_tref_id)
1837 {
1838 $lng = $this->lng;
1839
1840 $tpl = new ilTemplate("tpl.suggested_resources.html", true, true, "Services/Skill");
1841
1842 // use a profile
1843 if ($a_profile_id > 0) {
1844 $too_low = true;
1845 $current_target_level = 0;
1846
1847 foreach ($a_levels as $k => $v) {
1848 foreach ($this->profile_levels as $pl) {
1849 if ($pl["level_id"] == $v["id"] &&
1850 $pl["base_skill_id"] == $v["skill_id"]) {
1851 $too_low = true;
1852 $current_target_level = $v["id"];
1853 }
1854 }
1855
1856 if ($this->actual_levels[$v["skill_id"]][$a_tref_id] == $v["id"]) {
1857 $too_low = false;
1858 }
1859 }
1860
1861 // suggested resources
1862 if ($too_low) {
1863 include_once("./Services/Skill/classes/class.ilSkillResources.php");
1864 $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
1865 $res = $skill_res->getResources();
1866 $imp_resources = array();
1867 foreach ($res as $level) {
1868 foreach ($level as $r) {
1869 if ($r["imparting"] == true &&
1870 $current_target_level == $r["level_id"]) {
1871 $imp_resources[] = $r;
1872 }
1873 }
1874 }
1875 foreach ($imp_resources as $r) {
1876 $ref_id = $r["rep_ref_id"];
1879 include_once("./Services/Link/classes/class.ilLink.php");
1880 $tpl->setCurrentBlock("resource_item");
1881 $tpl->setVariable("TXT_RES", $title);
1882 $tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
1883 $tpl->parseCurrentBlock();
1884 }
1885 if (count($imp_resources) > 0) {
1886 $tpl->touchBlock("resources_list");
1887 $tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_res"));
1888 return $tpl->get();
1889 } else {
1890 $tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_no_res"));
1891 return $tpl->get();
1892 }
1893 } else {
1894 $tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_no_needs_impr"));
1895 return $tpl->get();
1896 }
1897 } else {
1898 // no profile, just list all resources
1899 include_once("./Services/Skill/classes/class.ilSkillResources.php");
1900 $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
1901 $res = $skill_res->getResources();
1902 // add $r["level_id"] info
1903 $any = false;
1904 foreach ($res as $level) {
1905 $available = false;
1906 $cl = 0;
1907 foreach ($level as $r) {
1908 if ($r["imparting"]) {
1909 $ref_id = $r["rep_ref_id"];
1912 include_once("./Services/Link/classes/class.ilLink.php");
1913 $tpl->setCurrentBlock("resource_item");
1914 $tpl->setVariable("TXT_RES", $title);
1915 $tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
1916 $tpl->parseCurrentBlock();
1917 $available = true;
1918 $any = true;
1919 $cl = $r["level_id"];
1920 }
1921 }
1922 if ($available) {
1923 $tpl->setCurrentBlock("resources_list_level");
1924 $tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level"));
1925 $tpl->setVariable("LEVEL_NAME", ilBasicSkill::lookupLevelTitle($cl));
1926 $tpl->parseCurrentBlock();
1927 $tpl->touchBlock("resources_list");
1928 }
1929 }
1930 if ($any) {
1931 $tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_suggested_resources"));
1932 return $tpl->get();
1933 }
1934 }
1935 return "";
1936 }
1937
1944 public function listAssignedProfile()
1945 {
1947
1948 $main_tpl = $this->tpl;
1949
1950 $tpl = new ilTemplate("tpl.skill_filter.html", true, true, "Services/Skill");
1951
1952 $this->setTabs("profile");
1953
1954 $this->determineCurrentProfile();
1956
1957 $filter_toolbar = new ilToolbarGUI();
1958 $filter_toolbar->setFormAction($ilCtrl->getFormAction($this));
1959 $this->getFilter()->addToToolbar($filter_toolbar, true);
1960
1961 $skills = array();
1962 if ($this->getProfileId() > 0) {
1963 $profile = new ilSkillProfile($this->getProfileId());
1964 $this->profile_levels = $profile->getSkillLevels();
1965
1966 foreach ($this->profile_levels as $l) {
1967 $skills[] = array(
1968 "base_skill_id" => $l["base_skill_id"],
1969 "tref_id" => $l["tref_id"],
1970 "level_id" => $l["level_id"]
1971 );
1972 }
1973 }
1974
1975 $this->getActualLevels($skills, $this->user->getId());
1976
1977 // render
1978 $html = "";
1979 foreach ($skills as $s) {
1980 // todo draft check
1981 $html .= $this->getSkillHTML($s["base_skill_id"], 0, true, $s["tref_id"]);
1982 }
1983
1984 if ($html != "") {
1985 $filter_toolbar->addFormButton($this->lng->txt("skmg_refresh_view"), "applyFilterAssignedProfiles");
1986
1987 $tpl->setVariable("FILTER", $filter_toolbar->getHTML());
1988
1989 $html = $tpl->get() . $html;
1990 }
1991
1992 $main_tpl->setContent($html);
1993 }
1994}
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
static hasSelfEvaluated($a_user_id, $a_skill_id, $a_tref_id)
Has use self evaluated a skill?
static lookupLevelTitle($a_id)
Lookup level title.
const TYPE_SPIDER
static getInstanceByType($a_type, $a_id)
Get type instance.
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
Class for single dates.
Class ilObjFile.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstance()
Get instance.
const PANEL_STYLE_PRIMARY
Explorer for selecting a personal skill.
static getAssignedMaterial($a_user_id, $a_tref_id, $a_level)
Get assigned material (for a skill level and user)
static removeMaterial($a_user_id, $a_tref_id, $a_level_id, $a_wsp_id)
Remove material.
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
static getSelfEvaluationDate($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill)
Get self evaluation.
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
static assignMaterial($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level, $a_wsp_id)
Assign material to skill level.
static removeSkill($a_user_id, $a_skill_node_id)
Remove personal skill.
static countAssignedMaterial($a_user_id, $a_tref_id, $a_level)
Get assigned material (for a skill level and user)
static saveSelfEvaluation($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level)
Save self evaluation.
Personal skills GUI class.
assignMaterials()
Assign materials to skill levels.
setTriggerObjectsFilter($trigger_objects_filter)
getScaleBar($a_levels, $a_activated_levels)
Get scale bar.
setHistoryView($a_val)
Set history view.
hideSkill($a_skill_id, $a_tref_id=0)
Hide skill.
getBasicSkillDescription(string $description)
Get description for basic skill.
selfEvaluation()
Assign materials to skill levels.
setObjectSkills($a_obj_id, $a_skills=null)
Set object skills.
setIntroText($a_val)
Set intro text.
getSkillCategoryDescription(int $skill_id, int $tref_id)
Get description for skill category.
confirmSkillRemove()
Confirm skill remove.
getMaterialInfo($a_wsp_id, $a_user_id)
Get material file name and goto url.
getActualLevels($skills, $user_id)
Get actual levels.
getGapAnalysisSelfEvalLevels()
Get self evaluation levels for gap analysis.
applyFilterAssignedProfiles()
Apply filter for profiles view.
getActualGapItem($a_levels, $a_tref_id=0)
assignMaterial()
Assign materials to skill level.
renderSkillHTML($a_top_skill_id, $a_user_id=0, $a_edit=false, $a_tref_id=0)
Render skill html.
setGapAnalysisSelfEvalLevels(array $a_val)
Set self evaluation levels for gap analysis.
getSkillLevelDescription($skill)
Get level description.
setTabs($a_activate)
Set tabs.
getProfileTargetItem($a_profile_id, $a_levels, $a_tref_id=0)
Get profile target item.
showProfileSelectorToolbar()
Show profile selector toolbar.
getSelfEvalGapItem($a_levels, $a_tref_id=0)
getSkillHTML($a_top_skill_id, $a_user_id=0, $a_edit=false, $a_tref_id=0)
Get skill presentation HTML.
addSkill()
Add personal skill.
determineCurrentProfile()
Determine current profile id.
getGapAnalysisHTML($a_user_id=0, $a_skills=null)
Get gap analysis html.
getSuggestedResources($a_profile_id, $a_levels, $a_base_skill, $a_tref_id)
Render suggested resources.
setGapAnalysisActualStatusModePerObject($a_obj_id, $a_cat_title="")
Set gap analysis actual status mode "per object".
saveSelfEvaluation()
Save self evaluation.
getMaterials($a_levels, $a_tref_id=0, $a_user_id=0)
Get materials.
setGapAnalysisActualStatusModePerType($a_type, $a_cat_title="")
Set gap analysis actual status mode "per type".
getHistoryView()
Get history view.
listSkillsForAdd()
LIst skills for adding.
setProfileId($a_val)
Set profile id.
getEvalItem($a_levels, $a_level_entry)
Get eval item.
This class represents a selection list property in a property form.
Self evaluation, second simplier implementation.
Assign materials to skill levels table.
static getProfilesOfUser($a_user_id)
Get profiles of a user.
Manages resources for skills.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static _lookupDescription($a_obj_id)
Lookup Description.
static _lookupType($a_obj_id)
Lookup Type.
special template class to simplify handling of ITX/PEAR
Class ilUIHookProcessor.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Access handler for personal workspace.
Explorer for selecting a personal workspace item.
Tree handler for personal workspace.
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
$i
Definition: metadata.php:24
global $ilSetting
Definition: privfeed.php:17
$type
$url
foreach($_POST as $key=> $value) $res
$ilUser
Definition: imgupload.php:18
ui()
Definition: ui.php:5
$a_type
Definition: workflow.php:92
$message
Definition: xapiexit.php:14
$DIC
Definition: xapitoken.php:46