ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 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
 
 $allowpercentage = true
 
- 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 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 47 of file class.ilTRBLNumericStyleValueInputGUI.php.

48 {
49 global $DIC;
50
51 $this->lng = $DIC->language();
52 $this->user = $DIC->user();
53 parent::__construct($a_title, $a_postvar);
54 $this->setType("style_numeric");
55 $this->dirs = array("all", "top", "bottom", "left", "right");
56 }
user()
Definition: user.php:4
setType($a_type)
Set Type.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilFormPropertyGUI\setType(), and 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.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

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

184 {
186
187 foreach ($this->dirs as $dir) {
188 $num_value = $_POST[$this->getPostVar()][$dir]["num_value"] =
189 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_value"]));
190 $num_unit = $_POST[$this->getPostVar()][$dir]["num_unit"] =
191 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_unit"]));
192
193 /*
194 if ($this->getRequired() && trim($num_value) == "")
195 {
196 $this->setAlert($lng->txt("msg_input_is_required"));
197
198 return false;
199 }*/
200
201 if (!is_numeric($num_value) && $num_value != "") {
202 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
203 return false;
204 }
205
206 if (trim($num_value) != "") {
207 switch ($dir) {
208 case "all": $this->setAllValue($num_value . $num_unit); break;
209 case "top": $this->setTopValue($num_value . $num_unit); break;
210 case "bottom": $this->setBottomValue($num_value . $num_unit); break;
211 case "left": $this->setLeftValue($num_value . $num_unit); break;
212 case "right": $this->setRightValue($num_value . $num_unit); break;
213 }
214 }
215 }
216
217 return true;
218 }
$_POST["username"]
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

References $_POST, ilFormPropertyGUI\$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 173 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 73 of file class.ilTRBLNumericStyleValueInputGUI.php.

74 {
75 return $this->allvalue;
76 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getBottomValue()

ilTRBLNumericStyleValueInputGUI::getBottomValue ( )

Get Bottom Value.

Returns
string Bottom Value

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

114 {
115 return $this->bottomvalue;
116 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getLeftValue()

ilTRBLNumericStyleValueInputGUI::getLeftValue ( )

Get Left Value.

Returns
string Left Value

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

134 {
135 return $this->leftvalue;
136 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRightValue()

ilTRBLNumericStyleValueInputGUI::getRightValue ( )

Get Right Value.

Returns
string Right Value

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

154 {
155 return $this->rightvalue;
156 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ getTopValue()

ilTRBLNumericStyleValueInputGUI::getTopValue ( )

Get Top Value.

Returns
string Top Value

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

94 {
95 return $this->topvalue;
96 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilTRBLNumericStyleValueInputGUI::insert ( $a_tpl)

Insert property html.

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

224 {
226
227 $layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style/Content");
228
229 foreach ($this->dirs as $dir) {
230 $tpl = new ilTemplate("tpl.prop_trbl_style_numeric.html", true, true, "Services/Style/Content");
232
233 switch ($dir) {
234 case "all": $value = strtolower(trim($this->getAllValue())); break;
235 case "top": $value = strtolower(trim($this->getTopValue())); break;
236 case "bottom": $value = strtolower(trim($this->getBottomValue())); break;
237 case "left": $value = strtolower(trim($this->getLeftValue())); break;
238 case "right": $value = strtolower(trim($this->getRightValue())); break;
239 }
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
252 foreach ($unit_options as $option) {
253 $tpl->setCurrentBlock("unit_option");
254 $tpl->setVariable("VAL_UNIT", $option);
255 $tpl->setVariable("TXT_UNIT", $option);
256 if ($current_unit == $option) {
257 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
258 }
259 $tpl->parseCurrentBlock();
260 }
261
262 $tpl->setVariable("POSTVAR", $this->getPostVar());
263 $tpl->setVariable("VAL_NUM", $disp_val);
264 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
265 $tpl->setVariable("DIR", $dir);
266
267 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
268 }
269
270 $a_tpl->setCurrentBlock("prop_generic");
271 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
272 $a_tpl->parseCurrentBlock();
273 }
static _getStyleParameterNumericUnits($a_no_percentage=false)
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

References ilFormPropertyGUI\$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 163 of file class.ilTRBLNumericStyleValueInputGUI.php.

164 {
165 $this->allowpercentage = $a_allowpercentage;
166 }

◆ setAllValue()

ilTRBLNumericStyleValueInputGUI::setAllValue (   $a_allvalue)

Set All Value.

Parameters
string$a_allvalueAll Value

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

64 {
65 $this->allvalue = $a_allvalue;
66 }

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

104 {
105 $this->bottomvalue = $a_bottomvalue;
106 }

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

124 {
125 $this->leftvalue = $a_leftvalue;
126 }

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

144 {
145 $this->rightvalue = $a_rightvalue;
146 }

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

84 {
85 $this->topvalue = $a_topvalue;
86 }

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

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

References $ilUser, $user, 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 39 of file class.ilTRBLNumericStyleValueInputGUI.php.

Referenced by getAllowPercentage().

◆ $user

ilTRBLNumericStyleValueInputGUI::$user
protected

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

Referenced by setValueByArray().

◆ $value

ilTRBLNumericStyleValueInputGUI::$value
protected

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

Referenced by insert().


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