ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 setDisableUpload ($disable_upload)
 setDisableActions ($disable_actions)
 setDisableText ($disable_text)
 setValue ($a_value)
 Set Value.
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes.
 getSuffixes ()
 Get Accepted Suffixes.
 setValues ($a_values)
 Set Values.
 getValues ()
 Get Values.
 setQuestionObject ($a_value)
 Set question object.
 getQuestionObject ()
 Get question object.
 setAllowMove ($a_allow_move)
 Set allow move.
 getAllowMove ()
 Get allow move.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
- Public Member Functions inherited from ilTextInputGUI
 getValue ()
 Get Value.
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure.
 getValidationFailureMessage ()
 setValidationRegexp ($a_value)
 Set validation regexp.
 getValidationRegexp ()
 Get validation regexp.
 setMaxLength ($a_maxlength)
 Set Max Length.
 getMaxLength ()
 Get Max Length.
 setSize ($a_size)
 Set Size.
 setInlineStyle ($a_style)
 Set inline style.
 getInlineStyle ()
 Get inline style.
 setCssClass ($a_class)
 getCssClass ()
 setValueByArray ($a_values)
 Set value by array.
 getSize ()
 Get Size.
 setSuffix ($a_value)
 Set suffix.
 getSuffix ()
 Get suffix.
 setInputType ($a_type)
 set input type
 getInputType ()
 get input type
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter.
 getSubmitFormOnEnter ()
 Get submit form on enter.
 getDataSource ()
 get datasource link for js autocomplete
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete
 setMultiValues (array $a_values)
 Set multi values.
 render ($a_mode="")
 Render item.
 getTableFilterHTML ()
 Get HTML for table filter.
 getToolbarHTML ()
 Get HTML for toolbar.
 setDisableHtmlAutoComplete ($autocomplete)
 isHtmlAutoCompleteDisabled ()
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
 getItemByPostVar ($a_post_var)
 Get item by post var.
- Public Member Functions inherited from ilFormPropertyGUI
executeCommand ()
 Execute command.
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setPostVar ($a_postvar)
 Set Post Variable.
 getPostVar ()
 Get Post Variable.
 getFieldId ()
 Get Post Variable.
 setInfo ($a_info)
 Set Information Text.
 getInfo ()
 Get Information Text.
 setAlert ($a_alert)
 Set Alert Text.
 getAlert ()
 Get Alert Text.
 setRequired ($a_required)
 Set Required.
 getRequired ()
 Get Required.
 setDisabled ($a_disabled)
 Set Disabled.
 getDisabled ()
 Get Disabled.
 setParentForm ($a_parentform)
 Set Parent Form.
 getParentForm ()
 Get Parent Form.
 setParent ($a_val)
 Set Parent GUI object.
 getParent ()
 Get Parent GUI object.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 serializeData ()
 serialize data
 unserializeData ($a_data)
 unserialize data
 writeToSession ()
 Write to session.
 clearFromSession ()
 Clear session value.
 readFromSession ()
 Read from session.
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties)
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi.
 getMulti ()
 Get Multi.
 getMultiValues ()
 Get multi values.
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g.

Protected Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type.
 getMultiIconsHTML ()
 Get HTML for multiple value icons.

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:
class.ilImageWizardInputGUI.php 56134 2014-12-09 13:22:18Z mbecker

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

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

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

{
parent::__construct($a_title, $a_postvar);
$this->setSuffixes(array("jpg", "jpeg", "png", "gif"));
$this->setSize('25');
$this->validationRegexp = "";
}

+ Here is the call graph for this function:

Member Function Documentation

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 167 of file class.ilImageWizardInputGUI.php.

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

{
global $lng;
if (is_array($_POST[$this->getPostVar()])) $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
if (is_array($_FILES[$this->getPostVar()]['error']['image']))
{
foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error)
{
// error handling
if ($error > 0)
{
switch ($error)
{
case UPLOAD_ERR_INI_SIZE:
$this->setAlert($lng->txt("form_msg_file_size_exceeds"));
return false;
break;
case UPLOAD_ERR_FORM_SIZE:
$this->setAlert($lng->txt("form_msg_file_size_exceeds"));
return false;
break;
case UPLOAD_ERR_PARTIAL:
$this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
return false;
break;
case UPLOAD_ERR_NO_FILE:
if ($this->getRequired())
{
if (!strlen($_POST[$this->getPostVar()]['imagename'][$index]))
{
$this->setAlert($lng->txt("form_msg_file_no_upload"));
return false;
}
}
break;
case UPLOAD_ERR_NO_TMP_DIR:
$this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
return false;
break;
case UPLOAD_ERR_CANT_WRITE:
$this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
return false;
break;
case UPLOAD_ERR_EXTENSION:
$this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
return false;
break;
}
}
}
}
else
{
if ($this->getRequired())
{
$this->setAlert($lng->txt("form_msg_file_no_upload"));
return false;
}
}
if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image']))
{
foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname)
{
$filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
$filename_arr = pathinfo($filename);
$suffix = $filename_arr["extension"];
$mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
$size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
// check suffixes
if (strlen($tmpname) && is_array($this->getSuffixes()))
{
if (!in_array(strtolower($suffix), $this->getSuffixes()))
{
$this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
return false;
}
}
}
}
if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image']))
{
foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname)
{
$filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
$filename_arr = pathinfo($filename);
$suffix = $filename_arr["extension"];
$mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
$size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
// virus handling
if (strlen($tmpname))
{
$vir = ilUtil::virusHandling($tmpname, $filename);
if ($vir[0] == false)
{
$this->setAlert($lng->txt("form_msg_file_virus_found")."<br />".$vir[1]);
return false;
}
}
}
}
return $this->checkSubItemsInput();
}

