ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilEMailInputGUI Class Reference

This class represents a email property in a property form. More...

+ Inheritance diagram for ilEMailInputGUI:
+ Collaboration diagram for ilEMailInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setValue (string $a_value)
 
 getValue ()
 
 setValueByArray (array $a_values)
 
 allowRFC822 (bool $a_value)
 Allow extended email address format. More...
 
 checkInput ()
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
 setRetype (bool $a_val)
 
 getRetype ()
 
 setRetypeValue (string $a_retypevalue)
 
 getRetypeValue ()
 
 setSize (int $size)
 
 getSize ()
 
 setMaxLength (int $max_length)
 
 getMaxLength ()
 
- 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 Member Functions

 sanitize ($key)
 
- 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)
 

Protected Attributes

string $value = ""
 
int $size = 30
 
int $max_length = 80
 
bool $allowRFC822 = false
 
bool $retype = false
 
string $retypevalue = ''
 
- 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...
 

Detailed Description

This class represents a email 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 26 of file class.ilEMailInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 35 of file class.ilEMailInputGUI.php.

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

38  {
39  global $DIC;
40 
41  $this->lng = $DIC->language();
42  parent::__construct($a_title, $a_postvar);
43  $this->setRetype(false);
44  }
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ allowRFC822()

ilEMailInputGUI::allowRFC822 ( bool  $a_value)

Allow extended email address format.

"example@example.com" vs "example <example@example.com>"

Definition at line 67 of file class.ilEMailInputGUI.php.

Referenced by sanitize().

67  : void
68  {
69  $this->allowRFC822 = $a_value;
70  }
allowRFC822(bool $a_value)
Allow extended email address format.
+ Here is the caller graph for this function:

◆ checkInput()

ilEMailInputGUI::checkInput ( )

Definition at line 82 of file class.ilEMailInputGUI.php.

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getRetype(), ilUtil\is_email(), sanitize(), ilFormPropertyGUI\setAlert(), ilFormPropertyGUI\str(), and ilLanguage\txt().

