ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. 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 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

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

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

47  {
48  global $DIC;
49 
50  $this->lng = $DIC->language();
51  $this->user = $DIC->user();
52  parent::__construct($a_title, $a_postvar);
53  $this->setType("border_width");
54  $this->dirs = array("all", "top", "bottom", "left", "right");
55  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
setType($a_type)
Set Type.
+ 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

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

References $_POST, ilFormPropertyGUI\$lng, ilFormPropertyGUI\$type, $value, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), setTopValue(), and ilUtil\stripSlashes().

163  {
164  $lng = $this->lng;
165 
166  foreach ($this->dirs as $dir) {
167  $type = $_POST[$this->getPostVar()][$dir]["type"] =
168  ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["type"]);
169  $num_value = $_POST[$this->getPostVar()][$dir]["num_value"] =
170  trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_value"]));
171  $num_unit = $_POST[$this->getPostVar()][$dir]["num_unit"] =
172  trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_unit"]));
173  $pre_value = $_POST[$this->getPostVar()][$dir]["pre_calue"] =
174  ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["pre_value"]);
175 
176  /*
177  if ($this->getRequired() && trim($num_value) == "")
178  {
179  $this->setAlert($lng->txt("msg_input_is_required"));
180 
181  return false;
182  }*/
183 
184  if (!is_numeric($num_value) && $num_value != "") {
185  $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
186  return false;
187  }
188 
189  $value = "";
190  if ($type == "numeric") {
191  if ($num_value != "") {
192  $value = $num_value . $num_unit;
193  }
194  } else {
195  $value = $pre_value;
196  }
197 
198  if (trim($value) != "") {
199  switch ($dir) {
200  case "all": $this->setAllValue($value); break;
201  case "top": $this->setTopValue($value); break;
202  case "bottom": $this->setBottomValue($value); break;
203  case "left": $this->setLeftValue($value); break;
204  case "right": $this->setRightValue($value); break;
205  }
206  }
207  }
208 
209  return true;
210  }
setBottomValue($a_bottomvalue)
Set Bottom Value.
getPostVar()
Get Post Variable.
setTopValue($a_topvalue)
Set Top Value.
setAlert($a_alert)
Set Alert Text.
setLeftValue($a_leftvalue)
Set Left Value.
setAllValue($a_allvalue)
Set All Value.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setRightValue($a_rightvalue)
Set Right Value.
$_POST["username"]
+ Here is the call graph for this function:

◆ getAllValue()

ilTRBLBorderWidthInputGUI::getAllValue ( )

Get All Value.

Returns
string All Value

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

Referenced by insert().

73  {
74  return $this->allvalue;
75  }
+ Here is the caller graph for this function:

◆ getBottomValue()

ilTRBLBorderWidthInputGUI::getBottomValue ( )

Get Bottom Value.

Returns
string Bottom Value

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

Referenced by insert().

113  {
114  return $this->bottomvalue;
115  }
+ Here is the caller graph for this function:

◆ getLeftValue()

ilTRBLBorderWidthInputGUI::getLeftValue ( )

Get Left Value.

Returns
string Left Value

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

Referenced by insert().

133  {
134  return $this->leftvalue;
135  }
+ Here is the caller graph for this function:

◆ getRightValue()

ilTRBLBorderWidthInputGUI::getRightValue ( )

Get Right Value.

Returns
string Right Value

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

Referenced by insert().

153  {
154  return $this->rightvalue;
155  }
+ Here is the caller graph for this function:

◆ getTopValue()

ilTRBLBorderWidthInputGUI::getTopValue ( )

Get Top Value.

Returns
string Top Value

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

Referenced by insert().

93  {
94  return $this->topvalue;
95  }
+ 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.

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

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

◆ setAllValue()

ilTRBLBorderWidthInputGUI::setAllValue (   $a_allvalue)

Set All Value.

Parameters
string$a_allvalueAll Value

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

Referenced by checkInput(), and setValueByArray().

