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

This class represents a width/height item in a property form. More...

+ Inheritance diagram for ilWidthHeightInputGUI:
+ Collaboration diagram for ilWidthHeightInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setWidth ($a_width)
 Set Width.
 getWidth ()
 Get Width.
 setHeight ($a_height)
 Set Height.
 getHeight ()
 Get Height.
 setConstrainProportions ($a_constrainproportions)
 Set Constrain Proportions.
 getConstrainProportions ()
 Get Constrain Proportions.
 checkInput ()
 Check input, strip slashes etc.
 insert ($a_tpl)
 Insert property html.
 setValueByArray ($a_values)
 Set value by array.
- 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.
 getSubForm ()
 Get sub form html.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 getItemByPostVar ($a_post_var)
 Get item by post var.
 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

 $value
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false
 $parentgui
 $parentform
 $hidden_title = ""

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type.

Detailed Description

This class represents a width/height item in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilWidthHeightInputGUI.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

References ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("width_height");
$this->dirs = array("width", "height");
}

+ Here is the call graph for this function:

Member Function Documentation

ilWidthHeightInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

Definition at line 94 of file class.ilWidthHeightInputGUI.php.

References $_POST, $dir, $lng, $value, ilFormPropertyGUI\getPostVar(), setHeight(), setWidth(), and ilUtil\stripSlashes().

{
global $lng;
foreach ($this->dirs as $dir)
{
$pre_value = $_POST[$this->getPostVar()][$dir]["pre_value"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["pre_value"]);
/*
if ($this->getRequired() && trim($num_value) == "")
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}*/
$value = $pre_value;
if (trim($value) != "")
{
switch ($dir)
{
case "width": $this->setWidth($value); break;
case "height": $this->setHeight($value); break;
}
}
}
return true;
}

+ Here is the call graph for this function:

ilWidthHeightInputGUI::getConstrainProportions ( )

Get Constrain Proportions.

Returns
boolean Constrain Proportions

Definition at line 84 of file class.ilWidthHeightInputGUI.php.

Referenced by insert().

{
return $this->constrainproportions;
}

+ Here is the caller graph for this function:

ilWidthHeightInputGUI::getHeight ( )

Get Height.

Returns
integer Height

Definition at line 64 of file class.ilWidthHeightInputGUI.php.

Referenced by insert().

{
return $this->height;
}

+ Here is the caller graph for this function:

ilWidthHeightInputGUI::getWidth ( )

Get Width.

Returns
integer Width

Definition at line 44 of file class.ilWidthHeightInputGUI.php.

Referenced by insert().

{
return $this->width;
}

+ Here is the caller graph for this function:

ilWidthHeightInputGUI::insert (   $a_tpl)

Insert property html.

Definition at line 130 of file class.ilWidthHeightInputGUI.php.

References $dir, $GLOBALS, $lng, $tpl, $value, getConstrainProportions(), getHeight(), ilFormPropertyGUI\getPostVar(), and getWidth().

{
global $lng;
$tpl = new ilTemplate("tpl.prop_width_height.html", true, true, "Services/MediaObjects");
foreach ($this->dirs as $dir)
{
switch($dir)
{
case "width": $value = strtolower(trim($this->getWidth())); break;
case "height": $value = strtolower(trim($this->getHeight())); break;
}
$tpl->setVariable("VAL_".strtoupper($dir), $value);
}
{
$tpl->setVariable("CHECKED", 'checked="checked"');
}
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("TXT_CONSTR_PROP", $lng->txt("cont_constrain_proportions"));
$wh_ratio = 0;
if ((int) $this->getHeight() > 0)
{
$wh_ratio = (int) $this->getWidth() / (int) $this->getHeight();
}
$tpl->setVariable("WH_RATIO", str_replace(",", ".", round($wh_ratio, 6)));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
$GLOBALS["tpl"]->addJavascript("./Services/MediaObjects/js/ServiceMediaObjectPropWidthHeight.js");
}

+ Here is the call graph for this function:

ilWidthHeightInputGUI::setConstrainProportions (   $a_constrainproportions)

Set Constrain Proportions.

Parameters
boolean$a_constrainproportionsConstrain Proportions

Definition at line 74 of file class.ilWidthHeightInputGUI.php.

Referenced by ilPCMediaObjectGUI\initAliasForm(), ilObjMediaObjectGUI\initForm(), and setValueByArray().

{
$this->constrainproportions = $a_constrainproportions;
}

+ Here is the caller graph for this function:

ilWidthHeightInputGUI::setHeight (   $a_height)

Set Height.

Parameters
integer$a_heightHeight

Definition at line 54 of file class.ilWidthHeightInputGUI.php.

Referenced by checkInput(), and setValueByArray().

{
$this->height = $a_height;
}

+ Here is the caller graph for this function:

ilWidthHeightInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 171 of file class.ilWidthHeightInputGUI.php.

References ilFormPropertyGUI\getPostVar(), setConstrainProportions(), setHeight(), and setWidth().

{
global $ilUser;
$this->setWidth($a_values[$this->getPostVar()]["width"]);
$this->setHeight($a_values[$this->getPostVar()]["height"]);
$this->setConstrainProportions($a_values[$this->getPostVar()]["constr_prop"]);
}

+ Here is the call graph for this function:

ilWidthHeightInputGUI::setWidth (   $a_width)

Set Width.

Parameters
integer$a_widthWidth

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

Referenced by checkInput(), and setValueByArray().

{
$this->width = $a_width;
}

+ Here is the caller graph for this function:

Field Documentation

ilWidthHeightInputGUI::$value
protected

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

Referenced by checkInput(), and insert().


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