ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 setHorizontalValue ($a_horizontalvalue)
 Set Horizontal Value. More...
 
 getHorizontalValue ()
 Get Horizontal Value. More...
 
 setVerticalValue ($a_verticalvalue)
 Set Vertical Value. More...
 
 getVerticalValue ()
 Get Vertical Value. More...
 
 getValue ()
 Get value. More...
 
 setValue ($a_val)
 Set value. 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Attributes

 $value
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- 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 background position 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.ilBackgroundPositionInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

42 {
43 parent::__construct($a_title, $a_postvar);
44 $this->setType("border_width");
45 $this->dirs = array("horizontal", "vertical");
46 }
setType($a_type)
Set Type.

References ilFormPropertyGUI\setType().

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

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

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

137 {
138 global $lng;
139
140 foreach ($this->dirs as $dir)
141 {
142 $type = $_POST[$this->getPostVar()][$dir]["type"] =
143 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["type"]);
144 $num_value = $_POST[$this->getPostVar()][$dir]["num_value"] =
145 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_value"]));
146 $num_unit = $_POST[$this->getPostVar()][$dir]["num_unit"] =
147 trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_unit"]));
148 $pre_value = $_POST[$this->getPostVar()][$dir]["pre_calue"] =
149 ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["pre_value"]);
150
151 /*
152 if ($this->getRequired() && trim($num_value) == "")
153 {
154 $this->setAlert($lng->txt("msg_input_is_required"));
155
156 return false;
157 }*/
158
159 if (!is_numeric($num_value) && trim($num_value) != "")
160 {
161 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
162 return false;
163 }
164
165 $value = "";
166 if ($type == "numeric")
167 {
168 if ($num_value != "")
169 {
170 $value = $num_value.$num_unit;
171 }
172 }
173 else
174 {
175 $value = $pre_value;
176 }
177
178 if (trim($value) != "")
179 {
180 switch ($dir)
181 {
182 case "horizontal": $this->setHorizontalValue($value); break;
183 case "vertical": $this->setVerticalValue($value); break;
184 }
185 }
186
187 }
188
189 return true;
190 }
setHorizontalValue($a_horizontalvalue)
Set Horizontal Value.
setVerticalValue($a_verticalvalue)
Set Vertical Value.
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
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40

References $_POST, $lng, ilFormPropertyGUI\$type, $value, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), setHorizontalValue(), setVerticalValue(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getHorizontalValue()

ilBackgroundPositionInputGUI::getHorizontalValue ( )

Get Horizontal Value.

Returns
string Horizontal Value

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

64 {
65 return $this->horizontalvalue;
66 }

Referenced by getValue(), and insert().

+ Here is the caller graph for this function:

◆ getValue()

ilBackgroundPositionInputGUI::getValue ( )

Get value.

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

92 {
93 if ($this->getHorizontalValue() != "")
94 {
95 if ($this->getVerticalValue() != "")
96 {
97 return $this->getHorizontalValue()." ".$this->getVerticalValue();
98 }
99 else
100 {
101 return $this->getHorizontalValue();
102 }
103 }
104 else
105 {
106 if ($this->getVerticalValue() != "")
107 {
108 return "left ".$this->getVerticalValue();
109 }
110 }
111 return "";
112 }

References getHorizontalValue(), and getVerticalValue().

+ Here is the call graph for this function:

◆ getVerticalValue()

ilBackgroundPositionInputGUI::getVerticalValue ( )

Get Vertical Value.

Returns
string Vertical Value

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

84 {
85 return $this->verticalvalue;
86 }

Referenced by getValue(), and insert().

+ Here is the caller graph for this function:

◆ insert()

ilBackgroundPositionInputGUI::insert ( $a_tpl)

Insert property html.

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

196 {
197 global $lng;
198
199 $layout_tpl = new ilTemplate("tpl.prop_hv_layout.html", true, true, "Services/Style");
200
201 foreach ($this->dirs as $dir)
202 {
203 $tpl = new ilTemplate("tpl.prop_background_position.html", true, true, "Services/Style");
205 $pre_options = ilObjStyleSheet::_getStyleParameterValues("background-position");
206 $pre_options = $pre_options[$dir];
207 switch($dir)
208 {
209 case "horizontal": $value = strtolower(trim($this->getHorizontalValue())); break;
210 case "vertical": $value = strtolower(trim($this->getVerticalValue())); break;
211 }
212
213 if (in_array($value, $pre_options))
214 {
215 $current_type = "pre";
216 $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
217 }
218 else
219 {
220 $current_type = "unit";
221 $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
222
223 $current_unit = "";
224 foreach ($unit_options as $u)
225 {
226 if (substr($value, strlen($value) - strlen($u)) == $u)
227 {
228 $current_unit = $u;
229 }
230 }
231 $disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
232 if ($current_unit == "")
233 {
234 $current_unit = "px";
235 }
236 $tpl->setVariable("VAL_NUM", $disp_val);
237 }
238
239 foreach ($unit_options as $option)
240 {
241 $tpl->setCurrentBlock("unit_option");
242 $tpl->setVariable("VAL_UNIT", $option);
243 $tpl->setVariable("TXT_UNIT", $option);
244 if ($current_type == "unit" && $current_unit == $option)
245 {
246 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
247 }
248 $tpl->parseCurrentBlock();
249 }
250
251 foreach ($pre_options as $option)
252 {
253 $tpl->setCurrentBlock("pre_option");
254 $tpl->setVariable("VAL_PRE", $option);
255 $tpl->setVariable("TXT_PRE", $option);
256 if ($current_type == "pre" && $value == $option)
257 {
258 $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
259 }
260 $tpl->parseCurrentBlock();
261 }
262
263 $tpl->setVariable("POSTVAR", $this->getPostVar());
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 $layout_tpl->setVariable("COLSPAN", "2");
270
271 $a_tpl->setCurrentBlock("prop_generic");
272 $a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
273 $a_tpl->parseCurrentBlock();
274 }
global $tpl
Definition: ilias.php:8
static _getStyleParameterNumericUnits($a_no_percentage=false)
static _getStyleParameterValues($par)
special template class to simplify handling of ITX/PEAR

References $lng, $tpl, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), ilObjStyleSheet\_getStyleParameterValues(), getHorizontalValue(), ilFormPropertyGUI\getPostVar(), and getVerticalValue().

+ Here is the call graph for this function:

◆ setHorizontalValue()

ilBackgroundPositionInputGUI::setHorizontalValue (   $a_horizontalvalue)

Set Horizontal Value.

Parameters
string$a_horizontalvalueHorizontal Value

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

54 {
55 $this->horizontalvalue = $a_horizontalvalue;
56 }

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

+ Here is the caller graph for this function:

◆ setValue()

ilBackgroundPositionInputGUI::setValue (   $a_val)

Set value.

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

118 {
119 $a_val = trim($a_val);
120 $a_val_arr = explode(" ", $a_val);
121 $hor = trim($a_val_arr[0]);
122 $ver = trim($a_val_arr[1]);
123 if ($hor == "center" && $ver == "")
124 {
125 $ver = "center";
126 }
127 $this->setHorizontalValue($hor);
128 $this->setVerticalValue($ver);
129 }

References setHorizontalValue(), and setVerticalValue().

+ Here is the call graph for this function:

◆ setValueByArray()

ilBackgroundPositionInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

282 {
283 global $ilUser;
284
285 if ($a_values[$this->getPostVar()]["horizontal"]["type"] == "predefined")
286 {
287 $this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["pre_value"]);
288 }
289 else
290 {
291 $this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["num_value"].
292 $a_values[$this->getPostVar()]["horizontal"]["num_unit"]);
293 }
294 if ($a_values[$this->getPostVar()]["vertical"]["type"] == "predefined")
295 {
296 $this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["pre_value"]);
297 }
298 else
299 {
300 $this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["num_value"].
301 $a_values[$this->getPostVar()]["vertical"]["num_unit"]);
302 }
303 }
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ setVerticalValue()

ilBackgroundPositionInputGUI::setVerticalValue (   $a_verticalvalue)

Set Vertical Value.

Parameters
string$a_verticalvalueVertical Value

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

74 {
75 $this->verticalvalue = $a_verticalvalue;
76 }

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

+ Here is the caller graph for this function:

Field Documentation

◆ $value

ilBackgroundPositionInputGUI::$value
protected

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

Referenced by checkInput(), and insert().


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