24 include_once
"./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php";
35 $this->values = array();
36 if (is_array( $a_value ))
38 if (is_array( $a_value[
'answer'] ))
40 foreach ($a_value[
'answer'] as $index =>
$value)
42 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMultipleResponseImage.php";
44 array_push( $this->values, $answer );
59 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
68 if (is_array( $foundvalues ))
71 if (is_array( $foundvalues[
'answer'] ))
73 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
75 if (((strlen( $answervalue )) == 0) && (strlen( $foundvalues[
'imagename'][$aidx] ) == 0))
77 $this->
setAlert( $lng->txt(
"msg_input_is_required" ) );
84 if (is_array( $foundvalues[
'points'] ))
86 foreach ($foundvalues[
'points'] as $points)
92 if (((strlen( $points )) == 0) || (!is_numeric( $points )))
94 $this->
setAlert( $lng->txt(
"form_msg_numeric_value_required" ) );
101 $this->
setAlert( $lng->txt(
"enter_enough_positive_points" ) );
105 if (is_array( $_FILES ) && count( $_FILES ) && $this->
getSingleline())
107 if (!$this->hideImages)
109 if (is_array( $_FILES[$this->
getPostVar()][
'error'][
'image'] ))
111 foreach ($_FILES[$this->
getPostVar()][
'error'][
'image'] as $index => $error)
118 case UPLOAD_ERR_INI_SIZE:
119 $this->
setAlert( $lng->txt(
"form_msg_file_size_exceeds" ) );
123 case UPLOAD_ERR_FORM_SIZE:
124 $this->
setAlert( $lng->txt(
"form_msg_file_size_exceeds" ) );
128 case UPLOAD_ERR_PARTIAL:
129 $this->
setAlert( $lng->txt(
"form_msg_file_partially_uploaded" ) );
133 case UPLOAD_ERR_NO_FILE:
136 if ((!strlen( $foundvalues[
'imagename'][$index]
137 )) && (!strlen( $foundvalues[
'answer'][$index] ))
140 $this->
setAlert( $lng->txt(
"form_msg_file_no_upload" ) );
146 case UPLOAD_ERR_NO_TMP_DIR:
147 $this->
setAlert( $lng->txt(
"form_msg_file_missing_tmp_dir" ) );
151 case UPLOAD_ERR_CANT_WRITE:
152 $this->
setAlert( $lng->txt(
"form_msg_file_cannot_write_to_disk" ) );
156 case UPLOAD_ERR_EXTENSION:
157 $this->
setAlert( $lng->txt(
"form_msg_file_upload_stopped_ext" ) );
168 $this->
setAlert( $lng->txt(
"form_msg_file_no_upload" ) );
173 if (is_array( $_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] ))
175 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
179 $suffix = $filename_arr[
"extension"];
180 $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
181 $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
183 if (strlen( $tmpname ) && is_array( $this->
getSuffixes() ))
187 $this->
setAlert( $lng->txt(
"form_msg_file_wrong_file_type" ) );
194 if (is_array( $_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] ))
196 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
200 $suffix = $filename_arr[
"extension"];
201 $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
202 $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
204 if (strlen( $tmpname ))
207 if ($vir[0] ==
false)
209 $this->
setAlert( $lng->txt(
"form_msg_file_virus_found" ) .
"<br />" . $vir[1] );
220 $this->
setAlert( $lng->txt(
"msg_input_is_required" ) );
236 $tpl =
new ilTemplate(
"tpl.prop_essaykeywordswizardinput.html",
true,
true,
"Modules/TestQuestionPool");
238 foreach ($this->values as
$value)
242 if (is_object( $value ))
244 $tpl->setCurrentBlock(
"prop_text_propval" );
246 $tpl->parseCurrentBlock();
247 $tpl->setCurrentBlock(
"prop_points_propval" );
249 $tpl->parseCurrentBlock();
251 $tpl->setCurrentBlock(
'singleline' );
253 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]" );
254 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i );
259 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"" );
261 $tpl->parseCurrentBlock();
266 if (is_object( $value ))
268 $tpl->setCurrentBlock(
"prop_points_propval" );
270 $tpl->parseCurrentBlock();
275 $tpl->setCurrentBlock(
"row" );
276 $class = ($i % 2 == 0) ?
"even" :
"odd";
281 if ($i == count( $this->values ) - 1)
285 $tpl->setVariable(
"ROW_CLASS", $class );
287 $tpl->setVariable(
"ROW_NUMBER", $i );
289 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]" );
290 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]" );
291 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]" );
294 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"" );
298 $tpl->parseCurrentBlock();
303 $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes' ) );
304 $tpl->setVariable(
"TEXT_NO", $lng->txt(
'no' ) );
305 $tpl->setVariable(
"DELETE_IMAGE_HEADER", $lng->txt(
'delete_image_header' ) );
306 $tpl->setVariable(
"DELETE_IMAGE_QUESTION", $lng->txt(
'delete_image_question' ) );
307 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text' ) );
308 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points' ) );
309 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions' ) );
310 $tpl->setVariable(
"POINTS_CHECKED_TEXT", $lng->txt(
'checkbox_checked' ) );
312 $a_tpl->setCurrentBlock(
"prop_generic" );
313 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get() );
314 $a_tpl->parseCurrentBlock();
317 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
319 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/multiplechoicewizard.js" );