ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBackgroundPositionInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 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
 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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 = "" 
)

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

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

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  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilBackgroundPositionInputGUI::checkInput ( )

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

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\$type, getInput(), ilFormPropertyGUI\setAlert(), setHorizontalValue(), setVerticalValue(), and ilLanguage\txt().

97  : bool
98  {
99  $lng = $this->lng;
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); break;
126  case "vertical": $this->setVerticalValue($value); break;
127  }
128  }
129  }
130 
131  return true;
132  }
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...
+ 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().

53  : string
54  {
56  }
+ Here is the caller graph for this function:

◆ getInput()

ilBackgroundPositionInputGUI::getInput ( )

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

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

Referenced by checkInput().

134  : array
135  {
136  return $this->arrayArray($this->getPostVar());
137  }
+ 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.

References getHorizontalValue(), and getVerticalValue().

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  }
+ 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().

63  : string
64  {
65  return $this->verticalvalue;
66  }
+ Here is the caller graph for this function:

◆ insert()

ilBackgroundPositionInputGUI::insert ( ilTemplate  $a_tpl)

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

References ilFormPropertyGUI\$lng, $tpl, ilObjStyleSheet\_getStyleParameterNumericUnits(), ilObjStyleSheet\_getStyleParameterValues(), getHorizontalValue(), ilFormPropertyGUI\getPostVar(), getVerticalValue(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

139  : void
140  {
141  $lng = $this->lng;
142 
143  $layout_tpl = new ilTemplate("tpl.prop_hv_layout.html", true, true, "Services/Style/Content");
144 
145  foreach ($this->dirs as $dir) {
146  $value = "";
147  $current_unit = "";
148  $tpl = new ilTemplate("tpl.prop_background_position.html", true, true, "Services/Style/Content");
150  $pre_options = ilObjStyleSheet::_getStyleParameterValues("background-position");
151  $pre_options = $pre_options[$dir];
152  switch ($dir) {
153  case "horizontal": $value = strtolower(trim($this->getHorizontalValue())); break;
154  case "vertical": $value = strtolower(trim($this->getVerticalValue())); break;
155  }
156 
157  if (in_array($value, $pre_options)) {
158  $current_type = "pre";
159  $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
160  } else {
161  $current_type = "unit";
162  $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
163 
164  foreach ($unit_options as $u) {
165  if (substr($value, strlen($value) - strlen($u)) == $u) {
166  $current_unit = $u;
167  }
168  }
169  $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
170  if ($current_unit == "") {
171  $current_unit = "px";
172  }
173  $tpl->setVariable("VAL_NUM", $disp_val);
174  }
175 
176  foreach ($unit_options as $option) {
177  $tpl->setCurrentBlock("unit_option");
178  $tpl->setVariable("VAL_UNIT", $option);
179  $tpl->setVariable("TXT_UNIT", $option);
180  if ($current_type == "unit" && $current_unit == $option) {
181  $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
182  }
183  $tpl->parseCurrentBlock();
184  }
185 
186  foreach ($pre_options as $option) {
187  $tpl->setCurrentBlock("pre_option");
188  $tpl->setVariable("VAL_PRE", $option);
189  $tpl->setVariable("TXT_PRE", $option);
190  if ($current_type == "pre" && $value == $option) {
191  $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
192  }
193  $tpl->parseCurrentBlock();
194  }
195 
196  $tpl->setVariable("POSTVAR", $this->getPostVar());
197  $tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
198  $tpl->setVariable("DIR", $dir);
199 
200  $layout_tpl->setVariable(strtoupper($dir), $tpl->get());
201  }
202  $layout_tpl->setVariable("COLSPAN", "2");
203 
204  $a_tpl->setCurrentBlock("prop_generic");
205  $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
206  $a_tpl->parseCurrentBlock();
207  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
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...
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static _getStyleParameterValues(string $par)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ setHorizontalValue()

ilBackgroundPositionInputGUI::setHorizontalValue ( string  $a_horizontalvalue)

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

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

48  : void
49  {
50  $this->horizontalvalue = $a_horizontalvalue;
51  }
+ Here is the caller graph for this function:

◆ setValue()

ilBackgroundPositionInputGUI::setValue ( string  $a_val)

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

References setHorizontalValue(), and setVerticalValue().

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  }
+ Here is the call graph for this function:

◆ setValueByArray()

ilBackgroundPositionInputGUI::setValueByArray ( array  $a_values)

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

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

209  : void
210  {
211  if ($a_values[$this->getPostVar()]["horizontal"]["type"] == "predefined") {
212  $this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["pre_value"]);
213  } else {
214  $this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["num_value"] .
215  $a_values[$this->getPostVar()]["horizontal"]["num_unit"]);
216  }
217  if ($a_values[$this->getPostVar()]["vertical"]["type"] == "predefined") {
218  $this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["pre_value"]);
219  } else {
220  $this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["num_value"] .
221  $a_values[$this->getPostVar()]["vertical"]["num_unit"]);
222  }
223  }
+ Here is the call graph for this function:

◆ setVerticalValue()

ilBackgroundPositionInputGUI::setVerticalValue ( string  $a_verticalvalue)

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

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

58  : void
59  {
60  $this->verticalvalue = $a_verticalvalue;
61  }
+ 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.

◆ $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: