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());
46 parent::__construct($a_parent_obj, $a_parent_cmd);
52 $this->total = $a_total;
58 $this->
setStyle(
'table',
'fullwidth');
63 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()) {
69 $this->
addColumn($this->lng->txt(
"obligatory"),
'obligatory',
'');
71 if (isset($this->visibleOptionalColumns[
'description'])) {
72 $this->
addColumn($this->optionalColumns[
'description'][
'txt'],
'description',
'');
74 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'type',
'');
75 $this->
addColumn($this->lng->txt(
"points"),
'',
'');
76 if (isset($this->visibleOptionalColumns[
'author'])) {
77 $this->
addColumn($this->optionalColumns[
'author'][
'txt'],
'author',
'');
79 if (isset($this->visibleOptionalColumns[
'working_time'])) {
80 $this->
addColumn($this->optionalColumns[
'working_time'][
'txt'],
'working_time',
'');
82 $this->
addColumn($this->lng->txt(
"qpl"),
'qpl',
'');
89 $this->
addMultiCommand(
'removeQuestions', $this->lng->txt(
'remove_question'));
91 if ($this->checked_move) {
92 $this->
addMultiCommand(
'insertQuestionsBefore', $this->lng->txt(
'insert_before'));
93 $this->
addMultiCommand(
'insertQuestionsAfter', $this->lng->txt(
'insert_after'));
97 $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()) {
106 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrderAndObligations'));
108 $this->
addCommandButton(
'saveOrderAndObligations', $this->lng->txt(
'saveOrder'));
113 $this->
enable(
'select_all');
122 'qid' =>
array(
'txt' => $this->lng->txt(
'question_id'),
'default' =>
true),
123 'description' =>
array(
'txt' => $this->lng->txt(
'description'),
'default' =>
false),
124 'author' =>
array(
'txt' => $this->lng->txt(
'author'),
'default' =>
false),
125 'working_time'=>
array(
'txt' => $this->lng->txt(
'working_time'),
'default' =>
false)
134 if (strcmp(
$column[
'text'], $this->lng->txt(
"points")) == 0) {
135 $this->
column[
$key][
'text'] = $this->lng->txt(
"points") .
" (" . $this->totalPoints .
")";
136 } elseif (strcmp(
$column[
'text'], $this->lng->txt(
"working_time")) == 0) {
137 $this->
column[
$key][
'text'] = $this->lng->txt(
"working_time") .
" (" . $this->totalWorkingTime .
")";
140 parent::fillHeader();
154 $q_id =
$data[
"question_id"];
156 $this->tpl->setVariable(
"QUESTION_ID", $q_id);
157 if (isset($this->visibleOptionalColumns[
'qid'])) {
158 $this->tpl->setVariable(
"QUESTION_ID_PRESENTATION", $q_id);
161 if (!
$data[
'complete']) {
163 $this->tpl->setVariable(
"ALT_WARNING", $this->lng->txt(
"warning_question_not_complete"));
164 $this->tpl->setVariable(
"TITLE_WARNING", $this->lng->txt(
"warning_question_not_complete"));
169 $this->tpl->setVariable(
"QUESTION_TITLE",
"<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(),
"questions") .
"&eqid=$q_id&eqpl=$qpl_ref_id" .
"\">" .
$data[
"title"] .
"</a>");
172 if (
$data[
"obligationPossible"]) {
173 $CHECKED =
$data[
"obligatory"] ?
"checked=\"checked\" " :
"";
174 $OBLIGATORY =
"<input type=\"checkbox\" name=\"obligatory[$q_id]\" value=\"1\" $CHECKED/>";
181 $this->tpl->setVariable(
"QUESTION_TITLE",
$data[
"title"]);
184 if (
$data[
"obligatory"]) {
185 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
192 if ($this->parent_obj->object->areObligationsEnabled()) {
193 $this->tpl->setVariable(
"QUESTION_OBLIGATORY", $OBLIGATORY);
196 $this->tpl->setVariable(
"QUESTION_SEQUENCE", $this->lng->txt(
"tst_sequence"));
199 if (
$data[
"sequence"] != 1) {
200 $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>");
203 $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>");
207 if (isset($this->visibleOptionalColumns[
'description'])) {
208 if (
$data[
"description"]) {
209 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"] ?
$data[
"description"] :
' ');
211 $this->tpl->touchBlock(
'question_comment_block');
214 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
216 $this->tpl->setVariable(
"QUESTION_POINTS",
$data[
"points"]);
217 $this->totalPoints +=
$data[
"points"];
219 if (isset($this->visibleOptionalColumns[
'author'])) {
220 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
222 if (isset($this->visibleOptionalColumns[
'working_time'])) {
223 $this->tpl->setVariable(
"QUESTION_WORKING_TIME",
$data[
"working_time"]);
228 $this->tpl->setVariable(
"QUESTION_POOL", $this->lng->txt(
'tst_question_not_from_pool_info'));
232 $this->position += 10;
233 $field =
"<input type=\"text\" name=\"order[q_" .
$data[
"question_id"] .
234 "]\" value=\"" . $this->position .
"\" maxlength=\"3\" size=\"3\" />";
235 $this->tpl->setVariable(
"QUESTION_POSITION", $field);
240 $this->writeAccess = $value;
250 $this->checked_move = $value;
260 $this->total = $value;
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static sumTimesInISO8601FormatH_i_s_Extended($time1, $time2)
setStyle($a_element, $a_style)
__construct($a_parent_obj, $a_parent_cmd, $a_write_access=false, $a_checked_move=false, $a_total=0)
Constructor.
setExternalSegmentation($a_val)
Set external segmentation.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static get($a_glyph, $a_text="")
Get glyph html.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
getSelectedColumns()
Get selected columns.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
setFormName($a_formname="")
Set Form name.
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.
Set thin black border outline around column
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.