ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (string $a_title="", string $a_postvar="")
 
 setValue (string $a_value)
 
 getValue ()
 
 setAllowPercentage (bool $a_allowpercentage)
 
 getAllowPercentage ()
 
 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

ilObjUser $user
 
string $value = ""
 
bool $allowpercentage = true
 
- 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
 symbol ()
 
 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 class represents a numeric style property 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.ilNumericStyleValueInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

33  {
34  global $DIC;
35 
36  $this->lng = $DIC->language();
37  $this->user = $DIC->user();
38  parent::__construct($a_title, $a_postvar);
39  $this->setType("style_numeric");
40  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilNumericStyleValueInputGUI::checkInput ( )

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

References ilFormPropertyGUI\$lng, getInput(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), setValue(), and ilLanguage\txt().

62  : bool
63  {
64  $lng = $this->lng;
65 
66  $input = $this->getInput();
67  $num_value = $input["num_value"];
68  $num_unit = $input["num_unit"];
69 
70  if ($this->getRequired() && trim($num_value) == "") {
71  $this->setAlert($lng->txt("msg_input_is_required"));
72 
73  return false;
74  }
75 
76  if (!is_numeric($num_value) && $num_value != "") {
77  $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
78 
79  return false;
80  }
81 
82  if (trim($num_value) != "") {
83  $this->setValue($num_value . $num_unit);
84  }
85 
86  return true;
87  }
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:

◆ getAllowPercentage()

ilNumericStyleValueInputGUI::getAllowPercentage ( )

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

References $allowpercentage.

Referenced by insert().

57  : bool
58  {
60  }
+ Here is the caller graph for this function:

◆ getInput()

ilNumericStyleValueInputGUI::getInput ( )

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

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

Referenced by checkInput().

89  : array
90  {
91  return $this->strArray($this->getPostVar());
92  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValue()

ilNumericStyleValueInputGUI::getValue ( )

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

References $value.

Referenced by insert().

47  : string
48  {
49  return $this->value;
50  }
+ Here is the caller graph for this function:

◆ insert()

ilNumericStyleValueInputGUI::insert ( ilTemplate  $a_tpl)

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

References ilObjStyleSheet\_getStyleParameterNumericUnits(), getAllowPercentage(), ilFormPropertyGUI\getPostVar(), getValue(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

94  : void
95  {
96  $tpl = new ilTemplate("tpl.prop_style_numeric.html", true, true, "components/ILIAS/Style/Content");
97 
98  $tpl->setVariable("POSTVAR", $this->getPostVar());
99 
101 
102  $value = strtolower(trim($this->getValue()));
103 
104  $current_unit = "";
105  foreach ($unit_options as $u) {
106  if (substr($value, strlen($value) - strlen($u)) == $u) {
107  $current_unit = $u;
108  }
109  }
110  $tpl->setVariable(
111  "VAL_NUM",
112  substr($value, 0, strlen($value) - strlen($current_unit))
113  );
114  if ($current_unit == "") {
115  $current_unit = "px";
116  }
117 
118  foreach ($unit_options as $option) {
119  $tpl->setCurrentBlock("unit_option");
120  $tpl->setVariable("VAL_UNIT", $option);
121  $tpl->setVariable("TXT_UNIT", $option);
122  if ($current_unit == $option) {
123  $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
124  }
125  $tpl->parseCurrentBlock();
126  }
127 
128  $a_tpl->setCurrentBlock("prop_generic");
129  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
130  $a_tpl->parseCurrentBlock();
131  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setAllowPercentage()

ilNumericStyleValueInputGUI::setAllowPercentage ( bool  $a_allowpercentage)

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

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

52  : void
53  {
54  $this->allowpercentage = $a_allowpercentage;
55  }
+ Here is the caller graph for this function:

◆ setValue()

ilNumericStyleValueInputGUI::setValue ( string  $a_value)

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

Referenced by checkInput(), and setValueByArray().

42  : void
43  {
44  $this->value = $a_value;
45  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilNumericStyleValueInputGUI::setValueByArray ( array  $a_values)

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

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

133  : void
134  {
135  $this->setValue($a_values[$this->getPostVar()]["num_value"] .
136  $a_values[$this->getPostVar()]["num_unit"]);
137  }
+ Here is the call graph for this function:

Field Documentation

◆ $allowpercentage

bool ilNumericStyleValueInputGUI::$allowpercentage = true
protected

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

Referenced by getAllowPercentage().

◆ $user

ilObjUser ilNumericStyleValueInputGUI::$user
protected

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

◆ $value

string ilNumericStyleValueInputGUI::$value = ""
protected

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

Referenced by getValue().


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