4 include_once(
'./Services/Table/classes/class.ilTable2GUI.php');
41 public function __construct($a_parent_obj, $a_parent_cmd, $a_write_access =
false, $a_checked_move =
false, $a_total = 0)
43 $this->
setId(
'tst_qst_lst_'.$a_parent_obj->object->getRefId());
51 $this->total = $a_total;
57 $this->
setStyle(
'table',
'fullwidth');
62 if(isset($this->visibleOptionalColumns[
'qid']))
64 $this->
addColumn($this->optionalColumns[
'qid'][
'txt'],
'qid',
'');
66 $this->
addColumn($this->lng->txt(
"tst_question_title"),
'title',
'');
68 if( $a_parent_obj->object->areObligationsEnabled() )
70 $this->
addColumn($this->lng->txt(
"obligatory"),
'obligatory',
'');
72 if(isset($this->visibleOptionalColumns[
'description']))
74 $this->
addColumn($this->optionalColumns[
'description'][
'txt'],
'description',
'');
76 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'type',
'');
77 $this->
addColumn($this->lng->txt(
"points"),
'',
'');
78 if(isset($this->visibleOptionalColumns[
'author']))
80 $this->
addColumn($this->optionalColumns[
'author'][
'txt'],
'author',
'');
82 $this->
addColumn($this->lng->txt(
"qpl"),
'qpl',
'');
90 $this->
addMultiCommand(
'removeQuestions', $this->lng->txt(
'remove_question'));
92 if ($this->checked_move)
94 $this->
addMultiCommand(
'insertQuestionsBefore', $this->lng->txt(
'insert_before'));
95 $this->
addMultiCommand(
'insertQuestionsAfter', $this->lng->txt(
'insert_after'));
99 $this->
addMultiCommand(
'copyAndLinkToQuestionpool', $this->lng->txt(
'copy_and_link_to_questionpool'));
104 $this->
setRowTemplate(
"tpl.il_as_tst_questions_row.html",
"Modules/Test");
106 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
108 if( $a_parent_obj->object->areObligationsEnabled() )
110 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrderAndObligations'));
114 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrder'));
119 $this->
enable(
'select_all');
128 'qid' => array(
'txt' => $this->lng->txt(
'question_id'),
'default' =>
true),
129 'description' => array(
'txt' => $this->lng->txt(
'description'),
'default' =>
false),
130 'author' => array(
'txt' => $this->lng->txt(
'author'),
'default' =>
false)
138 foreach ($this->column as $key => $column)
140 if (strcmp($column[
'text'], $this->lng->txt(
"points")) == 0)
142 $this->column[$key][
'text'] = $this->lng->txt(
"points") .
" (" . $this->totalPoints .
")";
159 $q_id =
$data[
"question_id"];
161 $this->tpl->setVariable(
"QUESTION_ID", $q_id);
162 if(isset($this->visibleOptionalColumns[
'qid']))
164 $this->tpl->setVariable(
"QUESTION_ID_PRESENTATION", $q_id);
168 if (!
$data[
'complete']) {
170 $this->tpl->setVariable(
"ALT_WARNING", $this->lng->txt(
"warning_question_not_complete"));
171 $this->tpl->setVariable(
"TITLE_WARNING", $this->lng->txt(
"warning_question_not_complete"));
176 $this->tpl->setVariable(
"QUESTION_TITLE",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&eqid=$q_id&eqpl=$qpl_ref_id" .
"\">" .
$data[
"title"] .
"</a>");
179 if(
$data[
"obligationPossible"] )
181 $CHECKED =
$data[
"obligatory"] ?
"checked=\"checked\" " :
"";
182 $OBLIGATORY =
"<input type=\"checkbox\" name=\"obligatory[$q_id]\" value=\"1\" $CHECKED/>";
193 $this->tpl->setVariable(
"QUESTION_TITLE",
$data[
"title"]);
196 if(
$data[
"obligatory"] )
198 $OBLIGATORY =
"<img src=\"".ilUtil::getImagePath(
"obligatory.gif",
"Modules/Test").
199 "\" alt=\"".$lng->txt(
"question_obligatory").
200 "\" title=\"".$lng->txt(
"question_obligatory").
"\" />";
202 else $OBLIGATORY =
'';
205 if( $this->parent_obj->object->areObligationsEnabled() )
207 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $OBLIGATORY);
210 $this->tpl->setVariable(
"QUESTION_SEQUENCE", $this->lng->txt(
"tst_sequence"));
214 if (
$data[
"sequence"] != 1)
216 $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>");
220 $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>");
224 if(isset($this->visibleOptionalColumns[
'description']))
226 if(
$data[
"description"])
228 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"] ?
$data[
"description"] :
' ');
232 $this->tpl->touchBlock(
'question_comment_block');
235 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
237 $this->tpl->setVariable(
"QUESTION_POINTS",
$data[
"points"]);
238 $this->totalPoints +=
$data[
"points"];
240 if(isset($this->visibleOptionalColumns[
'author']))
242 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
248 $this->tpl->setVariable(
"QUESTION_POOL", $this->lng->txt(
'tst_question_not_from_pool_info'));
252 $this->position += 10;
253 $field =
"<input type=\"text\" name=\"order[q_".$data[
"question_id"].
254 "]\" value=\"".$this->position.
"\" maxlength=\"3\" style=\"width:30px\" />";
255 $this->tpl->setVariable(
"QUESTION_POSITION", $field);
260 $this->writeAccess = $value;
270 $this->checked_move = $value;
280 $this->total = $value;