ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6
16{
20 function __construct($a_parent_obj, $a_parent_cmd, $a_survey)
21 {
22 global $ilCtrl, $lng, $ilAccess, $lng;
23
24 $this->survey = $a_survey;
25
26 parent::__construct($a_parent_obj, $a_parent_cmd);
27 $this->getSkills();
28 $this->setTitle($lng->txt("survey_competences"));
29
30 include_once("./Services/Skill/classes/class.ilSkillTree.php");
31 $this->skill_tree = new ilSkillTree();
32
33 include_once("./Modules/Survey/classes/class.ilSurveySkillThresholds.php");
34 $this->skill_thres = new ilSurveySkillThresholds($a_survey);
35 $this->thresholds = $this->skill_thres->getThresholds();
36
37 $this->addColumn($this->lng->txt("survey_skill"));
38 $this->addColumn($this->lng->txt("survey_skill_nr_q"));
39 $this->addColumn($this->lng->txt("survey_skill_max_scale_points"));
40 $this->addColumn($this->lng->txt("survey_up_to_x_points"));
41 $this->addColumn($this->lng->txt("actions"));
42
43 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
44 $this->setRowTemplate("tpl.svy_skill_row.html", "Modules/Survey");
45
46 //$this->addMultiCommand("", $lng->txt(""));
47 //$this->addCommandButton("", $lng->txt(""));
48 }
49
56 function getSkills()
57 {
58 include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
59 $sskill = new ilSurveySkill($this->survey);
60 $opts = $sskill->getAllAssignedSkillsAsOptions();
61 $data = array();
62 foreach ($opts as $k => $o)
63 {
64 $v = explode(":", $k);
65
66 $question_ids = $sskill->getQuestionsForSkill($v[0], $v[1]);
67 $scale_sum = $sskill->determineMaxScale($v[0], $v[1]);
68
69 $data[] = array("title" => ilBasicSkill::_lookupTitle($v[0], $v[1]),
70 "base_skill" => $v[0],
71 "tref_id" => $v[1],
72 "nr_of_q" => count($question_ids),
73 "scale_sum" => $scale_sum
74 );
75 }
76
77 $this->setData($data);
78 }
79
80
84 protected function fillRow($a_set)
85 {
86 global $lng, $ilCtrl;
87
88 $ilCtrl->setParameter($this->parent_obj, "sk_id", $a_set["base_skill"]);
89 $ilCtrl->setParameter($this->parent_obj, "tref_id", $a_set["tref_id"]);
90
91 $this->tpl->setVariable("COMPETENCE",
92 ilBasicSkill::_lookupTitle($a_set["base_skill"], $a_set["tref_id"]));
93 $path = $this->skill_tree->getSkillTreePath($a_set["base_skill"], $a_set["tref_id"]);
94 $path_nodes = array();
95 foreach ($path as $p)
96 {
97 if ($p["child"] > 1 && $p["skill_id"] != $a_set["base_skill"])
98 {
99 $path_nodes[] = ilBasicSkill::_lookupTitle($p["skill_id"], $p["tref_id"]);
100 }
101 }
102 $this->tpl->setVariable("PATH", implode($path_nodes, " > "));
103
104
105
106 $this->tpl->setVariable("NR_OF_QUESTIONS", $a_set["nr_of_q"]);
107 $this->tpl->setVariable("MAX_SCALE_POINTS", $a_set["scale_sum"]);
108 $this->tpl->setVariable("CMD", $ilCtrl->getLinkTarget($this->parent_obj, "listSkillThresholds"));
109 $this->tpl->setVariable("ACTION", $lng->txt("edit"));
110
111 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
112 $bs = new ilBasicSkill($a_set["base_skill"]);
113 $ld = $bs->getLevelData();
114 foreach ($ld as $l)
115 {
116 $this->tpl->setCurrentBlock("points");
117 $this->tpl->setVariable("LEV", $l["title"]);
118
119 $tr = $this->thresholds[$l["id"]][$a_set["tref_id"]];
120 if ((int) $tr != 0)
121 {
122 $this->tpl->setVariable("THRESHOLD", (int) $tr);
123 }
124 else
125 {
126 $this->tpl->setVariable("THRESHOLD", "");
127 }
128 $this->tpl->parseCurrentBlock();
129 }
130 }
131
132}
133?>
global $l
Definition: afr.php:30
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
TableGUI class for skill list in survey.
fillRow($a_set)
Fill table row.
__construct($a_parent_obj, $a_parent_cmd, $a_survey)
Constructor.
Skill tresholds for 360 surveys.
Skill/Competence handling in surveys.
Class ilTable2GUI.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22