ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (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 ()
 
 setAllowPercentage (bool $a_allowpercentage)
 
 getAllowPercentage ()
 
 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 = ""
 
string $allvalue = ""
 
array $dirs
 
ilObjUser $user
 
string $value
 
bool $allowpercentage = true
 
- 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 numeric style property 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.ilTRBLNumericStyleValueInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

43 {
44 global $DIC;
45
46 $this->lng = $DIC->language();
47 $this->user = $DIC->user();
48 parent::__construct($a_title, $a_postvar);
49 $this->setType("style_numeric");
50 $this->dirs = array("all", "top", "bottom", "left", "right");
51 }
__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()

ilTRBLNumericStyleValueInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

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

113 : bool
114 {
116
117 $input = $this->getInput();
118
119 foreach ($this->dirs as $dir) {
120 $num_value = $input[$dir]["num_value"];
121 $num_unit = $input[$dir]["num_unit"];
122
123 /*
124 if ($this->getRequired() && trim($num_value) == "")
125 {
126 $this->setAlert($lng->txt("msg_input_is_required"));
127
128 return false;
129 }*/
130
131 if (!is_numeric($num_value) && $num_value != "") {
132 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
133 return false;
134 }
135
136 if (trim($num_value) != "") {
137 switch ($dir) {
138 case "all": $this->setAllValue($num_value . $num_unit);
139 break;
140 case "top": $this->setTopValue($num_value . $num_unit);
141 break;
142 case "bottom": $this->setBottomValue($num_value . $num_unit);
143 break;
144 case "left": $this->setLeftValue($num_value . $num_unit);
145 break;
146 case "right": $this->setRightValue($num_value . $num_unit);
147 break;
148 }
149 }
150 }
151
152 return true;
153 }
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, getInput(), ilFormPropertyGUI\setAlert(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), setTopValue(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getAllowPercentage()

ilTRBLNumericStyleValueInputGUI::getAllowPercentage ( )

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

References $allowpercentage.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getAllValue()

ilTRBLNumericStyleValueInputGUI::getAllValue ( )

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

References $allvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getBottomValue()

ilTRBLNumericStyleValueInputGUI::getBottomValue ( )

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

References $bottomvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getInput()

ilTRBLNumericStyleValueInputGUI::getInput ( )

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

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

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()

ilTRBLNumericStyleValueInputGUI::getLeftValue ( )

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

References $leftvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRightValue()

ilTRBLNumericStyleValueInputGUI::getRightValue ( )

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

References $rightvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getTopValue()

ilTRBLNumericStyleValueInputGUI::getTopValue ( )

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

References $topvalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilTRBLNumericStyleValueInputGUI::insert ( ilTemplate  $a_tpl)

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

160 : void
161 {
163
164 $value = "";
165 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "components/ILIAS/Style/Content");
166
167 foreach ($this->dirs as $dir) {
168 $tpl = new ilTemplate("tpl.prop_trbl_style_numeric.html", true, true, "components/ILIAS/Style/Content");
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 $current_unit = "";
185 foreach ($unit_options as $u) {
186 if (substr($value, strlen($value) - strlen($u)) == $u) {
187 $current_unit = $u;
188 }
189 }
190 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
191 if ($current_unit == "") {
192 $current_unit = "px";
193 }
194
195 foreach ($unit_options as $option) {
196 $tpl->setCurrentBlock("unit_option");
197 $tpl->setVariable("VAL_UNIT", $option);
198 $tpl->setVariable("TXT_UNIT", $option);
199 if ($current_unit == $option) {
200 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
201 }
202 $tpl->parseCurrentBlock();
203 }
204
205 $tpl->setVariable("POSTVAR", $this->getPostVar());
206 $tpl->setVariable("VAL_NUM", $disp_val);
207 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
208 $tpl->setVariable("DIR", $dir);
209
210 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
211 }
212
213 $a_tpl->setCurrentBlock("prop_generic");
214 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
215 $a_tpl->parseCurrentBlock();
216 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
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(), getAllowPercentage(), 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:

◆ setAllowPercentage()

ilTRBLNumericStyleValueInputGUI::setAllowPercentage ( bool  $a_allowpercentage)

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

103 : void
104 {
105 $this->allowpercentage = $a_allowpercentage;
106 }

◆ setAllValue()

ilTRBLNumericStyleValueInputGUI::setAllValue ( string  $a_allvalue)

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

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

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setBottomValue()

ilTRBLNumericStyleValueInputGUI::setBottomValue ( string  $a_bottomvalue)

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

73 : void
74 {
75 $this->bottomvalue = $a_bottomvalue;
76 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setLeftValue()

ilTRBLNumericStyleValueInputGUI::setLeftValue ( string  $a_leftvalue)

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

83 : void
84 {
85 $this->leftvalue = $a_leftvalue;
86 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setRightValue()

ilTRBLNumericStyleValueInputGUI::setRightValue ( string  $a_rightvalue)

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

93 : void
94 {
95 $this->rightvalue = $a_rightvalue;
96 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setTopValue()

ilTRBLNumericStyleValueInputGUI::setTopValue ( string  $a_topvalue)

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

63 : void
64 {
65 $this->topvalue = $a_topvalue;
66 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilTRBLNumericStyleValueInputGUI::setValueByArray ( array  $a_values)

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

218 : void
219 {
220 $this->setAllValue($a_values[$this->getPostVar()]["all"]["num_value"] .
221 $a_values[$this->getPostVar()]["all"]["num_unit"]);
222 $this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["num_value"] .
223 $a_values[$this->getPostVar()]["bottom"]["num_unit"]);
224 $this->setTopValue($a_values[$this->getPostVar()]["top"]["num_value"] .
225 $a_values[$this->getPostVar()]["top"]["num_unit"]);
226 $this->setLeftValue($a_values[$this->getPostVar()]["left"]["num_value"] .
227 $a_values[$this->getPostVar()]["left"]["num_unit"]);
228 $this->setRightValue($a_values[$this->getPostVar()]["right"]["num_value"] .
229 $a_values[$this->getPostVar()]["right"]["num_unit"]);
230 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $allowpercentage

bool ilTRBLNumericStyleValueInputGUI::$allowpercentage = true
protected

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

Referenced by getAllowPercentage().

◆ $allvalue

string ilTRBLNumericStyleValueInputGUI::$allvalue = ""
protected

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

Referenced by getAllValue().

◆ $bottomvalue

string ilTRBLNumericStyleValueInputGUI::$bottomvalue = ""
protected

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

Referenced by getBottomValue().

◆ $dirs

array ilTRBLNumericStyleValueInputGUI::$dirs
protected

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

◆ $leftvalue

string ilTRBLNumericStyleValueInputGUI::$leftvalue = ""
protected

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

Referenced by getLeftValue().

◆ $rightvalue

string ilTRBLNumericStyleValueInputGUI::$rightvalue = ""
protected

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

Referenced by getRightValue().

◆ $topvalue

string ilTRBLNumericStyleValueInputGUI::$topvalue = ""
protected

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

Referenced by getTopValue().

◆ $user

ilObjUser ilTRBLNumericStyleValueInputGUI::$user
protected

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

◆ $value

string ilTRBLNumericStyleValueInputGUI::$value
protected

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

Referenced by insert().


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