4 include_once(
'./Services/Table/classes/class.ilTable2GUI.php');
5 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
42 public function __construct($a_parent_obj, $a_parent_cmd, $a_write_access =
false, $a_checked_move =
false, $a_total = 0)
44 $this->
setId(
'tst_qst_lst_'.$a_parent_obj->object->getRefId());
52 $this->total = $a_total;
58 $this->
setStyle(
'table',
'fullwidth');
63 if(isset($this->visibleOptionalColumns[
'qid']))
65 $this->
addColumn($this->optionalColumns[
'qid'][
'txt'],
'qid',
'');
67 $this->
addColumn($this->lng->txt(
"tst_question_title"),
'title',
'');
69 if( $a_parent_obj->object->areObligationsEnabled() )
71 $this->
addColumn($this->lng->txt(
"obligatory"),
'obligatory',
'');
73 if(isset($this->visibleOptionalColumns[
'description']))
75 $this->
addColumn($this->optionalColumns[
'description'][
'txt'],
'description',
'');
77 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'type',
'');
78 $this->
addColumn($this->lng->txt(
"points"),
'',
'');
79 if(isset($this->visibleOptionalColumns[
'author']))
81 $this->
addColumn($this->optionalColumns[
'author'][
'txt'],
'author',
'');
83 if(isset($this->visibleOptionalColumns[
'working_time']))
85 $this->
addColumn($this->optionalColumns[
'working_time'][
'txt'],
'working_time',
'');
87 $this->
addColumn($this->lng->txt(
"qpl"),
'qpl',
'');
95 $this->
addMultiCommand(
'removeQuestions', $this->lng->txt(
'remove_question'));
97 if ($this->checked_move)
99 $this->
addMultiCommand(
'insertQuestionsBefore', $this->lng->txt(
'insert_before'));
100 $this->
addMultiCommand(
'insertQuestionsAfter', $this->lng->txt(
'insert_after'));
104 $this->
addMultiCommand(
'copyAndLinkToQuestionpool', $this->lng->txt(
'copy_and_link_to_questionpool'));
109 $this->
setRowTemplate(
"tpl.il_as_tst_questions_row.html",
"Modules/Test");
111 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
113 if( $a_parent_obj->object->areObligationsEnabled() )
115 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrderAndObligations'));
119 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrder'));
124 $this->
enable(
'select_all');
133 'qid' => array(
'txt' => $this->lng->txt(
'question_id'),
'default' =>
true),
134 'description' => array(
'txt' => $this->lng->txt(
'description'),
'default' =>
false),
135 'author' => array(
'txt' => $this->lng->txt(
'author'),
'default' =>
false),
136 'working_time'=> array(
'txt' => $this->lng->txt(
'working_time'),
'default' =>
false)
144 foreach ($this->column as $key => $column)
146 if (strcmp($column[
'text'], $this->lng->txt(
"points")) == 0)
148 $this->column[$key][
'text'] = $this->lng->txt(
"points") .
" (" . $this->totalPoints .
")";
150 elseif (strcmp($column[
'text'], $this->lng->txt(
"working_time")) == 0)
152 $this->column[$key][
'text'] = $this->lng->txt(
"working_time") .
" (" . $this->totalWorkingTime .
")";
169 $q_id =
$data[
"question_id"];
171 $this->tpl->setVariable(
"QUESTION_ID", $q_id);
172 if(isset($this->visibleOptionalColumns[
'qid']))
174 $this->tpl->setVariable(
"QUESTION_ID_PRESENTATION", $q_id);
178 if (!
$data[
'complete']) {
180 $this->tpl->setVariable(
"ALT_WARNING", $this->lng->txt(
"warning_question_not_complete"));
181 $this->tpl->setVariable(
"TITLE_WARNING", $this->lng->txt(
"warning_question_not_complete"));
186 $this->tpl->setVariable(
"QUESTION_TITLE",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&eqid=$q_id&eqpl=$qpl_ref_id" .
"\">" .
$data[
"title"] .
"</a>");
189 if(
$data[
"obligationPossible"] )
191 $CHECKED =
$data[
"obligatory"] ?
"checked=\"checked\" " :
"";
192 $OBLIGATORY =
"<input type=\"checkbox\" name=\"obligatory[$q_id]\" value=\"1\" $CHECKED/>";
203 $this->tpl->setVariable(
"QUESTION_TITLE",
$data[
"title"]);
206 if(
$data[
"obligatory"] )
208 $OBLIGATORY =
"<img src=\"".ilUtil::getImagePath(
"obligatory.gif",
"Modules/Test").
209 "\" alt=\"".$lng->txt(
"question_obligatory").
210 "\" title=\"".$lng->txt(
"question_obligatory").
"\" />";
212 else $OBLIGATORY =
'';
215 if( $this->parent_obj->object->areObligationsEnabled() )
217 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $OBLIGATORY);
220 $this->tpl->setVariable(
"QUESTION_SEQUENCE", $this->lng->txt(
"tst_sequence"));
224 if (
$data[
"sequence"] != 1)
226 $this->tpl->setVariable(
"BUTTON_UP",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&up=".
$data[
"question_id"].
"\">" .
ilGlyphGUI::get(
ilGlyphGUI::UP, $this->lng->txt(
'up')) .
"</a>");
230 $this->tpl->setVariable(
"BUTTON_DOWN",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&down=".
$data[
"question_id"].
"\">" .
ilGlyphGUI::get(
ilGlyphGUI::DOWN, $this->lng->txt(
'down')) .
"</a>");
234 if(isset($this->visibleOptionalColumns[
'description']))
236 if(
$data[
"description"])
238 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"] ?
$data[
"description"] :
' ');
242 $this->tpl->touchBlock(
'question_comment_block');
245 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
247 $this->tpl->setVariable(
"QUESTION_POINTS",
$data[
"points"]);
248 $this->totalPoints +=
$data[
"points"];
250 if(isset($this->visibleOptionalColumns[
'author']))
252 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
254 if(isset($this->visibleOptionalColumns[
'working_time']))
256 $this->tpl->setVariable(
"QUESTION_WORKING_TIME",
$data[
"working_time"]);
262 $this->tpl->setVariable(
"QUESTION_POOL", $this->lng->txt(
'tst_question_not_from_pool_info'));
266 $this->position += 10;
267 $field =
"<input type=\"text\" name=\"order[q_".$data[
"question_id"].
268 "]\" value=\"".$this->position.
"\" maxlength=\"3\" style=\"width:30px\" />";
269 $this->tpl->setVariable(
"QUESTION_POSITION", $field);
274 $this->writeAccess = $value;
284 $this->checked_move = $value;
294 $this->total = $value;