XOOPS
2.6.0
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
Text.php
Go to the documentation of this file.
1
<?php
2
/*
3
You may not change or alter any portion of this comment or credits
4
of supporting developers from this source code or any supporting source code
5
which is considered copyrighted (c) material of the original comment or credit authors.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
namespace
Xoops\Form
;
13
25
class
Text
extends
Element
26
{
33
//private $size;
34
42
//private $maxlength;
43
50
//private $placeholder;
51
62
public
function
__construct
(
$caption
,
$name
, $size, $maxlength,
$value
=
''
, $placeholder =
''
)
63
{
64
$this->
setAttribute
(
'type'
,
'text'
);
65
$this->
setCaption
(
$caption
);
66
$this->
setAttribute
(
'name'
,
$name
);
67
$this->
setAttribute
(
'size'
, intval($size));
68
$this->
setAttribute
(
'maxlength'
, intval($maxlength));
69
$this->
setValue
(
$value
);
70
if
(!empty($placeholder)) {
71
$this->
setAttribute
(
'placeholder'
, $placeholder);
72
}
73
}
74
80
public
function
getSize
()
81
{
82
return
(
int
) $this->
getAttribute
(
'size'
);
83
}
84
90
public
function
getMaxlength
()
91
{
92
return
(
int
) $this->
getAttribute
(
'maxlength'
);
93
}
94
100
public
function
getPlaceholder
()
101
{
102
return
(
string
) $this->
getAttribute
(
'placeholder'
);
103
}
104
110
public
function
render
()
111
{
112
if
($this->
getSize
() > $this->
getMaxcols
()) {
113
$maxcols
= $this->
getMaxcols
();
114
}
else
{
115
$maxcols
= $this->
getSize
();
116
}
117
$this->
addAttribute
(
'class'
,
'span'
.
$maxcols
);
118
$dlist = $this->
isDatalist
();
119
if
(!empty($dlist)) {
120
$this->
addAttribute
(
'list'
,
'list_'
. $this->
getName
());
121
}
122
123
$attributes
= $this->
renderAttributeString
();
124
return
'<input '
.
$attributes
.
'value="'
125
. $this->
getValue
() .
'" '
. $this->
getExtra
() .
' >'
;
126
}
127
}
Xoops\Form\Text
Definition:
Text.php:25
Xoops\Form\Element\setValue
setValue($value)
Definition:
Element.php:199
Xoops\Form\Element\getValue
getValue($encode=false)
Definition:
Element.php:180
Xoops\Form\Element\setCaption
setCaption($caption)
Definition:
Element.php:396
Xoops\Form
Definition:
BlockForm.php:12
Xoops\Form\Element\renderAttributeString
renderAttributeString()
Definition:
Element.php:156
Xoops\Html\Attributes\setAttribute
setAttribute($name, $value=null)
Definition:
Attributes.php:42
Xoops\Form\Text\getMaxlength
getMaxlength()
Definition:
Text.php:90
Xoops\Form\Text\__construct
__construct($caption, $name, $size, $maxlength, $value= '', $placeholder= '')
Definition:
Text.php:62
Xoops\Html\Attributes\getAttribute
getAttribute($name)
Definition:
Attributes.php:86
Xoops\Form\Text\render
render()
Definition:
Text.php:110
Xoops\Form\Element\getMaxcols
getMaxcols()
Definition:
Element.php:585
Xoops\Form\Element\getExtra
getExtra($encode=false)
Definition:
Element.php:539
Xoops\Form\Element
Definition:
Element.php:28
Xoops\Form\Element\$caption
$caption
Definition:
Element.php:55
Xoops\Form\Text\getPlaceholder
getPlaceholder()
Definition:
Text.php:100
Xoops\Html\Attributes\addAttribute
addAttribute($name, $value)
Definition:
Attributes.php:117
Xoops\Form\Element\getName
getName()
Definition:
Element.php:230
Xoops\Form\Element\isDatalist
isDatalist()
Definition:
Element.php:381
Xoops\Form\Text\getSize
getSize()
Definition:
Text.php:80
$name
$name
Definition:
force_download.php:15
Xoops\Form\Element\$value
$value
Definition:
Element.php:131
Xoops\Html\Attributes\$attributes
$attributes
Definition:
Attributes.php:32
Xoops\Form\Element\$maxcols
$maxcols
Definition:
Element.php:139
usr64
htdocs
xoops_lib
Xoops
Form
Text.php
Generated on Fri May 22 2015 03:06:59 for XOOPS by
1.8.9.1