ILIAS
Release_5_0_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilEMailInputGUI.php
Go to the documentation of this file.
1
<?php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
30
class
ilEMailInputGUI
extends
ilFormPropertyGUI
31
{
32
protected
$value
;
33
protected
$size
= 30;
34
protected
$max_length
= 80;
35
protected
$allowRFC822
=
false
;
// [bool]
36
40
protected
$retype
=
false
;
41
45
protected
$retypevalue
=
''
;
46
52
function
__construct
($a_title =
""
, $a_postvar =
""
)
53
{
54
parent::__construct
($a_title, $a_postvar);
55
$this->
setRetype
(
false
);
56
}
57
62
function
setValue
($a_value)
63
{
64
$this->value = $a_value;
65
}
66
71
function
getValue
()
72
{
73
return
$this->value
;
74
}
75
80
function
setValueByArray
($a_values)
81
{
82
$this->
setValue
($a_values[$this->
getPostVar
()]);
83
$this->
setRetypeValue
($a_values[$this->
getPostVar
() .
'_retype'
]);
84
}
85
93
function
allowRFC822
($a_value)
94
{
95
$this->
allowRFC822
= (bool)$a_value;
96
}
97
102
function
checkInput
()
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
}
132
136
function
insert
(
ilTemplate
$a_tpl)
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
$a_tpl->
setCurrentBlock
(
'prop_generic'
);
172
$a_tpl->
setVariable
(
'PROP_GENERIC'
, $ptpl->get());
173
$a_tpl->
parseCurrentBlock
();
174
}
175
179
public
function
setRetype
($a_val)
180
{
181
$this->retype = $a_val;
182
}
183
187
public
function
getRetype
()
188
{
189
return
$this->retype
;
190
}
191
195
public
function
setRetypeValue
($a_retypevalue)
196
{
197
$this->retypevalue = $a_retypevalue;
198
}
199
203
public
function
getRetypeValue
()
204
{
205
return
$this->retypevalue
;
206
}
207
211
public
function
setSize
(
$size
)
212
{
213
$this->size =
$size
;
214
}
215
219
public
function
getSize
()
220
{
221
return
$this->size
;
222
}
223
227
public
function
setMaxLength
(
$max_length
)
228
{
229
$this->max_length =
$max_length
;
230
}
231
235
public
function
getMaxLength
()
236
{
237
return
$this->max_length
;
238
}
239
}
Services
Form
classes
class.ilEMailInputGUI.php
Generated on Wed Apr 27 2016 21:01:39 for ILIAS by
1.8.1.2 (using
Doxyfile
)