ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 allowRFC822 ($a_value)
 Allow extended email address format. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 
 setRetype ($a_val)
 
 getRetype ()
 
 setRetypeValue ($a_retypevalue)
 
 getRetypeValue ()
 
 setSize ($size)
 
 getSize ()
 
 setMaxLength ($max_length)
 
 getMaxLength ()
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($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...
 

Protected Attributes

 $lng
 
 $value
 
 $size = 30
 
 $max_length = 80
 
 $allowRFC822 = false
 
 $retype = false
 
 $retypevalue = ''
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a email property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References $DIC, and setRetype().

58  {
59  global $DIC;
60 
61  $this->lng = $DIC->language();
62  parent::__construct($a_title, $a_postvar);
63  $this->setRetype(false);
64  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ allowRFC822()

ilEMailInputGUI::allowRFC822 (   $a_value)

Allow extended email address format.

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

Parameters
bool$a_value

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

Referenced by checkInput().

102  {
103  $this->allowRFC822 = (bool) $a_value;
104  }
allowRFC822($a_value)
Allow extended email address format.
+ Here is the caller graph for this function:

◆ checkInput()

ilEMailInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

References $_POST, $lng, allowRFC822(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getRetype(), ilUtil\is_email(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

111  {
112  $lng = $this->lng;
113 
114  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()], !(bool) $this->allowRFC822);
115  $_POST[$this->getPostVar() . '_retype'] = ilUtil::stripSlashes($_POST[$this->getPostVar() . '_retype'], !(bool) $this->allowRFC822);
116  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
117  $this->setAlert($lng->txt("msg_input_is_required"));
118 
119  return false;
120  }
121  if ($this->getRetype() && ($_POST[$this->getPostVar()] != $_POST[$this->getPostVar() . '_retype'])) {
122  $this->setAlert($lng->txt('email_not_match'));
123 
124  return false;
125  }
126  if (!ilUtil::is_email($_POST[$this->getPostVar()]) &&
127  trim($_POST[$this->getPostVar()]) != ""
128  ) {
129  $this->setAlert($lng->txt("email_not_valid"));
130 
131  return false;
132  }
133 
134 
135  return true;
136  }
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
allowRFC822($a_value)
Allow extended email address format.
$_POST["username"]
+ Here is the call graph for this function:

◆ getMaxLength()

ilEMailInputGUI::getMaxLength ( )
Returns
int

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

References $max_length.

Referenced by insert().

242  {
243  return $this->max_length;
244  }
+ Here is the caller graph for this function:

◆ getRetype()

ilEMailInputGUI::getRetype ( )
Returns
boolean

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

References $retype.

Referenced by checkInput(), and insert().

194  {
195  return $this->retype;
196  }
+ Here is the caller graph for this function:

◆ getRetypeValue()

ilEMailInputGUI::getRetypeValue ( )
Returns
string

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

References $retypevalue.

Referenced by insert().

210  {
211  return $this->retypevalue;
212  }
+ Here is the caller graph for this function:

◆ getSize()

ilEMailInputGUI::getSize ( )
Returns
int

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

References $size.

Referenced by insert().

226  {
227  return $this->size;
228  }
+ Here is the caller graph for this function:

◆ getValue()

ilEMailInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

Referenced by insert().

80  {
81  return $this->value;
82  }
+ Here is the caller graph for this function:

◆ insert()

ilEMailInputGUI::insert ( ilTemplate  $a_tpl)
Parameters
ilTemplate$a_tpl

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

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

142  {
143  $lng = $this->lng;
144 
145  $ptpl = new ilTemplate('tpl.prop_email.html', true, true, 'Services/Form');
146 
147  if ($this->getRetype()) {
148  $ptpl->setCurrentBlock('retype_email');
149  $ptpl->setVariable('RSIZE', $this->getSize());
150  $ptpl->setVariable('RID', $this->getFieldId());
151  $ptpl->setVariable('RMAXLENGTH', $this->getMaxLength());
152  $ptpl->setVariable('RPOST_VAR', $this->getPostVar());
153 
154  $retype_value = $this->getRetypeValue();
155  $ptpl->setVariable('PROPERTY_RETYPE_VALUE', ilUtil::prepareFormOutput($retype_value));
156  if ($this->getDisabled()) {
157  $ptpl->setVariable('RDISABLED', ' disabled="disabled"');
158  }
159  $ptpl->setVariable('TXT_RETYPE', $lng->txt('form_retype_email'));
160  $ptpl->parseCurrentBlock();
161  }
162 
163  $ptpl->setVariable('POST_VAR', $this->getPostVar());
164  $ptpl->setVariable('ID', $this->getFieldId());
165  $ptpl->setVariable('PROPERTY_VALUE', ilUtil::prepareFormOutput($this->getValue()));
166  $ptpl->setVariable('SIZE', $this->getSize());
167  $ptpl->setVariable('MAXLENGTH', $this->getMaxLength());
168  if ($this->getDisabled()) {
169  $ptpl->setVariable('DISABLED', ' disabled="disabled"');
170  $ptpl->setVariable('HIDDEN_INPUT', $this->getHiddenTag($this->getPostVar(), $this->getValue()));
171  }
172 
173  if ($this->getRequired()) {
174  $ptpl->setVariable("REQUIRED", "required=\"required\"");
175  }
176 
177  $a_tpl->setCurrentBlock('prop_generic');
178  $a_tpl->setVariable('PROP_GENERIC', $ptpl->get());
179  $a_tpl->parseCurrentBlock();
180  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getHiddenTag($a_post_var, $a_value)
Get hidden tag (used for disabled properties)
getPostVar()
Get Post Variable.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
+ Here is the call graph for this function:

◆ setMaxLength()

ilEMailInputGUI::setMaxLength (   $max_length)
Parameters
int$max_length

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

References $max_length.

234  {
235  $this->max_length = $max_length;
236  }

◆ setRetype()

ilEMailInputGUI::setRetype (   $a_val)
Parameters
boolean$a_val

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

Referenced by __construct().

186  {
187  $this->retype = $a_val;
188  }
+ Here is the caller graph for this function:

◆ setRetypeValue()

ilEMailInputGUI::setRetypeValue (   $a_retypevalue)
Parameters
string$a_retypevalue

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

Referenced by setValueByArray().

202  {
203  $this->retypevalue = $a_retypevalue;
204  }
+ Here is the caller graph for this function:

◆ setSize()

ilEMailInputGUI::setSize (   $size)
Parameters
int$size

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

References $size, and size.

218  {
219  $this->size = $size;
220  }
font size
Definition: langcheck.php:162

◆ setValue()

ilEMailInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

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

71  {
72  $this->value = $a_value;
73  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilEMailInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

89  {
90  $this->setValue($a_values[$this->getPostVar()]);
91  $this->setRetypeValue($a_values[$this->getPostVar() . '_retype']);
92  }
setValue($a_value)
Set Value.
getPostVar()
Get Post Variable.
setRetypeValue($a_retypevalue)
+ Here is the call graph for this function:

Field Documentation

◆ $allowRFC822

ilEMailInputGUI::$allowRFC822 = false
protected

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

◆ $lng

ilEMailInputGUI::$lng
protected

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

Referenced by checkInput(), and insert().

◆ $max_length

ilEMailInputGUI::$max_length = 80
protected

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

Referenced by getMaxLength(), and setMaxLength().

◆ $retype

ilEMailInputGUI::$retype = false
protected

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

Referenced by getRetype().

◆ $retypevalue

ilEMailInputGUI::$retypevalue = ''
protected

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

Referenced by getRetypeValue().

◆ $size

ilEMailInputGUI::$size = 30
protected

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

Referenced by getSize(), and setSize().

◆ $value

ilEMailInputGUI::$value
protected

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

Referenced by getValue().


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