ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
5 include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
6 include_once("./Services/Skill/classes/class.ilSkillProfile.php");
7 
19 {
20  protected $offline_mode;
21  protected $skill_tree;
22  static $skill_tt_cnt = 1;
23  protected $actual_levels = array();
25  protected $mode = "";
26  protected $history_view = false;
27  protected $intro_text = "";
28  protected $hidden_skills = array();
29 
35  public function __construct()
36  {
37  global $ilCtrl, $lng, $ilHelp, $ilSetting;
38 
39  $lng->loadLanguageModule('skmg');
40 
41  $ilHelp->setScreenIdComponent("skill");
42 
43  $ilCtrl->saveParameter($this, "skill_id");
44  $ilCtrl->saveParameter($this, "tref_id");
45  $ilCtrl->saveParameter($this, "profile_id");
46 
47  include_once("./Services/Skill/classes/class.ilSkillTree.php");
48  $this->skill_tree = new ilSkillTree();
49 
50  $this->use_materials = !$ilSetting->get("disable_personal_workspace");
51  }
52 
58  function setProfileId($a_val)
59  {
60  $this->profile_id = $a_val;
61  }
62 
68  function getProfileId()
69  {
70  return $this->profile_id;
71  }
72 
79  {
80  $this->gap_self_eval_levels = $a_val;
81  }
82 
89  {
91  }
92 
98  function setHistoryView($a_val)
99  {
100  $this->history_view = $a_val;
101  }
102 
108  function getHistoryView()
109  {
110  return $this->history_view;
111  }
112 
118  function setIntroText($a_val)
119  {
120  $this->intro_text = $a_val;
121  }
122 
128  function getIntroText()
129  {
130  return $this->intro_text;
131  }
132 
139  function hideSkill($a_skill_id, $a_tref_id = 0)
140  {
141  $this->hidden_skills[] = $a_skill_id.":".$a_tref_id;
142  }
143 
144 
151  public function executeCommand()
152  {
153  global $ilCtrl, $tpl, $lng, $ilUser;
154 
155  $next_class = $ilCtrl->getNextClass($this);
156 
157  $profiles = ilSkillProfile::getProfilesOfUser($ilUser->getId());
158 
159  // determin standard command
160  $std_cmd = "listSkills";
161  if (count($profiles) > 0)
162  {
163 // $std_cmd = "listProfiles";
164  }
165 
166  $cmd = $ilCtrl->getCmd($std_cmd);
167 
168  $tpl->setTitle($lng->txt("skills"));
169  $tpl->setTitleIcon(ilUtil::getImagePath("icon_skmg.svg"));
170 
171  switch($next_class)
172  {
173  default:
174  $this->$cmd();
175  break;
176  }
177  return true;
178  }
179 
183  function setTabs($a_activate)
184  {
185  global $ilTabs, $lng, $ilCtrl;
186 
187  // list skills
188  $ilTabs->addTab("list_skills",
189  $lng->txt("skmg_list_skills"),
190  $ilCtrl->getLinkTarget($this, "listSkills"));
191 
192  // assign materials
193 /* $ilTabs->addTab("assign_materials",
194  $lng->txt("skmg_assign_materials"),
195  $ilCtrl->getLinkTarget($this, "assignMaterials"));*/
196 
197  $ilTabs->activateTab($a_activate);
198  }
199 
200  function setOfflineMode($a_file_path)
201  {
202  $this->offline_mode = $a_file_path;
203  }
204 
208  function listSkills()
209  {
210  global $tpl, $ilTabs, $lng, $ilCtrl, $ilToolbar, $ilUser;
211 
212  $this->setTabs("list_skills");
213 
214  include_once("./Services/Skill/classes/class.ilSkillTree.php");
215  $stree = new ilSkillTree();
216 
217  // skill selection / add new personal skill
218  $ilToolbar->addFormButton($lng->txt("skmg_add_skill"),
219  "listSkillsForAdd");
220  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
221 
222  $skills = ilPersonalSkill::getSelectedUserSkills($ilUser->getId());
223  $html = "";
224  foreach ($skills as $s)
225  {
226  $path = $stree->getSkillTreePath($s["skill_node_id"]);
227 
228  // check draft
229  foreach ($path as $p)
230  {
231  if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT)
232  {
233  continue(2);
234  }
235  }
236  $html.= $this->getSkillHTML($s["skill_node_id"], 0, true);
237  }
238 
239  // list skills
240 // include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
241 // $sktab = new ilPersonalSkillTableGUI($this, "listSkills");
242 
243  $tpl->setContent($html);
244 
245  }
246 
255  function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false, $a_tref_id = 0)
256  {
257  // user interface plugin slot + default rendering
258  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
259  $uip = new ilUIHookProcessor("Services/Skill", "personal_skill_html",
260  array("personal_skills_gui" => $this, "top_skill_id" => $a_top_skill_id, "user_id" => $a_user_id,
261  "edit" => $a_edit, "tref_id" => $a_tref_id));
262  if (!$uip->replaced())
263  {
264  $skill_html = $this->renderSkillHTML($a_top_skill_id, $a_user_id, $a_edit, $a_tref_id);
265  }
266  $skill_html = $uip->getHTML($skill_html);
267 
268  return $skill_html;
269  }
270 
277  function renderSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false, $a_tref_id = 0)
278  {
279  global $ilUser, $lng, $ilCtrl, $ilSetting;
280 
281 //echo "<br>".$a_top_skill_id.":".$a_tref_id;
282  $this->tooltips = array();
283 
284  if ($a_user_id == 0)
285  {
286  $user = $ilUser;
287  }
288  else
289  {
290  $user = new ilObjUser($a_user_id);
291  }
292 
293  $tpl = new ilTemplate("tpl.skill_pres.html", true, true, "Services/Skill");
294 
295  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
296 
297  include_once("./Services/Skill/classes/class.ilSkillTree.php");
298  $stree = new ilSkillTree();
299 
300  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
301  include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
302 
303  // general settings for the action drop down
304  include_once("Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
305  $act_list = new ilAdvancedSelectionListGUI();
306  $act_list->setListTitle($lng->txt("actions"));
307  $act_list->setSelectionHeaderClass("small");
308 // $act_list->setLinksMode("il_ContainerItemCommand2");
309  $act_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
310  $act_list->setUseImages(false);
311 
312  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
313  $vtree = new ilVirtualSkillTree();
314  $tref_id = $a_tref_id;
315  $skill_id = $a_top_skill_id;
316  if (ilSkillTreeNode::_lookupType($a_top_skill_id) == "sktr")
317  {
318  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
319  $tref_id = $a_top_skill_id;
320  $skill_id = ilSkillTemplateReference::_lookupTemplateId($a_top_skill_id);
321  }
322  $b_skills = $vtree->getSubTreeForCSkillId($skill_id.":".$tref_id, true);
323 //if ($a_tref_id > 0) $a_top_skill_id = $a_tref_id;
324  foreach ($b_skills as $bs)
325  {
326 $bs["id"] = $bs["skill_id"];
327 $bs["tref"] = $bs["tref_id"];
328 //var_dump($bs); exit;
329  $path = $stree->getSkillTreePath($bs["id"], $bs["tref"]);
330 
331  // check draft
332  foreach ($path as $p)
333  {
334  if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT)
335  {
336  continue(2);
337  }
338  }
339  reset($path);
340 
341  $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]);
342  $level_data = $skill->getLevelData();
343 
344  if ($this->getProfileId() > 0)
345  {
346  $this->renderProfileTargetRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
347  }
348  if ($this->mode != "gap")
349  {
350  $this->renderMaterialsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
351  }
352 
353  if ($this->mode == "gap" && !$this->history_view)
354  {
355  $this->renderActualLevelsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
356  $this->renderGapSelfEvalRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
357  }
358  else
359  {
360  // get date of self evaluation
361  $se_date = ilPersonalSkill::getSelfEvaluationDate($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]);
362  $se_rendered = ($se_date == "")
363  ? true
364  : false;
365 
366  // get all object triggered entries and render them
367  foreach ($skill->getAllHistoricLevelEntriesOfUser($bs["tref"] , $user->getId(), ilBasicSkill::EVAL_BY_ALL) as $level_entry)
368  {
369  // render the self evaluation at the correct position within the list of object triggered entries
370  if ($se_date > $level_entry["status_date"] && !$se_rendered)
371  {
372  $se_rendered = true;
373  }
374  $this->renderObjectEvalRow($tpl, $level_data, $level_entry);
375  }
376 
377  }
378  $this->renderSuggestedResources($tpl, $level_data, $bs["id"], $bs["tref"]);
379 
380  $too_low = true;
381  $current_target_level = 0;
382 
383  foreach ($level_data as $k => $v)
384  {
385  // level
386  $tpl->setCurrentBlock("level_td");
387  $tpl->setVariable("VAL_LEVEL", $v["title"]);
388  $tt_id = "skmg_skl_tt_".self::$skill_tt_cnt;
389  self::$skill_tt_cnt++;
390  $tpl->setVariable("TT_ID", $tt_id);
391  if ($v["description"] != "")
392  {
393  ilTooltipGUI::addTooltip($tt_id, $v["description"]);
394  }
395  $tpl->parseCurrentBlock();
396  }
397 
398 
399  $title = $sep = "";
400  $found = false;
401  foreach ($path as $p)
402  {
403  if ($found)
404  {
405  $title.= $sep.$p["title"];
406  $sep = " > ";
407  }
408  if ($a_top_skill_id == $p["child"])
409  {
410  $found = true;
411  }
412  }
413 
414  $tpl->setCurrentBlock("skill");
415  $tpl->setVariable("BSKILL_TITLE", $title);
416 /* $tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level"));
417  $tpl->setVariable("TXT_SELF_EVAL", $lng->txt("skmg_self_evaluation"));
418  if ($this->use_materials)
419  {
420  $tpl->setVariable("TXT_MATERIAL", $lng->txt("skmg_material"));
421  }*/
422  $tpl->setVariable("TXT_TARGET", $lng->txt("skmg_target_level"));
423  $tpl->setVariable("TXT_360_SURVEY", $lng->txt("skmg_360_survey"));
424 
425  if ($a_edit)
426  {
427  $act_list->flush();
428  $act_list->setId("act_".$a_top_skill_id."_".$bs["id"]);
429  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id);
430  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "tref_id", $bs["tref"]);
431  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "basic_skill_id", $bs["id"]);
432  if ($this->use_materials)
433  {
434  $act_list->addItem($lng->txt('skmg_assign_materials'), "",
435  $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials"));
436  }
437  $act_list->addItem($lng->txt('skmg_self_evaluation'), "",
438  $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "selfEvaluation"));
439  $tpl->setVariable("ACTIONS2", $act_list->getHTML());
440  }
441 
442  $tpl->parseCurrentBlock();
443 
444  }
445 
446  $tpl->setVariable("SKILL_TITLE", ilSkillTreeNode::_lookupTitle($skill_id, $tref_id));
447 
448  if ($a_edit)
449  {
450  $act_list->flush();
451  $act_list->setId("act_".$a_top_skill_id);
452  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id);
453 // $act_list->addItem($lng->txt('skmg_assign_materials'), "",
454 // $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials"));
455  $act_list->addItem($lng->txt('skmg_remove_skill'), "",
456  $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "confirmSkillRemove"));
457  $tpl->setVariable("ACTIONS1", $act_list->getHTML());
458  }
459 
460 
461 
462  return $tpl->get();
463  }
464 
465  function getTooltipsJs()
466  {
467  return $this->tooltips;
468  }
469 
476  function getMaterialInfo($a_wsp_id, $a_user_id)
477  {
478  if(!$this->ws_tree)
479  {
480  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
481  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
482  $this->ws_tree = new ilWorkspaceTree($a_user_id);
483  $this->ws_access = new ilWorkspaceAccessHandler($caption);
484  }
485 
486  $obj_id = $this->ws_tree->lookupObjectId($a_wsp_id);
487  $caption = ilObject::_lookupTitle($obj_id);
488 
489  if(!$this->offline_mode)
490  {
491  $url = $this->ws_access->getGotoLink($a_wsp_id, $obj_id);
492  }
493  else
494  {
495  $url = $this->offline_mode."file_".$obj_id."/";
496 
497  // all possible material types for now
498  switch(ilObject::_lookupType($obj_id))
499  {
500  case "tstv":
501  include_once "Modules/Test/classes/class.ilObjTestVerification.php";
502  $obj = new ilObjTestVerification($obj_id, false);
503  $url .= $obj->getOfflineFilename();
504  break;
505 
506  case "excv":
507  include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
508  $obj = new ilObjExerciseVerification($obj_id, false);
509  $url .= $obj->getOfflineFilename();
510  break;
511 
512  case "crsv":
513  include_once "Modules/Course/classes/Verification/class.ilObjCourseVerification.php";
514  $obj = new ilObjCourseVerification($obj_id, false);
515  $url .= $obj->getOfflineFilename();
516  break;
517 
518  case "scov":
519  include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
520  $obj = new ilObjSCORMVerification($obj_id, false);
521  $url .= $obj->getOfflineFilename();
522  break;
523 
524  case "file":
525  $file = new ilObjFile($obj_id, false);
526  $url .= $file->getFilename();
527  break;
528  }
529  }
530 
531  return array($caption, $url);
532  }
533 
537  function addSkill()
538  {
539  global $ilUser, $ilCtrl, $lng;
540 
541  ilPersonalSkill::addPersonalSkill($ilUser->getId(), (int) $_GET["obj_id"]);
542 
543  ilUtil::sendSuccess($lng->txt("msg_object_modified"));
544  $ilCtrl->redirect($this, "listSkills");
545  }
546 
547 
548 
553  {
554  global $ilCtrl, $tpl, $lng;
555 
556  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
557  if ($_GET["skill_id"] > 0)
558  {
559  $_POST["id"][] = $_GET["skill_id"];
560  }
561  if (!is_array($_POST["id"]) || count($_POST["id"]) == 0)
562  {
563  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
564  $ilCtrl->redirect($this, "listSkills");
565  }
566  else
567  {
568  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
569  $cgui = new ilConfirmationGUI();
570  $cgui->setFormAction($ilCtrl->getFormAction($this));
571  $cgui->setHeaderText($lng->txt("skmg_really_remove_skills"));
572  $cgui->setCancel($lng->txt("cancel"), "listSkills");
573  $cgui->setConfirm($lng->txt("delete"), "removeSkills");
574 
575  foreach ($_POST["id"] as $i)
576  {
577  $cgui->addItem("id[]", $i, ilSkillTreeNode::_lookupTitle($i));
578  }
579 
580  $tpl->setContent($cgui->getHTML());
581  }
582  }
583 
587  function removeSkills()
588  {
589  global $ilUser, $lng, $ilCtrl;
590 
591  if (is_array($_POST["id"]))
592  {
593  foreach ($_POST["id"] as $n_id)
594  {
595  ilPersonalSkill::removeSkill($ilUser->getId(), $n_id);
596  }
597  }
598 
599  ilUtil::sendSuccess($lng->txt("msg_object_modified"));
600  $ilCtrl->redirect($this, "listSkills");
601  }
602 
603 
604  //
605  // Materials assignments
606  //
607 
614  function assignMaterials()
615  {
616  global $ilTabs, $lng, $ilCtrl, $tpl, $ilToolbar;
617 
618  $ilTabs->setBackTarget($lng->txt("back"),
619  $ilCtrl->getLinkTarget($this, "listSkills"));
620 
621  $ilCtrl->saveParameter($this, "skill_id");
622  $ilCtrl->saveParameter($this, "basic_skill_id");
623  $ilCtrl->saveParameter($this, "tref_id");
624 
625  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
626  $tpl->setTitle(ilSkillTreeNode::_lookupTitle((int) $_GET["skill_id"]));
627  $tpl->setTitleIcon(ilUtil::getImagePath("icon_".
628  ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]).
629  ".svg"));
630 
631  // basic skill selection
632  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
633  $vtree = new ilVirtualSkillTree();
634  $tref_id = 0;
635  $skill_id = (int) $_GET["skill_id"];
636  if (ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) == "sktr")
637  {
638  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
639  $tref_id = $_GET["skill_id"];
640  $skill_id = ilSkillTemplateReference::_lookupTemplateId($_GET["skill_id"]);
641  }
642  $bs = $vtree->getSubTreeForCSkillId($skill_id.":".$tref_id, true);
643 
644  $options = array();
645  foreach ($bs as $b)
646  {
647  //$options[$b["id"]] = ilSkillTreeNode::_lookupTitle($b["id"]);
648  $options[$b["skill_id"]] = ilSkillTreeNode::_lookupTitle($b["skill_id"]);
649  }
650 
651  $cur_basic_skill_id = ((int) $_POST["basic_skill_id"] > 0)
652  ? (int) $_POST["basic_skill_id"]
653  : (((int) $_GET["basic_skill_id"] > 0)
654  ? (int) $_GET["basic_skill_id"]
655  : key($options));
656 
657  $ilCtrl->setParameter($this, "basic_skill_id", $cur_basic_skill_id);
658 
659  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
660  $si = new ilSelectInputGUI($lng->txt("skmg_skill"), "basic_skill_id");
661  $si->setOptions($options);
662  $si->setValue($cur_basic_skill_id);
663  $ilToolbar->addInputItem($si, true);
664  $ilToolbar->addFormButton($lng->txt("select"),
665  "assignMaterials");
666 
667  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
668 
669  // table
670  include_once("./Services/Skill/classes/class.ilSkillAssignMaterialsTableGUI.php");
671  $tab = new ilSkillAssignMaterialsTableGUI($this, "assignMaterials",
672  (int) $_GET["skill_id"], (int) $_GET["tref_id"], $cur_basic_skill_id);
673 
674  $tpl->setContent($tab->getHTML());
675 
676  }
677 
678 
685  function assignMaterial()
686  {
687  global $tpl, $ilUser, $ilCtrl, $ilTabs, $lng, $ilSetting;
688 
689  if(!$ilSetting->get("disable_personal_workspace"))
690  {
691  ilUtil::sendInfo($lng->txt("skmg_ass_materials_from_workspace")." » <a href='ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace'>".$lng->txt("personal_workspace")."</a>");
692  }
693 
694  $ilCtrl->saveParameter($this, "skill_id");
695  $ilCtrl->saveParameter($this, "level_id");
696  $ilCtrl->saveParameter($this, "tref_id");
697  $ilCtrl->saveParameter($this, "basic_skill_id");
698 
699  $ilTabs->setBackTarget($lng->txt("back"),
700  $ilCtrl->getLinkTarget($this, "assignMaterials"));
701 
702  // get ws tree
703  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
704  $tree = new ilWorkspaceTree($ilUser->getId());
705 
706  // get access handler
707  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
708  $acc_handler = new ilWorkspaceAccessHandler($tree);
709 
710  // get es explorer
711  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorer.php");
713  'skill_wspexpand', $tree, $acc_handler);
714  $exp->setTargetGet('wsp_id');
715  $exp->setFiltered(false);
716  $exp->removeAllFormItemTypes();
717  $exp->addFormItemForType("file");
718  $exp->addFormItemForType("tstv");
719  $exp->addFormItemForType("excv");
720 
721  if($_GET['skill_wspexpand'] == '')
722  {
723  // not really used as session is already set [see above]
724  $expanded = $tree->readRootId();
725  }
726  else
727  {
728  $expanded = $_GET['skill_wspexpand'];
729  }
730  $exp->setCheckedItems(array((int)$_POST['wsp_id']));
731  $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'assignMaterial'));
732  $exp->setPostVar('wsp_id[]');
733  $exp->setExpand($expanded);
734  $exp->setOutput(0);
735 
736  // fill template
737  $mtpl = new ilTemplate("tpl.materials_selection.html", true, true, "Services/Skill");
738  $mtpl->setVariable("EXP", $exp->getOutput());
739 
740  // toolbars
741  $tb = new ilToolbarGUI();
742  $tb->addFormButton($lng->txt("select"),
743  "selectMaterial");
744  $tb->setFormAction($ilCtrl->getFormAction($this));
745  $tb->setOpenFormTag(true);
746  $tb->setCloseFormTag(false);
747  $mtpl->setVariable("TOOLBAR1", $tb->getHTML());
748  $tb->setOpenFormTag(false);
749  $tb->setCloseFormTag(true);
750  $mtpl->setVariable("TOOLBAR2", $tb->getHTML());
751 
752  $tpl->setContent($mtpl->get());
753  }
754 
758  function selectMaterial()
759  {
760  global $ilUser, $ilCtrl, $lng;
761 
762  include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
763  if (is_array($_POST["wsp_id"]))
764  {
765  foreach ($_POST["wsp_id"] as $w)
766  {
767  ilPersonalSkill::assignMaterial($ilUser->getId(), (int) $_GET["skill_id"],
768  (int) $_GET["tref_id"],
769  (int) $_GET["basic_skill_id"], (int) $_GET["level_id"], (int) $w);
770  }
771  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
772  }
773 
774  $ilCtrl->saveParameter($this, "skill_id");
775  $ilCtrl->saveParameter($this, "level_id");
776  $ilCtrl->saveParameter($this, "tref_id");
777  $ilCtrl->saveParameter($this, "basic_skill_id");
778 
779  $ilCtrl->redirect($this, "assignMaterials");
780  }
781 
782 
786  function removeMaterial()
787  {
788  global $ilUser, $lng, $ilCtrl;
789 
790  ilPersonalSkill::removeMaterial($ilUser->getId(), (int) $_GET["tref_id"],
791  (int) $_GET["level_id"],
792  (int) $_GET["wsp_id"]);
793  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
794  $ilCtrl->redirect($this, "assignMaterials");
795  }
796 
797 
798  //
799  // Self evaluation
800  //
801 
808  function selfEvaluation()
809  {
810  global $ilTabs, $lng, $ilCtrl, $tpl, $ilToolbar;
811 
812  $ilTabs->setBackTarget($lng->txt("back"),
813  $ilCtrl->getLinkTarget($this, "listSkills"));
814 
815  $ilCtrl->saveParameter($this, "skill_id");
816  $ilCtrl->saveParameter($this, "basic_skill_id");
817  $ilCtrl->saveParameter($this, "tref_id");
818 
819  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
820  $tpl->setTitle(ilSkillTreeNode::_lookupTitle((int) $_GET["skill_id"]));
821  $tpl->setTitleIcon(ilUtil::getImagePath("icon_".
822  ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]).
823  ".svg"));
824 
825  // basic skill selection
826  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
827  $vtree = new ilVirtualSkillTree();
828  $tref_id = 0;
829  $skill_id = (int) $_GET["skill_id"];
830  if (ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) == "sktr")
831  {
832  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
833  $tref_id = $_GET["skill_id"];
834  $skill_id = ilSkillTemplateReference::_lookupTemplateId($_GET["skill_id"]);
835  }
836  $bs = $vtree->getSubTreeForCSkillId($skill_id.":".$tref_id, true);
837 
838 
839  $options = array();
840  foreach ($bs as $b)
841  {
842  $options[$b["skill_id"]] = ilSkillTreeNode::_lookupTitle($b["skill_id"]);
843  }
844 
845  $cur_basic_skill_id = ((int) $_POST["basic_skill_id"] > 0)
846  ? (int) $_POST["basic_skill_id"]
847  : (((int) $_GET["basic_skill_id"] > 0)
848  ? (int) $_GET["basic_skill_id"]
849  : key($options));
850 
851  $ilCtrl->setParameter($this, "basic_skill_id", $cur_basic_skill_id);
852 
853  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
854  $si = new ilSelectInputGUI($lng->txt("skmg_skill"), "basic_skill_id");
855  $si->setOptions($options);
856  $si->setValue($cur_basic_skill_id);
857  $ilToolbar->addInputItem($si, true);
858  $ilToolbar->addFormButton($lng->txt("select"),
859  "selfEvaluation");
860 
861  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
862 
863  // table
864  include_once("./Services/Skill/classes/class.ilSelfEvaluationSimpleTableGUI.php");
865  $tab = new ilSelfEvaluationSimpleTableGUI($this, "selfEvaluation",
866  (int) $_GET["skill_id"], (int) $_GET["tref_id"], $cur_basic_skill_id);
867 
868  $tpl->setContent($tab->getHTML());
869 
870  }
871 
876  {
877  global $ilUser, $lng, $ilCtrl;
878 
879  ilPersonalSkill::saveSelfEvaluation($ilUser->getId(), (int) $_GET["skill_id"],
880  (int) $_GET["tref_id"], (int) $_GET["basic_skill_id"], (int) $_POST["se"]);
881  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
882 
883 /* $ilCtrl->saveParameter($this, "skill_id");
884  $ilCtrl->saveParameter($this, "level_id");
885  $ilCtrl->saveParameter($this, "tref_id");
886  $ilCtrl->saveParameter($this, "basic_skill_id");*/
887 
888  $ilCtrl->redirect($this, "listSkills");
889 
890  }
891 
898  function listSkillsForAdd()
899  {
900  global $ilUser, $tpl, $ilCtrl, $lng, $ilTabs;
901 
902  $ilTabs->setBackTarget($lng->txt("back"),
903  $ilCtrl->getLinkTarget($this, ""));
904 
905  include_once("./Services/Skill/classes/class.ilPersonalSkillExplorerGUI.php");
906  $exp = new ilPersonalSkillExplorerGUI($this, "listSkillsForAdd", $this, "addSkill");
907  if ($exp->getHasSelectableNodes())
908  {
909  if (!$exp->handleCommand())
910  {
911  $tpl->setContent($exp->getHTML());
912  }
913  ilUtil::sendInfo($lng->txt("skmg_select_skill"));
914  }
915  else
916  {
917  ilUtil::sendInfo($lng->txt("skmg_no_nodes_selectable"));
918  }
919  }
920 
927  function listProfiles()
928  {
929  global $ilCtrl, $ilToolbar, $ilUser, $lng, $tpl;
930 
931  $profiles = ilSkillProfile::getProfilesOfUser($ilUser->getId());
932 
933  if (count($profiles) == 0)
934  {
935  return;
936  }
937 
938  // select profiles
939  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
940  $options = array();
941  foreach ($profiles as $p)
942  {
943  $options[$p["id"]] = $p["title"];
944  }
945 
946  if (!isset($options[$_GET["profile_id"]]))
947  {
948  $_GET["profile_id"] = (int) key($options);
949  $ilCtrl->setParameter($this, "profile_id", $_GET["profile_id"]);
950  }
951  $current_profile_id = $_GET["profile_id"];
952 
953  $si = new ilSelectInputGUI($lng->txt("skmg_profile"), "");
954  $si->setOptions($options);
955  $si->setValue($current_profile_id);
956  $ilToolbar->addInputItem($si, true);
957  $ilToolbar->addFormButton($lng->txt("select"),
958  "selectProfile");
959  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
960 
961  $this->setProfileId($current_profile_id);
962 
963  $tpl->setContent($this->getGapAnalysisHTML());
964  }
965 
971  function setGapAnalysisActualStatusModePerType($a_type, $a_cat_title = "")
972  {
973  $this->gap_mode = "max_per_type";
974  $this->gap_mode_type = $a_type;
975  $this->gap_cat_title = $a_cat_title;
976  $this->mode = "gap";
977  }
978 
984  function setGapAnalysisActualStatusModePerObject($a_obj_id, $a_cat_title = "")
985  {
986  $this->gap_mode = "max_per_object";
987  $this->gap_mode_obj_id = $a_obj_id;
988  $this->gap_cat_title = $a_cat_title;
989  $this->mode = "gap";
990  }
991 
998  function getGapAnalysisHTML($a_user_id = 0, $a_skills = null)
999  {
1000  global $ilUser, $lng;
1001 
1002  include_once("./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
1003 
1004  if ($this->getIntroText() != "")
1005  {
1006  $pan = ilPanelGUI::getInstance();
1007  $pan->setPanelStyle(ilPanelGUI::PANEL_STYLE_PRIMARY);
1008  $pan->setBody($this->getIntroText());
1009  $intro_html = $pan->getHTML();
1010  }
1011 
1012 // $this->setTabs("list_skills");
1013 
1014  if ($a_user_id == 0)
1015  {
1016  $user_id = $ilUser->getId();
1017  }
1018  else
1019  {
1020  $user_id = $a_user_id;
1021  }
1022 
1023  $skills = array();
1024  if ($this->getProfileId() > 0)
1025  {
1026  $profile = new ilSkillProfile($this->getProfileId());
1027  $this->profile_levels = $profile->getSkillLevels();
1028 
1029  foreach ($this->profile_levels as $l)
1030  {
1031  $skills[] = array(
1032  "base_skill_id" => $l["base_skill_id"],
1033  "tref_id" => $l["tref_id"],
1034  "level_id" => $l["level_id"]
1035  );
1036  }
1037  }
1038  else if (is_array($a_skills))
1039  {
1040  $skills = $a_skills;
1041  }
1042 
1043  // get actual levels for gap analysis
1044  $this->actual_levels = array();
1045  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
1046  foreach ($skills as $sk)
1047  {
1048  $bs = new ilBasicSkill($sk["base_skill_id"]);
1049  if ($this->gap_mode == "max_per_type")
1050  {
1051  $max = $bs->getMaxLevelPerType($sk["tref_id"], $this->gap_mode_type, $user_id);
1052  $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
1053  }
1054  else if ($this->gap_mode == "max_per_object")
1055  {
1056  $max = $bs->getMaxLevelPerObject($sk["tref_id"], $this->gap_mode_obj_id, $user_id);
1057  $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
1058  }
1059  }
1060 
1061  $incl_self_eval = false;
1062  if (count($this->getGapAnalysisSelfEvalLevels() > 0))
1063  {
1064  $incl_self_eval = true;
1065  $self_vals = $this->getGapAnalysisSelfEvalLevels();
1066  }
1067 
1068  // output spider stuff
1069  $all_chart_html = "";
1070 
1071  // determine skills that should be shown in the spider web
1072  $sw_skills = array();
1073  foreach ($skills as $sk)
1074  {
1075  if (!in_array($sk["base_skill_id"].":".$sk["tref_id"], $this->hidden_skills))
1076  {
1077  $sw_skills[] = $sk;
1078  }
1079  }
1080 
1081  if (count($sw_skills) >= 3)
1082  {
1083  $skill_packages = array();
1084 
1085  if (count($sw_skills) < 8)
1086  {
1087  $skill_packages[1] = $sw_skills;
1088  }
1089  else
1090  {
1091  $mod = count($sw_skills) % 7;
1092  $pkg_num = floor((count($sw_skills) - 1) / 7) + 1;
1093  $cpkg = 1;
1094  foreach ($sw_skills as $k => $s)
1095  {
1096  $skill_packages[$cpkg][$k] = $s;
1097  if ($mod < 3 && count($skill_packages) == ($pkg_num - 1) && count($skill_packages[$cpkg]) == 3+$mod)
1098  {
1099  $cpkg+=1;
1100  }
1101  else if (count($skill_packages[$cpkg]) == 7)
1102  {
1103  $cpkg+=1;
1104  }
1105  }
1106  }
1107 
1108  $pkg_cnt = 0;
1109  foreach ($skill_packages as $pskills)
1110  {
1111  $pkg_cnt++;
1112  $max_cnt = 0;
1113  $leg_labels = array();
1114  //var_dump($this->profile_levels);
1115  //foreach ($this->profile_levels as $k => $l)
1116 
1117  // write target, actual and self counter to skill array
1118  foreach ($pskills as $k => $l)
1119  {
1120  //$bs = new ilBasicSkill($l["base_skill_id"]);
1121  $bs = new ilBasicSkill($l["base_skill_id"]);
1122  $leg_labels[] = ilBasicSkill::_lookupTitle($l["base_skill_id"] , $l["tref_id"]);
1123  $levels = $bs->getLevelData();
1124  $cnt = 0;
1125  foreach ($levels as $lv)
1126  {
1127  $cnt++;
1128  if ($l["level_id"] == $lv["id"])
1129  {
1130  $pskills[$k]["target_cnt"] = $cnt;
1131  }
1132  if ($this->actual_levels[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"])
1133  {
1134  $pskills[$k]["actual_cnt"] = $cnt;
1135  }
1136  if ($incl_self_eval)
1137  {
1138  if ($self_vals[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"])
1139  {
1140  $pskills[$k]["self_cnt"] = $cnt;
1141  }
1142  }
1143  $max_cnt = max($max_cnt, $cnt);
1144  }
1145  }
1146 
1147  // $leg_labels = array("AAAAA", "BBBBB", "CCCCC");
1148 
1149  //var_dump($this->profile_levels);
1150  //var_dump($this->actual_levels);
1151 
1152  include_once("./Services/Chart/classes/class.ilChart.php");
1153  $chart = ilChart::getInstanceByType(ilChart::TYPE_SPIDER, "gap_chart".$pkg_cnt);
1154  $chart->setsize(800, 300);
1155  $chart->setYAxisMax($max_cnt);
1156  $chart->setLegLabels($leg_labels);
1157 
1158  // target level
1159  $cd = $chart->getDataInstance();
1160  $cd->setLabel($lng->txt("skmg_target_level"));
1161  $cd->setFill(true, "#A0A0A0");
1162 
1163  // other users
1164  $cd2 = $chart->getDataInstance();
1165  if ($this->gap_cat_title != "")
1166  {
1167  $cd2->setLabel($this->gap_cat_title);
1168  }
1169  else if ($this->gap_mode == "max_per_type")
1170  {
1171  $cd2->setLabel($lng->txt("objs_".$this->gap_mode_type));
1172  }
1173  else if ($this->gap_mode == "max_per_object")
1174  {
1175  $cd2->setLabel(ilObject::_lookupTitle($this->gap_mode_obj_id));
1176  }
1177  $cd2->setFill(true, "#8080FF");
1178 
1179  // self evaluation
1180  if ($incl_self_eval)
1181  {
1182  $cd3 = $chart->getDataInstance();
1183  $cd3->setLabel($lng->txt("skmg_self_evaluation"));
1184  $cd3->setFill(true, "#FF8080");
1185  }
1186 
1187  // fill in data
1188  $cnt = 0;
1189  foreach ($pskills as $pl)
1190  {
1191  $cd->addPoint($cnt, (int) $pl["target_cnt"]);
1192  $cd2->addPoint($cnt, (int) $pl["actual_cnt"]);
1193  if ($incl_self_eval)
1194  {
1195  $cd3->addPoint($cnt, (int) $pl["self_cnt"]);
1196  }
1197  $cnt++;
1198  }
1199 
1200  // add data to chart
1201  if ($this->getProfileId() > 0)
1202  {
1203  $chart->addData($cd);
1204  }
1205  $chart->addData($cd2);
1206  if ($incl_self_eval && count($this->getGapAnalysisSelfEvalLevels()) > 0)
1207  {
1208  $chart->addData($cd3);
1209  }
1210 
1211  if ($pkg_cnt == 1)
1212  {
1213  $lg = new ilChartLegend();
1214  $chart->setLegend($lg);
1215  }
1216 
1217  $chart_html = $chart->getHTML();
1218  $all_chart_html.= $chart_html;
1219  }
1220 
1221  $pan = ilPanelGUI::getInstance();
1222  $pan->setPanelStyle(ilPanelGUI::PANEL_STYLE_PRIMARY);
1223  $pan->setBody($all_chart_html);
1224  $all_chart_html = $pan->getHTML();
1225  }
1226 
1227  $stree = new ilSkillTree();
1228  $html = "";
1229  foreach ($skills as $s)
1230  {
1231  $path = $stree->getSkillTreePath($s["base_skill_id"]);
1232 
1233  // check draft
1234  foreach ($path as $p)
1235  {
1236  if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT)
1237  {
1238  continue(2);
1239  }
1240  }
1241  $html.= $this->getSkillHTML($s["base_skill_id"], $user_id, false, $s["tref_id"]);
1242  }
1243 
1244  // list skills
1245 // include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
1246 // $sktab = new ilPersonalSkillTableGUI($this, "listSkills");
1247 
1248  return $intro_html.$all_chart_html.$html;
1249  }
1250 
1257  function selectProfile()
1258  {
1259  global $ilCtrl;
1260 
1261  $ilCtrl->setParameter($this, "profile_id", $_GET["profile_id"]);
1262  $ilCtrl->redirect($this, "listProfiles");
1263  }
1264 
1271  function renderSelfEvaluationRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1272  {
1273  global $ilUser, $lng;
1274 
1275  if ($a_user_id == 0)
1276  {
1277  $a_user_id = $ilUser->getId();
1278  }
1279 
1280  $se_date = ilPersonalSkill::getSelfEvaluationDate($a_user_id, $a_top_skill_id, $a_tref_id, $a_base_skill);
1281 
1282  $se_level = ilPersonalSkill::getSelfEvaluation($a_user_id,
1283  $a_top_skill_id, $a_tref_id, $a_base_skill);
1284  // check, if current self eval level is in current level data
1285  $valid_sel_level = false;
1286  if ($se_level > 0)
1287  {
1288  foreach ($a_levels as $k => $v)
1289  {
1290  if ($v["id"] == $se_level)
1291  {
1292  $valid_sel_level = true;
1293  }
1294  }
1295  }
1296  reset($a_levels);
1297  $found = false;
1298  foreach ($a_levels as $k => $v)
1299  {
1300  $a_tpl->setCurrentBlock("val_level_td");
1301  if ($valid_sel_level && $v["id"] == $se_level)
1302  {
1303  $a_tpl->setVariable("VAL_LEVEL", "x");
1304  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1305  }
1306  else
1307  {
1308  $a_tpl->setVariable("VAL_LEVEL", " ");
1309  }
1310  $a_tpl->parseCurrentBlock();
1311  /*if ($v["id"] == $se_level)
1312  {
1313  $found = true;
1314  }*/
1315  }
1316 
1317  $a_tpl->setCurrentBlock("value_row");
1319  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_self_evaluation").
1320  ", ".ilDatePresentation::formatDate(new ilDateTime($se_date, IL_CAL_DATETIME)));
1322  $a_tpl->parseCurrentBlock();
1323  }
1324 
1331  function renderMaterialsRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1332  {
1333  global $ilUser, $lng;
1334 
1335  if ($a_user_id == 0)
1336  {
1337  $a_user_id = $ilUser->getId();
1338  }
1339 
1340  $got_mat = false;
1341  foreach ($a_levels as $v)
1342  {
1343  $mat_cnt = ilPersonalSkill::countAssignedMaterial($a_user_id,
1344  $a_tref_id, $v["id"]);
1345  if ($mat_cnt > 0)
1346  {
1347  $got_mat = true;
1348  }
1349  }
1350  if (!$got_mat)
1351  {
1352  return;
1353  }
1354 
1355  foreach ($a_levels as $k => $v)
1356  {
1357  $mat_cnt = ilPersonalSkill::countAssignedMaterial($a_user_id,
1358  $a_tref_id, $v["id"]);
1359  if ($mat_cnt == 0)
1360  {
1361  $a_tpl->setCurrentBlock("val_level_td");
1362  $a_tpl->setVariable("VAL_LEVEL", " ");
1363  $a_tpl->parseCurrentBlock();
1364  }
1365  else
1366  {
1367  // links to material files
1368  $a_tpl->setCurrentBlock("level_link");
1369 
1370  $mat_tt = array();
1371  $cnt = 1;
1372  foreach(ilPersonalSkill::getAssignedMaterial($a_user_id,
1373  $a_tref_id, $v["id"]) as $item)
1374  {
1375  $mat_data = $this->getMaterialInfo($item["wsp_id"], $a_user_id);
1376  $a_tpl->setVariable("HREF_LINK", $mat_data[1]);
1377  $a_tpl->setVariable("TXT_LINK", $cnt);
1378 
1379  // tooltip
1380  $mat_tt_id = "skmg_skl_tt_mat_".self::$skill_tt_cnt;
1381  self::$skill_tt_cnt++;
1382  $a_tpl->setVariable("LEVEL_LINK_ID", $mat_tt_id);
1383 
1384  if(!$this->offline_mode)
1385  {
1386  ilTooltipGUI::addTooltip($mat_tt_id, $mat_data[0]);
1387  }
1388  else
1389  {
1390  $this->tooltips[] = ilTooltipGUI::getTooltip($mat_tt_id, $mat_data[0]);
1391  }
1392 
1393  $a_tpl->parseCurrentBlock();
1394  $cnt++;
1395  }
1396 
1397  $a_tpl->setCurrentBlock("val_level_td");
1398  $a_tpl->setVariable("TD_CLASS", "ilSkillMat");
1399  $a_tpl->parseCurrentBlock();
1400  }
1401  }
1402 
1403  $a_tpl->setCurrentBlock("value_row");
1404  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_material"));
1405  $a_tpl->parseCurrentBlock();
1406  }
1407 
1414  function renderProfileTargetRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1415  {
1416  global $ilUser, $lng;
1417 
1418  if ($a_user_id == 0)
1419  {
1420  $a_user_id = $ilUser->getId();
1421  }
1422 
1423  $profile = new ilSkillProfile($this->getProfileId());
1424  $profile_levels = $profile->getSkillLevels();
1425 
1426  foreach ($a_levels as $k => $v)
1427  {
1428  $a_tpl->setCurrentBlock("val_level_td");
1429  $target_level = false;
1430  foreach ($profile_levels as $pl)
1431  {
1432  if ($pl["level_id"] == $v["id"] &&
1433  $pl["base_skill_id"] == $v["skill_id"] &&
1434  $a_tref_id == $pl["tref_id"])
1435  {
1436  $target_level = true;
1437  $current_target_level = $v["id"];
1438  }
1439  }
1440  if ($target_level)
1441  {
1442  $too_low = true;
1443  $a_tpl->setVariable("VAL_LEVEL", "x");
1444  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1445  }
1446  else
1447  {
1448  $a_tpl->setVariable("VAL_LEVEL", " ");
1449  }
1450  $a_tpl->parseCurrentBlock();
1451  }
1452 
1453  $a_tpl->setCurrentBlock("value_row");
1454  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_target_level"));
1455  $a_tpl->parseCurrentBlock();
1456  }
1457 
1464  function renderActualLevelsRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1465  {
1466  global $ilUser, $lng;
1467 
1468  if ($a_user_id == 0)
1469  {
1470  $a_user_id = $ilUser->getId();
1471  }
1472 
1473  $profile = new ilSkillProfile($this->getProfileId());
1474  $profile_levels = $profile->getSkillLevels();
1475 
1476  foreach ($a_levels as $k => $v)
1477  {
1478  $a_tpl->setCurrentBlock("val_level_td");
1479  $survey_level = false;
1480  if ($this->actual_levels[$v["skill_id"]][$a_tref_id] == $v["id"])
1481  {
1482  $survey_level = true;
1483  $too_low = false;
1484  }
1485  if ($survey_level)
1486  {
1487  $a_tpl->setVariable("VAL_LEVEL", "x");
1488  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1489  }
1490  else
1491  {
1492  $a_tpl->setVariable("VAL_LEVEL", " ");
1493  }
1494  $a_tpl->parseCurrentBlock();
1495  }
1496 
1497  $a_tpl->setCurrentBlock("value_row");
1498  if ($this->gap_cat_title != "")
1499  {
1500  $a_tpl->setVariable("TXT_VAL_TITLE", $this->gap_cat_title);
1501  }
1502  else if ($this->gap_mode == "max_per_type")
1503  {
1504  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("objs_".$this->gap_mode_type));
1505  }
1506  else if ($this->gap_mode == "max_per_object")
1507  {
1508  $a_tpl->setVariable("TXT_VAL_TITLE", ilObject::_lookupTitle($this->gap_mode_obj_id));
1509  }
1510 
1511  $a_tpl->parseCurrentBlock();
1512  }
1513 
1520  function renderGapSelfEvalRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1521  {
1522  global $ilUser, $lng;
1523 
1524  if ($a_user_id == 0)
1525  {
1526  $a_user_id = $ilUser->getId();
1527  }
1528 
1529  $self_vals = $this->getGapAnalysisSelfEvalLevels();
1530  if (count($self_vals) == 0)
1531  {
1532  return;
1533  }
1534 
1535  foreach ($a_levels as $k => $v)
1536  {
1537  $a_tpl->setCurrentBlock("val_level_td");
1538  $survey_level = false;
1539  if ($self_vals[$v["skill_id"]][$a_tref_id] == $v["id"])
1540  {
1541  $survey_level = true;
1542  }
1543  if ($survey_level)
1544  {
1545  $a_tpl->setVariable("VAL_LEVEL", "x");
1546  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1547  }
1548  else
1549  {
1550  $a_tpl->setVariable("VAL_LEVEL", " ");
1551  }
1552  $a_tpl->parseCurrentBlock();
1553  }
1554 
1555  $a_tpl->setCurrentBlock("value_row");
1556  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_self_evaluation"));
1557 
1558  $a_tpl->parseCurrentBlock();
1559  }
1560 
1567  function renderObjectEvalRow($a_tpl, $a_levels, $a_level_entry)
1568  {
1569  global $lng, $ilAccess;
1570 
1571  $se_level = $a_level_entry["level_id"];
1572 
1573  // check, if current self eval level is in current level data
1574  $valid_sel_level = false;
1575  if ($se_level > 0)
1576  {
1577  foreach ($a_levels as $k => $v)
1578  {
1579  if ($v["id"] == $se_level)
1580  {
1581  $valid_sel_level = true;
1582  }
1583  }
1584  }
1585  reset($a_levels);
1586  $found = false;
1587  foreach ($a_levels as $k => $v)
1588  {
1589  $a_tpl->setCurrentBlock("val_level_td");
1590  if ($valid_sel_level && $v["id"] == $se_level)
1591  {
1592  $a_tpl->setVariable("VAL_LEVEL", "x");
1593  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1594  }
1595  else
1596  {
1597  $a_tpl->setVariable("VAL_LEVEL", " ");
1598  }
1599  $a_tpl->parseCurrentBlock();
1600  /*if ($v["id"] == $se_level)
1601  {
1602  $found = true;
1603  }*/
1604  }
1605 
1606  $a_tpl->setCurrentBlock("value_row");
1608  if ($a_level_entry["self_eval"] == 1 && $a_level_entry["trigger_obj_id"] == 0)
1609  {
1610  $title = $lng->txt("skmg_self_evaluation");
1611  }
1612  else
1613  {
1614  $title = ($a_level_entry["trigger_obj_id"] > 0 && $a_level_entry["self_eval"] == 1)
1615  ? $a_level_entry["trigger_title"]." (".$lng->txt("skmg_self_evaluation").")"
1616  : $a_level_entry["trigger_title"];
1617  }
1618 
1619  if ($a_level_entry["trigger_ref_id"] > 0
1620  && $ilAccess->checkAccess("read", "", $a_level_entry["trigger_ref_id"]))
1621  {
1622  include_once("./Services/Link/classes/class.ilLink.php");
1623  $title = "<a href='".ilLink::_getLink($a_level_entry["trigger_ref_id"])."'>".$title."</a>";
1624  }
1625 
1626  $a_tpl->setVariable("TXT_VAL_TITLE", $title.
1627  ", ".ilDatePresentation::formatDate(new ilDateTime($a_level_entry["status_date"], IL_CAL_DATETIME)));
1629  $a_tpl->parseCurrentBlock();
1630  }
1631 
1638  function renderSuggestedResources($a_tpl, $a_levels, $a_base_skill, $a_tref_id)
1639  {
1640  global $lng;
1641 
1642  // use a profile
1643  if ($this->getProfileId() > 0)
1644  {
1645  $profile = new ilSkillProfile($this->getProfileId());
1646  $profile_levels = $profile->getSkillLevels();
1647 
1648  $too_low = true;
1649  $current_target_level = 0;
1650 
1651 
1652  foreach ($a_levels as $k => $v)
1653  {
1654  foreach ($this->profile_levels as $pl)
1655  {
1656  if ($pl["level_id"] == $v["id"] &&
1657  $pl["base_skill_id"] == $v["skill_id"])
1658  {
1659  $too_low = true;
1660  $current_target_level = $v["id"];
1661  }
1662  }
1663 
1664  if ($this->actual_levels[$v["skill_id"]][0] == $v["id"])
1665  {
1666  $too_low = false;
1667  }
1668  }
1669 
1670  // suggested resources
1671  if ($too_low)
1672  {
1673  include_once("./Services/Skill/classes/class.ilSkillResources.php");
1674  $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
1675  $res = $skill_res->getResources();
1676  $imp_resources = array();
1677  foreach ($res as $level)
1678  {
1679  foreach($level as $r)
1680  {
1681  if ($r["imparting"] == true &&
1682  $current_target_level == $r["level_id"])
1683  {
1684  $imp_resources[] = $r;
1685  }
1686  }
1687  }
1688  foreach($imp_resources as $r)
1689  {
1690  $ref_id = $r["rep_ref_id"];
1691  $obj_id = ilObject::_lookupObjId($ref_id);
1692  $title = ilObject::_lookupTitle($obj_id);
1693  include_once("./Services/Link/classes/class.ilLink.php");
1694  $a_tpl->setCurrentBlock("resource_item");
1695  $a_tpl->setVariable("TXT_RES", $title);
1696  $a_tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
1697  $a_tpl->parseCurrentBlock();
1698  }
1699  if (count($imp_resources) > 0)
1700  {
1701  $a_tpl->touchBlock("resources_list");
1702  $a_tpl->setCurrentBlock("resources");
1703  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_res"));
1704  $a_tpl->parseCurrentBlock();
1705  }
1706  else
1707  {
1708  $a_tpl->setCurrentBlock("resources");
1709  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_no_res"));
1710  $a_tpl->parseCurrentBlock();
1711  }
1712  }
1713  else
1714  {
1715  $a_tpl->setCurrentBlock("resources");
1716  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_no_needs_impr"));
1717  $a_tpl->parseCurrentBlock();
1718  }
1719  }
1720  else
1721  {
1722  // no profile, just list all resources
1723  include_once("./Services/Skill/classes/class.ilSkillResources.php");
1724  $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
1725  $res = $skill_res->getResources();
1726  // add $r["level_id"] info
1727  $any = false;
1728  foreach ($res as $level)
1729  {
1730  $available = false;
1731  $cl = 0;
1732  foreach($level as $r)
1733  {
1734  if ($r["imparting"])
1735  {
1736  $ref_id = $r["rep_ref_id"];
1737  $obj_id = ilObject::_lookupObjId($ref_id);
1738  $title = ilObject::_lookupTitle($obj_id);
1739  include_once("./Services/Link/classes/class.ilLink.php");
1740  $a_tpl->setCurrentBlock("resource_item");
1741  $a_tpl->setVariable("TXT_RES", $title);
1742  $a_tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
1743  $a_tpl->parseCurrentBlock();
1744  $available = true;
1745  $any = true;
1746  $cl = $r["level_id"];
1747  }
1748  }
1749  if ($available)
1750  {
1751  $a_tpl->setCurrentBlock("resources_list_level");
1752  $a_tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level"));
1753  $a_tpl->setVariable("LEVEL_NAME", ilBasicSkill::lookupLevelTitle($cl));
1754  $a_tpl->parseCurrentBlock();
1755  $a_tpl->touchBlock("resources_list");
1756  }
1757  }
1758  if ($any)
1759  {
1760  $a_tpl->setCurrentBlock("resources");
1761  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_suggested_resources"));
1762  $a_tpl->parseCurrentBlock();
1763  }
1764  }
1765  }
1766 
1767 }
1768 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
saveSelfEvaluation()
Save self evaluation.
$lg
Definition: example_018.php:62
hideSkill($a_skill_id, $a_tref_id=0)
Hide skill.
$path
Definition: aliased.php:25
renderSuggestedResources($a_tpl, $a_levels, $a_base_skill, $a_tref_id)
Render suggested resources.
const TYPE_SPIDER
setProfileId($a_val)
Set profile id.
renderActualLevelsRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id=0, $a_user_id=0)
Render actual levels row (gap analysis)
const IL_CAL_DATETIME
This class represents a selection list property in a property form.
static lookupLevelTitle($a_id)
Lookup level title.
Chart legend.
Skill tree.
$_GET["client_id"]
getMaterialInfo($a_wsp_id, $a_user_id)
Get material file name and goto url.
renderGapSelfEvalRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id=0, $a_user_id=0)
Render actual levels row (gap analysis)
const PANEL_STYLE_PRIMARY
$cmd
Definition: sahs_server.php:35
getHistoryView()
Get history view.
Explorer for selecting a personal skill.
Access handler for personal workspace.
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
addSkill()
Add personal skill.
getSkillHTML($a_top_skill_id, $a_user_id=0, $a_edit=false, $a_tref_id=0)
Get skill presentation HTML.
UI interface hook processor.
setTabs($a_activate)
Set tabs.
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
$url
Definition: shib_logout.php:72
static saveSelfEvaluation($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level)
Save self evaluation.
renderSkillHTML($a_top_skill_id, $a_user_id=0, $a_edit=false, $a_tref_id=0)
Render skill html.
getGapAnalysisHTML($a_user_id=0, $a_skills=null)
Get gap analysis html.
$w
Assign materials to skill levels table.
removeMaterial()
Remove material.
Tree handler for personal workspace.
global $tpl
Definition: ilias.php:8
static _lookupType($a_obj_id)
Lookup Type.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
assignMaterial()
Assign materials to skill level.
$a_type
Definition: workflow.php:93
Personal skills GUI class.
static getProfilesOfUser($a_user_id)
Get profiles of a user.
$r
Definition: example_031.php:79
selfEvaluation()
Assign materials to skill levels.
getGapAnalysisSelfEvalLevels()
Get self evaluation levels for gap analysis.
static addTooltip($a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
Adds a tooltip to an HTML element.
selectMaterial()
Select material.
if(!is_array($argv)) $options
static removeSkill($a_user_id, $a_skill_node_id)
Remove personal skill.
setIntroText($a_val)
Set intro text.
Self evaluation, second simplier implementation.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
Manages resources for skills.
Class ilObjFile.
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
Date and time handling
renderProfileTargetRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id=0, $a_user_id=0)
Render profile target row.
$ilUser
Definition: imgupload.php:18
static _lookupTemplateId($a_obj_id)
Lookup template ID.
setHistoryView($a_val)
Set history view.
listSkillsForAdd()
LIst skills for adding.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
renderObjectEvalRow($a_tpl, $a_levels, $a_level_entry)
Render object evaluation row (has_level table)
User interface class for advanced drop-down selection lists.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static getSelfEvaluation($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill)
Get self evaluation.
static getAssignedMaterial($a_user_id, $a_tref_id, $a_level)
Get assigned material (for a skill level and user)
static getInstance()
Get instance.
global $l
Definition: afr.php:30
$ref_id
Definition: sahs_server.php:39
assignMaterials()
Assign materials to skill levels.
global $ilSetting
Definition: privfeed.php:17
static countAssignedMaterial($a_user_id, $a_tref_id, $a_level)
Get assigned material (for a skill level and user)
setGapAnalysisActualStatusModePerType($a_type, $a_cat_title="")
Set gap analysis actual status mode "per type".
global $lng
Definition: privfeed.php:17
executeCommand()
Execute command.
renderSelfEvaluationRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id=0, $a_user_id=0)
Render self evaluation row.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
Basic Skill.
confirmSkillRemove()
Confirm skill remove.
$_POST["username"]
$html
Definition: example_001.php:87
static getSelfEvaluationDate($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill)
Get self evaluation.
static getInstanceByType($a_type, $a_id)
Get type instance.
setGapAnalysisSelfEvalLevels($a_val)
Set self evaluation levels for gap analysis.
static removeMaterial($a_user_id, $a_tref_id, $a_level_id, $a_wsp_id)
Remove material.
renderMaterialsRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id=0, $a_user_id=0)
Render materials row.
Confirmation screen class.
static assignMaterial($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level, $a_wsp_id)
Assign material to skill level.
setGapAnalysisActualStatusModePerObject($a_obj_id, $a_cat_title="")
Set gap analysis actual status mode "per object".