ILIAS  release_7 Revision v7.30-3-g800a261c036
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
11{
15 public function __construct($a_parent_obj, $a_parent_cmd, $a_survey)
16 {
17 global $DIC;
18
19 $this->ctrl = $DIC->ctrl();
20 $this->lng = $DIC->language();
21 $ilCtrl = $DIC->ctrl();
22 $lng = $DIC->language();
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 $this->skill_tree = new ilSkillTree();
31
32 $this->skill_thres = new ilSurveySkillThresholds($a_survey);
33 $this->thresholds = $this->skill_thres->getThresholds();
34
35 $this->addColumn($this->lng->txt("survey_skill"));
36 $this->addColumn($this->lng->txt("survey_skill_nr_q"));
37 $this->addColumn($this->lng->txt("survey_skill_max_scale_points"));
38 $this->addColumn($this->lng->txt("survey_up_to_x_points"));
39 $this->addColumn($this->lng->txt("actions"));
40
41 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
42 $this->setRowTemplate("tpl.svy_skill_row.html", "Modules/Survey");
43
44 //$this->addMultiCommand("", $lng->txt(""));
45 //$this->addCommandButton("", $lng->txt(""));
46 }
47
54 public function getSkills()
55 {
56 $sskill = new ilSurveySkill($this->survey);
57 $opts = $sskill->getAllAssignedSkillsAsOptions();
58 $data = array();
59 foreach ($opts as $k => $o) {
60 $v = explode(":", $k);
61
62 $question_ids = $sskill->getQuestionsForSkill($v[0], $v[1]);
63 $scale_sum = $sskill->determineMaxScale($v[0], $v[1]);
64
65 $data[] = array("title" => ilBasicSkill::_lookupTitle($v[0], $v[1]),
66 "base_skill" => $v[0],
67 "tref_id" => $v[1],
68 "nr_of_q" => count($question_ids),
69 "scale_sum" => $scale_sum
70 );
71 }
72
73 $this->setData($data);
74 }
75
76
80 protected function fillRow($a_set)
81 {
83 $ilCtrl = $this->ctrl;
84
85 $ilCtrl->setParameter($this->parent_obj, "sk_id", $a_set["base_skill"]);
86 $ilCtrl->setParameter($this->parent_obj, "tref_id", $a_set["tref_id"]);
87
88 $this->tpl->setVariable(
89 "COMPETENCE",
90 ilBasicSkill::_lookupTitle($a_set["base_skill"], $a_set["tref_id"])
91 );
92 $path = $this->skill_tree->getSkillTreePath($a_set["base_skill"], $a_set["tref_id"]);
93 $path_nodes = array();
94 foreach ($path as $p) {
95 if ($p["child"] > 1 && $p["skill_id"] != $a_set["base_skill"]) {
96 $path_nodes[] = ilBasicSkill::_lookupTitle($p["skill_id"], $p["tref_id"]);
97 }
98 }
99 $this->tpl->setVariable("PATH", implode(" > ", $path_nodes));
100
101
102
103 $this->tpl->setVariable("NR_OF_QUESTIONS", $a_set["nr_of_q"]);
104 $this->tpl->setVariable("MAX_SCALE_POINTS", $a_set["scale_sum"]);
105 $this->tpl->setVariable("CMD", $ilCtrl->getLinkTarget($this->parent_obj, "listSkillThresholds"));
106 $this->tpl->setVariable("ACTION", $lng->txt("edit"));
107
108 $bs = new ilBasicSkill($a_set["base_skill"]);
109 $ld = $bs->getLevelData();
110 foreach ($ld as $l) {
111 $this->tpl->setCurrentBlock("points");
112 $this->tpl->setVariable("LEV", $l["title"]);
113
114 $tr = $this->thresholds[$l["id"]][$a_set["tref_id"]];
115 if ((int) $tr != 0) {
116 $this->tpl->setVariable("THRESHOLD", (int) $tr);
117 } else {
118 $this->tpl->setVariable("THRESHOLD", "");
119 }
120 $this->tpl->parseCurrentBlock();
121 }
122 }
123}
An exception for terminatinating execution or to throw for unit testing.
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.
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.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc