Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00031 class ilTextInputGUI extends ilSubEnabledFormPropertyGUI
00032 {
00033 protected $value;
00034 protected $maxlength = 200;
00035 protected $size = 40;
00036
00043 function __construct($a_title = "", $a_postvar = "")
00044 {
00045 parent::__construct($a_title, $a_postvar);
00046 $this->setInputType("text");
00047 }
00048
00054 function setValue($a_value)
00055 {
00056 $this->value = $a_value;
00057 }
00058
00064 function getValue()
00065 {
00066 return $this->value;
00067 }
00068
00074 function setMaxLength($a_maxlength)
00075 {
00076 $this->maxlength = $a_maxlength;
00077 }
00078
00084 function getMaxLength()
00085 {
00086 return $this->maxlength;
00087 }
00088
00094 function setSize($a_size)
00095 {
00096 $this->size = $a_size;
00097 }
00098
00104 function setValueByArray($a_values)
00105 {
00106 $this->setValue($a_values[$this->getPostVar()]);
00107 }
00108
00114 function getSize()
00115 {
00116 return $this->size;
00117 }
00118
00126 public function setInputType($a_type)
00127 {
00128 $this->input_type = $a_type;
00129 }
00130
00136 public function getInputType()
00137 {
00138 return $this->input_type;
00139 }
00140
00141
00147 function checkInput()
00148 {
00149 global $lng;
00150
00151 $_POST[$this->getPostVar()] =
00152 ilUtil::stripSlashes($_POST[$this->getPostVar()]);
00153 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
00154 {
00155 $this->setAlert($lng->txt("msg_input_is_required"));
00156
00157 return false;
00158 }
00159
00160 return $this->checkSubItemsInput();
00161 }
00162
00168 function insert(&$a_tpl)
00169 {
00170 $a_tpl->setCurrentBlock("prop_text");
00171
00172 switch($this->getInputType())
00173 {
00174 case 'password':
00175 $a_tpl->setVariable('PROP_INPUT_TYPE','password');
00176 break;
00177 case 'text':
00178 default:
00179 $a_tpl->setVariable('PROP_INPUT_TYPE','text');
00180 }
00181 $a_tpl->setVariable("POST_VAR", $this->getPostVar());
00182 $a_tpl->setVariable("ID", $this->getFieldId());
00183 $a_tpl->setVariable("PROPERTY_VALUE",
00184 ilUtil::prepareFormOutput($this->getValue()));
00185 $a_tpl->setVariable("SIZE", $this->getSize());
00186 $a_tpl->setVariable("MAXLENGTH", $this->getMaxLength());
00187 if ($this->getDisabled())
00188 {
00189 $a_tpl->setVariable("DISABLED",
00190 " disabled=\"disabled\"");
00191 }
00192 $a_tpl->parseCurrentBlock();
00193 }
00194 }