ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
103 {
105 }
106
112 public function checkInput()
113 {
115
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
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 {
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}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
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.
insert($a_tpl)
Insert property html.
__construct($a_title="", $a_postvar="")
Constructor.
isHtmlAutoCompleteDisabled()
Get autocomplete.
checkInput()
Check input, strip slashes etc.
getCurrentUserId()
Get Check whether login is unused.
setValueByArray($a_values)
Set value by array.
static 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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46