4 include_once
"./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php";
15 $this->values = array();
16 if (is_array( $a_value ))
18 if (is_array( $a_value[
'answer'] ))
20 foreach ($a_value[
'answer'] as $index =>
$value)
22 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMultipleResponseImage.php";
24 array_push( $this->values, $answer );
39 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
48 if (is_array( $foundvalues ))
51 if (is_array( $foundvalues[
'answer'] ))
53 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
55 if (((strlen( $answervalue )) == 0) && (strlen( $foundvalues[
'imagename'][$aidx] ) == 0))
57 $this->
setAlert( $lng->txt(
"msg_input_is_required" ) );
64 if (is_array( $foundvalues[
'points'] ))
66 foreach ($foundvalues[
'points'] as $points)
72 if (((strlen( $points )) == 0) || (!is_numeric( $points )))
74 $this->
setAlert( $lng->txt(
"form_msg_numeric_value_required" ) );
81 $this->
setAlert( $lng->txt(
"enter_enough_positive_points" ) );
85 if (is_array( $_FILES ) && count( $_FILES ) && $this->
getSingleline())
87 if (!$this->hideImages)
89 if (is_array( $_FILES[$this->
getPostVar()][
'error'][
'image'] ))
91 foreach ($_FILES[$this->
getPostVar()][
'error'][
'image'] as $index => $error)
98 case UPLOAD_ERR_INI_SIZE:
99 $this->
setAlert( $lng->txt(
"form_msg_file_size_exceeds" ) );
103 case UPLOAD_ERR_FORM_SIZE:
104 $this->
setAlert( $lng->txt(
"form_msg_file_size_exceeds" ) );
108 case UPLOAD_ERR_PARTIAL:
109 $this->
setAlert( $lng->txt(
"form_msg_file_partially_uploaded" ) );
113 case UPLOAD_ERR_NO_FILE:
116 if ((!strlen( $foundvalues[
'imagename'][$index]
117 )) && (!strlen( $foundvalues[
'answer'][$index] ))
120 $this->
setAlert( $lng->txt(
"form_msg_file_no_upload" ) );
126 case UPLOAD_ERR_NO_TMP_DIR:
127 $this->
setAlert( $lng->txt(
"form_msg_file_missing_tmp_dir" ) );
131 case UPLOAD_ERR_CANT_WRITE:
132 $this->
setAlert( $lng->txt(
"form_msg_file_cannot_write_to_disk" ) );
136 case UPLOAD_ERR_EXTENSION:
137 $this->
setAlert( $lng->txt(
"form_msg_file_upload_stopped_ext" ) );
148 $this->
setAlert( $lng->txt(
"form_msg_file_no_upload" ) );
153 if (is_array( $_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] ))
155 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
159 $suffix = $filename_arr[
"extension"];
160 $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
161 $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
163 if (strlen( $tmpname ) && is_array( $this->
getSuffixes() ))
167 $this->
setAlert( $lng->txt(
"form_msg_file_wrong_file_type" ) );
174 if (is_array( $_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] ))
176 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
180 $suffix = $filename_arr[
"extension"];
181 $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
182 $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
184 if (strlen( $tmpname ))
187 if ($vir[0] ==
false)
189 $this->
setAlert( $lng->txt(
"form_msg_file_virus_found" ) .
"<br />" . $vir[1] );
200 $this->
setAlert( $lng->txt(
"msg_input_is_required" ) );
216 $tpl =
new ilTemplate(
"tpl.prop_essaykeywordswizardinput.html",
true,
true,
"Modules/TestQuestionPool");
218 foreach ($this->values as
$value)
222 if (is_object( $value ))
224 $tpl->setCurrentBlock(
"prop_text_propval" );
226 $tpl->parseCurrentBlock();
227 $tpl->setCurrentBlock(
"prop_points_propval" );
229 $tpl->parseCurrentBlock();
231 $tpl->setCurrentBlock(
'singleline' );
233 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]" );
234 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i );
239 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"" );
241 $tpl->parseCurrentBlock();
246 if (is_object( $value ))
248 $tpl->setCurrentBlock(
"prop_points_propval" );
250 $tpl->parseCurrentBlock();
255 $tpl->setCurrentBlock(
"row" );
256 $class = ($i % 2 == 0) ?
"even" :
"odd";
261 if ($i == count( $this->values ) - 1)
265 $tpl->setVariable(
"ROW_CLASS", $class );
267 $tpl->setVariable(
"ROW_NUMBER", $i );
269 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]" );
270 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]" );
271 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]" );
274 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"" );
278 $tpl->parseCurrentBlock();
283 $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes' ) );
284 $tpl->setVariable(
"TEXT_NO", $lng->txt(
'no' ) );
285 $tpl->setVariable(
"DELETE_IMAGE_HEADER", $lng->txt(
'delete_image_header' ) );
286 $tpl->setVariable(
"DELETE_IMAGE_QUESTION", $lng->txt(
'delete_image_question' ) );
287 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text' ) );
288 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points' ) );
289 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions' ) );
290 $tpl->setVariable(
"POINTS_CHECKED_TEXT", $lng->txt(
'checkbox_checked' ) );
292 $a_tpl->setCurrentBlock(
"prop_generic" );
293 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get() );
294 $a_tpl->parseCurrentBlock();
297 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
299 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/multiplechoicewizard.js" );
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getMaxLength()
Get Max Length.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
& _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
ASS_AnswerBinaryStateImage is a class for answers with a binary state indicator (checked/unchecked, set/unset) and an image file.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
static initDomEvent()
Init YUI DomEvent.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl