ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
ilNumericStyleValueInputGUI Class Reference

This class represents a numeric style property in a property form. More...

+ Inheritance diagram for ilNumericStyleValueInputGUI:
+ Collaboration diagram for ilNumericStyleValueInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get 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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 

Protected Attributes

 $value
 
 $allowpercentage = true
 
- 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 numeric style 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.ilNumericStyleValueInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 42 of file class.ilNumericStyleValueInputGUI.php.

References ilFormPropertyGUI\setType().

43  {
44  parent::__construct($a_title, $a_postvar);
45  $this->setType("style_numeric");
46 
47  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilNumericStyleValueInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 94 of file class.ilNumericStyleValueInputGUI.php.

References $_POST, $lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), setValue(), and ilUtil\stripSlashes().

95  {
96  global $lng;
97 
98  $num_value = $_POST[$this->getPostVar()]["num_value"] =
99  trim(ilUtil::stripSlashes($_POST[$this->getPostVar()]["num_value"]));
100  $num_unit = $_POST[$this->getPostVar()]["num_unit"] =
101  trim(ilUtil::stripSlashes($_POST[$this->getPostVar()]["num_unit"]));
102 
103  if ($this->getRequired() && trim($num_value) == "")
104  {
105  $this->setAlert($lng->txt("msg_input_is_required"));
106 
107  return false;
108  }
109 
110  if (!is_numeric($num_value) && $num_value != "")
111  {
112  $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
113 
114  return false;
115  }
116 
117  if (trim($num_value) != "")
118  {
119  $this->setValue($num_value.$num_unit);
120  }
121 
122  return true;
123  }
$_POST['username']
Definition: cron.php:12
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
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getAllowPercentage()

ilNumericStyleValueInputGUI::getAllowPercentage ( )

Get Allow Percentage.

Returns
boolean Allow Percentage

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

References $allowpercentage.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getValue()

ilNumericStyleValueInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 64 of file class.ilNumericStyleValueInputGUI.php.

References $value.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilNumericStyleValueInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 128 of file class.ilNumericStyleValueInputGUI.php.

References $tpl, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), getAllowPercentage(), ilFormPropertyGUI\getPostVar(), and getValue().

129  {
130  $tpl = new ilTemplate("tpl.prop_style_numeric.html", true, true, "Services/Style");
131 
132  $tpl->setVariable("POSTVAR", $this->getPostVar());
133 
135 
136  $value = strtolower(trim($this->getValue()));
137 
138  $current_unit = "";
139  foreach ($unit_options as $u)
140  {
141  if (substr($value, strlen($value) - strlen($u)) == $u)
142  {
143  $current_unit = $u;
144  }
145  }
146  $tpl->setVariable("VAL_NUM",
147  substr($value, 0, strlen($value) - strlen($current_unit)));
148  if ($current_unit == "")
149  {
150  $current_unit = "px";
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_unit == $option)
159  {
160  $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
161  }
162  $tpl->parseCurrentBlock();
163  }
164 
165  $a_tpl->setCurrentBlock("prop_generic");
166  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
167  $a_tpl->parseCurrentBlock();
168  }
getPostVar()
Get Post Variable.
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
static _getStyleParameterNumericUnits($a_no_percentage=false)
+ Here is the call graph for this function:

◆ setAllowPercentage()

ilNumericStyleValueInputGUI::setAllowPercentage (   $a_allowpercentage)

Set Allow Percentage.

Parameters
boolean$a_allowpercentageAllow Percentage

Definition at line 74 of file class.ilNumericStyleValueInputGUI.php.

Referenced by ilObjStyleSheetGUI\initTagStyleForm(), and ilObjStyleSheetGUI\initTemplateGenerationForm().

75  {
76  $this->allowpercentage = $a_allowpercentage;
77  }
+ Here is the caller graph for this function:

◆ setValue()

ilNumericStyleValueInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 54 of file class.ilNumericStyleValueInputGUI.php.

Referenced by checkInput(), and setValueByArray().

55  {
56  $this->value = $a_value;
57  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilNumericStyleValueInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 175 of file class.ilNumericStyleValueInputGUI.php.

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

176  {
177  global $ilUser;
178 
179  $this->setValue($a_values[$this->getPostVar()]["num_value"].
180  $a_values[$this->getPostVar()]["num_unit"]);
181  }
getPostVar()
Get Post Variable.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

Field Documentation

◆ $allowpercentage

ilNumericStyleValueInputGUI::$allowpercentage = true
protected

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

Referenced by getAllowPercentage().

◆ $value

ilNumericStyleValueInputGUI::$value
protected

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

Referenced by getValue(), and insert().


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