ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilFontSizeInputGUI Class Reference

This class represents a fint size property in a property form. More...

+ Inheritance diagram for ilFontSizeInputGUI:
+ Collaboration diagram for ilFontSizeInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get 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 fint size property 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.ilFontSizeInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

42 {
43 parent::__construct($a_title, $a_postvar);
44 $this->setType("fontsize");
45 }
setType($a_type)
Set Type.

References ilFormPropertyGUI\setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilFontSizeInputGUI::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 72 of file class.ilFontSizeInputGUI.php.

73 {
74 global $lng;
75
76 $type = $_POST[$this->getPostVar()]["type"] =
77 ilUtil::stripSlashes($_POST[$this->getPostVar()]["type"]);
78 $num_value = $_POST[$this->getPostVar()]["num_value"] =
79 ilUtil::stripSlashes($_POST[$this->getPostVar()]["num_value"]);
80 $num_unit = $_POST[$this->getPostVar()]["num_unit"] =
81 ilUtil::stripSlashes($_POST[$this->getPostVar()]["num_unit"]);
82 $pre_value = $_POST[$this->getPostVar()]["pre_value"] =
83 ilUtil::stripSlashes($_POST[$this->getPostVar()]["pre_value"]);
84
85 if ($this->getRequired() && $type == "numeric" && trim($num_value) == "")
86 {
87 $this->setAlert($lng->txt("msg_input_is_required"));
88
89 return false;
90 }
91
92 if ($type == "numeric")
93 {
94 if (!is_numeric($num_value) && $num_value != "")
95 {
96 $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
97
98 return false;
99 }
100
101 if (trim($num_value) != "")
102 {
103 $this->setValue($num_value.$num_unit);
104 }
105 }
106 else
107 {
108 $this->setValue($pre_value);
109 }
110
111 return true;
112 }
setValue($a_value)
Set 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, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), setValue(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getValue()

ilFontSizeInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 62 of file class.ilFontSizeInputGUI.php.

References $value.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilFontSizeInputGUI::insert ( $a_tpl)

Insert property html.

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

118 {
119 $tpl = new ilTemplate("tpl.prop_fontsize.html", true, true, "Services/Style");
120
121 $tpl->setVariable("POSTVAR", $this->getPostVar());
122
124 $pre_options = ilObjStyleSheet::_getStyleParameterValues("font-size");
125
126 $value = strtolower(trim($this->getValue()));
127
128 if (in_array($value, $pre_options))
129 {
130 $current_type = "pre";
131 $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
132 }
133 else
134 {
135 $current_type = "unit";
136 $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
137 $current_unit = "";
138 foreach ($unit_options as $u)
139 {
140 if (substr($value, strlen($value) - strlen($u)) == $u)
141 {
142 $current_unit = $u;
143 }
144 }
145 $tpl->setVariable("VAL_NUM",
146 substr($value, 0, strlen($value) - strlen($current_unit)));
147 if ($current_unit == "")
148 {
149 $current_unit = "px";
150 }
151 }
152
153 foreach ($unit_options as $option)
154 {
155 $tpl->setCurrentBlock("unit_option");
156 $tpl->setVariable("VAL_UNIT", $option);
157 $tpl->setVariable("TXT_UNIT", $option);
158 if ($current_type == "unit" && $current_unit == $option)
159 {
160 $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
161 }
162 $tpl->parseCurrentBlock();
163 }
164
165 foreach ($pre_options as $option)
166 {
167 $tpl->setCurrentBlock("pre_option");
168 $tpl->setVariable("VAL_PRE", $option);
169 $tpl->setVariable("TXT_PRE", $option);
170 if ($current_type == "pre" && $value == $option)
171 {
172 $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
173 }
174 $tpl->parseCurrentBlock();
175 }
176
177 $a_tpl->setCurrentBlock("prop_generic");
178 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
179 $a_tpl->parseCurrentBlock();
180 }
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 $tpl, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), ilObjStyleSheet\_getStyleParameterValues(), ilFormPropertyGUI\getPostVar(), and getValue().

+ Here is the call graph for this function:

◆ setValue()

ilFontSizeInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 52 of file class.ilFontSizeInputGUI.php.

53 {
54 $this->value = $a_value;
55 }

Referenced by checkInput(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilFontSizeInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 187 of file class.ilFontSizeInputGUI.php.

188 {
189 global $ilUser;
190
191 if ($a_values[$this->getPostVar()]["type"] == "predefined")
192 {
193 $this->setValue($a_values[$this->getPostVar()]["pre_value"]);
194 }
195 else
196 {
197 $this->setValue($a_values[$this->getPostVar()]["num_value"].
198 $a_values[$this->getPostVar()]["num_unit"]);
199 }
200 }
global $ilUser
Definition: imgupload.php:15

References $ilUser, ilFormPropertyGUI\getPostVar(), and setValue().

+ Here is the call graph for this function:

Field Documentation

◆ $value

ilFontSizeInputGUI::$value
protected

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

Referenced by getValue(), and insert().


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