ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTRBLNumericStyleValueInputGUI Class Reference

This class represents a numeric style property with all/top/right/bottom/left in a property form. More...

+ Inheritance diagram for ilTRBLNumericStyleValueInputGUI:
+ Collaboration diagram for ilTRBLNumericStyleValueInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setAllValue ($a_allvalue)
 Set All Value. More...
 
 getAllValue ()
 Get All Value. More...
 
 setTopValue ($a_topvalue)
 Set Top Value. More...
 
 getTopValue ()
 Get Top Value. More...
 
 setBottomValue ($a_bottomvalue)
 Set Bottom Value. More...
 
 getBottomValue ()
 Get Bottom Value. More...
 
 setLeftValue ($a_leftvalue)
 Set Left Value. More...
 
 getLeftValue ()
 Get Left Value. More...
 
 setRightValue ($a_rightvalue)
 Set Right Value. More...
 
 getRightValue ()
 Get Right Value. More...
 
 setAllowPercentage ($a_allowpercentage)
 Set Allow Percentage. More...
 
 getAllowPercentage ()
 Get Allow Percentage. 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
 
 $allowpercentage = true
 
- 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 numeric style property with all/top/right/bottom/left 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 31 of file class.ilTRBLNumericStyleValueInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

Definition at line 42 of file class.ilTRBLNumericStyleValueInputGUI.php.

43 {
44 parent::__construct($a_title, $a_postvar);
45 $this->setType("style_numeric");
46 $this->dirs = array("all", "top", "bottom", "left", "right");
47 }
setType($a_type)
Set Type.

References ilFormPropertyGUI\setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilTRBLNumericStyleValueInputGUI::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 174 of file class.ilTRBLNumericStyleValueInputGUI.php.

