ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
79  function getCurrentUserId()
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 
113  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
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  if($this->getRequired())
161  {
162  $a_tpl->setVariable("REQUIRED", "required=\"required\"");
163  }
164  $a_tpl->parseCurrentBlock();
165  }
166 }
167 ?>
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
__construct($a_title="", $a_postvar="")
Constructor.
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...
font size
Definition: langcheck.php:162
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
static isLogin($a_login)
This class represents a property in a property form.
setCurrentUserId($a_user_id)
Set Check whether login is unused.
global $lng
Definition: privfeed.php:17
insert($a_tpl)
Insert property html.
$_POST["username"]
getCurrentUserId()
Get Check whether login is unused.