63  {
64  $this->allvalue = $a_allvalue;
65  }
+ Here is the caller graph for this function:

◆ setBottomValue()

ilTRBLBorderWidthInputGUI::setBottomValue (   $a_bottomvalue)

Set Bottom Value.

Parameters
string$a_bottomvalueBottom Value

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

Referenced by checkInput(), and setValueByArray().

103  {
104  $this->bottomvalue = $a_bottomvalue;
105  }
+ Here is the caller graph for this function:

◆ setLeftValue()

ilTRBLBorderWidthInputGUI::setLeftValue (   $a_leftvalue)

Set Left Value.

Parameters
string$a_leftvalueLeft Value

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

Referenced by checkInput(), and setValueByArray().

123  {
124  $this->leftvalue = $a_leftvalue;
125  }
+ Here is the caller graph for this function:

◆ setRightValue()

ilTRBLBorderWidthInputGUI::setRightValue (   $a_rightvalue)

Set Right Value.

Parameters
string$a_rightvalueRight Value

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

Referenced by checkInput(), and setValueByArray().

143  {
144  $this->rightvalue = $a_rightvalue;
145  }
+ Here is the caller graph for this function:

◆ setTopValue()

ilTRBLBorderWidthInputGUI::setTopValue (   $a_topvalue)

Set Top Value.

Parameters
string$a_topvalueTop Value

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

Referenced by checkInput(), and setValueByArray().

83  {
84  $this->topvalue = $a_topvalue;
85  }
+ 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 292 of file class.ilTRBLBorderWidthInputGUI.php.

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

293  {
295 
296  if ($a_values[$this->getPostVar()]["all"]["type"] == "predefined") {
297  $this->setAllValue($a_values[$this->getPostVar()]["all"]["pre_value"]);
298  } else {
299  $this->setAllValue($a_values[$this->getPostVar()]["all"]["num_value"] .
300  $a_values[$this->getPostVar()]["all"]["num_unit"]);
301  }
302  if ($a_values[$this->getPostVar()]["bottom"]["type"] == "predefined") {
303  $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["pre_value"]);
304  } else {
305  $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["num_value"] .
306  $a_values[$this->getPostVar()]["bottom"]["num_unit"]);
307  }
308  if ($a_values[$this->getPostVar()]["top"]["type"] == "predefined") {
309  $this->setTopValue($a_values[$this->getPostVar()]["top"]["pre_value"]);
310  } else {
311  $this->setTopValue($a_values[$this->getPostVar()]["top"]["num_value"] .
312  $a_values[$this->getPostVar()]["top"]["num_unit"]);
313  }
314  if ($a_values[$this->getPostVar()]["left"]["type"] == "predefined") {
315  $this->setLeftValue($a_values[$this->getPostVar()]["left"]["pre_value"]);
316  } else {
317  $this->setLeftValue($a_values[$this->getPostVar()]["left"]["num_value"] .
318  $a_values[$this->getPostVar()]["left"]["num_unit"]);
319  }
320  if ($a_values[$this->getPostVar()]["right"]["type"] == "predefined") {
321  $this->setRightValue($a_values[$this->getPostVar()]["right"]["pre_value"]);
322  } else {
323  $this->setRightValue($a_values[$this->getPostVar()]["right"]["num_value"] .
324  $a_values[$this->getPostVar()]["right"]["num_unit"]);
325  }
326  }
setBottomValue($a_bottomvalue)
Set Bottom Value.
getPostVar()
Get Post Variable.
setTopValue($a_topvalue)
Set Top Value.
setLeftValue($a_leftvalue)
Set Left Value.
$ilUser
Definition: imgupload.php:18
setAllValue($a_allvalue)
Set All Value.
setRightValue($a_rightvalue)
Set Right Value.
+ Here is the call graph for this function:

Field Documentation

◆ $user

ilTRBLBorderWidthInputGUI::$user
protected

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

Referenced by setValueByArray().

◆ $value

ilTRBLBorderWidthInputGUI::$value
protected

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

Referenced by checkInput(), and insert().


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