ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilImageWizardInputGUI Class Reference

This class represents a single choice wizard property in a property form. More...

+ Inheritance diagram for ilImageWizardInputGUI:
+ Collaboration diagram for ilImageWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 getSuffixes ()
 Get Accepted Suffixes. More...
 
 setValues ($a_values)
 Set Values. More...
 
 getValues ()
 Get Values. More...
 
 setQuestionObject ($a_value)
 Set question object. More...
 
 getQuestionObject ()
 Get question object. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilTextInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure. More...
 
 getValidationFailureMessage ()
 
 setValidationRegexp ($a_value)
 Set validation regexp. More...
 
 getValidationRegexp ()
 Get validation regexp. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setInlineStyle ($a_style)
 Set inline style. More...
 
 getInlineStyle ()
 Get inline style. More...
 
 setCssClass ($a_class)
 
 getCssClass ()
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setInputType ($a_type)
 set input type More...
 
 getInputType ()
 get input type More...
 
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter. More...
 
 getSubmitFormOnEnter ()
 Get submit form on enter. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getDataSource ()
 get datasource link for js autocomplete More...
 
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete More...
 
 setDataSourceSubmitOnSelection ($a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl ($a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setDisableHtmlAutoComplete ($autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Attributes

 $values = array()
 
 $allowMove = false
 
 $qstObject = null
 
 $suffixes = array()
 
- Protected Attributes inherited from ilTextInputGUI
 $value
 
 $maxlength = 200
 
 $size = 40
 
 $validationRegexp
 
 $validationFailureMessage = ''
 
 $suffix
 
 $style_css
 
 $css_class
 
 $ajax_datasource
 
 $ajax_datasource_delimiter
 
 $ajax_datasource_commit = false
 
 $ajax_datasource_commit_url
 
 $submit_form_on_enter = false
 
 $autocomplete_disabled = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a single choice wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

Definition at line 14 of file class.ilImageWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilImageWizardInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

Definition at line 27 of file class.ilImageWizardInputGUI.php.

28 {
29 parent::__construct($a_title, $a_postvar);
31 $this->setSize('25');
32 $this->validationRegexp = "";
33 }
static getAllowedImageMaterialFileExtensions()
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setSize($a_size)
Set Size.

References assQuestion\getAllowedImageMaterialFileExtensions(), ilTextInputGUI\setSize(), and setSuffixes().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilImageWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilTextInputGUI.

Definition at line 137 of file class.ilImageWizardInputGUI.php.

138 {
139 global $lng;
140
141 if (is_array($_POST[$this->getPostVar()])) {
143 }
144 if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
145 foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
146 // error handling
147 if ($error > 0) {
148 switch ($error) {
149 case UPLOAD_ERR_INI_SIZE:
150 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
151 return false;
152 break;
153
154 case UPLOAD_ERR_FORM_SIZE:
155 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
156 return false;
157 break;
158
159 case UPLOAD_ERR_PARTIAL:
160 $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
161 return false;
162 break;
163
164 case UPLOAD_ERR_NO_FILE:
165 if ($this->getRequired()) {
166 if (!strlen($_POST[$this->getPostVar()]['imagename'][$index])) {
167 $this->setAlert($lng->txt("form_msg_file_no_upload"));
168 return false;
169 }
170 }
171 break;
172
173 case UPLOAD_ERR_NO_TMP_DIR:
174 $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
175 return false;
176 break;
177
178 case UPLOAD_ERR_CANT_WRITE:
179 $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
180 return false;
181 break;
182
183 case UPLOAD_ERR_EXTENSION:
184 $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
185 return false;
186 break;
187 }
188 }
189 }
190 } else {
191 if ($this->getRequired()) {
192 $this->setAlert($lng->txt("form_msg_file_no_upload"));
193 return false;
194 }
195 }
196
197 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
198 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
199 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
200 $filename_arr = pathinfo($filename);
201 $suffix = $filename_arr["extension"];
202 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
203 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
204 // check suffixes
205 if (strlen($tmpname) && is_array($this->getSuffixes())) {
206 if (!in_array(strtolower($suffix), $this->getSuffixes())) {
207 $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
208 return false;
209 }
210 }
211 }
212 }
213
214 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
215 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
216 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
217 $filename_arr = pathinfo($filename);
218 $suffix = $filename_arr["extension"];
219 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
220 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
221 // virus handling
222 if (strlen($tmpname)) {
223 $vir = ilUtil::virusHandling($tmpname, $filename);
224 if ($vir[0] == false) {
225 $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
226 return false;
227 }
228 }
229 }
230 }
231
232 return $this->checkSubItemsInput();
233 }
$_POST["username"]
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
getSuffixes()
Get Accepted Suffixes.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
$error
Definition: Error.php:17
$index
Definition: metadata.php:60

References $_POST, $error, $filename, $index, ilFormPropertyGUI\$lng, ilTextInputGUI\$suffix, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSuffixes(), ilFormPropertyGUI\setAlert(), ilUtil\stripSlashesRecursive(), and ilUtil\virusHandling().

+ Here is the call graph for this function:

