ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 protected $access;
21
25 public function __construct($a_parent_obj, $a_parent_cmd, $a_survey)
26 {
27 global $DIC;
28
29 $this->ctrl = $DIC->ctrl();
30 $this->lng = $DIC->language();
31 $this->access = $DIC->access();
32 $ilCtrl = $DIC->ctrl();
33 $lng = $DIC->language();
34 $ilAccess = $DIC->access();
35 $lng = $DIC->language();
36
37 $this->object = $a_survey;
38 include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
39 $this->skill_survey = new ilSurveySkill($a_survey);
40
41 include_once("./Services/Skill/classes/class.ilSkillTree.php");
42 $this->skill_tree = new ilSkillTree();
43
44 parent::__construct($a_parent_obj, $a_parent_cmd);
45 $this->getQuestions();
46 //$this->setTitle($lng->txt("survey_questions_to_skill_ass"));
47
48 $this->addColumn($this->lng->txt("question"));
49 $this->addColumn($this->lng->txt("survey_skill"));
50 $this->addColumn($this->lng->txt("actions"));
51
52 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
53 $this->setRowTemplate("tpl.svy_skill_ass_row.html", "Modules/Survey");
54
55 // $this->addMultiCommand("", $lng->txt(""));
56// $this->addCommandButton("", $lng->txt(""));
57 }
58
65 public function getQuestions()
66 {
69
70 $survey_questions = $this->object->getSurveyQuestions();
71
72 if (count($survey_questions) > 0) {
73 $table_data = array();
74 $last_questionblock_id = $position = $block_position = 0;
75 foreach ($survey_questions as $question_id => $data) {
76 // it is only possible to assign to a subset
77 // of question types: single choice(2)
78 $supported = false;
79 if (in_array($data["questiontype_fi"], array(2))) {
80 $supported = true;
81 }
82
83 $id = $data["question_id"];
84
85 $table_data[$id] = array("id" => $id,
86 "type" => "question",
87 "supported" => $supported,
88 "heading" => $data["heading"],
89 "title" => $data["title"],
90 "description" => $data["description"],
91 "author" => $data["author"],
92 "obligatory" => (bool) $data["obligatory"]);
93 }
94 }
95 $this->setData($table_data);
96 }
97
98
102 protected function fillRow($a_set)
103 {
106
107 $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["id"]);
108
109 if ($a_set["supported"]) {
110 $this->tpl->setCurrentBlock("cmd");
111 $this->tpl->setVariable(
112 "HREF_CMD",
113 $ilCtrl->getLinkTarget(
114 $this->parent_obj,
115 "assignSkillToQuestion"
116 )
117 );
118 $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_assign_competence"));
119 $this->tpl->parseCurrentBlock();
120
121 if ($s = $this->skill_survey->getSkillForQuestion($a_set["id"])) {
122 $this->tpl->setCurrentBlock("cmd");
123 $this->tpl->setVariable(
124 "HREF_CMD",
125 $ilCtrl->getLinkTarget(
126 $this->parent_obj,
127 "removeSkillFromQuestion"
128 )
129 );
130 $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_remove_competence"));
131 $this->tpl->parseCurrentBlock();
132
133 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
134 $this->tpl->setVariable(
135 "COMPETENCE",
136 ilBasicSkill::_lookupTitle($s["base_skill_id"], $s["tref_id"])
137 );
138
139 //var_dump($a_set);
140 $path = $this->skill_tree->getSkillTreePath($s["base_skill_id"], $s["tref_id"]);
141 $path_nodes = array();
142 foreach ($path as $p) {
143 if ($p["child"] > 1 && $p["skill_id"] != $s["base_skill_id"]) {
144 $path_nodes[] = ilBasicSkill::_lookupTitle($p["skill_id"], $p["tref_id"]);
145 }
146 }
147 $this->tpl->setVariable("PATH", implode($path_nodes, " > "));
148 $this->tpl->setVariable("COMP_ID", "comp_" . $a_set["id"]);
149
150 /*include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
151 ilTooltipGUI::addTooltip("comp_".$a_set["id"],
152 ilBasicSkill::_lookupDescription($s["base_skill_id"]));*/
153 }
154 } else {
155 $this->tpl->setVariable("NOT_SUPPORTED", $lng->txt("svy_skl_comp_assignm_not_supported"));
156 }
157
158 $this->tpl->setVariable("QUESTION_TITLE", $a_set["title"]);
159
160 $ilCtrl->setParameter($this->parent_obj, "q_id", "");
161 }
162}
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 survey questions to skill assignment.
__construct($a_parent_obj, $a_parent_cmd, $a_survey)
Constructor.
Skill/Competence handling in surveys.
Class ilTable2GUI.
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
$s
Definition: pwgen.php:45
global $DIC
Definition: saml.php:7