82  : bool
83  {
84  $lng = $this->lng;
85 
86  if ($this->getRequired() && trim($this->str($this->getPostVar())) == "") {
87  $this->setAlert($lng->txt("msg_input_is_required"));
88  return false;
89  }
90  if ($this->getRetype() &&
91  ($this->sanitize($this->getPostVar()) != $this->sanitize($this->getPostVar() . '_retype'))) {
92  $this->setAlert($lng->txt('email_not_match'));
93  return false;
94  }
95  if (!ilUtil::is_email($this->sanitize($this->getPostVar())) &&
96  trim($this->sanitize($this->getPostVar())) != ""
97  ) {
98  $this->setAlert($lng->txt("email_not_valid"));
99  return false;
100  }
101  return true;
102  }
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...
static is_email(string $a_email, ?ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
+ Here is the call graph for this function:

◆ getInput()

ilEMailInputGUI::getInput ( )

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

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

104  : string
105  {
106  return trim($this->sanitize($this->getPostVar()));
107  }
+ Here is the call graph for this function:

◆ getMaxLength()

ilEMailInputGUI::getMaxLength ( )

Definition at line 185 of file class.ilEMailInputGUI.php.

References $max_length.

Referenced by insert().

185  : int
186  {
187  return $this->max_length;
188  }
+ Here is the caller graph for this function:

◆ getRetype()

ilEMailInputGUI::getRetype ( )

Definition at line 155 of file class.ilEMailInputGUI.php.

References $retype.

Referenced by checkInput(), and insert().

155  : bool
156  {
157  return $this->retype;
158  }
+ Here is the caller graph for this function:

◆ getRetypeValue()

ilEMailInputGUI::getRetypeValue ( )

Definition at line 165 of file class.ilEMailInputGUI.php.

References $retypevalue.

Referenced by insert().

165  : string
166  {
167  return $this->retypevalue;
168  }
+ Here is the caller graph for this function:

◆ getSize()

ilEMailInputGUI::getSize ( )

Definition at line 175 of file class.ilEMailInputGUI.php.

References $size.

Referenced by insert().

175  : int
176  {
177  return $this->size;
178  }
+ Here is the caller graph for this function:

◆ getValue()

ilEMailInputGUI::getValue ( )

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

References $value.

Referenced by insert().

51  : string
52  {
53  return $this->value;
54  }
+ Here is the caller graph for this function:

◆ insert()

ilEMailInputGUI::insert ( ilTemplate  $a_tpl)

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

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getHiddenTag(), getMaxLength(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getRetype(), getRetypeValue(), getSize(), getValue(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

109  : void
110  {
111  $lng = $this->lng;
112 
113  $ptpl = new ilTemplate('tpl.prop_email.html', true, true, 'components/ILIAS/Form');
114 
115  if ($this->getRetype()) {
116  $ptpl->setCurrentBlock('retype_email');
117  $ptpl->setVariable('RSIZE', $this->getSize());
118  $ptpl->setVariable('RID', $this->getFieldId());
119  $ptpl->setVariable('RMAXLENGTH', $this->getMaxLength());
120  $ptpl->setVariable('RPOST_VAR', $this->getPostVar());
121 
122  $retype_value = $this->getRetypeValue();
123  $ptpl->setVariable('PROPERTY_RETYPE_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($retype_value));
124  if ($this->getDisabled()) {
125  $ptpl->setVariable('RDISABLED', ' disabled="disabled"');
126  }
127  $ptpl->setVariable('TXT_RETYPE', $lng->txt('form_retype_email'));
128  $ptpl->parseCurrentBlock();
129  }
130 
131  $ptpl->setVariable('POST_VAR', $this->getPostVar());
132  $ptpl->setVariable('ID', $this->getFieldId());
133  $ptpl->setVariable('PROPERTY_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($this->getValue()));
134  $ptpl->setVariable('SIZE', $this->getSize());
135  $ptpl->setVariable('MAXLENGTH', $this->getMaxLength());
136  if ($this->getDisabled()) {
137  $ptpl->setVariable('DISABLED', ' disabled="disabled"');
138  $ptpl->setVariable('HIDDEN_INPUT', $this->getHiddenTag($this->getPostVar(), $this->getValue()));
139  }
140 
141  if ($this->getRequired()) {
142  $ptpl->setVariable("REQUIRED", "required=\"required\"");
143  }
144 
145  $a_tpl->setCurrentBlock('prop_generic');
146  $a_tpl->setVariable('PROP_GENERIC', $ptpl->get());
147  $a_tpl->parseCurrentBlock();
148  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
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...
static prepareFormOutput($a_str, bool $a_strip=false)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
getHiddenTag(string $a_post_var, string $a_value)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ sanitize()

ilEMailInputGUI::sanitize (   $key)
protected

Definition at line 73 of file class.ilEMailInputGUI.php.

References allowRFC822(), ilFormPropertyGUI\getRequestParam(), ILIAS\Repository\refinery(), and ilUtil\stripSlashes().

Referenced by checkInput(), and getInput().

73  : string
74  {
75  $t = $this->refinery->kindlyTo()->string();
76  return ilUtil::stripSlashes(
77  (string) ($this->getRequestParam($key, $t) ?? ""),
78  !$this->allowRFC822
79  );
80  }
getRequestParam(string $key, Refinery\Transformation $t)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
allowRFC822(bool $a_value)
Allow extended email address format.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMaxLength()

ilEMailInputGUI::setMaxLength ( int  $max_length)

Definition at line 180 of file class.ilEMailInputGUI.php.

References $max_length.

Referenced by ilObjSystemFolderGUI\initContactInformationForm().

180  : void
181  {
182  $this->max_length = $max_length;
183  }
+ Here is the caller graph for this function:

◆ setRetype()

ilEMailInputGUI::setRetype ( bool  $a_val)

Definition at line 150 of file class.ilEMailInputGUI.php.

Referenced by __construct().

150  : void
151  {
152  $this->retype = $a_val;
153  }
+ Here is the caller graph for this function:

◆ setRetypeValue()

ilEMailInputGUI::setRetypeValue ( string  $a_retypevalue)

Definition at line 160 of file class.ilEMailInputGUI.php.

Referenced by setValueByArray().

160  : void
161  {
162  $this->retypevalue = $a_retypevalue;
163  }
+ Here is the caller graph for this function:

◆ setSize()

ilEMailInputGUI::setSize ( int  $size)

Definition at line 170 of file class.ilEMailInputGUI.php.

References $size.

170  : void
171  {
172  $this->size = $size;
173  }

◆ setValue()

ilEMailInputGUI::setValue ( string  $a_value)

Definition at line 46 of file class.ilEMailInputGUI.php.

Referenced by ilUserProfile\getEmailInput(), and setValueByArray().

46  : void
47  {
48  $this->value = $a_value;
49  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilEMailInputGUI::setValueByArray ( array  $a_values)

Definition at line 56 of file class.ilEMailInputGUI.php.

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

56  : void
57  {
58  $this->setValue($a_values[$this->getPostVar()] ?? "");
59  $this->setRetypeValue($a_values[$this->getPostVar() . '_retype'] ?? "");
60  }
setRetypeValue(string $a_retypevalue)
setValue(string $a_value)
+ Here is the call graph for this function:

Field Documentation

◆ $allowRFC822

bool ilEMailInputGUI::$allowRFC822 = false
protected

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

◆ $max_length

int ilEMailInputGUI::$max_length = 80
protected

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

Referenced by getMaxLength(), and setMaxLength().

◆ $retype

bool ilEMailInputGUI::$retype = false
protected

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

Referenced by getRetype().

◆ $retypevalue

string ilEMailInputGUI::$retypevalue = ''
protected

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

Referenced by getRetypeValue().

◆ $size

int ilEMailInputGUI::$size = 30
protected

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

Referenced by getSize(), and setSize().

◆ $value

string ilEMailInputGUI::$value = ""
protected

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

Referenced by getValue().


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