ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
11{
15 protected $access;
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 $this->access = $DIC->access();
27 $ilCtrl = $DIC->ctrl();
28 $lng = $DIC->language();
29 $ilAccess = $DIC->access();
30 $lng = $DIC->language();
31
32 $this->object = $a_survey;
33 $this->skill_survey = new ilSurveySkill($a_survey);
34
35 $this->skill_tree = new ilSkillTree();
36
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38 $this->getQuestions();
39 //$this->setTitle($lng->txt("survey_questions_to_skill_ass"));
40
41 $this->addColumn($this->lng->txt("question"));
42 $this->addColumn($this->lng->txt("survey_skill"));
43 $this->addColumn($this->lng->txt("actions"));
44
45 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
46 $this->setRowTemplate("tpl.svy_skill_ass_row.html", "Modules/Survey");
47
48 // $this->addMultiCommand("", $lng->txt(""));
49// $this->addCommandButton("", $lng->txt(""));
50 }
51
58 public function getQuestions()
59 {
62
63 $survey_questions = $this->object->getSurveyQuestions();
64
65 if (count($survey_questions) > 0) {
66 $table_data = array();
67 $last_questionblock_id = $position = $block_position = 0;
68 foreach ($survey_questions as $question_id => $data) {
69 // it is only possible to assign to a subset
70 // of question types: single choice(2)
71 $supported = false;
72 if (in_array($data["questiontype_fi"], array(2))) {
73 $supported = true;
74 }
75
76 $id = $data["question_id"];
77
78 $table_data[$id] = array("id" => $id,
79 "type" => "question",
80 "supported" => $supported,
81 "heading" => $data["heading"],
82 "title" => $data["title"],
83 "description" => $data["description"],
84 "author" => $data["author"],
85 "obligatory" => (bool) $data["obligatory"]);
86 }
87 }
88 $this->setData($table_data);
89 }
90
91
95 protected function fillRow($a_set)
96 {
99
100 $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["id"]);
101
102 if ($a_set["supported"]) {
103 $this->tpl->setCurrentBlock("cmd");
104 $this->tpl->setVariable(
105 "HREF_CMD",
106 $ilCtrl->getLinkTarget(
107 $this->parent_obj,
108 "assignSkillToQuestion"
109 )
110 );
111 $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_assign_competence"));
112 $this->tpl->parseCurrentBlock();
113
114 if ($s = $this->skill_survey->getSkillForQuestion($a_set["id"])) {
115 $this->tpl->setCurrentBlock("cmd");
116 $this->tpl->setVariable(
117 "HREF_CMD",
118 $ilCtrl->getLinkTarget(
119 $this->parent_obj,
120 "removeSkillFromQuestion"
121 )
122 );
123 $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_remove_competence"));
124 $this->tpl->parseCurrentBlock();
125
126 $this->tpl->setVariable(
127 "COMPETENCE",
128 ilBasicSkill::_lookupTitle($s["base_skill_id"], $s["tref_id"])
129 );
130
131 //var_dump($a_set);
132 $path = $this->skill_tree->getSkillTreePath($s["base_skill_id"], $s["tref_id"]);
133 $path_nodes = array();
134 foreach ($path as $p) {
135 if ($p["child"] > 1 && $p["skill_id"] != $s["base_skill_id"]) {
136 $path_nodes[] = ilBasicSkill::_lookupTitle($p["skill_id"], $p["tref_id"]);
137 }
138 }
139 $this->tpl->setVariable("PATH", implode(" > ", $path_nodes));
140 $this->tpl->setVariable("COMP_ID", "comp_" . $a_set["id"]);
141 }
142 } else {
143 $this->tpl->setVariable("NOT_SUPPORTED", $lng->txt("svy_skl_comp_assignm_not_supported"));
144 }
145
146 $this->tpl->setVariable("QUESTION_TITLE", $a_set["title"]);
147
148 $ilCtrl->setParameter($this->parent_obj, "q_id", "");
149 }
150}
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.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46