ILIAS  release_8 Revision v8.24
ilEMailInputGUI 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 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 ()
 Check input, strip slashes etc. More...
 
 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
 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 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 email property in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

37 {
38 global $DIC;
39
40 $this->lng = $DIC->language();
41 parent::__construct($a_title, $a_postvar);
42 $this->setRetype(false);
43 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ 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 66 of file class.ilEMailInputGUI.php.

66 : void
67 {
68 $this->allowRFC822 = $a_value;
69 }
allowRFC822(bool $a_value)
Allow extended email address format.

References allowRFC822().

Referenced by allowRFC822(), and sanitize().

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

◆ checkInput()

ilEMailInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

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

81 : bool
82 {
84
85 if ($this->getRequired() && trim($this->str($this->getPostVar())) == "") {
86 $this->setAlert($lng->txt("msg_input_is_required"));
87 return false;
88 }
89 if ($this->getRetype() &&
90 ($this->sanitize($this->getPostVar()) != $this->sanitize($this->getPostVar() . '_retype'))) {
91 $this->setAlert($lng->txt('email_not_match'));
92 return false;
93 }
94 if (!ilUtil::is_email($this->sanitize($this->getPostVar())) &&
95 trim($this->sanitize($this->getPostVar())) != ""
96 ) {
97 $this->setAlert($lng->txt("email_not_valid"));
98 return false;
99 }
100 return true;
101 }
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.

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

+ Here is the call graph for this function:

◆ getInput()

ilEMailInputGUI::getInput ( )

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

103 : string
104 {
105 return trim($this->sanitize($this->getPostVar()));
106 }

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

+ Here is the call graph for this function:

◆ getMaxLength()

ilEMailInputGUI::getMaxLength ( )

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

184 : int
185 {
186 return $this->max_length;
187 }

References $max_length.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getRetype()

ilEMailInputGUI::getRetype ( )

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

154 : bool
155 {
156 return $this->retype;
157 }

References $retype.

Referenced by checkInput(), and insert().

+ Here is the caller graph for this function:

◆ getRetypeValue()

ilEMailInputGUI::getRetypeValue ( )

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

164 : string
165 {
166 return $this->retypevalue;
167 }

References $retypevalue.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getSize()

ilEMailInputGUI::getSize ( )

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

174 : int
175 {
176 return $this->size;
177 }

References $size.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getValue()

ilEMailInputGUI::getValue ( )

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

50 : string
51 {
52 return $this->value;
53 }

References $value.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilEMailInputGUI::insert ( ilTemplate  $a_tpl)

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

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

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().

+ Here is the call graph for this function:

◆ sanitize()

ilEMailInputGUI::sanitize (   $key)
protected

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

72 : string
73 {
74 $t = $this->refinery->kindlyTo()->string();
76 (string) ($this->getRequestParam($key, $t) ?? ""),
77 !$this->allowRFC822
78 );
79 }
getRequestParam(string $key, Refinery\Transformation $t)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, allowRFC822(), ilFormPropertyGUI\getRequestParam(), ILIAS\Repository\refinery(), and ilUtil\stripSlashes().

Referenced by checkInput(), and getInput().

+ 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 179 of file class.ilEMailInputGUI.php.

179 : void
180 {
181 $this->max_length = $max_length;
182 }

References $max_length.

◆ setRetype()

ilEMailInputGUI::setRetype ( bool  $a_val)

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

149 : void
150 {
151 $this->retype = $a_val;
152 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setRetypeValue()

ilEMailInputGUI::setRetypeValue ( string  $a_retypevalue)

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

159 : void
160 {
161 $this->retypevalue = $a_retypevalue;
162 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setSize()

ilEMailInputGUI::setSize ( int  $size)

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

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

References $size.

◆ setValue()

ilEMailInputGUI::setValue ( string  $a_value)

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

45 : void
46 {
47 $this->value = $a_value;
48 }

Referenced by setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilEMailInputGUI::setValueByArray ( array  $a_values)

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

55 : void
56 {
57 $this->setValue($a_values[$this->getPostVar()] ?? "");
58 $this->setRetypeValue($a_values[$this->getPostVar() . '_retype'] ?? "");
59 }
setRetypeValue(string $a_retypevalue)
setValue(string $a_value)

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

+ Here is the call graph for this function:

Field Documentation

◆ $allowRFC822

bool ilEMailInputGUI::$allowRFC822 = false
protected

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

◆ $max_length

int ilEMailInputGUI::$max_length = 80
protected

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

Referenced by getMaxLength(), and setMaxLength().

◆ $retype

bool ilEMailInputGUI::$retype = false
protected

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

Referenced by getRetype().

◆ $retypevalue

string ilEMailInputGUI::$retypevalue = ''
protected

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

Referenced by getRetypeValue().

◆ $size

int ilEMailInputGUI::$size = 30
protected

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

Referenced by getSize(), and setSize().

◆ $value

string ilEMailInputGUI::$value = ""
protected

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

Referenced by getValue().


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