ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBackgroundPositionInputGUI Class Reference

This class represents a background position in a property form. More...

+ Inheritance diagram for ilBackgroundPositionInputGUI:
+ Collaboration diagram for ilBackgroundPositionInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setHorizontalValue (string $a_horizontalvalue)
 
 getHorizontalValue ()
 
 setVerticalValue (string $a_verticalvalue)
 
 getVerticalValue ()
 
 getValue ()
 
 setValue (string $a_val)
 
 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

array $dirs = []
 
string $verticalvalue = ""
 
string $horizontalvalue = ""
 
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 background position 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.ilBackgroundPositionInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

38 {
39 global $DIC;
40
41 $this->lng = $DIC->language();
42 $this->user = $DIC->user();
43 parent::__construct($a_title, $a_postvar);
44 $this->setType("border_width");
45 $this->dirs = array("horizontal", "vertical");
46 }
__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()

ilBackgroundPositionInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

Definition at line 97 of file class.ilBackgroundPositionInputGUI.php.

97 : bool
98 {
100
101 $input = $this->getInput();
102
103 foreach ($this->dirs as $dir) {
104 $type = $input[$dir]["type"];
105 $num_value = $input[$dir]["num_value"];
106 $num_unit = $input[$dir]["num_unit"];
107 $pre_value = $input[$dir]["pre_value"];
108
109 if (!is_numeric($num_value) && trim($num_value) != "") {
110 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
111 return false;
112 }
113
114 $value = "";
115 if ($type == "numeric") {
116 if ($num_value != "") {
117 $value = $num_value . $num_unit;
118 }
119 } else {
120 $value = $pre_value;
121 }
122
123 if (trim($value) != "") {
124 switch ($dir) {
125 case "horizontal": $this->setHorizontalValue($value);
126 break;
127 case "vertical": $this->setVerticalValue($value);
128 break;
129 }
130 }
131 }
132
133 return true;
134 }
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(), setHorizontalValue(), setVerticalValue(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getHorizontalValue()

ilBackgroundPositionInputGUI::getHorizontalValue ( )

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

References $horizontalvalue.

Referenced by getValue(), and insert().

+ Here is the caller graph for this function:

◆ getInput()

ilBackgroundPositionInputGUI::getInput ( )

Definition at line 136 of file class.ilBackgroundPositionInputGUI.php.

136 : array
137 {
138 return $this->arrayArray($this->getPostVar());
139 }

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:

◆ getValue()

ilBackgroundPositionInputGUI::getValue ( )

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

68 : string
69 {
70 if ($this->getHorizontalValue() != "") {
71 if ($this->getVerticalValue() != "") {
72 return $this->getHorizontalValue() . " " . $this->getVerticalValue();
73 } else {
74 return $this->getHorizontalValue();
75 }
76 } else {
77 if ($this->getVerticalValue() != "") {
78 return "left " . $this->getVerticalValue();
79 }
80 }
81 return "";
82 }

References getHorizontalValue(), and getVerticalValue().

+ Here is the call graph for this function:

◆ getVerticalValue()

ilBackgroundPositionInputGUI::getVerticalValue ( )

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

References $verticalvalue.

Referenced by getValue(), and insert().

+ Here is the caller graph for this function:

◆ insert()

ilBackgroundPositionInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 141 of file class.ilBackgroundPositionInputGUI.php.

141 : void
142 {
144
145 $layout_tpl = new ilTemplate("tpl.prop_hv_layout.html", true, true, "components/ILIAS/Style/Content");
146
147 foreach ($this->dirs as $dir) {
148 $value = "";
149 $current_unit = "";
150 $tpl = new ilTemplate("tpl.prop_background_position.html", true, true, "components/ILIAS/Style/Content");
152 $pre_options = ilObjStyleSheet::_getStyleParameterValues("background-position");
153 $pre_options = $pre_options[$dir];
154 switch ($dir) {
155 case "horizontal": $value = strtolower(trim($this->getHorizontalValue()));
156 break;
157 case "vertical": $value = strtolower(trim($this->getVerticalValue()));
158 break;
159 }
160
161 if (in_array($value, $pre_options)) {
162 $current_type = "pre";
163 $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
164 } else {
165 $current_type = "unit";
166 $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
167
168 foreach ($unit_options as $u) {
169 if (substr($value, strlen($value) - strlen($u)) == $u) {
170 $current_unit = $u;
171 }
172 }
173 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
174 if ($current_unit == "") {
175 $current_unit = "px";
176 }
177 $tpl->setVariable("VAL_NUM", $disp_val);
178 }
179
180 foreach ($unit_options as $option) {
181 $tpl->setCurrentBlock("unit_option");
182 $tpl->setVariable("VAL_UNIT", $option);
183 $tpl->setVariable("TXT_UNIT", $option);
184 if ($current_type == "unit" && $current_unit == $option) {
185 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
186 }
187 $tpl->parseCurrentBlock();
188 }
189
190 foreach ($pre_options as $option) {
191 $tpl->setCurrentBlock("pre_option");
192 $tpl->setVariable("VAL_PRE", $option);
193 $tpl->setVariable("TXT_PRE", $option);
194 if ($current_type == "pre" && $value == $option) {
195 $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
196 }
197 $tpl->parseCurrentBlock();
198 }
199
200 $tpl->setVariable("POSTVAR", $this->getPostVar());
201 $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
202 $tpl->setVariable("DIR", $dir);
203
204 $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
205 }
206 $layout_tpl->setVariable("COLSPAN", "2");
207
208 $a_tpl->setCurrentBlock("prop_generic");
209 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
210 $a_tpl->parseCurrentBlock();
211 }
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(), getHorizontalValue(), ilFormPropertyGUI\getPostVar(), getVerticalValue(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ setHorizontalValue()

ilBackgroundPositionInputGUI::setHorizontalValue ( string  $a_horizontalvalue)

Definition at line 48 of file class.ilBackgroundPositionInputGUI.php.

48 : void
49 {
50 $this->horizontalvalue = $a_horizontalvalue;
51 }

Referenced by checkInput(), setValue(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValue()

ilBackgroundPositionInputGUI::setValue ( string  $a_val)

Definition at line 84 of file class.ilBackgroundPositionInputGUI.php.

84 : void
85 {
86 $a_val = trim($a_val);
87 $a_val_arr = explode(" ", $a_val);
88 $hor = trim($a_val_arr[0]);
89 $ver = trim($a_val_arr[1] ?? "");
90 if ($hor == "center" && $ver == "") {
91 $ver = "center";
92 }
93 $this->setHorizontalValue($hor);
94 $this->setVerticalValue($ver);
95 }

References setHorizontalValue(), and setVerticalValue().

+ Here is the call graph for this function:

◆ setValueByArray()

ilBackgroundPositionInputGUI::setValueByArray ( array  $a_values)

Definition at line 213 of file class.ilBackgroundPositionInputGUI.php.

213 : void
214 {
215 if ($a_values[$this->getPostVar()]["horizontal"]["type"] == "predefined") {
216 $this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["pre_value"]);
217 } else {
218 $this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["num_value"] .
219 $a_values[$this->getPostVar()]["horizontal"]["num_unit"]);
220 }
221 if ($a_values[$this->getPostVar()]["vertical"]["type"] == "predefined") {
222 $this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["pre_value"]);
223 } else {
224 $this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["num_value"] .
225 $a_values[$this->getPostVar()]["vertical"]["num_unit"]);
226 }
227 }

References ilFormPropertyGUI\getPostVar(), setHorizontalValue(), and setVerticalValue().

+ Here is the call graph for this function:

◆ setVerticalValue()

ilBackgroundPositionInputGUI::setVerticalValue ( string  $a_verticalvalue)

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

58 : void
59 {
60 $this->verticalvalue = $a_verticalvalue;
61 }

Referenced by checkInput(), setValue(), and setValueByArray().

+ Here is the caller graph for this function:

Field Documentation

◆ $dirs

array ilBackgroundPositionInputGUI::$dirs = []
protected

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

◆ $horizontalvalue

string ilBackgroundPositionInputGUI::$horizontalvalue = ""
protected

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

Referenced by getHorizontalValue().

◆ $user

ilObjUser ilBackgroundPositionInputGUI::$user
protected

Definition at line 34 of file class.ilBackgroundPositionInputGUI.php.

◆ $value

string ilBackgroundPositionInputGUI::$value = ""
protected

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

Referenced by checkInput(), and insert().

◆ $verticalvalue

string ilBackgroundPositionInputGUI::$verticalvalue = ""
protected

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

Referenced by getVerticalValue().


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