ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFlashFileInputGUI Class Reference

This class represents an image file property in a property form. More...

+ Inheritance diagram for ilFlashFileInputGUI:
+ Collaboration diagram for ilFlashFileInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setValueByArray ($a_values)
 Set value by array.
 getValue ()
 Get Value.
 setValue ($a_value)
 Set Value.
 checkInput ()
 Check input, strip slashes etc.
 setApplet ($a_applet)
 Set applet.
 getApplet ()
 Get applet.
 setAppletPathWeb ($a_path)
 Set applet.path web.
 getAppletPathWeb ()
 Get applet.path web.
 getWidth ()
 Get width.
 setWidth ($a_width)
 Set width.
 getHeight ()
 Get height.
 setHeight ($a_height)
 Set height.
 getParameters ()
 Get parameters.
 setParameters ($a_parameters)
 Set parameters.
 addParameter ($name, $value)
 Add parameter.
 removeParameter ($name)
 Remove parameter.
 clearParameters ()
 Remove all parameters.
 insert (&$a_tpl)
 Insert property html.
 getDeletionFlag ()
 Get deletion flag.
- Public Member Functions inherited from ilFileInputGUI
 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.
 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.
 render ($a_mode="")
 Render html.
 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)

Protected Attributes

 $applet
 $applet_path_web
 $width
 $height
 $parameters
- Protected Attributes inherited from ilFileInputGUI
 $size = 40
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false
 $parentgui
 $parentform
 $hidden_title = ""

Additional Inherited Members

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

Detailed Description

This class represents an image file property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
Id:
class.ilFlashFileInputGUI.php 20529 2009-07-11 17:17:02Z hschottm

Definition at line 11 of file class.ilFlashFileInputGUI.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFileInputGUI.

Definition at line 25 of file class.ilFlashFileInputGUI.php.

References ilFileInputGUI\setSuffixes(), and ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("flash_file");
$this->setSuffixes(array("swf"));
$this->width = 550;
$this->height = 400;
$this->parameters = array();
}

+ Here is the call graph for this function:

Member Function Documentation

ilFlashFileInputGUI::addParameter (   $name,
  $value 
)

Add parameter.

Parameters
string$nameParameter name
string$valueParameter value

Definition at line 291 of file class.ilFlashFileInputGUI.php.

References $name.

{
$this->parameters[$name] = $value;
}
ilFlashFileInputGUI::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 73 of file class.ilFlashFileInputGUI.php.

References $_POST, $error, ilFileInputGUI\$filename, $lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFileInputGUI\getSuffixes(), getValue(), ilFormPropertyGUI\setAlert(), and ilUtil\virusHandling().

{
global $lng;
// remove trailing '/'
while (substr($_FILES[$this->getPostVar()]["name"],-1) == '/')
{
$_FILES[$this->getPostVar()]["name"] = substr($_FILES[$this->getPostVar()]["name"],0,-1);
}
$filename = $_FILES[$this->getPostVar()]["name"];
$filename_arr = pathinfo($_FILES[$this->getPostVar()]["name"]);
$suffix = $filename_arr["extension"];
$mimetype = $_FILES[$this->getPostVar()]["type"];
$size_bytes = $_FILES[$this->getPostVar()]["size"];
$temp_name = $_FILES[$this->getPostVar()]["tmp_name"];
$error = $_FILES[$this->getPostVar()]["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($this->getValue()))
{
$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;
}
}
// check suffixes
if ($_FILES[$this->getPostVar()]["tmp_name"] != "" &&
is_array($this->getSuffixes()))
{
if (!in_array(strtolower($suffix), $this->getSuffixes()))
{
$this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
return false;
}
}
// virus handling
if ($_FILES[$this->getPostVar()]["tmp_name"] != "")
{
$vir = ilUtil::virusHandling($temp_name, $filename);
if ($vir[0] == false)
{
$this->setAlert($lng->txt("form_msg_file_virus_found")."<br />".$vir[1]);
return false;
}
}
if (is_array($_POST[$this->getPostVar()]))
{
if (($this->getRequired() && strlen($_POST[$this->getPostVar()]['width']) == 0) ||
($this->getRequired() && strlen($_POST[$this->getPostVar()]['height']) == 0))
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
if (is_array($_POST[$this->getPostVar()]['flash_param_name']))
{
foreach ($_POST[$this->getPostVar()]['flash_param_name'] as $idx => $val)
{
if (strlen($val) == 0 || strlen($_POST[$this->getPostVar()]['flash_param_value'][$idx]) == 0)
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
}
}
}
return true;
}

+ Here is the call graph for this function:

ilFlashFileInputGUI::clearParameters ( )

Remove all parameters.

Definition at line 309 of file class.ilFlashFileInputGUI.php.

{
$this->parameters = array();
}
ilFlashFileInputGUI::getApplet ( )

Get applet.

Returns
string Applet

Definition at line 200 of file class.ilFlashFileInputGUI.php.

References $applet.

Referenced by getValue(), and insert().

{
return $this->applet;
}

+ Here is the caller graph for this function:

ilFlashFileInputGUI::getAppletPathWeb ( )

Get applet.path web.

Returns
string Applet path web

Definition at line 220 of file class.ilFlashFileInputGUI.php.

References $applet_path_web.

Referenced by insert().

+ Here is the caller graph for this function:

ilFlashFileInputGUI::getDeletionFlag ( )

Get deletion flag.

Definition at line 392 of file class.ilFlashFileInputGUI.php.

References $_POST, and ilFormPropertyGUI\getPostVar().

{
if ($_POST[$this->getPostVar()."_delete"])
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilFlashFileInputGUI::getHeight ( )

Get height.

Returns
integer height

Definition at line 250 of file class.ilFlashFileInputGUI.php.

References $height.

Referenced by insert().

{
return $this->height;
}

+ Here is the caller graph for this function:

ilFlashFileInputGUI::getParameters ( )

Get parameters.

Returns
array Parameters

Definition at line 270 of file class.ilFlashFileInputGUI.php.

References $parameters.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilFlashFileInputGUI::getValue ( )

Get Value.

Returns
string Value

Reimplemented from ilFileInputGUI.

Definition at line 45 of file class.ilFlashFileInputGUI.php.

References getApplet().

Referenced by checkInput().

{
return $this->getApplet();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFlashFileInputGUI::getWidth ( )

Get width.

Returns
integer width

Definition at line 230 of file class.ilFlashFileInputGUI.php.

References $width.

Referenced by insert().

{
return $this->width;
}

+ Here is the caller graph for this function:

ilFlashFileInputGUI::insert ( $a_tpl)

Insert property html.

Reimplemented from ilFileInputGUI.

Definition at line 317 of file class.ilFlashFileInputGUI.php.

References $lng, $name, $tpl, getApplet(), getAppletPathWeb(), ilFormPropertyGUI\getFieldId(), getHeight(), ilFileInputGUI\getMaxFileSizeString(), getParameters(), ilFormPropertyGUI\getPostVar(), getWidth(), ilYuiUtil\initConnectionWithAnimation(), ilFileInputGUI\outputSuffixes(), and ilUtil\prepareFormOutput().

{
global $lng;
$template = new ilTemplate("tpl.prop_flashfile.html", true, true, "Services/Form");
if ($this->getApplet() != "")
{
$this->outputSuffixes($template);
if (count($this->getParameters()))
{
$index = 0;
$params = array();
foreach ($this->getParameters() as $name => $value)
{
array_push($params, urlencode($name) . "=" . urlencode($value));
$template->setCurrentBlock("applet_param_input");
$template->setVariable("TEXT_NAME", $lng->txt("name"));
$template->setVariable("TEXT_VALUE", $lng->txt("value"));
$template->setVariable("PARAM_INDEX", $index);
$template->setVariable("POST_VAR_P", $this->getPostVar());
$template->setVariable("VALUE_NAME", "value=\"" . ilUtil::prepareFormOutput($name) . "\"");
$template->setVariable("VALUE_VALUE", "value=\"" . ilUtil::prepareFormOutput($value) . "\"");
$template->setVariable("TEXT_DELETE_PARAM", $lng->txt("delete_parameter"));
$template->parseCurrentBlock();
$index++;
}
$template->setCurrentBlock("applet_parameter");
$template->setVariable("PARAM_VALUE", join($params, "&"));
$template->parseCurrentBlock();
$template->setCurrentBlock("flash_vars");
$template->setVariable("PARAM_VALUE", join($params, "&"));
$template->parseCurrentBlock();
}
$template->setCurrentBlock("applet");
$template->setVariable("TEXT_ADD_PARAM", $lng->txt("add_parameter"));
$template->setVariable("APPLET_WIDTH", $this->getWidth());
$template->setVariable("APPLET_HEIGHT", $this->getHeight());
$template->setVariable("POST_VAR_D", $this->getPostVar());
$template->setVariable("FILENAME", $this->getApplet());
$template->setVariable("TEXT_WIDTH", $lng->txt("width"));
$template->setVariable("TEXT_HEIGHT", $lng->txt("height"));
$template->setVariable("APPLET_FILE", $this->getApplet());
$template->setVariable("APPLET_PATH", $this->getAppletPathWeb().$this->getApplet());
if ($this->getWidth()) $template->setVariable("VALUE_WIDTH", "value=\"" . $this->getWidth() . "\"");
if ($this->getHeight()) $template->setVariable("VALUE_HEIGHT", "value=\"" . $this->getHeight() . "\"");
$template->setVariable("ID", $this->getFieldId());
$template->setVariable("TXT_DELETE_EXISTING",
$lng->txt("delete_existing_file"));
$template->parseCurrentBlock();
}
$js_tpl = new ilTemplate('tpl.flashAddParam.js', true, true, 'Services/Form');
$js_tpl->setVariable("TEXT_NAME", $lng->txt("name"));
$js_tpl->setVariable("TEXT_VALUE", $lng->txt("value"));
$js_tpl->setVariable("POST_VAR", $this->getPostVar());
$js_tpl->setVariable("TEXT_DELETE_PARAM", $lng->txt("delete_parameter"));
$js_tpl->setVariable("TEXT_CONFIRM_DELETE_PARAMETER", $lng->txt("confirm_delete_parameter"));
$template->setVariable("POST_VAR", $this->getPostVar());
$template->setVariable("ID", $this->getFieldId());
$template->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice")." ".$this->getMaxFileSizeString());
$template->setVariable("JAVASCRIPT_FLASH", $js_tpl->get());
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $template->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
}

+ Here is the call graph for this function:

ilFlashFileInputGUI::removeParameter (   $name)

Remove parameter.

Parameters
string$nameParameter name

Definition at line 301 of file class.ilFlashFileInputGUI.php.

References $name.

{
unset($this->parameters[$name]);
}
ilFlashFileInputGUI::setApplet (   $a_applet)

Set applet.

Parameters
string$a_appletApplet

Definition at line 190 of file class.ilFlashFileInputGUI.php.

Referenced by setValue().

{
$this->applet = $a_applet;
}

+ Here is the caller graph for this function:

ilFlashFileInputGUI::setAppletPathWeb (   $a_path)

Set applet.path web.

Parameters
string$a_pathApplet path web

Definition at line 210 of file class.ilFlashFileInputGUI.php.

{
$this->applet_path_web = $a_path;
}
ilFlashFileInputGUI::setHeight (   $a_height)

Set height.

Parameters
integer$a_heightheight

Definition at line 260 of file class.ilFlashFileInputGUI.php.

Referenced by setValue().

{
$this->height = $a_height;
}

+ Here is the caller graph for this function:

ilFlashFileInputGUI::setParameters (   $a_parameters)

Set parameters.

Parameters
array$a_parametersParameters

Definition at line 280 of file class.ilFlashFileInputGUI.php.

{
$this->parameters = $a_parameters;
}
ilFlashFileInputGUI::setValue (   $a_value)

Set Value.

(used for displaying file title of existing file below input field)

Parameters
string$a_valueValue

Reimplemented from ilFileInputGUI.

Definition at line 50 of file class.ilFlashFileInputGUI.php.

References setApplet(), setHeight(), and setWidth().

Referenced by setValueByArray().

{
if (is_array($a_value))
{
if (array_key_exists('width', $a_value)) $this->setWidth($a_value['width']);
if (array_key_exists('height', $a_value)) $this->setHeight($a_value['height']);
if (array_key_exists('filename', $a_value)) $this->setApplet($a_value['filename']);
if (is_array($a_value['flash_param_name']))
{
$this->parameters = array();
foreach ($a_value['flash_param_name'] as $idx => $val)
{
$this->parameters[$val] = $a_value['flash_param_value'][$idx];
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFlashFileInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Reimplemented from ilFileInputGUI.

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

References ilFormPropertyGUI\getPostVar(), and setValue().

{
$this->setValue($a_values[$this->getPostVar()]);
}

+ Here is the call graph for this function:

ilFlashFileInputGUI::setWidth (   $a_width)

Set width.

Parameters
integer$a_widthwidth

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

Referenced by setValue().

{
$this->width = $a_width;
}

+ Here is the caller graph for this function:

Field Documentation

ilFlashFileInputGUI::$applet
protected

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

Referenced by getApplet().

ilFlashFileInputGUI::$applet_path_web
protected

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

Referenced by getAppletPathWeb().

ilFlashFileInputGUI::$height
protected

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

Referenced by getHeight().

ilFlashFileInputGUI::$parameters
protected

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

Referenced by getParameters().

ilFlashFileInputGUI::$width
protected

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

Referenced by getWidth().


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