ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 

Protected Attributes

 $value
 
 $size = 30
 
 $max_length = 80
 
 $allowRFC822 = false
 
 $retype = false
 
 $retypevalue = ''
 
- Protected Attributes inherited from ilFormPropertyGUI
 $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 52 of file class.ilEMailInputGUI.php.

References setRetype().

53  {
54  parent::__construct($a_title, $a_postvar);
55  $this->setRetype(false);
56  }
+ 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 93 of file class.ilEMailInputGUI.php.

Referenced by checkInput().

94  {
95  $this->allowRFC822 = (bool)$a_value;
96  }
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 102 of file class.ilEMailInputGUI.php.

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

103  {
104  global $lng;
105 
106  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()], !(bool)$this->allowRFC822);
107  $_POST[$this->getPostVar() . '_retype'] = ilUtil::stripSlashes($_POST[$this->getPostVar() . '_retype'], !(bool)$this->allowRFC822);
108  if($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
109  {
110  $this->setAlert($lng->txt("msg_input_is_required"));
111 
112  return false;
113  }
114  if($this->getRetype() && ($_POST[$this->getPostVar()] != $_POST[$this->getPostVar() . '_retype']))
115  {
116  $this->setAlert($lng->txt('email_not_match'));
117 
118  return false;
119  }
120  if(!ilUtil::is_email($_POST[$this->getPostVar()]) &&
121  trim($_POST[$this->getPostVar()]) != ""
122  )
123  {
124  $this->setAlert($lng->txt("email_not_valid"));
125 
126  return false;
127  }
128 
129 
130  return true;
131  }
getPostVar()
Get Post Variable.
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:17
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 240 of file class.ilEMailInputGUI.php.

References $max_length.

Referenced by insert().

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

◆ getRetype()

ilEMailInputGUI::getRetype ( )
Returns
boolean

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

References $retype.

Referenced by checkInput(), and insert().

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

◆ getRetypeValue()

ilEMailInputGUI::getRetypeValue ( )
Returns
string

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

References $retypevalue.

Referenced by insert().

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

◆ getSize()

ilEMailInputGUI::getSize ( )
Returns
int

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

References $size.

Referenced by insert().

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

◆ getValue()

ilEMailInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

Referenced by insert().

72  {
73  return $this->value;
74  }
+ Here is the caller graph for this function:

◆ insert()

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

Definition at line 136 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().

137  {
138  global $lng;
139 
140  $ptpl = new ilTemplate('tpl.prop_email.html', true, true, 'Services/Form');
141 
142  if($this->getRetype())
143  {
144  $ptpl->setCurrentBlock('retype_email');
145  $ptpl->setVariable('RSIZE', $this->getSize());
146  $ptpl->setVariable('RID', $this->getFieldId());
147  $ptpl->setVariable('RMAXLENGTH', $this->getMaxLength());
148  $ptpl->setVariable('RPOST_VAR', $this->getPostVar());
149 
150  $retype_value = $this->getRetypeValue();
151  $ptpl->setVariable('PROPERTY_RETYPE_VALUE', ilUtil::prepareFormOutput($retype_value));
152  if($this->getDisabled())
153  {
154  $ptpl->setVariable('RDISABLED', ' disabled="disabled"');
155  }
156  $ptpl->setVariable('TXT_RETYPE', $lng->txt('form_retype_email'));
157  $ptpl->parseCurrentBlock();
158  }
159 
160  $ptpl->setVariable('POST_VAR', $this->getPostVar());
161  $ptpl->setVariable('ID', $this->getFieldId());
162  $ptpl->setVariable('PROPERTY_VALUE', ilUtil::prepareFormOutput($this->getValue()));
163  $ptpl->setVariable('SIZE', $this->getSize());
164  $ptpl->setVariable('MAXLENGTH', $this->getMaxLength());
165  if($this->getDisabled())
166  {
167  $ptpl->setVariable('DISABLED', ' disabled="disabled"');
168  $ptpl->setVariable('HIDDEN_INPUT', $this->getHiddenTag($this->getPostVar(), $this->getValue()));
169  }
170 
171  if($this->getRequired())
172  {
173  $ptpl->setVariable("REQUIRED", "required=\"required\"");
174  }
175 
176  $a_tpl->setCurrentBlock('prop_generic');
177  $a_tpl->setVariable('PROP_GENERIC', $ptpl->get());
178  $a_tpl->parseCurrentBlock();
179  }
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.
global $lng
Definition: privfeed.php:17
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 232 of file class.ilEMailInputGUI.php.

References $max_length.

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

◆ setRetype()

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

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

Referenced by __construct().

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

◆ setRetypeValue()

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

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

Referenced by setValueByArray().

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

◆ setSize()

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

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

References $size, and size.

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

◆ setValue()

ilEMailInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

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

63  {
64  $this->value = $a_value;
65  }
+ 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 80 of file class.ilEMailInputGUI.php.

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

81  {
82  $this->setValue($a_values[$this->getPostVar()]);
83  $this->setRetypeValue($a_values[$this->getPostVar() . '_retype']);
84  }
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 35 of file class.ilEMailInputGUI.php.

◆ $max_length

ilEMailInputGUI::$max_length = 80
protected

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

Referenced by getMaxLength(), and setMaxLength().

◆ $retype

ilEMailInputGUI::$retype = false
protected

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

Referenced by getRetype().

◆ $retypevalue

ilEMailInputGUI::$retypevalue = ''
protected

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

Referenced by getRetypeValue().

◆ $size

ilEMailInputGUI::$size = 30
protected

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

Referenced by getSize(), and setSize().

◆ $value

ilEMailInputGUI::$value
protected

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

Referenced by getValue().


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