ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFileWizardInputGUI Class Reference

This class represents a file wizard property in a property form. More...

+ Inheritance diagram for ilFileWizardInputGUI:
+ Collaboration diagram for ilFileWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setImagePathWeb ($a_path)
 Set the web image path.
 getImagePathWeb ()
 Get the web image path.
 setFilenames ($a_filenames)
 Set filenames.
 getFilenames ()
 Get filenames.
 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 ilFileInputGUI
 setValueByArray ($a_values)
 Set value by array.
 setValue ($a_value)
 Set Value.
 getValue ()
 Get Value.
 setSize ($a_size)
 Set Size.
 getSize ()
 Get Size.
 setFilename ($a_val)
 Set filename value (if filename selection is enabled)
 getFilename ()
 Get Value.
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes.
 getSuffixes ()
 Get Accepted Suffixes.
 setPending ($a_val)
 Set pending filename value.
 getPending ()
 Get pending filename.
 enableFileNameSelection ($a_post_var)
 If enabled, users get the possibility to enter a filename for the uploaded file.
 isFileNameSelectionEnabled ()
 Check if filename selection is enabled.
 getFileNamePostVar ()
 Get file name post var.
 setALlowDeletion ($a_val)
 Set allow deletion.
 getALlowDeletion ()
 Get allow deletion.
 render ($a_mode="")
 Render html.
 getDeletionFlag ()
 Get deletion flag.
 getToolbarHTML ()
 Get HTML for toolbar.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 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)
 Set Multi.
 getMulti ()
 Get Multi.
 setMultiValues (array $a_values)
 Set multi values.
 getMultiValues ()
 Get multi values.

Protected Attributes

 $filenames = array()
 $allowMove = false
 $imagepath_web = ""
- Protected Attributes inherited from ilFileInputGUI
 $size = 40
 $pending
 $allow_deletion
- 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
 $multi_values

Additional Inherited Members

- Protected Member Functions inherited from ilFileInputGUI
 outputSuffixes ($a_tpl, $a_block="allowed_suffixes")
 getMaxFileSizeString ()

Detailed Description

This class represents a file wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
Id:
class.ilFileWizardInputGUI.php 18834 2009-02-03 10:10:29Z hschottm

Definition at line 31 of file class.ilFileWizardInputGUI.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFileInputGUI.

Definition at line 43 of file class.ilFileWizardInputGUI.php.

{
parent::__construct($a_title, $a_postvar);
}

Member Function Documentation

ilFileWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFileInputGUI.

Definition at line 113 of file class.ilFileWizardInputGUI.php.

References ilFileInputGUI\$filename, $lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFileInputGUI\getSuffixes(), ilFormPropertyGUI\setAlert(), and ilUtil\virusHandling().

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

+ Here is the call graph for this function:

ilFileWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 103 of file class.ilFileWizardInputGUI.php.

References $allowMove.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilFileWizardInputGUI::getFilenames ( )

Get filenames.

Returns
array filenames

Definition at line 83 of file class.ilFileWizardInputGUI.php.

References $filenames.

{
}
ilFileWizardInputGUI::getImagePathWeb ( )

Get the web image path.

Returns
string Path

Definition at line 63 of file class.ilFileWizardInputGUI.php.

References $imagepath_web.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilFileWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilFileInputGUI.

Definition at line 222 of file class.ilFileWizardInputGUI.php.

References $lng, $tpl, getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilUtil\getImagePath(), getImagePathWeb(), ilFileInputGUI\getMaxFileSizeString(), ilFormPropertyGUI\getPostVar(), ilYuiUtil\initDomEvent(), ilFileInputGUI\outputSuffixes(), and ilUtil\prepareFormOutput().

{
global $lng;
$tpl = new ilTemplate("tpl.prop_filewizardinput.html", true, true, "Services/Form");
$i = 0;
foreach ($this->filenames as $value)
{
if (strlen($value))
{
$tpl->setCurrentBlock("image");
$tpl->setVariable("SRC_IMAGE", $this->getImagePathWeb() . ilUtil::prepareFormOutput($value));
$tpl->setVariable("PICTURE_FILE", ilUtil::prepareFormOutput($value));
$tpl->setVariable("ID", $this->getFieldId() . "[$i]");
$tpl->setVariable("ALT_IMAGE", ilUtil::prepareFormOutput($value));
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove())
{
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
$tpl->setVariable("ID", $this->getFieldId() . "[$i]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$this->outputSuffixes($tpl, "allowed_image_suffixes");
$tpl->setCurrentBlock("row");
$class = ($i % 2 == 0) ? "even" : "odd";
if ($i == 0) $class .= " first";
if ($i == count($this->filenames)-1) $class .= " last";
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar() . "[$i]");
$tpl->setVariable("ID", $this->getFieldId() . "[$i]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
$tpl->setVariable("ALT_ADD", $lng->txt("add"));
$tpl->setVariable("ALT_REMOVE", $lng->txt("remove"));
if ($this->getDisabled())
{
$tpl->setVariable("DISABLED",
" disabled=\"disabled\"");
}
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString());
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getFieldId());
$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("./Services/Form/templates/default/filewizard.js");
}

+ Here is the call graph for this function:

ilFileWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 93 of file class.ilFileWizardInputGUI.php.

{
$this->allowMove = $a_allow_move;
}
ilFileWizardInputGUI::setFilenames (   $a_filenames)

Set filenames.

Parameters
array$a_valueValue

Definition at line 73 of file class.ilFileWizardInputGUI.php.

Referenced by ilObjExerciseGUI\initAssignmentForm(), and ilObjExerciseGUI\initUploadForm().

{
$this->filenames = $a_filenames;
}

+ Here is the caller graph for this function:

ilFileWizardInputGUI::setImagePathWeb (   $a_path)

Set the web image path.

Parameters
string$a_pathPath

Definition at line 53 of file class.ilFileWizardInputGUI.php.

{
$this->imagepath_web = $a_path;
}

Field Documentation

ilFileWizardInputGUI::$allowMove = false
protected

Definition at line 34 of file class.ilFileWizardInputGUI.php.

Referenced by getAllowMove().

ilFileWizardInputGUI::$filenames = array()
protected

Definition at line 33 of file class.ilFileWizardInputGUI.php.

Referenced by getFilenames().

ilFileWizardInputGUI::$imagepath_web = ""
protected

Definition at line 35 of file class.ilFileWizardInputGUI.php.

Referenced by getImagePathWeb().


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