ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSurveySkillTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
20  public function __construct($a_parent_obj, $a_parent_cmd, $a_survey)
21  {
22  global $DIC;
23 
24  $this->ctrl = $DIC->ctrl();
25  $this->lng = $DIC->language();
26  $ilCtrl = $DIC->ctrl();
27  $lng = $DIC->language();
28 
29  $this->survey = $a_survey;
30 
31  parent::__construct($a_parent_obj, $a_parent_cmd);
32  $this->getSkills();
33  $this->setTitle($lng->txt("survey_competences"));
34 
35  include_once("./Services/Skill/classes/class.ilSkillTree.php");
36  $this->skill_tree = new ilSkillTree();
37 
38  include_once("./Modules/Survey/classes/class.ilSurveySkillThresholds.php");
39  $this->skill_thres = new ilSurveySkillThresholds($a_survey);
40  $this->thresholds = $this->skill_thres->getThresholds();
41 
42  $this->addColumn($this->lng->txt("survey_skill"));
43  $this->addColumn($this->lng->txt("survey_skill_nr_q"));
44  $this->addColumn($this->lng->txt("survey_skill_max_scale_points"));
45  $this->addColumn($this->lng->txt("survey_up_to_x_points"));
46  $this->addColumn($this->lng->txt("actions"));
47 
48  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
49  $this->setRowTemplate("tpl.svy_skill_row.html", "Modules/Survey");
50 
51  //$this->addMultiCommand("", $lng->txt(""));
52  //$this->addCommandButton("", $lng->txt(""));
53  }
54 
61  public function getSkills()
62  {
63  include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
64  $sskill = new ilSurveySkill($this->survey);
65  $opts = $sskill->getAllAssignedSkillsAsOptions();
66  $data = array();
67  foreach ($opts as $k => $o) {
68  $v = explode(":", $k);
69 
70  $question_ids = $sskill->getQuestionsForSkill($v[0], $v[1]);
71  $scale_sum = $sskill->determineMaxScale($v[0], $v[1]);
72 
73  $data[] = array("title" => ilBasicSkill::_lookupTitle($v[0], $v[1]),
74  "base_skill" => $v[0],
75  "tref_id" => $v[1],
76  "nr_of_q" => count($question_ids),
77  "scale_sum" => $scale_sum
78  );
79  }
80 
81  $this->setData($data);
82  }
83 
84 
88  protected function fillRow($a_set)
89  {
90  $lng = $this->lng;
92 
93  $ilCtrl->setParameter($this->parent_obj, "sk_id", $a_set["base_skill"]);
94  $ilCtrl->setParameter($this->parent_obj, "tref_id", $a_set["tref_id"]);
95 
96  $this->tpl->setVariable(
97  "COMPETENCE",
98  ilBasicSkill::_lookupTitle($a_set["base_skill"], $a_set["tref_id"])
99  );
100  $path = $this->skill_tree->getSkillTreePath($a_set["base_skill"], $a_set["tref_id"]);
101  $path_nodes = array();
102  foreach ($path as $p) {
103  if ($p["child"] > 1 && $p["skill_id"] != $a_set["base_skill"]) {
104  $path_nodes[] = ilBasicSkill::_lookupTitle($p["skill_id"], $p["tref_id"]);
105  }
106  }
107  $this->tpl->setVariable("PATH", implode($path_nodes, " > "));
108 
109 
110 
111  $this->tpl->setVariable("NR_OF_QUESTIONS", $a_set["nr_of_q"]);
112  $this->tpl->setVariable("MAX_SCALE_POINTS", $a_set["scale_sum"]);
113  $this->tpl->setVariable("CMD", $ilCtrl->getLinkTarget($this->parent_obj, "listSkillThresholds"));
114  $this->tpl->setVariable("ACTION", $lng->txt("edit"));
115 
116  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
117  $bs = new ilBasicSkill($a_set["base_skill"]);
118  $ld = $bs->getLevelData();
119  foreach ($ld as $l) {
120  $this->tpl->setCurrentBlock("points");
121  $this->tpl->setVariable("LEV", $l["title"]);
122 
123  $tr = $this->thresholds[$l["id"]][$a_set["tref_id"]];
124  if ((int) $tr != 0) {
125  $this->tpl->setVariable("THRESHOLD", (int) $tr);
126  } else {
127  $this->tpl->setVariable("THRESHOLD", "");
128  }
129  $this->tpl->parseCurrentBlock();
130  }
131  }
132 }
TableGUI class for skill list in survey.
global $DIC
Definition: saml.php:7
Skill tree.
__construct($a_parent_obj, $a_parent_cmd, $a_survey)
Constructor.
fillRow($a_set)
Fill table row.
global $ilCtrl
Definition: ilias.php:18
Skill/Competence handling in surveys.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Skill tresholds for 360 surveys.
Class ilTable2GUI.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $l
Definition: afr.php:30
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
Basic Skill.