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

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

+ Inheritance diagram for ilTRBLBorderWidthInputGUI:
+ Collaboration diagram for ilTRBLBorderWidthInputGUI:

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...
 
 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 border width 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.ilTRBLBorderWidthInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

Definition at line 41 of file class.ilTRBLBorderWidthInputGUI.php.

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

References ilFormPropertyGUI\setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilTRBLBorderWidthInputGUI::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 153 of file class.ilTRBLBorderWidthInputGUI.php.

154 {
155 global $lng;
156
157 foreach ($this->dirs as $dir)
158 {
159 $type = $_POST[$this->getPostVar()][$dir]["type"] =
160 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["type"]);
161 $num_value = $_POST[$this->getPostVar()][$dir]["num_value"] =
162 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_value"]));
163 $num_unit = $_POST[$this->getPostVar()][$dir]["num_unit"] =
164 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_unit"]));
165 $pre_value = $_POST[$this->getPostVar()][$dir]["pre_calue"] =
166 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["pre_value"]);
167
168 /*
169 if ($this->getRequired() && trim($num_value) == "")
170 {
171 $this->setAlert($lng->txt("msg_input_is_required"));
172
173 return false;
174 }*/
175
176 if (!is_numeric($num_value) && $num_value != "")
177 {
178 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
179 return false;
180 }
181
182 $value = "";
183 if ($type == "numeric")
184 {
185 if ($num_value != "")
186 {
187 $value = $num_value.$num_unit;
188 }
189 }
190 else
191 {
192 $value = $pre_value;
193 }
194
195 if (trim($value) != "")
196 {
197 switch ($dir)
198 {
199 case "all": $this->setAllValue($value); break;
200 case "top": $this->setTopValue($value); break;
201 case "bottom": $this->setBottomValue($value); break;
202 case "left": $this->setLeftValue($value); break;
203 case "right": $this->setRightValue($value); break;
204 }
205 }
206
207 }
208
209 return true;
210 }
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
setLeftValue($a_leftvalue)
Set Left Value.
setTopValue($a_topvalue)
Set Top Value.
setBottomValue($a_bottomvalue)
Set Bottom Value.
setRightValue($a_rightvalue)
Set Right Value.
setAllValue($a_allvalue)
Set All Value.
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\$type, $value, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), setTopValue(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getAllValue()

ilTRBLBorderWidthInputGUI::getAllValue ( )

Get All Value.

Returns
string All Value

Definition at line 63 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by insert().

+ Here is the caller graph for this function:

◆ getBottomValue()

ilTRBLBorderWidthInputGUI::getBottomValue ( )

Get Bottom Value.

Returns
string Bottom Value

Definition at line 103 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by insert().

+ Here is the caller graph for this function:

◆ getLeftValue()

ilTRBLBorderWidthInputGUI::getLeftValue ( )

Get Left Value.

Returns
string Left Value

Definition at line 123 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRightValue()

ilTRBLBorderWidthInputGUI::getRightValue ( )

Get Right Value.

Returns
string Right Value

Definition at line 143 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by insert().

+ Here is the caller graph for this function:

◆ getTopValue()

ilTRBLBorderWidthInputGUI::getTopValue ( )

Get Top Value.

Returns
string Top Value

Definition at line 83 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilTRBLBorderWidthInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 215 of file class.ilTRBLBorderWidthInputGUI.php.

216 {
217 global $lng;
218
219 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style");
220
221 foreach ($this->dirs as $dir)
222 {
223 $tpl = new ilTemplate("tpl.prop_trbl_border_width.html", true, true, "Services/Style");
225 $pre_options = ilObjStyleSheet::_getStyleParameterValues("border-width");
226
227 switch($dir)
228 {
229 case "all": $value = strtolower(trim($this->getAllValue())); break;
230 case "top": $value = strtolower(trim($this->getTopValue())); break;
231 case "bottom": $value = strtolower(trim($this->getBottomValue())); break;
232 case "left": $value = strtolower(trim($this->getLeftValue())); break;
233 case "right": $value = strtolower(trim($this->getRightValue())); break;
234 }
235
236 if (in_array($value, $pre_options))
237 {
238 $current_type = "pre";
239 $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
240 }
241 else
242 {
243 $current_type = "unit";
244 $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
245
246 $current_unit = "";
247 foreach ($unit_options as $u)
248 {
249 if (substr($value, strlen($value) - strlen($u)) == $u)
250 {
251 $current_unit = $u;
252 }
253 }
254 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
255 if ($current_unit == "")
256 {
257 $current_unit = "px";
258 }
259 $tpl->setVariable("VAL_NUM", $disp_val);
260 }
261
262 foreach ($unit_options as $option)
263 {
264 $tpl->setCurrentBlock("unit_option");
265 $tpl->setVariable("VAL_UNIT", $option);
266 $tpl->setVariable("TXT_UNIT", $option);
267 if ($current_type == "unit" && $current_unit == $option)
268 {
269 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
270 }
271 $tpl->parseCurrentBlock();
272 }
273
274 foreach ($pre_options as $option)
275 {
276 $tpl->setCurrentBlock("pre_option");
277 $tpl->setVariable("VAL_PRE", $option);
278 $tpl->setVariable("TXT_PRE", $option);
279 if ($current_type == "pre" && $value == $option)
280 {
281 $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
282 }
283 $tpl->parseCurrentBlock();
284 }
285
286 $tpl->setVariable("POSTVAR", $this->getPostVar());
287 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
288 $tpl->setVariable("DIR", $dir);
289
290 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
291 }
292 $layout_tpl->setVariable("COLSPAN", "2");
293
294 $a_tpl->setCurrentBlock("prop_generic");
295 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
296 $a_tpl->parseCurrentBlock();
297 }
global $tpl
Definition: ilias.php:8
static _getStyleParameterNumericUnits($a_no_percentage=false)
static _getStyleParameterValues($par)
special template class to simplify handling of ITX/PEAR

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

+ Here is the call graph for this function:

◆ setAllValue()

ilTRBLBorderWidthInputGUI::setAllValue (   $a_allvalue)

Set All Value.

Parameters
string$a_allvalueAll Value

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

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

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setBottomValue()

ilTRBLBorderWidthInputGUI::setBottomValue (   $a_bottomvalue)

Set Bottom Value.

Parameters
string$a_bottomvalueBottom Value

Definition at line 93 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setLeftValue()

ilTRBLBorderWidthInputGUI::setLeftValue (   $a_leftvalue)

Set Left Value.

Parameters
string$a_leftvalueLeft Value

Definition at line 113 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setRightValue()

ilTRBLBorderWidthInputGUI::setRightValue (   $a_rightvalue)

Set Right Value.

Parameters
string$a_rightvalueRight Value

Definition at line 133 of file class.ilTRBLBorderWidthInputGUI.php.

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

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setTopValue()

ilTRBLBorderWidthInputGUI::setTopValue (   $a_topvalue)

Set Top Value.

Parameters
string$a_topvalueTop Value

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

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

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilTRBLBorderWidthInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 304 of file class.ilTRBLBorderWidthInputGUI.php.

305 {
306 global $ilUser;
307
308 if ($a_values[$this->getPostVar()]["all"]["type"] == "predefined")
309 {
310 $this->setAllValue($a_values[$this->getPostVar()]["all"]["pre_value"]);
311 }
312 else
313 {
314 $this->setAllValue($a_values[$this->getPostVar()]["all"]["num_value"].
315 $a_values[$this->getPostVar()]["all"]["num_unit"]);
316 }
317 if ($a_values[$this->getPostVar()]["bottom"]["type"] == "predefined")
318 {
319 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["pre_value"]);
320 }
321 else
322 {
323 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["num_value"].
324 $a_values[$this->getPostVar()]["bottom"]["num_unit"]);
325 }
326 if ($a_values[$this->getPostVar()]["top"]["type"] == "predefined")
327 {
328 $this->setTopValue($a_values[$this->getPostVar()]["top"]["pre_value"]);
329 }
330 else
331 {
332 $this->setTopValue($a_values[$this->getPostVar()]["top"]["num_value"].
333 $a_values[$this->getPostVar()]["top"]["num_unit"]);
334 }
335 if ($a_values[$this->getPostVar()]["left"]["type"] == "predefined")
336 {
337 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["pre_value"]);
338 }
339 else
340 {
341 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["num_value"].
342 $a_values[$this->getPostVar()]["left"]["num_unit"]);
343 }
344 if ($a_values[$this->getPostVar()]["right"]["type"] == "predefined")
345 {
346 $this->setRightValue($a_values[$this->getPostVar()]["right"]["pre_value"]);
347 }
348 else
349 {
350 $this->setRightValue($a_values[$this->getPostVar()]["right"]["num_value"].
351 $a_values[$this->getPostVar()]["right"]["num_unit"]);
352 }
353 }
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

◆ $value

ilTRBLBorderWidthInputGUI::$value
protected

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

Referenced by checkInput(), and insert().


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