ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCSSRectInputGUI Class Reference

This class represents a text property in a property form. 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
 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 text property in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
12 This component will be removed with ILIAS 12

Definition at line 27 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 42 of file class.ilCSSRectInputGUI.php.

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

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 143 of file class.ilCSSRectInputGUI.php.

143 : bool
144 {
146
147 $val = $this->getInput();
148 if (
149 $this->getRequired() &&
150 (
151 ($val[$this->getPostVar() . '_top'] == "")
152 || ($val[$this->getPostVar() . '_bottom'] == "")
153 || ($val[$this->getPostVar() . '_left'] == "")
154 || ($val[$this->getPostVar() . '_right'] == "")
155 )
156 ) {
157 $this->setAlert($lng->txt("msg_input_is_required"));
158 return false;
159 }
160
161 foreach (['top', 'right', 'bottom', 'left'] as $side) {
162 $value = $val[$this->getPostVar() . '_' . $side];
163
164 if (($this->getRequired() || $value !== "") && !preg_match('/^(([1-9]+|([1-9]+[0]*[\.,]{0,1}[\d]+))|(0[\.,](0*[1-9]+[\d]*))|0).*?$/si', $value)) {
165 $this->setAlert($lng->txt('msg_invalid_value_css_rect_input'));
166 return false;
167 }
168 }
169
170 if ($this->useUnits()) {
171 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'])) ||
172 (!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'])) ||
173 (!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'])) ||
174 (!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']))) {
175 $this->setAlert($lng->txt("msg_unit_is_required"));
176 return false;
177 }
178 }
179 return $this->checkSubItemsInput();
180 }
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 85 of file class.ilCSSRectInputGUI.php.

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

References $bottom.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getInput()

ilCSSRectInputGUI::getInput ( )

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

182 : array
183 {
184 $val = $this->strArray($this->getPostVar());
185 $ret[$this->getPostVar() . '_top'] = trim($val['top']);
186 $ret[$this->getPostVar() . '_right'] = trim($val['right']);
187 $ret[$this->getPostVar() . '_bottom'] = trim($val['bottom']);
188 $ret[$this->getPostVar() . '_left'] = trim($val['left']);
189 return $ret;
190 }

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 95 of file class.ilCSSRectInputGUI.php.

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

References $left.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRight()

ilCSSRectInputGUI::getRight ( )

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

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

References $right.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getSize()

ilCSSRectInputGUI::getSize ( )

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

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

References $size.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getTop()

ilCSSRectInputGUI::getTop ( )

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

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

References $top.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilCSSRectInputGUI::insert ( ilTemplate  $a_tpl)

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

192 : void
193 {
195
196 if (strlen($this->getTop())) {
197 $a_tpl->setCurrentBlock("cssrect_value_top");
198 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getTop()));
199 $a_tpl->parseCurrentBlock();
200 }
201 if (strlen($this->getBottom())) {
202 $a_tpl->setCurrentBlock("cssrect_value_bottom");
203 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getBottom()));
204 $a_tpl->parseCurrentBlock();
205 }
206 if (strlen($this->getLeft())) {
207 $a_tpl->setCurrentBlock("cssrect_value_left");
208 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getLeft()));
209 $a_tpl->parseCurrentBlock();
210 }
211 if (strlen($this->getRight())) {
212 $a_tpl->setCurrentBlock("cssrect_value_right");
213 $a_tpl->setVariable("CSSRECT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getRight()));
214 $a_tpl->parseCurrentBlock();
215 }
216 $a_tpl->setCurrentBlock("cssrect");
217 $a_tpl->setVariable("ID", $this->getFieldId());
218 $a_tpl->setVariable("SIZE", $this->getSize());
219 $a_tpl->setVariable("POST_VAR", $this->getPostVar());
220 $a_tpl->setVariable("TEXT_TOP", $lng->txt("pos_top"));
221 $a_tpl->setVariable("TEXT_RIGHT", $lng->txt("pos_right"));
222 $a_tpl->setVariable("TEXT_BOTTOM", $lng->txt("pos_bottom"));
223 $a_tpl->setVariable("TEXT_LEFT", $lng->txt("pos_left"));
224 if ($this->getDisabled()) {
225 $a_tpl->setVariable(
226 "DISABLED",
227 " disabled=\"disabled\""
228 );
229 }
230 $a_tpl->parseCurrentBlock();
231 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 80 of file class.ilCSSRectInputGUI.php.

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

◆ setLeft()

ilCSSRectInputGUI::setLeft ( string  $a_value)

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

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

◆ setRight()

ilCSSRectInputGUI::setRight ( string  $a_value)

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

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

◆ setSize()

ilCSSRectInputGUI::setSize ( int  $a_size)

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

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

◆ setTop()

ilCSSRectInputGUI::setTop ( string  $a_value)

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

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

◆ setUseUnits()

ilCSSRectInputGUI::setUseUnits ( bool  $a_value)

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

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

References useUnits().

+ Here is the call graph for this function:

◆ setValue()

ilCSSRectInputGUI::setValue ( array  $valueArray)

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

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

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilCSSRectInputGUI::setValueByArray ( array  $a_values)

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

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

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

+ Here is the call graph for this function:

◆ useUnits()

ilCSSRectInputGUI::useUnits ( )

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

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

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 32 of file class.ilCSSRectInputGUI.php.

Referenced by getBottom().

◆ $left

string ilCSSRectInputGUI::$left = ""
protected

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

Referenced by getLeft().

◆ $right

string ilCSSRectInputGUI::$right = ""
protected

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

Referenced by getRight().

◆ $size

int ilCSSRectInputGUI::$size = 0
protected

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

Referenced by getSize().

◆ $top

string ilCSSRectInputGUI::$top = ""
protected

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

Referenced by getTop().

◆ $useUnits

bool ilCSSRectInputGUI::$useUnits = false
protected

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

Referenced by useUnits().


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