47 $this->
setSuffixes(array(
"jpg",
"jpeg",
"png",
"gif"));
49 $this->validationRegexp =
"";
59 $this->values = array();
60 if (is_array($a_value))
62 if (is_array($a_value[
'count']))
64 foreach ($a_value[
'count'] as $index =>
$value)
66 array_push($this->values, $a_value[
'imagename'][$index]);
79 $this->suffixes = $a_suffixes;
99 $this->values = $a_values;
119 $this->qstObject =& $a_value;
139 $this->allowMove = $a_allow_move;
161 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
163 if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image']))
165 foreach ($_FILES[$this->
getPostVar()][
'error'][
'image'] as $index =>
$error)
172 case UPLOAD_ERR_INI_SIZE:
173 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
177 case UPLOAD_ERR_FORM_SIZE:
178 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
182 case UPLOAD_ERR_PARTIAL:
183 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
187 case UPLOAD_ERR_NO_FILE:
192 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
198 case UPLOAD_ERR_NO_TMP_DIR:
199 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
203 case UPLOAD_ERR_CANT_WRITE:
204 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
208 case UPLOAD_ERR_EXTENSION:
209 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
220 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
225 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image']))
227 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
231 $suffix = $filename_arr[
"extension"];
232 $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
233 $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
235 if (strlen($tmpname) && is_array($this->
getSuffixes()))
239 $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
246 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image']))
248 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
252 $suffix = $filename_arr[
"extension"];
253 $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
254 $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
256 if (strlen($tmpname))
259 if ($vir[0] ==
false)
261 $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
280 $tpl =
new ilTemplate(
"tpl.prop_imagewizardinput.html",
true,
true,
"Modules/TestQuestionPool");
282 foreach ($this->values as
$value)
286 $imagename = $this->qstObject->getImagePathWeb() .
$value;
287 if ($this->qstObject->getThumbSize())
289 if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() .
$value))
291 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() .
$value;
294 $tpl->setCurrentBlock(
'image');
295 $tpl->setVariable(
'SRC_IMAGE', $imagename);
296 $tpl->setVariable(
'IMAGE_NAME', $value);
298 $tpl->setVariable(
"TXT_DELETE_EXISTING", $lng->txt(
"delete_existing_file"));
299 $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
301 $tpl->parseCurrentBlock();
303 $tpl->setCurrentBlock(
'addimage');
304 $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() .
"[image][$i]");
305 $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
306 $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
308 $tpl->parseCurrentBlock();
312 $tpl->setCurrentBlock(
"move");
313 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
314 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
318 $tpl->parseCurrentBlock();
320 $tpl->setCurrentBlock(
"row");
321 $class = ($i % 2 == 0) ?
"even" :
"odd";
322 if ($i == 0) $class .=
" first";
323 if ($i == count($this->values)-1) $class .=
" last";
324 $tpl->setVariable(
"ROW_CLASS", $class);
326 $tpl->setVariable(
"ROW_NUMBER", $i);
328 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
329 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
332 $tpl->parseCurrentBlock();
338 $suff_str = $delim =
"";
341 $suff_str.= $delim.
".".
$suffix;
344 $tpl->setCurrentBlock(
'allowed_image_suffixes');
345 $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", $lng->txt(
"file_allowed_suffixes").
" ".$suff_str);
346 $tpl->parseCurrentBlock();
348 $tpl->setCurrentBlock(
"image_heading");
349 $tpl->setVariable(
"ANSWER_IMAGE", $lng->txt(
'answer_image'));
351 $tpl->parseCurrentBlock();
354 $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
355 $tpl->setVariable(
"TEXT_NO", $lng->txt(
'no'));
356 $tpl->setVariable(
"DELETE_IMAGE_HEADER", $lng->txt(
'delete_image_header'));
357 $tpl->setVariable(
"DELETE_IMAGE_QUESTION", $lng->txt(
'delete_image_question'));
358 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
359 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
361 $a_tpl->setCurrentBlock(
"prop_generic");
362 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
363 $a_tpl->parseCurrentBlock();
366 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
368 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/imagewizard.js");