◆ getAllowMove()

ilImageWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 127 of file class.ilImageWizardInputGUI.php.

References $allowMove.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getQuestionObject()

ilImageWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

Definition at line 107 of file class.ilImageWizardInputGUI.php.

References $qstObject.

◆ getSuffixes()

ilImageWizardInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

Definition at line 67 of file class.ilImageWizardInputGUI.php.

References $suffixes.

Referenced by checkInput(), and insert().

+ Here is the caller graph for this function:

◆ getValues()

ilImageWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

Definition at line 87 of file class.ilImageWizardInputGUI.php.

References $values.

◆ insert()

ilImageWizardInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

Definition at line 240 of file class.ilImageWizardInputGUI.php.

241 {
242 global $lng;
243
244 $tpl = new ilTemplate("tpl.prop_imagewizardinput.html", true, true, "Modules/TestQuestionPool");
245 $i = 0;
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;
252 }
253 }
254 $tpl->setCurrentBlock('image');
255 $tpl->setVariable('SRC_IMAGE', $imagename);
256 $tpl->setVariable('IMAGE_NAME', $value);
257 $tpl->setVariable('ALT_IMAGE', ilUtil::prepareFormOutput($value));
258 $tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
259 $tpl->setVariable("IMAGE_ROW_NUMBER", $i);
260 $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
261 $tpl->parseCurrentBlock();
262 }
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);
268 $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
269 $tpl->parseCurrentBlock();
270
271 if ($this->getAllowMove()) {
272 $tpl->setCurrentBlock("move");
273 $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
274 $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
275 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
276 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
277 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
278 $tpl->parseCurrentBlock();
279 }
280 $tpl->setCurrentBlock("row");
281 $tpl->setVariable("POST_VAR", $this->getPostVar());
282 $tpl->setVariable("ROW_NUMBER", $i);
283 $tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
284 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
285 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
286 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
287 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
288 $tpl->parseCurrentBlock();
289 $i++;
290 }
291
292 if (is_array($this->getSuffixes())) {
293 $suff_str = $delim = "";
294 foreach ($this->getSuffixes() as $suffix) {
295 $suff_str.= $delim . "." . $suffix;
296 $delim = ", ";
297 }
298 $tpl->setCurrentBlock('allowed_image_suffixes');
299 $tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str);
300 $tpl->parseCurrentBlock();
301 }
302 /*
303 $tpl->setCurrentBlock("image_heading");
304 $tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
305 $tpl->parseCurrentBlock();
306 */
307
308 $tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
309 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
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'));
316
317 $a_tpl->setCurrentBlock("prop_generic");
318 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
319 $a_tpl->parseCurrentBlock();
320
321 global $tpl;
322 $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
323 $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/imagewizard.js");
324 }
$tpl
Definition: ilias.php:10
getFieldId()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static getFileSizeInfo()
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$i
Definition: disco.tpl.php:19

References $i, ilFormPropertyGUI\$lng, ilTextInputGUI\$suffix, $tpl, ilTextInputGUI\$value, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getFieldId(), ilUtil\getFileSizeInfo(), ilFormPropertyGUI\getPostVar(), getSuffixes(), ilUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, and ilGlyphGUI\UP.

+ Here is the call graph for this function:

◆ setAllowMove()

ilImageWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 117 of file class.ilImageWizardInputGUI.php.

118 {
119 $this->allowMove = $a_allow_move;
120 }

◆ setQuestionObject()

ilImageWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

Definition at line 97 of file class.ilImageWizardInputGUI.php.

98 {
99 $this->qstObject =&$a_value;
100 }

◆ setSuffixes()

ilImageWizardInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

Definition at line 57 of file class.ilImageWizardInputGUI.php.

58 {
59 $this->suffixes = $a_suffixes;
60 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setValue()

ilImageWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

Definition at line 40 of file class.ilImageWizardInputGUI.php.

41 {
42 $this->values = array();
43 if (is_array($a_value)) {
44 if (is_array($a_value['count'])) {
45 foreach ($a_value['count'] as $index => $value) {
46 array_push($this->values, $a_value['imagename'][$index]);
47 }
48 }
49 }
50 }

References $index, and ilTextInputGUI\$value.

◆ setValues()

ilImageWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

Definition at line 77 of file class.ilImageWizardInputGUI.php.

78 {
79 $this->values = $a_values;
80 }

Field Documentation

◆ $allowMove

ilImageWizardInputGUI::$allowMove = false
protected

Definition at line 17 of file class.ilImageWizardInputGUI.php.

Referenced by getAllowMove().

◆ $qstObject

ilImageWizardInputGUI::$qstObject = null
protected

Definition at line 18 of file class.ilImageWizardInputGUI.php.

Referenced by getQuestionObject().

◆ $suffixes

ilImageWizardInputGUI::$suffixes = array()
protected

Definition at line 19 of file class.ilImageWizardInputGUI.php.

Referenced by getSuffixes().

◆ $values

ilImageWizardInputGUI::$values = array()
protected

Definition at line 16 of file class.ilImageWizardInputGUI.php.

Referenced by getValues().


The documentation for this class was generated from the following file: