ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  public function __construct($a_title = "", $a_postvar = "")
30  {
31  global $DIC;
32 
33  $this->lng = $DIC->language();
34  parent::__construct($a_title, $a_postvar);
35  }
36 
42  public function setValue($a_value)
43  {
44  $this->value = $a_value;
45  }
46 
52  public function getValue()
53  {
54  return $this->value;
55  }
56 
62  public function setValueByArray($a_values)
63  {
64  $this->setValue($a_values[$this->getPostVar()]);
65  }
66 
72  public function setCurrentUserId($a_user_id)
73  {
74  $this->checkunused = $a_user_id;
75  }
76 
82  public function getCurrentUserId()
83  {
84  return $this->checkunused;
85  }
86 
92  public function setDisableHtmlAutoComplete($a_value)
93  {
94  $this->autocomplete_disabled = (bool) $a_value;
95  }
96 
102  public function isHtmlAutoCompleteDisabled()
103  {
105  }
106 
112  public function checkInput()
113  {
114  $lng = $this->lng;
115 
116  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
117  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
118  $this->setAlert($lng->txt("msg_input_is_required"));
119 
120  return false;
121  }
122  if (!ilUtil::isLogin($_POST[$this->getPostVar()])) {
123  $this->setAlert($lng->txt("login_invalid"));
124 
125  return false;
126  }
127 
128  if (ilObjUser::_loginExists($_POST[$this->getPostVar()], $this->getCurrentUserId())) {
129  $this->setAlert($lng->txt("login_exists"));
130 
131  return false;
132  }
133 
134 
135  return true;
136  }
137 
141  public function insert($a_tpl)
142  {
143  $lng = $this->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->max_length);
151  if ($this->getDisabled()) {
152  $a_tpl->setVariable(
153  "DISABLED",
154  " disabled=\"disabled\""
155  );
156  }
157  if ($this->isHtmlAutoCompleteDisabled()) {
158  $a_tpl->setVariable("AUTOCOMPLETE", "autocomplete=\"off\"");
159  }
160  if ($this->getRequired()) {
161  $a_tpl->setVariable("REQUIRED", "required=\"required\"");
162  }
163  $a_tpl->parseCurrentBlock();
164  }
165 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
__construct($a_title="", $a_postvar="")
Constructor.
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setDisableHtmlAutoComplete($a_value)
Set autocomplete.
This class represents a user login property in a property form.
setValueByArray($a_values)
Set value by array.
setAlert($a_alert)
Set Alert Text.
checkInput()
Check input, strip slashes etc.
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...
isHtmlAutoCompleteDisabled()
Get autocomplete.
setValue($a_value)
Set Value.
getFieldId()
Get Post Variable.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
font size
Definition: langcheck.php:162
static isLogin($a_login)
This class represents a property in a property form.
setCurrentUserId($a_user_id)
Set Check whether login is unused.
insert($a_tpl)
Insert property html.
$_POST["username"]
getCurrentUserId()
Get Check whether login is unused.