ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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. More...
 
 setWidth ($a_width)
 Set Width. More...
 
 getWidth ()
 Get Width. More...
 
 setHeight ($a_height)
 Set Height. More...
 
 getHeight ()
 Get Height. More...
 
 setConstrainProportions ($a_constrainproportions)
 Set Constrain Proportions. More...
 
 getConstrainProportions ()
 Get Constrain Proportions. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 setValueByArray ($a_values)
 Set value by array. 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Attributes

 $value
 
- 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. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

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

◆ __construct()

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.

23 {
24 parent::__construct($a_title, $a_postvar);
25 $this->setType("width_height");
26 $this->dirs = array("width", "height");
27 }
setType($a_type)
Set Type.

References ilFormPropertyGUI\setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

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.

95 {
96 global $lng;
97
98 foreach ($this->dirs as $dir)
99 {
100 $pre_value = $_POST[$this->getPostVar()][$dir] =
101 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]);
102
103 /*
104 if ($this->getRequired() && trim($num_value) == "")
105 {
106 $this->setAlert($lng->txt("msg_input_is_required"));
107
108 return false;
109 }*/
110
111 $value = $pre_value;
112
113 if (trim($value) != "")
114 {
115 switch ($dir)
116 {
117 case "width": $this->setWidth($value); break;
118 case "height": $this->setHeight($value); break;
119 }
120 }
121
122 }
123
124 return true;
125 }
getPostVar()
Get Post Variable.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40

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

+ Here is the call graph for this function:

◆ getConstrainProportions()

ilWidthHeightInputGUI::getConstrainProportions ( )

Get Constrain Proportions.

Returns
boolean Constrain Proportions

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

85 {
86 return $this->constrainproportions;
87 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getHeight()

ilWidthHeightInputGUI::getHeight ( )

Get Height.

Returns
integer Height

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

65 {
66 return $this->height;
67 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getWidth()

ilWidthHeightInputGUI::getWidth ( )

Get Width.

Returns
integer Width

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

45 {
46 return $this->width;
47 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilWidthHeightInputGUI::insert (   $a_tpl)

Insert property html.

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

131 {
132 global $lng;
133
134 $tpl = new ilTemplate("tpl.prop_width_height.html", true, true, "Services/MediaObjects");
135
136 foreach ($this->dirs as $dir)
137 {
138 switch($dir)
139 {
140 case "width": $value = strtolower(trim($this->getWidth())); break;
141 case "height": $value = strtolower(trim($this->getHeight())); break;
142 }
143 $tpl->setVariable("VAL_".strtoupper($dir), $value);
144 }
145 if ($this->getConstrainProportions())
146 {
147 $tpl->setVariable("CHECKED", 'checked="checked"');
148 }
149
150 $tpl->setVariable("POST_VAR", $this->getPostVar());
151 $tpl->setVariable("TXT_CONSTR_PROP", $lng->txt("cont_constrain_proportions"));
152 $wh_ratio = 0;
153 if ((int) $this->getHeight() > 0)
154 {
155 $wh_ratio = (int) $this->getWidth() / (int) $this->getHeight();
156 }
157 $tpl->setVariable("WH_RATIO", str_replace(",", ".", round($wh_ratio, 6)));
158
159 $a_tpl->setCurrentBlock("prop_generic");
160 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
161 $a_tpl->parseCurrentBlock();
162
163 $GLOBALS["tpl"]->addJavascript("./Services/MediaObjects/js/ServiceMediaObjectPropWidthHeight.js");
164 }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
getConstrainProportions()
Get Constrain Proportions.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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

+ Here is the call graph for this function:

◆ setConstrainProportions()

ilWidthHeightInputGUI::setConstrainProportions (   $a_constrainproportions)

Set Constrain Proportions.

Parameters
boolean$a_constrainproportionsConstrain Proportions

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

75 {
76 $this->constrainproportions = $a_constrainproportions;
77 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setHeight()

ilWidthHeightInputGUI::setHeight (   $a_height)

Set Height.

Parameters
integer$a_heightHeight

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

55 {
56 $this->height = $a_height;
57 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilWidthHeightInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

172 {
173 global $ilUser;
174//var_dump($a_values[$this->getPostVar()]);
175 $this->setWidth($a_values[$this->getPostVar()]["width"]);
176 $this->setHeight($a_values[$this->getPostVar()]["height"]);
177 $this->setConstrainProportions($a_values[$this->getPostVar()]["constr_prop"]);
178 }
setConstrainProportions($a_constrainproportions)
Set Constrain Proportions.
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ setWidth()

ilWidthHeightInputGUI::setWidth (   $a_width)

Set Width.

Parameters
integer$a_widthWidth

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

35 {
36 $this->width = $a_width;
37 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

Field Documentation

◆ $value

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: