4 require_once
'Services/Form/classes/class.ilTextInputGUI.php';
5 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
29 parent::__construct($a_title, $a_postvar);
32 $this->validationRegexp =
"";
42 $this->values = array();
43 if (is_array($a_value)) {
44 if (is_array($a_value[
'count'])) {
46 array_push($this->values, $a_value[
'imagename'][
$index]);
59 $this->suffixes = $a_suffixes;
79 $this->values = $a_values;
99 $this->qstObject = &$a_value;
119 $this->allowMove = $a_allow_move;
145 if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image'])) {
146 foreach ($_FILES[$this->
getPostVar()][
'error'][
'image'] as
$index => $error) {
150 case UPLOAD_ERR_INI_SIZE:
151 $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
155 case UPLOAD_ERR_FORM_SIZE:
156 $this->
setAlert(
$lng->txt(
"form_msg_file_size_exceeds"));
160 case UPLOAD_ERR_PARTIAL:
161 $this->
setAlert(
$lng->txt(
"form_msg_file_partially_uploaded"));
165 case UPLOAD_ERR_NO_FILE:
174 case UPLOAD_ERR_NO_TMP_DIR:
175 $this->
setAlert(
$lng->txt(
"form_msg_file_missing_tmp_dir"));
179 case UPLOAD_ERR_CANT_WRITE:
180 $this->
setAlert(
$lng->txt(
"form_msg_file_cannot_write_to_disk"));
184 case UPLOAD_ERR_EXTENSION:
185 $this->
setAlert(
$lng->txt(
"form_msg_file_upload_stopped_ext"));
198 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
199 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as
$index => $tmpname) {
202 $suffix = $filename_arr[
"extension"];
206 if (strlen($tmpname) && is_array($this->
getSuffixes())) {
208 $this->
setAlert(
$lng->txt(
"form_msg_file_wrong_file_type"));
215 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
216 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as
$index => $tmpname) {
219 $suffix = $filename_arr[
"extension"];
223 if (strlen($tmpname)) {
225 if ($vir[0] ==
false) {
226 $this->
setAlert(
$lng->txt(
"form_msg_file_virus_found") .
"<br />" . $vir[1]);
246 $tpl =
new ilTemplate(
"tpl.prop_imagewizardinput.html",
true,
true,
"Modules/TestQuestionPool");
248 foreach ($this->values as
$value) {
249 if (strlen($value)) {
250 $imagename = $this->qstObject->getImagePathWeb() .
$value;
251 if ($this->qstObject->getThumbSize()) {
252 if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() .
$value)) {
253 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() .
$value;
256 $tpl->setCurrentBlock(
'image');
257 $tpl->setVariable(
'SRC_IMAGE', $imagename);
258 $tpl->setVariable(
'IMAGE_NAME', $value);
260 $tpl->setVariable(
"TXT_DELETE_EXISTING",
$lng->txt(
"delete_existing_file"));
261 $tpl->setVariable(
"IMAGE_ROW_NUMBER",
$i);
263 $tpl->parseCurrentBlock();
265 $tpl->setCurrentBlock(
'addimage');
266 $tpl->setVariable(
"IMAGE_BROWSE",
$lng->txt(
'select_file'));
267 $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() .
"[image][$i]");
268 $tpl->setVariable(
"IMAGE_SUBMIT",
$lng->txt(
"upload"));
269 $tpl->setVariable(
"IMAGE_ROW_NUMBER",
$i);
271 $tpl->parseCurrentBlock();
274 $tpl->setCurrentBlock(
"move");
275 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
276 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
280 $tpl->parseCurrentBlock();
282 $tpl->setCurrentBlock(
"row");
284 $tpl->setVariable(
"ROW_NUMBER",
$i);
286 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
287 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
290 $tpl->parseCurrentBlock();
295 $suff_str = $delim =
"";
297 $suff_str .= $delim .
"." .
$suffix;
300 $tpl->setCurrentBlock(
'allowed_image_suffixes');
301 $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES",
$lng->txt(
"file_allowed_suffixes") .
" " . $suff_str);
302 $tpl->parseCurrentBlock();
312 $tpl->setVariable(
"TEXT_YES",
$lng->txt(
'yes'));
313 $tpl->setVariable(
"TEXT_NO",
$lng->txt(
'no'));
314 $tpl->setVariable(
"DELETE_IMAGE_HEADER",
$lng->txt(
'delete_image_header'));
315 $tpl->setVariable(
"DELETE_IMAGE_QUESTION",
$lng->txt(
'delete_image_question'));
316 $tpl->setVariable(
"ANSWER_TEXT",
$lng->txt(
'answer_text'));
317 $tpl->setVariable(
"COMMANDS_TEXT",
$lng->txt(
'actions'));
319 $a_tpl->setCurrentBlock(
"prop_generic");
320 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
321 $a_tpl->parseCurrentBlock();
325 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
326 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/imagewizard.js");
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getAllowedImageMaterialFileExtensions()
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
setSize($a_size)
Set Size.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
This class represents a text property in a property form.