ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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();
24  protected $gap_self_eval_levels = array();
25  protected $mode = "";
26 
32  public function __construct()
33  {
34  global $ilCtrl, $lng, $ilHelp, $ilSetting;
35 
36  $lng->loadLanguageModule('skmg');
37 
38  $ilHelp->setScreenIdComponent("skill");
39 
40  $ilCtrl->saveParameter($this, "skill_id");
41  $ilCtrl->saveParameter($this, "tref_id");
42  $ilCtrl->saveParameter($this, "profile_id");
43 
44  include_once("./Services/Skill/classes/class.ilSkillTree.php");
45  $this->skill_tree = new ilSkillTree();
46 
47  $this->use_materials = !$ilSetting->get("disable_personal_workspace");
48  }
49 
55  function setProfileId($a_val)
56  {
57  $this->profile_id = $a_val;
58  }
59 
65  function getProfileId()
66  {
67  return $this->profile_id;
68  }
69 
76  {
77  $this->gap_self_eval_levels = $a_val;
78  }
79 
86  {
88  }
89 
96  public function executeCommand()
97  {
98  global $ilCtrl, $tpl, $lng, $ilUser;
99 
100  $next_class = $ilCtrl->getNextClass($this);
101 
102  $profiles = ilSkillProfile::getProfilesOfUser($ilUser->getId());
103 
104  // determin standard command
105  $std_cmd = "listSkills";
106  if (count($profiles) > 0)
107  {
108 // $std_cmd = "listProfiles";
109  }
110 
111  $cmd = $ilCtrl->getCmd($std_cmd);
112 
113  $tpl->setTitle($lng->txt("skills"));
114  $tpl->setTitleIcon(ilUtil::getImagePath("icon_skmg.svg"));
115 
116  switch($next_class)
117  {
118  default:
119  $this->$cmd();
120  break;
121  }
122  return true;
123  }
124 
128  function setTabs($a_activate)
129  {
130  global $ilTabs, $lng, $ilCtrl;
131 
132  // list skills
133  $ilTabs->addTab("list_skills",
134  $lng->txt("skmg_list_skills"),
135  $ilCtrl->getLinkTarget($this, "listSkills"));
136 
137  // assign materials
138 /* $ilTabs->addTab("assign_materials",
139  $lng->txt("skmg_assign_materials"),
140  $ilCtrl->getLinkTarget($this, "assignMaterials"));*/
141 
142  $ilTabs->activateTab($a_activate);
143  }
144 
145  function setOfflineMode($a_file_path)
146  {
147  $this->offline_mode = $a_file_path;
148  }
149 
153  function listSkills()
154  {
155  global $tpl, $ilTabs, $lng, $ilCtrl, $ilToolbar, $ilUser;
156 
157  $this->setTabs("list_skills");
158 
159  include_once("./Services/Skill/classes/class.ilSkillTree.php");
160  $stree = new ilSkillTree();
161 
162  // skill selection / add new personal skill
163  $ilToolbar->addFormButton($lng->txt("skmg_add_skill"),
164  "listSkillsForAdd");
165  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
166 
167  $skills = ilPersonalSkill::getSelectedUserSkills($ilUser->getId());
168  $html = "";
169  foreach ($skills as $s)
170  {
171  $path = $stree->getSkillTreePath($s["skill_node_id"]);
172 
173  // check draft
174  foreach ($path as $p)
175  {
176  if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT)
177  {
178  continue(2);
179  }
180  }
181  $html.= $this->getSkillHTML($s["skill_node_id"], 0, true);
182  }
183 
184  // list skills
185 // include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
186 // $sktab = new ilPersonalSkillTableGUI($this, "listSkills");
187 
188  $tpl->setContent($html);
189 
190  }
191 
200  function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false, $a_tref_id = 0)
201  {
202  global $ilUser, $lng, $ilCtrl, $ilSetting;
203 
204 //echo "<br>".$a_top_skill_id.":".$a_tref_id;
205  $this->tooltips = array();
206 
207  if ($a_user_id == 0)
208  {
209  $user = $ilUser;
210  }
211  else
212  {
213  $user = new ilObjUser($a_user_id);
214  }
215 
216  $tpl = new ilTemplate("tpl.skill_pres.html", true, true, "Services/Skill");
217 
218  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
219 
220  include_once("./Services/Skill/classes/class.ilSkillTree.php");
221  $stree = new ilSkillTree();
222 
223  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
224  include_once("./Services/Skill/classes/class.ilSkillTreeNodeFactory.php");
225 
226  // general settings for the action drop down
227  include_once("Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
228  $act_list = new ilAdvancedSelectionListGUI();
229  $act_list->setListTitle($lng->txt("actions"));
230  $act_list->setSelectionHeaderClass("small");
231 // $act_list->setLinksMode("il_ContainerItemCommand2");
232  $act_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
233  $act_list->setUseImages(false);
234 
235  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
236  $vtree = new ilVirtualSkillTree();
237  $tref_id = $a_tref_id;
238  $skill_id = $a_top_skill_id;
239  if (ilSkillTreeNode::_lookupType($a_top_skill_id) == "sktr")
240  {
241  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
242  $tref_id = $a_top_skill_id;
243  $skill_id = ilSkillTemplateReference::_lookupTemplateId($a_top_skill_id);
244  }
245  $b_skills = $vtree->getSubTreeForCSkillId($skill_id.":".$tref_id, true);
246 //if ($a_tref_id > 0) $a_top_skill_id = $a_tref_id;
247  foreach ($b_skills as $bs)
248  {
249 $bs["id"] = $bs["skill_id"];
250 $bs["tref"] = $bs["tref_id"];
251 //var_dump($bs); exit;
252  $path = $stree->getSkillTreePath($bs["id"], $bs["tref"]);
253 
254  // check draft
255  foreach ($path as $p)
256  {
257  if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT)
258  {
259  continue(2);
260  }
261  }
262  reset($path);
263 
264  $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]);
265  $level_data = $skill->getLevelData();
266 
267  if ($this->mode == "gap")
268  {
269  if ($this->getProfileId() > 0)
270  {
271  $this->renderProfileTargetRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
272  }
273  $this->renderActualLevelsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
274  $this->renderGapSelfEvalRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
275  $this->renderSuggestedResources($tpl, $level_data, $bs["id"], $bs["tref"]);
276  }
277  else
278  {
279  if ($this->getProfileId() > 0)
280  {
281  $this->renderProfileTargetRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
282  }
283  $this->renderMaterialsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
284 
285  // get date of self evaluation
286  $se_date = ilPersonalSkill::getSelfEvaluationDate($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]);
287  $se_rendered = ($se_date == "")
288  ? true
289  : false;
290 
291  // get all object triggered entries and render them
292  foreach ($skill->getAllHistoricLevelEntriesOfUser($bs["tref"] , $user->getId(), ilBasicSkill::EVAL_BY_ALL) as $level_entry)
293  {
294  // render the self evaluation at the correct position within the list of object triggered entries
295  if ($se_date > $level_entry["status_date"] && !$se_rendered)
296  {
297 // $this->renderSelfEvaluationRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
298  $se_rendered = true;
299  }
300  $this->renderObjectEvalRow($tpl, $level_data, $level_entry);
301  }
302 
303  // if not rendered yet, render self evaluation now
304  if (!$se_rendered)
305  {
306 // $this->renderSelfEvaluationRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"], $user->getId());
307  }
308  $this->renderSuggestedResources($tpl, $level_data, $bs["id"], $bs["tref"]);
309  }
310 
311  $too_low = true;
312  $current_target_level = 0;
313 
314  foreach ($level_data as $k => $v)
315  {
316  // level
317  $tpl->setCurrentBlock("level_td");
318  $tpl->setVariable("VAL_LEVEL", $v["title"]);
319  $tt_id = "skmg_skl_tt_".self::$skill_tt_cnt;
320  self::$skill_tt_cnt++;
321  $tpl->setVariable("TT_ID", $tt_id);
322  if ($v["description"] != "")
323  {
324  ilTooltipGUI::addTooltip($tt_id, $v["description"]);
325  }
326  $tpl->parseCurrentBlock();
327  }
328 
329 
330  $title = $sep = "";
331  $found = false;
332  foreach ($path as $p)
333  {
334  if ($found)
335  {
336  $title.= $sep.$p["title"];
337  $sep = " > ";
338  }
339  if ($a_top_skill_id == $p["child"])
340  {
341  $found = true;
342  }
343  }
344 
345  $tpl->setCurrentBlock("skill");
346  $tpl->setVariable("BSKILL_TITLE", $title);
347 /* $tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level"));
348  $tpl->setVariable("TXT_SELF_EVAL", $lng->txt("skmg_self_evaluation"));
349  if ($this->use_materials)
350  {
351  $tpl->setVariable("TXT_MATERIAL", $lng->txt("skmg_material"));
352  }*/
353  $tpl->setVariable("TXT_TARGET", $lng->txt("skmg_target_level"));
354  $tpl->setVariable("TXT_360_SURVEY", $lng->txt("skmg_360_survey"));
355 
356  if ($a_edit)
357  {
358  $act_list->flush();
359  $act_list->setId("act_".$a_top_skill_id."_".$bs["id"]);
360  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id);
361  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "tref_id", $bs["tref"]);
362  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "basic_skill_id", $bs["id"]);
363  if ($this->use_materials)
364  {
365  $act_list->addItem($lng->txt('skmg_assign_materials'), "",
366  $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials"));
367  }
368  $act_list->addItem($lng->txt('skmg_self_evaluation'), "",
369  $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "selfEvaluation"));
370  $tpl->setVariable("ACTIONS2", $act_list->getHTML());
371  }
372 
373  $tpl->parseCurrentBlock();
374 
375  }
376 
377  $tpl->setVariable("SKILL_TITLE", ilSkillTreeNode::_lookupTitle($skill_id, $tref_id));
378 
379  if ($a_edit)
380  {
381  $act_list->flush();
382  $act_list->setId("act_".$a_top_skill_id);
383  $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id);
384 // $act_list->addItem($lng->txt('skmg_assign_materials'), "",
385 // $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials"));
386  $act_list->addItem($lng->txt('skmg_remove_skill'), "",
387  $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "confirmSkillRemove"));
388  $tpl->setVariable("ACTIONS1", $act_list->getHTML());
389  }
390 
391 
392 
393  return $tpl->get();
394  }
395 
396  function getTooltipsJs()
397  {
398  return $this->tooltips;
399  }
400 
407  function getMaterialInfo($a_wsp_id, $a_user_id)
408  {
409  if(!$this->ws_tree)
410  {
411  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
412  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
413  $this->ws_tree = new ilWorkspaceTree($a_user_id);
414  $this->ws_access = new ilWorkspaceAccessHandler($caption);
415  }
416 
417  $obj_id = $this->ws_tree->lookupObjectId($a_wsp_id);
418  $caption = ilObject::_lookupTitle($obj_id);
419 
420  if(!$this->offline_mode)
421  {
422  $url = $this->ws_access->getGotoLink($a_wsp_id, $obj_id);
423  }
424  else
425  {
426  $url = $this->offline_mode."file_".$obj_id."/";
427 
428  // all possible material types for now
429  switch(ilObject::_lookupType($obj_id))
430  {
431  case "tstv":
432  include_once "Modules/Test/classes/class.ilObjTestVerification.php";
433  $obj = new ilObjTestVerification($obj_id, false);
434  $url .= $obj->getOfflineFilename();
435  break;
436 
437  case "excv":
438  include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
439  $obj = new ilObjExerciseVerification($obj_id, false);
440  $url .= $obj->getOfflineFilename();
441  break;
442 
443  case "crsv":
444  include_once "Modules/Course/classes/Verification/class.ilObjCourseVerification.php";
445  $obj = new ilObjCourseVerification($obj_id, false);
446  $url .= $obj->getOfflineFilename();
447  break;
448 
449  case "scov":
450  include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
451  $obj = new ilObjSCORMVerification($obj_id, false);
452  $url .= $obj->getOfflineFilename();
453  break;
454 
455  case "file":
456  $file = new ilObjFile($obj_id, false);
457  $url .= $file->getFilename();
458  break;
459  }
460  }
461 
462  return array($caption, $url);
463  }
464 
468  function addSkill()
469  {
470  global $ilUser, $ilCtrl, $lng;
471 
472  ilPersonalSkill::addPersonalSkill($ilUser->getId(), (int) $_GET["obj_id"]);
473 
474  ilUtil::sendSuccess($lng->txt("msg_object_modified"));
475  $ilCtrl->redirect($this, "listSkills");
476  }
477 
478 
479 
484  {
485  global $ilCtrl, $tpl, $lng;
486 
487  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
488  if ($_GET["skill_id"] > 0)
489  {
490  $_POST["id"][] = $_GET["skill_id"];
491  }
492  if (!is_array($_POST["id"]) || count($_POST["id"]) == 0)
493  {
494  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
495  $ilCtrl->redirect($this, "listSkills");
496  }
497  else
498  {
499  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
500  $cgui = new ilConfirmationGUI();
501  $cgui->setFormAction($ilCtrl->getFormAction($this));
502  $cgui->setHeaderText($lng->txt("skmg_really_remove_skills"));
503  $cgui->setCancel($lng->txt("cancel"), "listSkills");
504  $cgui->setConfirm($lng->txt("delete"), "removeSkills");
505 
506  foreach ($_POST["id"] as $i)
507  {
508  $cgui->addItem("id[]", $i, ilSkillTreeNode::_lookupTitle($i));
509  }
510 
511  $tpl->setContent($cgui->getHTML());
512  }
513  }
514 
518  function removeSkills()
519  {
520  global $ilUser, $lng, $ilCtrl;
521 
522  if (is_array($_POST["id"]))
523  {
524  foreach ($_POST["id"] as $n_id)
525  {
526  ilPersonalSkill::removeSkill($ilUser->getId(), $n_id);
527  }
528  }
529 
530  ilUtil::sendSuccess($lng->txt("msg_object_modified"));
531  $ilCtrl->redirect($this, "listSkills");
532  }
533 
534 
535  //
536  // Materials assignments
537  //
538 
545  function assignMaterials()
546  {
547  global $ilTabs, $lng, $ilCtrl, $tpl, $ilToolbar;
548 
549  $ilTabs->setBackTarget($lng->txt("back"),
550  $ilCtrl->getLinkTarget($this, "listSkills"));
551 
552  $ilCtrl->saveParameter($this, "skill_id");
553  $ilCtrl->saveParameter($this, "basic_skill_id");
554  $ilCtrl->saveParameter($this, "tref_id");
555 
556  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
557  $tpl->setTitle(ilSkillTreeNode::_lookupTitle((int) $_GET["skill_id"]));
558  $tpl->setTitleIcon(ilUtil::getImagePath("icon_".
559  ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]).
560  ".svg"));
561 
562  // basic skill selection
563  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
564  $vtree = new ilVirtualSkillTree();
565  $tref_id = 0;
566  $skill_id = (int) $_GET["skill_id"];
567  if (ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) == "sktr")
568  {
569  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
570  $tref_id = $_GET["skill_id"];
571  $skill_id = ilSkillTemplateReference::_lookupTemplateId($_GET["skill_id"]);
572  }
573  $bs = $vtree->getSubTreeForCSkillId($skill_id.":".$tref_id, true);
574 
575  $options = array();
576  foreach ($bs as $b)
577  {
578  //$options[$b["id"]] = ilSkillTreeNode::_lookupTitle($b["id"]);
579  $options[$b["skill_id"]] = ilSkillTreeNode::_lookupTitle($b["skill_id"]);
580  }
581 
582  $cur_basic_skill_id = ((int) $_POST["basic_skill_id"] > 0)
583  ? (int) $_POST["basic_skill_id"]
584  : (((int) $_GET["basic_skill_id"] > 0)
585  ? (int) $_GET["basic_skill_id"]
586  : key($options));
587 
588  $ilCtrl->setParameter($this, "basic_skill_id", $cur_basic_skill_id);
589 
590  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
591  $si = new ilSelectInputGUI($lng->txt("skmg_skill"), "basic_skill_id");
592  $si->setOptions($options);
593  $si->setValue($cur_basic_skill_id);
594  $ilToolbar->addInputItem($si, true);
595  $ilToolbar->addFormButton($lng->txt("select"),
596  "assignMaterials");
597 
598  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
599 
600  // table
601  include_once("./Services/Skill/classes/class.ilSkillAssignMaterialsTableGUI.php");
602  $tab = new ilSkillAssignMaterialsTableGUI($this, "assignMaterials",
603  (int) $_GET["skill_id"], (int) $_GET["tref_id"], $cur_basic_skill_id);
604 
605  $tpl->setContent($tab->getHTML());
606 
607  }
608 
609 
616  function assignMaterial()
617  {
618  global $tpl, $ilUser, $ilCtrl, $ilTabs, $lng, $ilSetting;
619 
620  if(!$ilSetting->get("disable_personal_workspace"))
621  {
622  ilUtil::sendInfo($lng->txt("skmg_ass_materials_from_workspace")." » <a href='ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace'>".$lng->txt("personal_workspace")."</a>");
623  }
624 
625  $ilCtrl->saveParameter($this, "skill_id");
626  $ilCtrl->saveParameter($this, "level_id");
627  $ilCtrl->saveParameter($this, "tref_id");
628  $ilCtrl->saveParameter($this, "basic_skill_id");
629 
630  $ilTabs->setBackTarget($lng->txt("back"),
631  $ilCtrl->getLinkTarget($this, "assignMaterials"));
632 
633  // get ws tree
634  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
635  $tree = new ilWorkspaceTree($ilUser->getId());
636 
637  // get access handler
638  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
639  $acc_handler = new ilWorkspaceAccessHandler($tree);
640 
641  // get es explorer
642  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorer.php");
644  'skill_wspexpand', $tree, $acc_handler);
645  $exp->setTargetGet('wsp_id');
646  $exp->setFiltered(false);
647  $exp->removeAllFormItemTypes();
648  $exp->addFormItemForType("file");
649  $exp->addFormItemForType("tstv");
650  $exp->addFormItemForType("excv");
651 
652  if($_GET['skill_wspexpand'] == '')
653  {
654  // not really used as session is already set [see above]
655  $expanded = $tree->readRootId();
656  }
657  else
658  {
659  $expanded = $_GET['skill_wspexpand'];
660  }
661  $exp->setCheckedItems(array((int)$_POST['wsp_id']));
662  $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'assignMaterial'));
663  $exp->setPostVar('wsp_id[]');
664  $exp->setExpand($expanded);
665  $exp->setOutput(0);
666 
667  // fill template
668  $mtpl = new ilTemplate("tpl.materials_selection.html", true, true, "Services/Skill");
669  $mtpl->setVariable("EXP", $exp->getOutput());
670 
671  // toolbars
672  $tb = new ilToolbarGUI();
673  $tb->addFormButton($lng->txt("select"),
674  "selectMaterial");
675  $tb->setFormAction($ilCtrl->getFormAction($this));
676  $tb->setOpenFormTag(true);
677  $tb->setCloseFormTag(false);
678  $mtpl->setVariable("TOOLBAR1", $tb->getHTML());
679  $tb->setOpenFormTag(false);
680  $tb->setCloseFormTag(true);
681  $mtpl->setVariable("TOOLBAR2", $tb->getHTML());
682 
683  $tpl->setContent($mtpl->get());
684  }
685 
689  function selectMaterial()
690  {
691  global $ilUser, $ilCtrl, $lng;
692 
693  include_once("./Services/Skill/classes/class.ilPersonalSkill.php");
694  if (is_array($_POST["wsp_id"]))
695  {
696  foreach ($_POST["wsp_id"] as $w)
697  {
698  ilPersonalSkill::assignMaterial($ilUser->getId(), (int) $_GET["skill_id"],
699  (int) $_GET["tref_id"],
700  (int) $_GET["basic_skill_id"], (int) $_GET["level_id"], (int) $w);
701  }
702  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
703  }
704 
705  $ilCtrl->saveParameter($this, "skill_id");
706  $ilCtrl->saveParameter($this, "level_id");
707  $ilCtrl->saveParameter($this, "tref_id");
708  $ilCtrl->saveParameter($this, "basic_skill_id");
709 
710  $ilCtrl->redirect($this, "assignMaterials");
711  }
712 
713 
717  function removeMaterial()
718  {
719  global $ilUser, $lng, $ilCtrl;
720 
721  ilPersonalSkill::removeMaterial($ilUser->getId(), (int) $_GET["tref_id"],
722  (int) $_GET["level_id"],
723  (int) $_GET["wsp_id"]);
724  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
725  $ilCtrl->redirect($this, "assignMaterials");
726  }
727 
728 
729  //
730  // Self evaluation
731  //
732 
739  function selfEvaluation()
740  {
741  global $ilTabs, $lng, $ilCtrl, $tpl, $ilToolbar;
742 
743  $ilTabs->setBackTarget($lng->txt("back"),
744  $ilCtrl->getLinkTarget($this, "listSkills"));
745 
746  $ilCtrl->saveParameter($this, "skill_id");
747  $ilCtrl->saveParameter($this, "basic_skill_id");
748  $ilCtrl->saveParameter($this, "tref_id");
749 
750  include_once("./Services/Skill/classes/class.ilSkillTreeNode.php");
751  $tpl->setTitle(ilSkillTreeNode::_lookupTitle((int) $_GET["skill_id"]));
752  $tpl->setTitleIcon(ilUtil::getImagePath("icon_".
753  ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]).
754  ".svg"));
755 
756  // basic skill selection
757  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
758  $vtree = new ilVirtualSkillTree();
759  $tref_id = 0;
760  $skill_id = (int) $_GET["skill_id"];
761  if (ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) == "sktr")
762  {
763  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
764  $tref_id = $_GET["skill_id"];
765  $skill_id = ilSkillTemplateReference::_lookupTemplateId($_GET["skill_id"]);
766  }
767  $bs = $vtree->getSubTreeForCSkillId($skill_id.":".$tref_id, true);
768 
769 
770  $options = array();
771  foreach ($bs as $b)
772  {
773  $options[$b["skill_id"]] = ilSkillTreeNode::_lookupTitle($b["skill_id"]);
774  }
775 
776  $cur_basic_skill_id = ((int) $_POST["basic_skill_id"] > 0)
777  ? (int) $_POST["basic_skill_id"]
778  : (((int) $_GET["basic_skill_id"] > 0)
779  ? (int) $_GET["basic_skill_id"]
780  : key($options));
781 
782  $ilCtrl->setParameter($this, "basic_skill_id", $cur_basic_skill_id);
783 
784  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
785  $si = new ilSelectInputGUI($lng->txt("skmg_skill"), "basic_skill_id");
786  $si->setOptions($options);
787  $si->setValue($cur_basic_skill_id);
788  $ilToolbar->addInputItem($si, true);
789  $ilToolbar->addFormButton($lng->txt("select"),
790  "selfEvaluation");
791 
792  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
793 
794  // table
795  include_once("./Services/Skill/classes/class.ilSelfEvaluationSimpleTableGUI.php");
796  $tab = new ilSelfEvaluationSimpleTableGUI($this, "selfEvaluation",
797  (int) $_GET["skill_id"], (int) $_GET["tref_id"], $cur_basic_skill_id);
798 
799  $tpl->setContent($tab->getHTML());
800 
801  }
802 
807  {
808  global $ilUser, $lng, $ilCtrl;
809 
810  ilPersonalSkill::saveSelfEvaluation($ilUser->getId(), (int) $_GET["skill_id"],
811  (int) $_GET["tref_id"], (int) $_GET["basic_skill_id"], (int) $_POST["se"]);
812  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
813 
814 /* $ilCtrl->saveParameter($this, "skill_id");
815  $ilCtrl->saveParameter($this, "level_id");
816  $ilCtrl->saveParameter($this, "tref_id");
817  $ilCtrl->saveParameter($this, "basic_skill_id");*/
818 
819  $ilCtrl->redirect($this, "listSkills");
820 
821  }
822 
829  function listSkillsForAdd()
830  {
831  global $ilUser, $tpl, $ilCtrl, $lng, $ilTabs;
832 
833  $ilTabs->setBackTarget($lng->txt("back"),
834  $ilCtrl->getLinkTarget($this, ""));
835 
836  include_once("./Services/Skill/classes/class.ilPersonalSkillExplorerGUI.php");
837  $exp = new ilPersonalSkillExplorerGUI($this, "listSkillsForAdd", $this, "addSkill");
838  if ($exp->getHasSelectableNodes())
839  {
840  if (!$exp->handleCommand())
841  {
842  $tpl->setContent($exp->getHTML());
843  }
844  ilUtil::sendInfo($lng->txt("skmg_select_skill"));
845  }
846  else
847  {
848  ilUtil::sendInfo($lng->txt("skmg_no_nodes_selectable"));
849  }
850  }
851 
858  function listProfiles()
859  {
860  global $ilCtrl, $ilToolbar, $ilUser, $lng, $tpl;
861 
862  $profiles = ilSkillProfile::getProfilesOfUser($ilUser->getId());
863 
864  if (count($profiles) == 0)
865  {
866  return;
867  }
868 
869  // select profiles
870  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
871  $options = array();
872  foreach ($profiles as $p)
873  {
874  $options[$p["id"]] = $p["title"];
875  }
876 
877  if (!isset($options[$_GET["profile_id"]]))
878  {
879  $_GET["profile_id"] = (int) key($options);
880  $ilCtrl->setParameter($this, "profile_id", $_GET["profile_id"]);
881  }
882  $current_profile_id = $_GET["profile_id"];
883 
884  $si = new ilSelectInputGUI($lng->txt("skmg_profile"), "");
885  $si->setOptions($options);
886  $si->setValue($current_profile_id);
887  $ilToolbar->addInputItem($si, true);
888  $ilToolbar->addFormButton($lng->txt("select"),
889  "selectProfile");
890  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
891 
892  $this->setProfileId($current_profile_id);
893 
894  $tpl->setContent($this->getGapAnalysisHTML());
895  }
896 
902  function setGapAnalysisActualStatusModePerType($a_type, $a_cat_title = "")
903  {
904  $this->gap_mode = "max_per_type";
905  $this->gap_mode_type = $a_type;
906  $this->gap_cat_title = $a_cat_title;
907  $this->mode = "gap";
908  }
909 
915  function setGapAnalysisActualStatusModePerObject($a_obj_id, $a_cat_title = "")
916  {
917  $this->gap_mode = "max_per_object";
918  $this->gap_mode_obj_id = $a_obj_id;
919  $this->gap_cat_title = $a_cat_title;
920  $this->mode = "gap";
921  }
922 
929  function getGapAnalysisHTML($a_user_id = 0, $a_skills = null)
930  {
931  global $ilUser, $lng;
932 
933 // $this->setTabs("list_skills");
934 
935  if ($a_user_id == 0)
936  {
937  $user_id = $ilUser->getId();
938  }
939  else
940  {
941  $user_id = $a_user_id;
942  }
943 
944  $skills = array();
945  if ($this->getProfileId() > 0)
946  {
947  $profile = new ilSkillProfile($this->getProfileId());
948  $this->profile_levels = $profile->getSkillLevels();
949 
950  foreach ($this->profile_levels as $l)
951  {
952  $skills[] = array(
953  "base_skill_id" => $l["base_skill_id"],
954  "tref_id" => $l["tref_id"],
955  "level_id" => $l["level_id"]
956  );
957  }
958  }
959  else if (is_array($a_skills))
960  {
961  $skills = $a_skills;
962  }
963 
964  // get actual levels for gap analysis
965  $this->actual_levels = array();
966  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
967  foreach ($skills as $sk)
968  {
969  $bs = new ilBasicSkill($sk["base_skill_id"]);
970  if ($this->gap_mode == "max_per_type")
971  {
972  $max = $bs->getMaxLevelPerType($sk["tref_id"], $this->gap_mode_type, $user_id);
973  $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
974  }
975  else if ($this->gap_mode == "max_per_object")
976  {
977  $max = $bs->getMaxLevelPerObject($sk["tref_id"], $this->gap_mode_obj_id, $user_id);
978  $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
979  }
980  }
981 
982  $incl_self_eval = false;
983  if (count($this->getGapAnalysisSelfEvalLevels() > 0))
984  {
985  $incl_self_eval = true;
986  $self_vals = $this->getGapAnalysisSelfEvalLevels();
987  }
988 
989  // output spider stuff
990  if (count($skills) >= 3)
991  {
992  $max_cnt = 0;
993  $leg_labels = array();
994 //var_dump($this->profile_levels);
995  //foreach ($this->profile_levels as $k => $l)
996 
997  // write target, actual and self counter to skill array
998  foreach ($skills as $k => $l)
999  {
1000  //$bs = new ilBasicSkill($l["base_skill_id"]);
1001  $bs = new ilBasicSkill($l["base_skill_id"]);
1002  $leg_labels[] = ilBasicSkill::_lookupTitle($l["base_skill_id"] , $l["tref_id"]);
1003  $levels = $bs->getLevelData();
1004  $cnt = 0;
1005  foreach ($levels as $lv)
1006  {
1007  $cnt++;
1008  if ($l["level_id"] == $lv["id"])
1009  {
1010  $skills[$k]["target_cnt"] = $cnt;
1011  }
1012  if ($this->actual_levels[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"])
1013  {
1014  $skills[$k]["actual_cnt"] = $cnt;
1015  }
1016  if ($incl_self_eval)
1017  {
1018  if ($self_vals[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"])
1019  {
1020  $skills[$k]["self_cnt"] = $cnt;
1021  }
1022  }
1023  $max_cnt = max($max_cnt, $cnt);
1024  }
1025  }
1026 
1027 // $leg_labels = array("AAAAA", "BBBBB", "CCCCC");
1028 
1029 //var_dump($this->profile_levels);
1030 //var_dump($this->actual_levels);
1031 
1032  include_once("./Services/Chart/classes/class.ilChart.php");
1033  $chart = ilChart::getInstanceByType(ilChart::TYPE_SPIDER, "gap_chart");
1034  $chart->setsize(800, 300);
1035  $chart->setYAxisMax($max_cnt);
1036  $chart->setLegLabels($leg_labels);
1037 
1038  // target level
1039  $cd = $chart->getDataInstance();
1040  $cd->setLabel($lng->txt("skmg_target_level"));
1041  $cd->setFill(true, "#A0A0A0");
1042 
1043  // other users
1044  $cd2 = $chart->getDataInstance();
1045  if ($this->gap_cat_title != "")
1046  {
1047  $cd2->setLabel($this->gap_cat_title);
1048  }
1049  else if ($this->gap_mode == "max_per_type")
1050  {
1051  $cd2->setLabel($lng->txt("objs_".$this->gap_mode_type));
1052  }
1053  else if ($this->gap_mode == "max_per_object")
1054  {
1055  $cd2->setLabel(ilObject::_lookupTitle($this->gap_mode_obj_id));
1056  }
1057  $cd2->setFill(true, "#8080FF");
1058 
1059  // self evaluation
1060  if ($incl_self_eval)
1061  {
1062  $cd3 = $chart->getDataInstance();
1063  $cd3->setLabel($lng->txt("skmg_self_evaluation"));
1064  $cd3->setFill(true, "#FF8080");
1065  }
1066 
1067  // fill in data
1068  $cnt = 0;
1069  foreach ($skills as $pl)
1070  {
1071  $cd->addPoint($cnt, (int) $pl["target_cnt"]);
1072  $cd2->addPoint($cnt, (int) $pl["actual_cnt"]);
1073  if ($incl_self_eval)
1074  {
1075  $cd3->addPoint($cnt, (int) $pl["self_cnt"]);
1076  }
1077  $cnt++;
1078  }
1079 
1080  // add data to chart
1081  if ($this->getProfileId() > 0)
1082  {
1083  $chart->addData($cd);
1084  }
1085  $chart->addData($cd2);
1086  if ($incl_self_eval && count($this->getGapAnalysisSelfEvalLevels()) > 0)
1087  {
1088  $chart->addData($cd3);
1089  }
1090 
1091  $lg = new ilChartLegend();
1092  $chart->setLegend($lg);
1093 
1094  $chart_html = $chart->getHTML();
1095 
1096  include_once("./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
1097  $pan = ilPanelGUI::getInstance();
1098  $pan->setPanelStyle(ilPanelGUI::PANEL_STYLE_PRIMARY);
1099  $pan->setBody($chart_html);
1100  $chart_html = $pan->getHTML();
1101  }
1102 
1103  $stree = new ilSkillTree();
1104  $html = "";
1105  foreach ($skills as $s)
1106  {
1107  $path = $stree->getSkillTreePath($s["base_skill_id"]);
1108 
1109  // check draft
1110  foreach ($path as $p)
1111  {
1112  if ($p["status"] == ilSkillTreeNode::STATUS_DRAFT)
1113  {
1114  continue(2);
1115  }
1116  }
1117  $html.= $this->getSkillHTML($s["base_skill_id"], $user_id, false, $s["tref_id"]);
1118  }
1119 
1120  // list skills
1121 // include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
1122 // $sktab = new ilPersonalSkillTableGUI($this, "listSkills");
1123 
1124  return $chart_html.$html;
1125  }
1126 
1133  function selectProfile()
1134  {
1135  global $ilCtrl;
1136 
1137  $ilCtrl->setParameter($this, "profile_id", $_GET["profile_id"]);
1138  $ilCtrl->redirect($this, "listProfiles");
1139  }
1140 
1147  function renderSelfEvaluationRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1148  {
1149  global $ilUser, $lng;
1150 
1151  if ($a_user_id == 0)
1152  {
1153  $a_user_id = $ilUser->getId();
1154  }
1155 
1156  $se_date = ilPersonalSkill::getSelfEvaluationDate($a_user_id, $a_top_skill_id, $a_tref_id, $a_base_skill);
1157 
1158  $se_level = ilPersonalSkill::getSelfEvaluation($a_user_id,
1159  $a_top_skill_id, $a_tref_id, $a_base_skill);
1160  // check, if current self eval level is in current level data
1161  $valid_sel_level = false;
1162  if ($se_level > 0)
1163  {
1164  foreach ($a_levels as $k => $v)
1165  {
1166  if ($v["id"] == $se_level)
1167  {
1168  $valid_sel_level = true;
1169  }
1170  }
1171  }
1172  reset($a_levels);
1173  $found = false;
1174  foreach ($a_levels as $k => $v)
1175  {
1176  $a_tpl->setCurrentBlock("val_level_td");
1177  if ($valid_sel_level && $v["id"] == $se_level)
1178  {
1179  $a_tpl->setVariable("VAL_LEVEL", "x");
1180  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1181  }
1182  else
1183  {
1184  $a_tpl->setVariable("VAL_LEVEL", " ");
1185  }
1186  $a_tpl->parseCurrentBlock();
1187  /*if ($v["id"] == $se_level)
1188  {
1189  $found = true;
1190  }*/
1191  }
1192 
1193  $a_tpl->setCurrentBlock("value_row");
1195  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_self_evaluation").
1196  ", ".ilDatePresentation::formatDate(new ilDateTime($se_date, IL_CAL_DATETIME)));
1198  $a_tpl->parseCurrentBlock();
1199  }
1200 
1207  function renderMaterialsRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1208  {
1209  global $ilUser, $lng;
1210 
1211  if ($a_user_id == 0)
1212  {
1213  $a_user_id = $ilUser->getId();
1214  }
1215 
1216  $got_mat = false;
1217  foreach ($a_levels as $v)
1218  {
1219  $mat_cnt = ilPersonalSkill::countAssignedMaterial($a_user_id,
1220  $a_tref_id, $v["id"]);
1221  if ($mat_cnt > 0)
1222  {
1223  $got_mat = true;
1224  }
1225  }
1226  if (!$got_mat)
1227  {
1228  return;
1229  }
1230 
1231  foreach ($a_levels as $k => $v)
1232  {
1233  $mat_cnt = ilPersonalSkill::countAssignedMaterial($a_user_id,
1234  $a_tref_id, $v["id"]);
1235  if ($mat_cnt == 0)
1236  {
1237  $a_tpl->setCurrentBlock("val_level_td");
1238  $a_tpl->setVariable("VAL_LEVEL", " ");
1239  $a_tpl->parseCurrentBlock();
1240  }
1241  else
1242  {
1243  // links to material files
1244  $a_tpl->setCurrentBlock("level_link");
1245 
1246  $mat_tt = array();
1247  $cnt = 1;
1248  foreach(ilPersonalSkill::getAssignedMaterial($a_user_id,
1249  $a_tref_id, $v["id"]) as $item)
1250  {
1251  $mat_data = $this->getMaterialInfo($item["wsp_id"], $a_user_id);
1252  $a_tpl->setVariable("HREF_LINK", $mat_data[1]);
1253  $a_tpl->setVariable("TXT_LINK", $cnt);
1254 
1255  // tooltip
1256  $mat_tt_id = "skmg_skl_tt_mat_".self::$skill_tt_cnt;
1257  self::$skill_tt_cnt++;
1258  $a_tpl->setVariable("LEVEL_LINK_ID", $mat_tt_id);
1259 
1260  if(!$this->offline_mode)
1261  {
1262  ilTooltipGUI::addTooltip($mat_tt_id, $mat_data[0]);
1263  }
1264  else
1265  {
1266  $this->tooltips[] = ilTooltipGUI::getTooltip($mat_tt_id, $mat_data[0]);
1267  }
1268 
1269  $a_tpl->parseCurrentBlock();
1270  $cnt++;
1271  }
1272 
1273  $a_tpl->setCurrentBlock("val_level_td");
1274  $a_tpl->setVariable("TD_CLASS", "ilSkillMat");
1275  $a_tpl->parseCurrentBlock();
1276  }
1277  }
1278 
1279  $a_tpl->setCurrentBlock("value_row");
1280  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_material"));
1281  $a_tpl->parseCurrentBlock();
1282  }
1283 
1290  function renderProfileTargetRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1291  {
1292  global $ilUser, $lng;
1293 
1294  if ($a_user_id == 0)
1295  {
1296  $a_user_id = $ilUser->getId();
1297  }
1298 
1299  $profile = new ilSkillProfile($this->getProfileId());
1300  $profile_levels = $profile->getSkillLevels();
1301 
1302  foreach ($a_levels as $k => $v)
1303  {
1304  $a_tpl->setCurrentBlock("val_level_td");
1305  $target_level = false;
1306  foreach ($profile_levels as $pl)
1307  {
1308  if ($pl["level_id"] == $v["id"] &&
1309  $pl["base_skill_id"] == $v["skill_id"] &&
1310  $a_tref_id == $pl["tref_id"])
1311  {
1312  $target_level = true;
1313  $current_target_level = $v["id"];
1314  }
1315  }
1316  if ($target_level)
1317  {
1318  $too_low = true;
1319  $a_tpl->setVariable("VAL_LEVEL", "x");
1320  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1321  }
1322  else
1323  {
1324  $a_tpl->setVariable("VAL_LEVEL", " ");
1325  }
1326  $a_tpl->parseCurrentBlock();
1327  }
1328 
1329  $a_tpl->setCurrentBlock("value_row");
1330  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_target_level"));
1331  $a_tpl->parseCurrentBlock();
1332  }
1333 
1340  function renderActualLevelsRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1341  {
1342  global $ilUser, $lng;
1343 
1344  if ($a_user_id == 0)
1345  {
1346  $a_user_id = $ilUser->getId();
1347  }
1348 
1349  $profile = new ilSkillProfile($this->getProfileId());
1350  $profile_levels = $profile->getSkillLevels();
1351 
1352  foreach ($a_levels as $k => $v)
1353  {
1354  $a_tpl->setCurrentBlock("val_level_td");
1355  $survey_level = false;
1356  if ($this->actual_levels[$v["skill_id"]][$a_tref_id] == $v["id"])
1357  {
1358  $survey_level = true;
1359  $too_low = false;
1360  }
1361  if ($survey_level)
1362  {
1363  $a_tpl->setVariable("VAL_LEVEL", "x");
1364  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1365  }
1366  else
1367  {
1368  $a_tpl->setVariable("VAL_LEVEL", " ");
1369  }
1370  $a_tpl->parseCurrentBlock();
1371  }
1372 
1373  $a_tpl->setCurrentBlock("value_row");
1374  if ($this->gap_cat_title != "")
1375  {
1376  $a_tpl->setVariable("TXT_VAL_TITLE", $this->gap_cat_title);
1377  }
1378  else if ($this->gap_mode == "max_per_type")
1379  {
1380  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("objs_".$this->gap_mode_type));
1381  }
1382  else if ($this->gap_mode == "max_per_object")
1383  {
1384  $a_tpl->setVariable("TXT_VAL_TITLE", ilObject::_lookupTitle($this->gap_mode_obj_id));
1385  }
1386 
1387  $a_tpl->parseCurrentBlock();
1388  }
1389 
1396  function renderGapSelfEvalRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0)
1397  {
1398  global $ilUser, $lng;
1399 
1400  if ($a_user_id == 0)
1401  {
1402  $a_user_id = $ilUser->getId();
1403  }
1404 
1405  $self_vals = $this->getGapAnalysisSelfEvalLevels();
1406  if (count($self_vals) == 0)
1407  {
1408  return;
1409  }
1410 
1411  foreach ($a_levels as $k => $v)
1412  {
1413  $a_tpl->setCurrentBlock("val_level_td");
1414  $survey_level = false;
1415  if ($self_vals[$v["skill_id"]][$a_tref_id] == $v["id"])
1416  {
1417  $survey_level = true;
1418  }
1419  if ($survey_level)
1420  {
1421  $a_tpl->setVariable("VAL_LEVEL", "x");
1422  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1423  }
1424  else
1425  {
1426  $a_tpl->setVariable("VAL_LEVEL", " ");
1427  }
1428  $a_tpl->parseCurrentBlock();
1429  }
1430 
1431  $a_tpl->setCurrentBlock("value_row");
1432  $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_self_evaluation"));
1433 
1434  $a_tpl->parseCurrentBlock();
1435  }
1436 
1443  function renderObjectEvalRow($a_tpl, $a_levels, $a_level_entry)
1444  {
1445  global $lng;
1446 
1447  $se_level = $a_level_entry["level_id"];
1448 
1449  // check, if current self eval level is in current level data
1450  $valid_sel_level = false;
1451  if ($se_level > 0)
1452  {
1453  foreach ($a_levels as $k => $v)
1454  {
1455  if ($v["id"] == $se_level)
1456  {
1457  $valid_sel_level = true;
1458  }
1459  }
1460  }
1461  reset($a_levels);
1462  $found = false;
1463  foreach ($a_levels as $k => $v)
1464  {
1465  $a_tpl->setCurrentBlock("val_level_td");
1466  if ($valid_sel_level && $v["id"] == $se_level)
1467  {
1468  $a_tpl->setVariable("VAL_LEVEL", "x");
1469  $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
1470  }
1471  else
1472  {
1473  $a_tpl->setVariable("VAL_LEVEL", " ");
1474  }
1475  $a_tpl->parseCurrentBlock();
1476  /*if ($v["id"] == $se_level)
1477  {
1478  $found = true;
1479  }*/
1480  }
1481 
1482  $a_tpl->setCurrentBlock("value_row");
1484  if ($a_level_entry["self_eval"] == 1 && $a_level_entry["trigger_obj_id"] == 0)
1485  {
1486  $title = $lng->txt("skmg_self_evaluation");
1487  }
1488  else
1489  {
1490  $title = ($a_level_entry["trigger_obj_id"] > 0 && $a_level_entry["self_eval"] == 1)
1491  ? $a_level_entry["trigger_title"]." (".$lng->txt("skmg_self_evaluation").")"
1492  : $a_level_entry["trigger_title"];
1493  }
1494 
1495  $a_tpl->setVariable("TXT_VAL_TITLE", $title.
1496  ", ".ilDatePresentation::formatDate(new ilDateTime($a_level_entry["status_date"], IL_CAL_DATETIME)));
1498  $a_tpl->parseCurrentBlock();
1499  }
1500 
1507  function renderSuggestedResources($a_tpl, $a_levels, $a_base_skill, $a_tref_id)
1508  {
1509  global $lng;
1510 
1511  // use a profile
1512  if ($this->getProfileId() > 0)
1513  {
1514  $profile = new ilSkillProfile($this->getProfileId());
1515  $profile_levels = $profile->getSkillLevels();
1516 
1517  $too_low = true;
1518  $current_target_level = 0;
1519 
1520 
1521  foreach ($a_levels as $k => $v)
1522  {
1523  foreach ($this->profile_levels as $pl)
1524  {
1525  if ($pl["level_id"] == $v["id"] &&
1526  $pl["base_skill_id"] == $v["skill_id"])
1527  {
1528  $too_low = true;
1529  $current_target_level = $v["id"];
1530  }
1531  }
1532 
1533  if ($this->actual_levels[$v["skill_id"]][0] == $v["id"])
1534  {
1535  $too_low = false;
1536  }
1537  }
1538 
1539  // suggested resources
1540  if ($too_low)
1541  {
1542  include_once("./Services/Skill/classes/class.ilSkillResources.php");
1543  $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
1544  $res = $skill_res->getResources();
1545  $imp_resources = array();
1546  foreach ($res as $level)
1547  {
1548  foreach($level as $r)
1549  {
1550  if ($r["imparting"] == true &&
1551  $current_target_level == $r["level_id"])
1552  {
1553  $imp_resources[] = $r;
1554  }
1555  }
1556  }
1557  foreach($imp_resources as $r)
1558  {
1559  $ref_id = $r["rep_ref_id"];
1560  $obj_id = ilObject::_lookupObjId($ref_id);
1561  $title = ilObject::_lookupTitle($obj_id);
1562  include_once("./Services/Link/classes/class.ilLink.php");
1563  $a_tpl->setCurrentBlock("resource_item");
1564  $a_tpl->setVariable("TXT_RES", $title);
1565  $a_tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
1566  $a_tpl->parseCurrentBlock();
1567  }
1568  if (count($imp_resources) > 0)
1569  {
1570  $a_tpl->touchBlock("resources_list");
1571  $a_tpl->setCurrentBlock("resources");
1572  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_res"));
1573  $a_tpl->parseCurrentBlock();
1574  }
1575  else
1576  {
1577  $a_tpl->setCurrentBlock("resources");
1578  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_no_res"));
1579  $a_tpl->parseCurrentBlock();
1580  }
1581  }
1582  else
1583  {
1584  $a_tpl->setCurrentBlock("resources");
1585  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_no_needs_impr"));
1586  $a_tpl->parseCurrentBlock();
1587  }
1588  }
1589  else
1590  {
1591  // no profile, just list all resources
1592  include_once("./Services/Skill/classes/class.ilSkillResources.php");
1593  $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
1594  $res = $skill_res->getResources();
1595  // add $r["level_id"] info
1596  $any = false;
1597  foreach ($res as $level)
1598  {
1599  $available = false;
1600  $cl = 0;
1601  foreach($level as $r)
1602  {
1603  if ($r["imparting"])
1604  {
1605  $ref_id = $r["rep_ref_id"];
1606  $obj_id = ilObject::_lookupObjId($ref_id);
1607  $title = ilObject::_lookupTitle($obj_id);
1608  include_once("./Services/Link/classes/class.ilLink.php");
1609  $a_tpl->setCurrentBlock("resource_item");
1610  $a_tpl->setVariable("TXT_RES", $title);
1611  $a_tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
1612  $a_tpl->parseCurrentBlock();
1613  $available = true;
1614  $any = true;
1615  $cl = $r["level_id"];
1616  }
1617  }
1618  if ($available)
1619  {
1620  $a_tpl->setCurrentBlock("resources_list_level");
1621  $a_tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level"));
1622  $a_tpl->setVariable("LEVEL_NAME", ilBasicSkill::lookupLevelTitle($cl));
1623  $a_tpl->parseCurrentBlock();
1624  $a_tpl->touchBlock("resources_list");
1625  }
1626  }
1627  if ($any)
1628  {
1629  $a_tpl->setCurrentBlock("resources");
1630  $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_suggested_resources"));
1631  $a_tpl->parseCurrentBlock();
1632  }
1633  }
1634  }
1635 
1636 }
1637 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
saveSelfEvaluation()
Save self evaluation.
print $file
renderSuggestedResources($a_tpl, $a_levels, $a_base_skill, $a_tref_id)
Render suggested resources.
const TYPE_SPIDER
setProfileId($a_val)
Set profile id.
$_POST['username']
Definition: cron.php:12
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
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.
setTabs($a_activate)
Set tabs.
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
static saveSelfEvaluation($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level)
Save self evaluation.
getGapAnalysisHTML($a_user_id=0, $a_skills=null)
Get gap analysis html.
addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
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
removeSkill($a_user_id, $a_skill_node_id)
Remove personal skill.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
assignMaterial()
Assign materials to skill level.
Personal skills GUI class.
static getProfilesOfUser($a_user_id)
Get profiles of a user.
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
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.
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.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
listSkillsForAdd()
LIst skills for adding.
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 $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
assignMaterials()
Assign materials to skill levels.
global $ilSetting
Definition: privfeed.php:40
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:40
$path
Definition: index.php:22
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.
Basic Skill.
confirmSkillRemove()
Confirm skill remove.
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.
$r
setGapAnalysisActualStatusModePerObject($a_obj_id, $a_cat_title="")
Set gap analysis actual status mode "per object".