ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilUserLoginInputGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 protected $value;
14 protected $size = 40;
15 protected $max_length = 80;
16 protected $checkunused = 0;
17
21 protected $autocomplete_disabled = false;
22
29 function __construct($a_title = "", $a_postvar = "")
30 {
31 parent::__construct($a_title, $a_postvar);
32 }
33
39 function setValue($a_value)
40 {
41 $this->value = $a_value;
42 }
43
49 function getValue()
50 {
51 return $this->value;
52 }
53
59 function setValueByArray($a_values)
60 {
61 $this->setValue($a_values[$this->getPostVar()]);
62 }
63
69 function setCurrentUserId($a_user_id)
70 {
71 $this->checkunused = $a_user_id;
72 }
73
80 {
81 return $this->checkunused;
82 }
83
89 function setDisableHtmlAutoComplete($a_value)
90 {
91 $this->autocomplete_disabled = (bool)$a_value;
92 }
93
100 {
102 }
103
109 function checkInput()
110 {
111 global $lng;
112
114 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
115 {
116 $this->setAlert($lng->txt("msg_input_is_required"));
117
118 return false;
119 }
120 if (!ilUtil::isLogin($_POST[$this->getPostVar()]))
121 {
122 $this->setAlert($lng->txt("login_invalid"));
123
124 return false;
125 }
126
128 {
129 $this->setAlert($lng->txt("login_exists"));
130
131 return false;
132 }
133
134
135 return true;
136 }
137
141 function insert(&$a_tpl)
142 {
143 global $lng;
144
145 $a_tpl->setCurrentBlock("prop_login");
146 $a_tpl->setVariable("POST_VAR", $this->getPostVar());
147 $a_tpl->setVariable("ID", $this->getFieldId());
148 $a_tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
149 $a_tpl->setVariable("SIZE", $this->size);
150 $a_tpl->setVariable("MAXLENGTH", $this->maxlength);
151 if ($this->getDisabled())
152 {
153 $a_tpl->setVariable("DISABLED",
154 " disabled=\"disabled\"");
155 }
156 if($this->isHtmlAutoCompleteDisabled())
157 {
158 $a_tpl->setVariable("AUTOCOMPLETE", "autocomplete=\"off\"");
159 }
160 $a_tpl->parseCurrentBlock();
161 }
162}
163?>
This class represents a property in a property form.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
getFieldId()
Get Post Variable.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
This class represents a user login property in a property form.
setCurrentUserId($a_user_id)
Set Check whether login is unused.
setValue($a_value)
Set Value.
setDisableHtmlAutoComplete($a_value)
Set autocomplete.
__construct($a_title="", $a_postvar="")
Constructor.
isHtmlAutoCompleteDisabled()
Get autocomplete.
insert(&$a_tpl)
Insert property html.
checkInput()
Check input, strip slashes etc.
getCurrentUserId()
Get Check whether login is unused.
setValueByArray($a_values)
Set value by array.
isLogin($a_login)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40