4 include_once
"./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php";
22 $this->values =
array();
23 if (is_array($a_value)) {
24 if (is_array($a_value[
'answer'])) {
26 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMultipleResponseImage.php";
28 array_push($this->values, $answer);
43 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
48 if (is_array($foundvalues)) {
50 if (is_array($foundvalues[
'answer'])) {
51 foreach ($foundvalues[
'answer'] as $aidx => $answervalue) {
52 if (((strlen($answervalue)) == 0) && (strlen($foundvalues[
'imagename'][$aidx]) == 0)) {
53 $this->
setAlert($lng->txt(
"msg_input_is_required"));
60 if (is_array($foundvalues[
'points'])) {
61 foreach ($foundvalues[
'points'] as $points) {
65 if (((strlen($points)) == 0) || (!is_numeric($points))) {
66 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
70 foreach ($foundvalues[
'points_unchecked'] as $points) {
71 if (((strlen($points)) == 0) || (!is_numeric($points))) {
72 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
78 $this->
setAlert($lng->txt(
"enter_enough_positive_points_checked"));
82 if (is_array($_FILES) && count($_FILES) && $this->
getSingleline()) {
83 if (!$this->hideImages) {
84 if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image'])) {
89 case UPLOAD_ERR_INI_SIZE:
90 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
94 case UPLOAD_ERR_FORM_SIZE:
95 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
99 case UPLOAD_ERR_PARTIAL:
100 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
104 case UPLOAD_ERR_NO_FILE:
106 if ((!strlen($foundvalues[
'imagename'][$index])) && (!strlen($foundvalues[
'answer'][$index]))) {
107 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
113 case UPLOAD_ERR_NO_TMP_DIR:
114 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
118 case UPLOAD_ERR_CANT_WRITE:
119 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
123 case UPLOAD_ERR_EXTENSION:
124 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
132 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
137 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
138 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as
$index => $tmpname) {
141 $suffix = $filename_arr[
"extension"];
145 if (strlen($tmpname) && is_array($this->
getSuffixes())) {
147 $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
154 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
155 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as
$index => $tmpname) {
158 $suffix = $filename_arr[
"extension"];
162 if (strlen($tmpname)) {
164 if ($vir[0] ==
false) {
165 $this->
setAlert($lng->txt(
"form_msg_file_virus_found") .
"<br />" . $vir[1]);
174 $this->
setAlert($lng->txt(
"msg_input_is_required"));
189 $tpl =
new ilTemplate(
"tpl.prop_multiplechoicewizardinput.html",
true,
true,
"Modules/TestQuestionPool");
191 foreach ($this->values as
$value) {
193 if (!$this->hideImages) {
194 if (strlen($value->getImage())) {
195 $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
196 if (($this->
getSingleline()) && ($this->qstObject->getThumbSize())) {
197 if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage())) {
198 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
201 $tpl->setCurrentBlock(
'image');
202 $tpl->setVariable(
'SRC_IMAGE', $imagename);
203 $tpl->setVariable(
'IMAGE_NAME', $value->getImage());
205 $tpl->setVariable(
"TXT_DELETE_EXISTING", $lng->txt(
"delete_existing_file"));
206 $tpl->setVariable(
"IMAGE_ROW_NUMBER",
$i);
208 $tpl->parseCurrentBlock();
210 $tpl->setCurrentBlock(
'addimage');
211 $tpl->setVariable(
"IMAGE_BROWSE", $lng->txt(
'select_file'));
212 $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() .
"[image][$i]");
213 $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
214 $tpl->setVariable(
"IMAGE_ROW_NUMBER",
$i);
216 $tpl->parseCurrentBlock();
219 if (is_object($value)) {
220 $tpl->setCurrentBlock(
"prop_text_propval");
222 $tpl->parseCurrentBlock();
223 $tpl->setCurrentBlock(
"prop_points_propval");
225 $tpl->parseCurrentBlock();
226 $tpl->setCurrentBlock(
"prop_points_unchecked_propval");
228 $tpl->parseCurrentBlock();
230 $tpl->setCurrentBlock(
'singleline');
232 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]");
233 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER",
$i);
237 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"");
239 $tpl->parseCurrentBlock();
241 if (is_object($value)) {
242 $tpl->setCurrentBlock(
"prop_points_propval");
244 $tpl->parseCurrentBlock();
245 $tpl->setCurrentBlock(
"prop_points_unchecked_propval");
247 $tpl->parseCurrentBlock();
249 $tpl->setCurrentBlock(
'multiline');
251 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() .
"[answer][$i]");
252 $tpl->setVariable(
"MULTILINE_ROW_NUMBER",
$i);
255 $tpl->setVariable(
"DISABLED_MULTILINE",
" disabled=\"disabled\"");
257 $tpl->parseCurrentBlock();
260 $tpl->setCurrentBlock(
"move");
261 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
262 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
266 $tpl->parseCurrentBlock();
268 $tpl->setCurrentBlock(
"row");
270 $tpl->setVariable(
"ROW_NUMBER",
$i);
272 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]");
273 $tpl->setVariable(
"POINTS_UNCHECKED_ID", $this->
getPostVar() .
"[points_unchecked][$i]");
274 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
275 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
277 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"");
281 $tpl->parseCurrentBlock();
286 if (!$this->hideImages) {
288 $suff_str = $delim =
"";
290 $suff_str.= $delim .
"." .
$suffix;
293 $tpl->setCurrentBlock(
'allowed_image_suffixes');
294 $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", $lng->txt(
"file_allowed_suffixes") .
" " . $suff_str);
295 $tpl->parseCurrentBlock();
298 $tpl->setCurrentBlock(
"image_heading");
299 $tpl->setVariable(
"ANSWER_IMAGE", $lng->txt(
'answer_image'));
301 $tpl->parseCurrentBlock();
306 $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
307 $tpl->setVariable(
"TEXT_NO", $lng->txt(
'no'));
308 $tpl->setVariable(
"DELETE_IMAGE_HEADER", $lng->txt(
'delete_image_header'));
309 $tpl->setVariable(
"DELETE_IMAGE_QUESTION", $lng->txt(
'delete_image_question'));
310 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
311 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
312 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
313 $tpl->setVariable(
"POINTS_CHECKED_TEXT", $lng->txt(
'checkbox_checked'));
314 $tpl->setVariable(
"POINTS_UNCHECKED_TEXT", $lng->txt(
'checkbox_unchecked'));
316 $a_tpl->setCurrentBlock(
"prop_generic");
317 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
318 $a_tpl->parseCurrentBlock();
321 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
322 $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
static _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 get($a_glyph, $a_text="")
Get glyph html.
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.
Create styles array
The data for the language used.