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;
144 if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image'])) {
149 case UPLOAD_ERR_INI_SIZE:
150 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
154 case UPLOAD_ERR_FORM_SIZE:
155 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
159 case UPLOAD_ERR_PARTIAL:
160 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
164 case UPLOAD_ERR_NO_FILE:
167 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
173 case UPLOAD_ERR_NO_TMP_DIR:
174 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
178 case UPLOAD_ERR_CANT_WRITE:
179 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
183 case UPLOAD_ERR_EXTENSION:
184 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
192 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
197 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
198 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as
$index => $tmpname) {
201 $suffix = $filename_arr[
"extension"];
205 if (strlen($tmpname) && is_array($this->
getSuffixes())) {
207 $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
214 if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
215 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as
$index => $tmpname) {
218 $suffix = $filename_arr[
"extension"];
222 if (strlen($tmpname)) {
224 if ($vir[0] ==
false) {
225 $this->
setAlert($lng->txt(
"form_msg_file_virus_found") .
"<br />" . $vir[1]);
244 $tpl =
new ilTemplate(
"tpl.prop_imagewizardinput.html",
true,
true,
"Modules/TestQuestionPool");
246 foreach ($this->values as
$value) {
247 if (strlen($value)) {
248 $imagename = $this->qstObject->getImagePathWeb() .
$value;
249 if ($this->qstObject->getThumbSize()) {
250 if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() .
$value)) {
251 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() .
$value;
254 $tpl->setCurrentBlock(
'image');
255 $tpl->setVariable(
'SRC_IMAGE', $imagename);
256 $tpl->setVariable(
'IMAGE_NAME', $value);
258 $tpl->setVariable(
"TXT_DELETE_EXISTING", $lng->txt(
"delete_existing_file"));
259 $tpl->setVariable(
"IMAGE_ROW_NUMBER",
$i);
261 $tpl->parseCurrentBlock();
263 $tpl->setCurrentBlock(
'addimage');
264 $tpl->setVariable(
"IMAGE_BROWSE", $lng->txt(
'select_file'));
265 $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() .
"[image][$i]");
266 $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
267 $tpl->setVariable(
"IMAGE_ROW_NUMBER",
$i);
269 $tpl->parseCurrentBlock();
272 $tpl->setCurrentBlock(
"move");
273 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
274 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
278 $tpl->parseCurrentBlock();
280 $tpl->setCurrentBlock(
"row");
282 $tpl->setVariable(
"ROW_NUMBER",
$i);
284 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
285 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
288 $tpl->parseCurrentBlock();
293 $suff_str = $delim =
"";
295 $suff_str.= $delim .
"." .
$suffix;
298 $tpl->setCurrentBlock(
'allowed_image_suffixes');
299 $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", $lng->txt(
"file_allowed_suffixes") .
" " . $suff_str);
300 $tpl->parseCurrentBlock();
310 $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
311 $tpl->setVariable(
"TEXT_NO", $lng->txt(
'no'));
312 $tpl->setVariable(
"DELETE_IMAGE_HEADER", $lng->txt(
'delete_image_header'));
313 $tpl->setVariable(
"DELETE_IMAGE_QUESTION", $lng->txt(
'delete_image_question'));
314 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
315 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
317 $a_tpl->setCurrentBlock(
"prop_generic");
318 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
319 $a_tpl->parseCurrentBlock();
322 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
323 $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.
Create styles array
The data for the language used.