24 include_once(
'./Services/Table/classes/class.ilTable2GUI.php');
51 public function __construct($a_parent_obj, $a_parent_cmd, $a_write_access =
false, $a_checked_move =
false, $a_total = 0)
59 $this->total = $a_total;
65 $this->
setStyle(
'table',
'fullwidth');
68 $this->
addColumn($this->lng->txt(
"tst_question_title"),
'title',
'');
70 if( $a_parent_obj->object->areObligationsEnabled() )
72 $this->
addColumn($this->lng->txt(
"obligatory"),
'obligatory',
'');
74 $this->
addColumn($this->lng->txt(
"description"),
'description',
'');
75 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'type',
'');
76 $this->
addColumn($this->lng->txt(
"points"),
'',
'');
77 $this->
addColumn($this->lng->txt(
"author"),
'author',
'');
78 $this->
addColumn($this->lng->txt(
"qpl"),
'qpl',
'');
87 $this->
addMultiCommand(
'removeQuestions', $this->lng->txt(
'remove_question'));
89 if ($this->checked_move)
91 $this->
addMultiCommand(
'insertQuestionsBefore', $this->lng->txt(
'insert_before'));
92 $this->
addMultiCommand(
'insertQuestionsAfter', $this->lng->txt(
'insert_after'));
96 $this->
addMultiCommand(
'copyAndLinkToQuestionpool', $this->lng->txt(
'copy_and_link_to_questionpool'));
101 $this->
setRowTemplate(
"tpl.il_as_tst_questions_row.html",
"Modules/Test");
103 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
105 if( $a_parent_obj->object->areObligationsEnabled() )
107 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrderAndObligations'));
111 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrder'));
116 $this->
enable(
'select_all');
121 foreach ($this->column as $key => $column)
123 if (strcmp($column[
'text'], $this->lng->txt(
"points")) == 0)
125 $this->column[$key][
'text'] = $this->lng->txt(
"points") .
" (" . $this->totalPoints .
")";
142 $q_id =
$data[
"question_id"];
144 $this->tpl->setVariable(
"QUESTION_ID", $q_id);
147 if (!
$data[
'complete']) {
149 $this->tpl->setVariable(
"ALT_WARNING", $this->lng->txt(
"warning_question_not_complete"));
150 $this->tpl->setVariable(
"TITLE_WARNING", $this->lng->txt(
"warning_question_not_complete"));
155 $this->tpl->setVariable(
"QUESTION_TITLE",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&eqid=$q_id&eqpl=$qpl_ref_id" .
"\">" .
$data[
"title"] .
"</a>");
158 if(
$data[
"obligationPossible"] )
160 $CHECKED =
$data[
"obligatory"] ?
"checked=\"checked\" " :
"";
161 $OBLIGATORY =
"<input type=\"checkbox\" name=\"obligatory[$q_id]\" value=\"1\" $CHECKED/>";
172 $this->tpl->setVariable(
"QUESTION_TITLE",
$data[
"title"]);
175 if(
$data[
"obligatory"] )
177 $OBLIGATORY =
"<img src=\"".ilUtil::getImagePath(
"obligatory.gif",
"Modules/Test").
178 "\" alt=\"".$lng->txt(
"question_obligatory").
179 "\" title=\"".$lng->txt(
"question_obligatory").
"\" />";
181 else $OBLIGATORY =
'';
184 if( $this->parent_obj->object->areObligationsEnabled() )
186 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $OBLIGATORY);
189 $this->tpl->setVariable(
"QUESTION_SEQUENCE", $this->lng->txt(
"tst_sequence"));
193 if (
$data[
"sequence"] != 1)
195 $this->tpl->setVariable(
"BUTTON_UP",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&up=".
$data[
"question_id"].
"\"><img src=\"" .
ilUtil::getImagePath(
"a_up.png") .
"\" alt=\"" . $this->lng->txt(
"up") .
"\" border=\"0\" /></a>");
199 $this->tpl->setVariable(
"BUTTON_DOWN",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&down=".
$data[
"question_id"].
"\"><img src=\"" .
ilUtil::getImagePath(
"a_down.png") .
"\" alt=\"" . $this->lng->txt(
"down") .
"\" border=\"0\" /></a>");
203 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"]);
205 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"]);
206 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
208 $this->tpl->setVariable(
"QUESTION_POINTS",
$data[
"points"]);
209 $this->totalPoints +=
$data[
"points"];
210 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
215 $this->tpl->setVariable(
"QUESTION_POOL", $this->lng->txt(
'tst_question_not_from_pool_info'));
219 $this->position += 10;
220 $field =
"<input type=\"text\" name=\"order[q_".$data[
"question_id"].
221 "]\" value=\"".$this->position.
"\" maxlength=\"3\" style=\"width:30px\" />";
222 $this->tpl->setVariable(
"QUESTION_POSITION", $field);
227 $this->writeAccess = $value;
237 $this->checked_move = $value;
247 $this->total = $value;