ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSurveySkillAssignmentTableGUI.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->object = $a_survey;
25 include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
26 $this->skill_survey = new ilSurveySkill($a_survey);
27
28 include_once("./Services/Skill/classes/class.ilSkillTree.php");
29 $this->skill_tree = new ilSkillTree();
30
31 parent::__construct($a_parent_obj, $a_parent_cmd);
32 $this->getQuestions();
33 //$this->setTitle($lng->txt("survey_questions_to_skill_ass"));
34
35 $this->addColumn($this->lng->txt("question"));
36 $this->addColumn($this->lng->txt("survey_skill"));
37 $this->addColumn($this->lng->txt("actions"));
38
39 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
40 $this->setRowTemplate("tpl.svy_skill_ass_row.html", "Modules/Survey");
41
42// $this->addMultiCommand("", $lng->txt(""));
43// $this->addCommandButton("", $lng->txt(""));
44 }
45
52 function getQuestions()
53 {
54 global $ilCtrl, $lng;
55
56 $survey_questions = $this->object->getSurveyQuestions();
57
58 if (count($survey_questions) > 0)
59 {
60 $table_data = array();
61 $last_questionblock_id = $position = $block_position = 0;
62 foreach ($survey_questions as $question_id => $data)
63 {
64 // it is only possible to assign to a subset
65 // of question types: single choice(2)
66 $supported = false;
67 if (in_array($data["questiontype_fi"], array(2)))
68 {
69 $supported = true;
70 }
71
72 $id = $data["question_id"];
73
74 $table_data[$id] = array("id" => $id,
75 "type" => "question",
76 "supported" => $supported,
77 "heading" => $data["heading"],
78 "title" => $data["title"],
79 "description" => $data["description"],
80 "author" => $data["author"],
81 "obligatory" => (bool)$data["obligatory"]);
82
83 }
84 }
85 $this->setData($table_data);
86 }
87
88
92 protected function fillRow($a_set)
93 {
94 global $lng, $ilCtrl;
95
96 $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["id"]);
97
98 if ($a_set["supported"])
99 {
100 $this->tpl->setCurrentBlock("cmd");
101 $this->tpl->setVariable("HREF_CMD",
102 $ilCtrl->getLinkTarget($this->parent_obj,
103 "assignSkillToQuestion"));
104 $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_assign_competence"));
105 $this->tpl->parseCurrentBlock();
106
107 if ($s = $this->skill_survey->getSkillForQuestion($a_set["id"]))
108 {
109 $this->tpl->setCurrentBlock("cmd");
110 $this->tpl->setVariable("HREF_CMD",
111 $ilCtrl->getLinkTarget($this->parent_obj,
112 "removeSkillFromQuestion"));
113 $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_remove_competence"));
114 $this->tpl->parseCurrentBlock();
115
116 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
117 $this->tpl->setVariable("COMPETENCE",
118 ilBasicSkill::_lookupTitle($s["base_skill_id"], $s["tref_id"]));
119
120 //var_dump($a_set);
121 $path = $this->skill_tree->getSkillTreePath($s["base_skill_id"], $s["tref_id"]);
122 $path_nodes = array();
123 foreach ($path as $p)
124 {
125 if ($p["child"] > 1 && $p["skill_id"] != $s["base_skill_id"])
126 {
127 $path_nodes[] = ilBasicSkill::_lookupTitle($p["skill_id"], $p["tref_id"]);
128 }
129 }
130 $this->tpl->setVariable("PATH", implode($path_nodes, " > "));
131 $this->tpl->setVariable("COMP_ID", "comp_".$a_set["id"]);
132
133 /*include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
134 ilTooltipGUI::addTooltip("comp_".$a_set["id"],
135 ilBasicSkill::_lookupDescription($s["base_skill_id"]));*/
136 }
137 }
138 else
139 {
140 $this->tpl->setVariable("NOT_SUPPORTED", $lng->txt("svy_skl_comp_assignm_not_supported"));
141 }
142
143 $this->tpl->setVariable("QUESTION_TITLE", $a_set["title"]);
144
145 $ilCtrl->setParameter($this->parent_obj, "q_id", "");
146
147 }
148
149}
150?>
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
TableGUI class for survey questions to skill assignment.
__construct($a_parent_obj, $a_parent_cmd, $a_survey)
Constructor.
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.
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