+ Here is the call graph for this function:

ilImageWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

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

References $allowMove.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilImageWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

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

References $qstObject.

{
}
ilImageWizardInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

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

References $suffixes.

Referenced by checkInput(), and insert().

{
}

+ Here is the caller graph for this function:

ilImageWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

References $values.

{
return $this->values;
}
ilImageWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

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

References $lng, ilTextInputGUI\$suffix, $tpl, ilTextInputGUI\$value, getAllowMove(), ilFormPropertyGUI\getFieldId(), ilUtil\getFileSizeInfo(), ilUtil\getImagePath(), ilFormPropertyGUI\getPostVar(), getSuffixes(), ilYuiUtil\initDomEvent(), and ilUtil\prepareFormOutput().

{
global $lng;
$tpl = new ilTemplate("tpl.prop_imagewizardinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->values as $value)
{
if (strlen($value))
{
$imagename = $this->qstObject->getImagePathWeb() . $value;
if ($this->qstObject->getThumbSize())
{
if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value))
{
$imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value;
}
}
$tpl->setCurrentBlock('image');
$tpl->setVariable('SRC_IMAGE', $imagename);
$tpl->setVariable('IMAGE_NAME', $value);
$tpl->setVariable('ALT_IMAGE', ilUtil::prepareFormOutput($value));
$tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
$tpl->setVariable("IMAGE_ROW_NUMBER", $i);
$tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
if($this->disable_upload)
{
$tpl->setVariable('DISABLED_UPLOADS', ' disabled="disabled"');
}
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('addimage');
$tpl->setVariable("IMAGE_ID", $this->getPostVar() . "[image][$i]");
$tpl->setVariable("IMAGE_SUBMIT", $lng->txt("upload"));
$tpl->setVariable("IMAGE_ROW_NUMBER", $i);
$tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
if($this->disable_upload)
{
$tpl->setVariable('DISABLED_UPLOADS', ' disabled="disabled"');
}
$tpl->parseCurrentBlock();
if ($this->getAllowMove() && !$this->disable_actions)
{
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
$tpl->setVariable("MOVE_ID", $this->getPostVar() . "[$i]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = ($i % 2 == 0) ? "even" : "odd";
if ($i == 0) $class .= " first";
if ($i == count($this->values)-1) $class .= " last";
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
if(!$this->disable_actions)
{
//$tpl->setCurrentBlock('addremove');
$tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
$tpl->setVariable( "ADD_BUTTON", ilUtil::getImagePath( 'edit_add.png' ) );
$tpl->setVariable( "REMOVE_BUTTON", ilUtil::getImagePath( 'edit_remove.png' ) );
} else {
//$tpl->setVariable('DISABLED_ACTIONS', ' disabled="disabled"');
}
$tpl->parseCurrentBlock();
$i++;
}
if (is_array($this->getSuffixes()))
{
$suff_str = $delim = "";
foreach($this->getSuffixes() as $suffix)
{
$suff_str.= $delim.".".$suffix;
$delim = ", ";
}
$tpl->setCurrentBlock('allowed_image_suffixes');
$tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes")." ".$suff_str);
$tpl->parseCurrentBlock();
}
/*
$tpl->setCurrentBlock("image_heading");
$tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
$tpl->parseCurrentBlock();
*/
$tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("TEXT_YES", $lng->txt('yes'));
$tpl->setVariable("TEXT_NO", $lng->txt('no'));
$tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
$tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
$tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
$tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/imagewizard.js");
}

+ Here is the call graph for this function:

ilImageWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

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

{
$this->allowMove = $a_allow_move;
}
ilImageWizardInputGUI::setDisableActions (   $disable_actions)
Parameters
boolean$disable_actions

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

References $disable_actions.

{
$this->disable_actions = $disable_actions;
}
ilImageWizardInputGUI::setDisableText (   $disable_text)
Parameters
boolean$disable_text

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

References $disable_text.

{
$this->disable_text = $disable_text;
}
ilImageWizardInputGUI::setDisableUpload (   $disable_upload)
Parameters
boolean$disable_upload

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

References $disable_upload.

{
$this->disable_upload = $disable_upload;
}
ilImageWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

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

{
$this->qstObject =& $a_value;
}
ilImageWizardInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

Referenced by __construct().

{
$this->suffixes = $a_suffixes;
}

+ Here is the caller graph for this function:

ilImageWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

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

References ilTextInputGUI\$value.

{
$this->values = array();
if (is_array($a_value))
{
if (is_array($a_value['count']))
{
foreach ($a_value['count'] as $index => $value)
{
array_push($this->values, $a_value['imagename'][$index]);
}
}
}
}
ilImageWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

{
$this->values = $a_values;
}

Field Documentation

ilImageWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

ilImageWizardInputGUI::$disable_actions = false
protected

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

Referenced by setDisableActions().

ilImageWizardInputGUI::$disable_text = false
protected

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

Referenced by setDisableText().

ilImageWizardInputGUI::$disable_upload = false
protected

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

Referenced by setDisableUpload().

ilImageWizardInputGUI::$qstObject = null
protected

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

Referenced by getQuestionObject().

ilImageWizardInputGUI::$suffixes = array()
protected

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

Referenced by getSuffixes().

ilImageWizardInputGUI::$values = array()
protected

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

Referenced by getValues().


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