ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 stripSlashesAddSpaceFallback ($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...
 

Protected Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- 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 47 of file class.ilNumericStyleValueInputGUI.php.

References $DIC, ilFormPropertyGUI\setType(), and user().

48  {
49  global $DIC;
50 
51  $this->lng = $DIC->language();
52  $this->user = $DIC->user();
53  parent::__construct($a_title, $a_postvar);
54  $this->setType("style_numeric");
55  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
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 102 of file class.ilNumericStyleValueInputGUI.php.

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

103  {
104  $lng = $this->lng;
105 
106  $num_value = $_POST[$this->getPostVar()]["num_value"] =
107  trim(ilUtil::stripSlashes($_POST[$this->getPostVar()]["num_value"]));
108  $num_unit = $_POST[$this->getPostVar()]["num_unit"] =
109  trim(ilUtil::stripSlashes($_POST[$this->getPostVar()]["num_unit"]));
110 
111  if ($this->getRequired() && trim($num_value) == "") {
112  $this->setAlert($lng->txt("msg_input_is_required"));
113 
114  return false;
115  }
116 
117  if (!is_numeric($num_value) && $num_value != "") {
118  $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
119 
120  return false;
121  }
122 
123  if (trim($num_value) != "") {
124  $this->setValue($num_value . $num_unit);
125  }
126 
127  return true;
128  }
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"]
+ Here is the call graph for this function:

◆ getAllowPercentage()

ilNumericStyleValueInputGUI::getAllowPercentage ( )

Get Allow Percentage.

Returns
boolean Allow Percentage

Definition at line 92 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 72 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 133 of file class.ilNumericStyleValueInputGUI.php.

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

134  {
135  $tpl = new ilTemplate("tpl.prop_style_numeric.html", true, true, "Services/Style/Content");
136 
137  $tpl->setVariable("POSTVAR", $this->getPostVar());
138 
140 
141  $value = strtolower(trim($this->getValue()));
142 
143  $current_unit = "";
144  foreach ($unit_options as $u) {
145  if (substr($value, strlen($value) - strlen($u)) == $u) {
146  $current_unit = $u;
147  }
148  }
149  $tpl->setVariable(
150  "VAL_NUM",
151  substr($value, 0, strlen($value) - strlen($current_unit))
152  );
153  if ($current_unit == "") {
154  $current_unit = "px";
155  }
156 
157  foreach ($unit_options as $option) {
158  $tpl->setCurrentBlock("unit_option");
159  $tpl->setVariable("VAL_UNIT", $option);
160  $tpl->setVariable("TXT_UNIT", $option);
161  if ($current_unit == $option) {
162  $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
163  }
164  $tpl->parseCurrentBlock();
165  }
166 
167  $a_tpl->setCurrentBlock("prop_generic");
168  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
169  $a_tpl->parseCurrentBlock();
170  }
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
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 82 of file class.ilNumericStyleValueInputGUI.php.

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

83  {
84  $this->allowpercentage = $a_allowpercentage;
85  }
+ Here is the caller graph for this function:

◆ setValue()

ilNumericStyleValueInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

Referenced by checkInput(), and setValueByArray().

63  {
64  $this->value = $a_value;
65  }
+ 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 177 of file class.ilNumericStyleValueInputGUI.php.

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

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

Field Documentation

◆ $allowpercentage

ilNumericStyleValueInputGUI::$allowpercentage = true
protected

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

Referenced by getAllowPercentage().

◆ $user

ilNumericStyleValueInputGUI::$user
protected

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

Referenced by setValueByArray().

◆ $value

ilNumericStyleValueInputGUI::$value
protected

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

Referenced by getValue(), and insert().


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