ILIAS  release_8 Revision v8.24
ilCSSRectInputGUI 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 ilCSSRectInputGUI:
+ Collaboration diagram for ilCSSRectInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue (array $valueArray)
 
 setUseUnits (bool $a_value)
 
 useUnits ()
 
 setTop (string $a_value)
 
 getTop ()
 
 setBottom (string $a_value)
 
 getBottom ()
 
 setLeft (string $a_value)
 
 getLeft ()
 
 setRight (string $a_value)
 
 getRight ()
 
 setSize (int $a_size)
 
 setValueByArray (array $a_values)
 
 getSize ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
- 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

string $top = ""
 
string $left = ""
 
string $right = ""
 
string $bottom = ""
 
int $size = 0
 
bool $useUnits = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- 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 text 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.ilCSSRectInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

42 {
43 global $DIC;
44
45 $this->lng = $DIC->language();
46 parent::__construct($a_title, $a_postvar);
47 $this->size = 6;
48 $this->useUnits = true;
49 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and useUnits().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilCSSRectInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

Definition at line 142 of file class.ilCSSRectInputGUI.php.

142 : bool
143 {
145
146 $val = $this->getInput();
147 if (
148 $this->getRequired() &&
149 (
150 ($val[$this->getPostVar() . '_top'] == "")
151 || ($val[$this->getPostVar() . '_bottom'] == "")
152 || ($val[$this->getPostVar() . '_left'] == "")
153 || ($val[$this->getPostVar() . '_right'] == "")
154 )
155 ) {
156 $this->setAlert($lng->txt("msg_input_is_required"));
157 return false;
158 }
159
160 if ($this->useUnits()) {
161 if ((!preg_match('/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*))|0)(cm|mm|in|pt|pc|px|em)$/is', $val[$this->getPostVar() . '_top'])) ||
162 (!preg_match('/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*))|0)(cm|mm|in|pt|pc|px|em)$/is', $val[$this->getPostVar() . '_right'])) ||
163 (!preg_match('/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*))|0)(cm|mm|in|pt|pc|px|em)$/is', $val[$this->getPostVar() . '_bottom'])) ||
164 (!preg_match('/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*))|0)(cm|mm|in|pt|pc|px|em)$/is', $val[$this->getPostVar() . '_left']))) {
165 $this->setAlert($lng->txt("msg_unit_is_required"));
166 return false;
167 }
168 }
169 return $this->checkSubItemsInput();
170 }
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...

References ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), getInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), ilLanguage\txt(), and useUnits().

+ Here is the call graph for this function:

◆ getBottom()

ilCSSRectInputGUI::getBottom ( )

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

84 : string
85 {
86 return $this->bottom;
87 }

References $bottom.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getInput()

ilCSSRectInputGUI::getInput ( )

Definition at line 172 of file class.ilCSSRectInputGUI.php.

172 : array
173 {
174 $val = $this->strArray($this->getPostVar());
175 $ret[$this->getPostVar() . '_top'] = trim($val['top']);
176 $ret[$this->getPostVar() . '_right'] = trim($val['right']);
177 $ret[$this->getPostVar() . '_bottom'] = trim($val['bottom']);
178 $ret[$this->getPostVar() . '_left'] = trim($val['left']);
179 return $ret;
180 }

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

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLeft()

ilCSSRectInputGUI::getLeft ( )

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

94 : string
95 {
96 return $this->left;
97 }

References $left.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRight()

ilCSSRectInputGUI::getRight ( )

Definition at line 104 of file class.ilCSSRectInputGUI.php.

104 : string
105 {
106 return $this->right;
107 }

References $right.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getSize()

ilCSSRectInputGUI::getSize ( )

Definition at line 137 of file class.ilCSSRectInputGUI.php.

137 : int
138 {
139 return $this->size;
140 }

References $size.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getTop()

ilCSSRectInputGUI::getTop ( )

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

74 : string
75 {
76 return $this->top;
77 }

References $top.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilCSSRectInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 182 of file class.ilCSSRectInputGUI.php.

182 : void
183 {
185
186 if (strlen($this->getTop())) {
187 $a_tpl->setCurrentBlock("cssrect_value_top");
188 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getTop()));
189 $a_tpl->parseCurrentBlock();
190 }
191 if (strlen($this->getBottom())) {
192 $a_tpl->setCurrentBlock("cssrect_value_bottom");
193 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getBottom()));
194 $a_tpl->parseCurrentBlock();
195 }
196 if (strlen($this->getLeft())) {
197 $a_tpl->setCurrentBlock("cssrect_value_left");
198 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getLeft()));
199 $a_tpl->parseCurrentBlock();
200 }
201 if (strlen($this->getRight())) {
202 $a_tpl->setCurrentBlock("cssrect_value_right");
203 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getRight()));
204 $a_tpl->parseCurrentBlock();
205 }
206 $a_tpl->setCurrentBlock("cssrect");
207 $a_tpl->setVariable("ID", $this->getFieldId());
208 $a_tpl->setVariable("SIZE", $this->getSize());
209 $a_tpl->setVariable("POST_VAR", $this->getPostVar());
210 $a_tpl->setVariable("TEXT_TOP", $lng->txt("pos_top"));
211 $a_tpl->setVariable("TEXT_RIGHT", $lng->txt("pos_right"));
212 $a_tpl->setVariable("TEXT_BOTTOM", $lng->txt("pos_bottom"));
213 $a_tpl->setVariable("TEXT_LEFT", $lng->txt("pos_left"));
214 if ($this->getDisabled()) {
215 $a_tpl->setVariable(
216 "DISABLED",
217 " disabled=\"disabled\""
218 );
219 }
220 $a_tpl->parseCurrentBlock();
221 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static prepareFormOutput($a_str, bool $a_strip=false)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilFormPropertyGUI\$lng, getBottom(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getLeft(), ilFormPropertyGUI\getPostVar(), getRight(), getSize(), getTop(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ setBottom()

ilCSSRectInputGUI::setBottom ( string  $a_value)

Definition at line 79 of file class.ilCSSRectInputGUI.php.

79 : void
80 {
81 $this->bottom = $a_value;
82 }

◆ setLeft()

ilCSSRectInputGUI::setLeft ( string  $a_value)

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

89 : void
90 {
91 $this->left = $a_value;
92 }

◆ setRight()

ilCSSRectInputGUI::setRight ( string  $a_value)

Definition at line 99 of file class.ilCSSRectInputGUI.php.

99 : void
100 {
101 $this->right = $a_value;
102 }

◆ setSize()

ilCSSRectInputGUI::setSize ( int  $a_size)

Definition at line 109 of file class.ilCSSRectInputGUI.php.

109 : void
110 {
111 $this->size = $a_size;
112 }

◆ setTop()

ilCSSRectInputGUI::setTop ( string  $a_value)

Definition at line 69 of file class.ilCSSRectInputGUI.php.

69 : void
70 {
71 $this->top = $a_value;
72 }

◆ setUseUnits()

ilCSSRectInputGUI::setUseUnits ( bool  $a_value)

Definition at line 59 of file class.ilCSSRectInputGUI.php.

59 : void
60 {
61 $this->useUnits = $a_value;
62 }

References useUnits().

+ Here is the call graph for this function:

◆ setValue()

ilCSSRectInputGUI::setValue ( array  $valueArray)

Definition at line 51 of file class.ilCSSRectInputGUI.php.

51 : void
52 {
53 $this->top = $valueArray['top'];
54 $this->left = $valueArray['left'];
55 $this->right = $valueArray['right'];
56 $this->bottom = $valueArray['bottom'];
57 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilCSSRectInputGUI::setValueByArray ( array  $a_values)

Definition at line 114 of file class.ilCSSRectInputGUI.php.

114 : void
115 {
116 $postVar = $this->getPostVar();
117
118 $positions = ['top', 'left', 'right', 'bottom'];
119 $values = [
120 'top' => '',
121 'bottom' => '',
122 'right' => '',
123 'left' => '',
124 ];
125
126 foreach ($positions as $position) {
127 if (isset($a_values[$postVar . '_' . $position])) {
128 $values[$position] = $a_values[$postVar . '_' . $position];
129 } elseif (isset($a_values[$postVar][$position])) {
130 $values[$position] = $a_values[$postVar][$position];
131 }
132 }
133
134 $this->setValue($values);
135 }
setValue(array $valueArray)

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

+ Here is the call graph for this function:

◆ useUnits()

ilCSSRectInputGUI::useUnits ( )

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

64 : bool
65 {
66 return $this->useUnits;
67 }

References $useUnits.

Referenced by __construct(), checkInput(), and setUseUnits().

+ Here is the caller graph for this function:

Field Documentation

◆ $bottom

string ilCSSRectInputGUI::$bottom = ""
protected

Definition at line 31 of file class.ilCSSRectInputGUI.php.

Referenced by getBottom().

◆ $left

string ilCSSRectInputGUI::$left = ""
protected

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

Referenced by getLeft().

◆ $right

string ilCSSRectInputGUI::$right = ""
protected

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

Referenced by getRight().

◆ $size

int ilCSSRectInputGUI::$size = 0
protected

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

Referenced by getSize().

◆ $top

string ilCSSRectInputGUI::$top = ""
protected

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

Referenced by getTop().

◆ $useUnits

bool ilCSSRectInputGUI::$useUnits = false
protected

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

Referenced by useUnits().


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