ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (string $a_title="", string $a_postvar="")
 
 setAllValue (string $a_allvalue)
 
 getAllValue ()
 
 setTopValue (string $a_topvalue)
 
 getTopValue ()
 
 setBottomValue (string $a_bottomvalue)
 
 getBottomValue ()
 
 setLeftValue (string $a_leftvalue)
 
 getLeftValue ()
 
 setRightValue (string $a_rightvalue)
 
 getRightValue ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
 setValueByArray (array $a_values)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $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...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 

Protected Attributes

string $rightvalue = ""
 
string $leftvalue = ""
 
string $bottomvalue = ""
 
string $topvalue = ""
 
array $dirs = []
 
string $allvalue = ""
 
ilObjUser $user
 
string $value = ""
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Detailed Description

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

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

41 {
42 global $DIC;
43
44 $this->lng = $DIC->language();
45 $this->user = $DIC->user();
46 parent::__construct($a_title, $a_postvar);
47 $this->setType("border_width");
48 $this->dirs = array("all", "top", "bottom", "left", "right");
49 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), ilFormPropertyGUI\setType(), and ILIAS\Repository\user().

+ 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.

Reimplemented from ilFormPropertyGUI.

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

101 : bool
102 {
104
105 $input = $this->getInput();
106
107 foreach ($this->dirs as $dir) {
108 $type = $input[$dir]["type"];
109 $num_value = $input[$dir]["num_value"];
110 $num_unit = $input[$dir]["num_unit"];
111 $pre_value = $input[$dir]["pre_value"];
112
113 /*
114 if ($this->getRequired() && trim($num_value) == "")
115 {
116 $this->setAlert($lng->txt("msg_input_is_required"));
117
118 return false;
119 }*/
120
121 if (!is_numeric($num_value) && $num_value != "") {
122 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
123 return false;
124 }
125
126 $value = "";
127 if ($type == "numeric") {
128 if ($num_value != "") {
129 $value = $num_value . $num_unit;
130 }
131 } else {
132 $value = $pre_value;
133 }
134
135 if (trim($value) != "") {
136 switch ($dir) {
137 case "all": $this->setAllValue($value);
138 break;
139 case "top": $this->setTopValue($value);
140 break;
141 case "bottom": $this->setBottomValue($value);
142 break;
143 case "left": $this->setLeftValue($value);
144 break;
145 case "right": $this->setRightValue($value);
146 break;
147 }
148 }
149 }
150
151 return true;
152 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\$type, $value, getInput(), ilFormPropertyGUI\setAlert(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), setTopValue(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getAllValue()

ilTRBLBorderWidthInputGUI::getAllValue ( )

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

56 : string
57 {
58 return $this->allvalue;
59 }

References $allvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getBottomValue()

ilTRBLBorderWidthInputGUI::getBottomValue ( )

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

76 : string
77 {
78 return $this->bottomvalue;
79 }

References $bottomvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getInput()

ilTRBLBorderWidthInputGUI::getInput ( )

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

154 : array
155 {
156 return $this->arrayArray($this->getPostVar());
157 }

References ilFormPropertyGUI\arrayArray(), and ilFormPropertyGUI\getPostVar().

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLeftValue()

ilTRBLBorderWidthInputGUI::getLeftValue ( )

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

86 : string
87 {
88 return $this->leftvalue;
89 }

References $leftvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRightValue()

ilTRBLBorderWidthInputGUI::getRightValue ( )

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

96 : string
97 {
98 return $this->rightvalue;
99 }

References $rightvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getTopValue()

ilTRBLBorderWidthInputGUI::getTopValue ( )

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

66 : string
67 {
68 return $this->topvalue;
69 }

References $topvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilTRBLBorderWidthInputGUI::insert ( ilTemplate  $a_tpl)

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

159 : void
160 {
162 $value = "";
163 $current_unit = "";
164 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "components/ILIAS/Style/Content");
165
166 foreach ($this->dirs as $dir) {
167 $tpl = new ilTemplate("tpl.prop_trbl_border_width.html", true, true, "components/ILIAS/Style/Content");
169 $pre_options = ilObjStyleSheet::_getStyleParameterValues("border-width");
170
171 switch ($dir) {
172 case "all": $value = strtolower(trim($this->getAllValue()));
173 break;
174 case "top": $value = strtolower(trim($this->getTopValue()));
175 break;
176 case "bottom": $value = strtolower(trim($this->getBottomValue()));
177 break;
178 case "left": $value = strtolower(trim($this->getLeftValue()));
179 break;
180 case "right": $value = strtolower(trim($this->getRightValue()));
181 break;
182 }
183
184 if (in_array($value, $pre_options)) {
185 $current_type = "pre";
186 $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
187 } else {
188 $current_type = "unit";
189 $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
190
191 $current_unit = "";
192 foreach ($unit_options as $u) {
193 if (substr($value, strlen($value) - strlen($u)) == $u) {
194 $current_unit = $u;
195 }
196 }
197 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
198 if ($current_unit == "") {
199 $current_unit = "px";
200 }
201 $tpl->setVariable("VAL_NUM", $disp_val);
202 }
203
204 foreach ($unit_options as $option) {
205 $tpl->setCurrentBlock("unit_option");
206 $tpl->setVariable("VAL_UNIT", $option);
207 $tpl->setVariable("TXT_UNIT", $option);
208 if ($current_type == "unit" && $current_unit == $option) {
209 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
210 }
211 $tpl->parseCurrentBlock();
212 }
213
214 foreach ($pre_options as $option) {
215 $tpl->setCurrentBlock("pre_option");
216 $tpl->setVariable("VAL_PRE", $option);
217 $tpl->setVariable("TXT_PRE", $option);
218 if ($current_type == "pre" && $value == $option) {
219 $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
220 }
221 $tpl->parseCurrentBlock();
222 }
223
224 $tpl->setVariable("POSTVAR", $this->getPostVar());
225 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
226 $tpl->setVariable("DIR", $dir);
227
228 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
229 }
230 $layout_tpl->setVariable("COLSPAN", "2");
231
232 $a_tpl->setCurrentBlock("prop_generic");
233 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
234 $a_tpl->parseCurrentBlock();
235 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
static _getStyleParameterValues(string $par)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilFormPropertyGUI\$lng, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), ilObjStyleSheet\_getStyleParameterValues(), getAllValue(), getBottomValue(), getLeftValue(), ilFormPropertyGUI\getPostVar(), getRightValue(), getTopValue(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ setAllValue()

ilTRBLBorderWidthInputGUI::setAllValue ( string  $a_allvalue)

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

51 : void
52 {
53 $this->allvalue = $a_allvalue;
54 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setBottomValue()

ilTRBLBorderWidthInputGUI::setBottomValue ( string  $a_bottomvalue)

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

71 : void
72 {
73 $this->bottomvalue = $a_bottomvalue;
74 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setLeftValue()

ilTRBLBorderWidthInputGUI::setLeftValue ( string  $a_leftvalue)

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

81 : void
82 {
83 $this->leftvalue = $a_leftvalue;
84 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setRightValue()

ilTRBLBorderWidthInputGUI::setRightValue ( string  $a_rightvalue)

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

91 : void
92 {
93 $this->rightvalue = $a_rightvalue;
94 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setTopValue()

ilTRBLBorderWidthInputGUI::setTopValue ( string  $a_topvalue)

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

61 : void
62 {
63 $this->topvalue = $a_topvalue;
64 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilTRBLBorderWidthInputGUI::setValueByArray ( array  $a_values)

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

237 : void
238 {
239 if ($a_values[$this->getPostVar()]["all"]["type"] == "predefined") {
240 $this->setAllValue($a_values[$this->getPostVar()]["all"]["pre_value"]);
241 } else {
242 $this->setAllValue($a_values[$this->getPostVar()]["all"]["num_value"] .
243 $a_values[$this->getPostVar()]["all"]["num_unit"]);
244 }
245 if ($a_values[$this->getPostVar()]["bottom"]["type"] == "predefined") {
246 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["pre_value"]);
247 } else {
248 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["num_value"] .
249 $a_values[$this->getPostVar()]["bottom"]["num_unit"]);
250 }
251 if ($a_values[$this->getPostVar()]["top"]["type"] == "predefined") {
252 $this->setTopValue($a_values[$this->getPostVar()]["top"]["pre_value"]);
253 } else {
254 $this->setTopValue($a_values[$this->getPostVar()]["top"]["num_value"] .
255 $a_values[$this->getPostVar()]["top"]["num_unit"]);
256 }
257 if ($a_values[$this->getPostVar()]["left"]["type"] == "predefined") {
258 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["pre_value"]);
259 } else {
260 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["num_value"] .
261 $a_values[$this->getPostVar()]["left"]["num_unit"]);
262 }
263 if ($a_values[$this->getPostVar()]["right"]["type"] == "predefined") {
264 $this->setRightValue($a_values[$this->getPostVar()]["right"]["pre_value"]);
265 } else {
266 $this->setRightValue($a_values[$this->getPostVar()]["right"]["num_value"] .
267 $a_values[$this->getPostVar()]["right"]["num_unit"]);
268 }
269 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $allvalue

string ilTRBLBorderWidthInputGUI::$allvalue = ""
protected

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

Referenced by getAllValue().

◆ $bottomvalue

string ilTRBLBorderWidthInputGUI::$bottomvalue = ""
protected

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

Referenced by getBottomValue().

◆ $dirs

array ilTRBLBorderWidthInputGUI::$dirs = []
protected

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

◆ $leftvalue

string ilTRBLBorderWidthInputGUI::$leftvalue = ""
protected

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

Referenced by getLeftValue().

◆ $rightvalue

string ilTRBLBorderWidthInputGUI::$rightvalue = ""
protected

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

Referenced by getRightValue().

◆ $topvalue

string ilTRBLBorderWidthInputGUI::$topvalue = ""
protected

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

Referenced by getTopValue().

◆ $user

ilObjUser ilTRBLBorderWidthInputGUI::$user
protected

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

◆ $value

string 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: