ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Attributes

 $user
 
 $value
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- 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 27 of file class.ilWidthHeightInputGUI.php.

28 {
29 global $DIC;
30
31 $this->lng = $DIC->language();
32 $this->user = $DIC->user();
33 parent::__construct($a_title, $a_postvar);
34 $this->setType("width_height");
35 $this->dirs = array("width", "height");
36 }
user()
Definition: user.php:4
setType($a_type)
Set Type.
global $DIC
Definition: saml.php:7

References $DIC, ilFormPropertyGUI\setType(), and user().

+ 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 103 of file class.ilWidthHeightInputGUI.php.

104 {
106
107 foreach ($this->dirs as $dir) {
108 $pre_value = $_POST[$this->getPostVar()][$dir] =
109 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]);
110
111 /*
112 if ($this->getRequired() && trim($num_value) == "")
113 {
114 $this->setAlert($lng->txt("msg_input_is_required"));
115
116 return false;
117 }*/
118
119 $value = $pre_value;
120
121 if (trim($value) != "") {
122 switch ($dir) {
123 case "width": $this->setWidth($value); break;
124 case "height": $this->setHeight($value); break;
125 }
126 }
127 }
128
129 return true;
130 }
$_POST["username"]
getPostVar()
Get Post Variable.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, ilFormPropertyGUI\$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 93 of file class.ilWidthHeightInputGUI.php.

94 {
95 return $this->constrainproportions;
96 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getHeight()

ilWidthHeightInputGUI::getHeight ( )

Get Height.

Returns
integer Height

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

74 {
75 return $this->height;
76 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getWidth()

ilWidthHeightInputGUI::getWidth ( )

Get Width.

Returns
integer Width

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

54 {
55 return $this->width;
56 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilWidthHeightInputGUI::insert (   $a_tpl)

Insert property html.

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

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

References $GLOBALS, ilFormPropertyGUI\$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 83 of file class.ilWidthHeightInputGUI.php.

84 {
85 $this->constrainproportions = $a_constrainproportions;
86 }

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 63 of file class.ilWidthHeightInputGUI.php.

64 {
65 $this->height = $a_height;
66 }

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 172 of file class.ilWidthHeightInputGUI.php.

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

References $ilUser, $user, 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 43 of file class.ilWidthHeightInputGUI.php.

44 {
45 $this->width = $a_width;
46 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

Field Documentation

◆ $user

ilWidthHeightInputGUI::$user
protected

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

Referenced by setValueByArray().

◆ $value

ilWidthHeightInputGUI::$value
protected

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

Referenced by checkInput(), and insert().


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