175 {
176 global $lng;
177
178 foreach ($this->dirs as $dir)
179 {
180 $num_value = $_POST[$this->getPostVar()][$dir]["num_value"] =
181 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_value"]));
182 $num_unit = $_POST[$this->getPostVar()][$dir]["num_unit"] =
183 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_unit"]));
184
185 /*
186 if ($this->getRequired() && trim($num_value) == "")
187 {
188 $this->setAlert($lng->txt("msg_input_is_required"));
189
190 return false;
191 }*/
192
193 if (!is_numeric($num_value) && $num_value != "")
194 {
195 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
196 return false;
197 }
198
199 if (trim($num_value) != "")
200 {
201 switch ($dir)
202 {
203 case "all": $this->setAllValue($num_value.$num_unit); break;
204 case "top": $this->setTopValue($num_value.$num_unit); break;
205 case "bottom": $this->setBottomValue($num_value.$num_unit); break;
206 case "left": $this->setLeftValue($num_value.$num_unit); break;
207 case "right": $this->setRightValue($num_value.$num_unit); break;
208 }
209 }
210 }
211
212 return true;
213 }
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
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, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), setTopValue(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getAllowPercentage()

ilTRBLNumericStyleValueInputGUI::getAllowPercentage ( )

Get Allow Percentage.

Returns
boolean Allow Percentage

Definition at line 164 of file class.ilTRBLNumericStyleValueInputGUI.php.

References $allowpercentage.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getAllValue()

ilTRBLNumericStyleValueInputGUI::getAllValue ( )

Get All Value.

Returns
string All Value

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

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

Referenced by insert().

+ Here is the caller graph for this function:

◆ getBottomValue()

ilTRBLNumericStyleValueInputGUI::getBottomValue ( )

Get Bottom Value.

Returns
string Bottom Value

Definition at line 104 of file class.ilTRBLNumericStyleValueInputGUI.php.

105 {
106 return $this->bottomvalue;
107 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getLeftValue()

ilTRBLNumericStyleValueInputGUI::getLeftValue ( )

Get Left Value.

Returns
string Left Value

Definition at line 124 of file class.ilTRBLNumericStyleValueInputGUI.php.

125 {
126 return $this->leftvalue;
127 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRightValue()

ilTRBLNumericStyleValueInputGUI::getRightValue ( )

Get Right Value.

Returns
string Right Value

Definition at line 144 of file class.ilTRBLNumericStyleValueInputGUI.php.

145 {
146 return $this->rightvalue;
147 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getTopValue()

ilTRBLNumericStyleValueInputGUI::getTopValue ( )

Get Top Value.

Returns
string Top Value

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

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

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilTRBLNumericStyleValueInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 218 of file class.ilTRBLNumericStyleValueInputGUI.php.

219 {
220 global $lng;
221
222 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style");
223
224 foreach ($this->dirs as $dir)
225 {
226 $tpl = new ilTemplate("tpl.prop_trbl_style_numeric.html", true, true, "Services/Style");
228
229 switch($dir)
230 {
231 case "all": $value = strtolower(trim($this->getAllValue())); break;
232 case "top": $value = strtolower(trim($this->getTopValue())); break;
233 case "bottom": $value = strtolower(trim($this->getBottomValue())); break;
234 case "left": $value = strtolower(trim($this->getLeftValue())); break;
235 case "right": $value = strtolower(trim($this->getRightValue())); break;
236 }
237
238 $current_unit = "";
239 foreach ($unit_options as $u)
240 {
241 if (substr($value, strlen($value) - strlen($u)) == $u)
242 {
243 $current_unit = $u;
244 }
245 }
246 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
247 if ($current_unit == "")
248 {
249 $current_unit = "px";
250 }
251
252 foreach ($unit_options as $option)
253 {
254 $tpl->setCurrentBlock("unit_option");
255 $tpl->setVariable("VAL_UNIT", $option);
256 $tpl->setVariable("TXT_UNIT", $option);
257 if ($current_unit == $option)
258 {
259 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
260 }
261 $tpl->parseCurrentBlock();
262 }
263
264 $tpl->setVariable("POSTVAR", $this->getPostVar());
265 $tpl->setVariable("VAL_NUM", $disp_val);
266 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
267 $tpl->setVariable("DIR", $dir);
268
269 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
270 }
271
272 $a_tpl->setCurrentBlock("prop_generic");
273 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
274 $a_tpl->parseCurrentBlock();
275 }
global $tpl
Definition: ilias.php:8
static _getStyleParameterNumericUnits($a_no_percentage=false)
special template class to simplify handling of ITX/PEAR

References $lng, $tpl, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), getAllowPercentage(), getAllValue(), getBottomValue(), getLeftValue(), ilFormPropertyGUI\getPostVar(), getRightValue(), and getTopValue().

+ Here is the call graph for this function:

◆ setAllowPercentage()

ilTRBLNumericStyleValueInputGUI::setAllowPercentage (   $a_allowpercentage)

Set Allow Percentage.

Parameters
boolean$a_allowpercentageAllow Percentage

Definition at line 154 of file class.ilTRBLNumericStyleValueInputGUI.php.

155 {
156 $this->allowpercentage = $a_allowpercentage;
157 }

◆ setAllValue()

ilTRBLNumericStyleValueInputGUI::setAllValue (   $a_allvalue)

Set All Value.

Parameters
string$a_allvalueAll Value

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

55 {
56 $this->allvalue = $a_allvalue;
57 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setBottomValue()

ilTRBLNumericStyleValueInputGUI::setBottomValue (   $a_bottomvalue)

Set Bottom Value.

Parameters
string$a_bottomvalueBottom Value

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

95 {
96 $this->bottomvalue = $a_bottomvalue;
97 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setLeftValue()

ilTRBLNumericStyleValueInputGUI::setLeftValue (   $a_leftvalue)

Set Left Value.

Parameters
string$a_leftvalueLeft Value

Definition at line 114 of file class.ilTRBLNumericStyleValueInputGUI.php.

115 {
116 $this->leftvalue = $a_leftvalue;
117 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setRightValue()

ilTRBLNumericStyleValueInputGUI::setRightValue (   $a_rightvalue)

Set Right Value.

Parameters
string$a_rightvalueRight Value

Definition at line 134 of file class.ilTRBLNumericStyleValueInputGUI.php.

135 {
136 $this->rightvalue = $a_rightvalue;
137 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setTopValue()

ilTRBLNumericStyleValueInputGUI::setTopValue (   $a_topvalue)

Set Top Value.

Parameters
string$a_topvalueTop Value

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

75 {
76 $this->topvalue = $a_topvalue;
77 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilTRBLNumericStyleValueInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 282 of file class.ilTRBLNumericStyleValueInputGUI.php.

283 {
284 global $ilUser;
285
286 $this->setAllValue($a_values[$this->getPostVar()]["all"]["num_value"].
287 $a_values[$this->getPostVar()]["all"]["num_unit"]);
288 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["num_value"].
289 $a_values[$this->getPostVar()]["bottom"]["num_unit"]);
290 $this->setTopValue($a_values[$this->getPostVar()]["top"]["num_value"].
291 $a_values[$this->getPostVar()]["top"]["num_unit"]);
292 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["num_value"].
293 $a_values[$this->getPostVar()]["left"]["num_unit"]);
294 $this->setRightValue($a_values[$this->getPostVar()]["right"]["num_value"].
295 $a_values[$this->getPostVar()]["right"]["num_unit"]);
296 }
global $ilUser
Definition: imgupload.php:15

References $ilUser, ilFormPropertyGUI\getPostVar(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), and setTopValue().

+ Here is the call graph for this function:

Field Documentation

◆ $allowpercentage

ilTRBLNumericStyleValueInputGUI::$allowpercentage = true
protected

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

Referenced by getAllowPercentage().

◆ $value

ilTRBLNumericStyleValueInputGUI::$value
protected

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

Referenced by insert().


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