ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFontSizeInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setValue (string $a_value)
 
 getValue ()
 
 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 = ""
 
- 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
 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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This class represents a fint size 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.ilFontSizeInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 32 of file class.ilFontSizeInputGUI.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("fontsize");
40  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilFontSizeInputGUI::checkInput ( )

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

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

52  : bool
53  {
54  $lng = $this->lng;
55 
56  $input = $this->getInput();
57 
58  $type = $input["type"];
59  $num_value = $input["num_value"];
60  $num_unit = $input["num_unit"];
61  $pre_value = $input["pre_value"];
62 
63  if ($this->getRequired() && $type == "numeric" && trim($num_value) == "") {
64  $this->setAlert($lng->txt("msg_input_is_required"));
65 
66  return false;
67  }
68 
69  if ($type == "numeric") {
70  if (!is_numeric($num_value) && $num_value != "") {
71  $this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
72 
73  return false;
74  }
75 
76  if (trim($num_value) != "") {
77  $this->setValue($num_value . $num_unit);
78  }
79  } else {
80  $this->setValue($pre_value);
81  }
82 
83  return true;
84  }
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:

◆ getInput()

ilFontSizeInputGUI::getInput ( )

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

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

Referenced by checkInput().

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

◆ getValue()

ilFontSizeInputGUI::getValue ( )

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

References $value.

Referenced by insert().

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

◆ insert()

ilFontSizeInputGUI::insert ( ilTemplate  $a_tpl)

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

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

91  : void
92  {
93  $tpl = new ilTemplate("tpl.prop_fontsize.html", true, true, "Services/Style/Content");
94 
95  $tpl->setVariable("POSTVAR", $this->getPostVar());
96  $current_unit = "";
97 
99  $pre_options = ilObjStyleSheet::_getStyleParameterValues("font-size");
100 
101  $value = strtolower(trim($this->getValue()));
102 
103  if (in_array($value, $pre_options)) {
104  $current_type = "pre";
105  $tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
106  } else {
107  $current_type = "unit";
108  $tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
109  foreach ($unit_options as $u) {
110  if (substr($value, strlen($value) - strlen($u)) == $u) {
111  $current_unit = $u;
112  }
113  }
114  $tpl->setVariable(
115  "VAL_NUM",
116  substr($value, 0, strlen($value) - strlen($current_unit))
117  );
118  if ($current_unit == "") {
119  $current_unit = "px";
120  }
121  }
122 
123  foreach ($unit_options as $option) {
124  $tpl->setCurrentBlock("unit_option");
125  $tpl->setVariable("VAL_UNIT", $option);
126  $tpl->setVariable("TXT_UNIT", $option);
127  if ($current_type == "unit" && $current_unit == $option) {
128  $tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
129  }
130  $tpl->parseCurrentBlock();
131  }
132 
133  foreach ($pre_options as $option) {
134  $tpl->setCurrentBlock("pre_option");
135  $tpl->setVariable("VAL_PRE", $option);
136  $tpl->setVariable("TXT_PRE", $option);
137  if ($current_type == "pre" && $value == $option) {
138  $tpl->setVariable("PRE_SELECTED", 'selected="selected"');
139  }
140  $tpl->parseCurrentBlock();
141  }
142 
143  $a_tpl->setCurrentBlock("prop_generic");
144  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
145  $a_tpl->parseCurrentBlock();
146  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static _getStyleParameterNumericUnits(bool $a_no_percentage=false)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static _getStyleParameterValues(string $par)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ setValue()

ilFontSizeInputGUI::setValue ( string  $a_value)

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

Referenced by checkInput(), and setValueByArray().

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

◆ setValueByArray()

ilFontSizeInputGUI::setValueByArray ( array  $a_values)

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

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

148  : void
149  {
150  if ($a_values[$this->getPostVar()]["type"] == "predefined") {
151  $this->setValue($a_values[$this->getPostVar()]["pre_value"]);
152  } else {
153  $this->setValue($a_values[$this->getPostVar()]["num_value"] .
154  $a_values[$this->getPostVar()]["num_unit"]);
155  }
156  }
+ Here is the call graph for this function:

Field Documentation

◆ $user

ilObjUser ilFontSizeInputGUI::$user
protected

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

◆ $value

string ilFontSizeInputGUI::$value = ""
protected

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

Referenced by getValue().


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