noalyss
Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
include
lib
itext.class.php
Go to the documentation of this file.
1
<?php
2
/*
3
* This file is part of NOALYSS.
4
*
5
* NOALYSS is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* NOALYSS is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with NOALYSS; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*/
19
20
// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
/*!
22
* \file
23
* \brief Html Input
24
*/
25
/*!
26
* \class IText
27
* \brief Html Input
28
*/
29
class
IText
extends
HtmlInput
30
{
31
var
$title
;
32
var
$autofocus
;
33
var
$css_size
;
34
var
$pattern
;
/*!< $pattern HTML pattern */
35
var
$maxlength
;
/*!< HTML maxlength */
36
function
__construct
(
$name
=
''
,
$value
=
''
,
$p_id
=
""
)
37
{
38
parent::__construct(
$name
,
$value
,
$p_id
);
39
$this->
title
=
""
;
40
$this->
placeholder
=
""
;
41
$this->
extra
=
""
;
42
$this->
style
=
' class="input_text" '
;
43
$this->autofocus=
false
;
44
$this->require=
false
;
45
$this->
css_size
=
""
;
46
$this->pattern=
""
;
47
$this->maxlength=
""
;
48
}
49
/*!\brief show the html input of the widget*/
50
public
function
input
($p_name=
null
,$p_value=
null
)
51
{
52
$this->
name
=($p_name==
null
)?$this->
name
:$p_name;
53
$this->
value
=($p_value==
null
)?$this->
value
:$p_value;
54
if
( $this->
readOnly
==
true
)
return
$this->
display
();
55
$this->
id
=($this->
id
==
""
)?$this->
name
:
$this->id
;
56
57
// Double quote makes troubles
58
$this->
value
=
noalyss_str_replace
(
'"'
,
''
,$this->
value
);
59
60
// compute attribute used by javascript
61
$strAttribute=$this->
get_node_attribute
();
62
$t
=
'title="'
.$this->title.
'" '
;
63
$autofocus
=(
$this->autofocus
)?
" autofocus "
:
""
;
64
$require
=(
$this->require
)?
"required"
:
""
;
65
66
// var $pattern regex to match the INPUT TEXT
67
$pattern
=
""
;
68
if
($this->pattern !=
""
) {
69
$pattern
= sprintf(
'pattern="%s"'
,$this->pattern);
70
}
71
72
// var maxlength HTML attribute
73
$maxlength
=
""
;
74
if
($this->maxlength !=
""
) {
75
$maxlength
=sprintf(
' maxlength="%s" '
,$this->maxlength);
76
}
77
78
if
( ! isset ($this->
css_size
) || empty ($this->
css_size
))
79
{
80
81
$r
= sprintf(
'<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
82
Size="%s" %s %s %s %s %s %s %s >
83
'
,$this->
style
,
84
$this->
id
,
85
$this->
name
,
86
htmlentities($this->
value
, ENT_COMPAT|
ENT_QUOTES
,
"UTF-8"
),
87
$this->
placeholder
,
88
$this->
title
,
89
$this->
size
,
90
$this->
javascript
,
91
$this->
extra
,
92
$autofocus
,
93
$require
,
94
$strAttribute,
95
$pattern
,
96
$maxlength
97
);
98
}
else
{
99
$r
= sprintf(
'<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
100
style="width:%s;" %s %s %s %s %s %s %s>
101
'
,$this->
style
,
102
$this->
id
,
103
$this->
name
,
104
htmlentities($this->
value
, ENT_COMPAT|
ENT_QUOTES
,
"UTF-8"
),
105
$this->
placeholder
,
106
$this->
title
,
107
$this->
css_size
,
108
$this->
javascript
,
109
$this->
extra
,
110
$autofocus
,
111
$require
,
112
$strAttribute,
113
$pattern
,
114
$maxlength
115
);
116
}
117
118
/* add tag for column if inside a table */
119
if
( $this->
table
== 1 )
$r
=
'<td>'
.$r.
'</td>'
;
120
121
return
$r
;
122
123
}
124
/*!\brief print in html the readonly value of the widget*/
125
public
function
display
()
126
{
127
$t
= ((isset($this->
title
)))?
'title="'
.$this->
title
.
'" '
:
' '
;
128
129
$extra
=(isset($this->
extra
))?$this->
extra
:
""
;
130
$strAttribute=$this->
get_node_attribute
();
131
132
$readonly
=
" readonly "
;
133
$this->
value
=htmlentities($this->
value
??
""
, ENT_COMPAT|
ENT_QUOTES
,
"UTF-8"
);
134
$this->
style
=
' class="input_text_ro" '
;
135
if
( ! isset ($this->
css_size
))
136
{
137
$r
=
'<INPUT '
.$this->style.
' TYPE="TEXT" id="'
.
138
$this->
id
.
'"'
.
$t
.
139
'NAME="'
.$this->name.
'" VALUE="'
.$this->
value
.
'" '
.
140
'SIZE="'
.$this->size.
'" '
.$this->
javascript
.
" $readonly $this->extra $strAttribute>"
;
141
}
else
{
142
$r
=
'<INPUT '
.$this->style.
' TYPE="TEXT" id="'
.
143
$this->
id
.
'"'
.
$t
.
144
'NAME="'
.$this->name.
'" VALUE="'
.$this->
value
.
'" '
.
145
' style="width:'
.$this->css_size.
'" '
.$this->
javascript
.
" $readonly $this->extra $strAttribute>"
;
146
}
147
148
/* add tag for column if inside a table */
149
if
( $this->
table
== 1 )
$r
=
'<td>'
.$r.
'</td>'
;
150
151
return
$r
;
152
153
}
154
function
set_require
($p_boolean)
155
{
156
$this->require=$p_boolean;
157
}
158
static
public
function
test_me
()
159
{
160
}
161
}
noalyss_str_replace
noalyss_str_replace($search, $replace, $string)
Definition
ac_common.php:1612
$p_id
$p_id
Definition
ajax_accounting.php:33
value
$q value
Definition
ajax_add_concerned_card.php:59
$r
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
Definition
ajax_add_concerned_card.php:53
javascript
$ret javascript
Definition
ajax_display_letter.php:53
style
$opd_description style
Definition
ajax_mod_predf_op.php:52
size
$name size
Definition
ajax_mod_predf_op.php:49
name
$from_poste name
Definition
balance.inc.php:163
HtmlInput\$value
$value
Definition
html_input.class.php:59
HtmlInput\$require
$require
Definition
html_input.class.php:72
HtmlInput\get_node_attribute
get_node_attribute()
Insert attribute inside a INPUT TYPE, these attribute can be retrieved in javascript with element....
Definition
html_input.class.php:1225
HtmlInput\$id
$id
Definition
html_input.class.php:76
HtmlInput\$name
$name
Definition
html_input.class.php:58
HtmlInput\$extra
$extra
Definition
html_input.class.php:66
IText
Html Input.
Definition
itext.class.php:30
IText\$maxlength
$maxlength
Definition
itext.class.php:35
IText\input
input($p_name=null, $p_value=null)
show the html input of the widget
Definition
itext.class.php:50
IText\$pattern
$pattern
Definition
itext.class.php:34
IText\$autofocus
$autofocus
Definition
itext.class.php:32
IText\test_me
static test_me()
Definition
itext.class.php:158
IText\$title
$title
Definition
itext.class.php:31
IText\set_require
set_require($p_boolean)
Definition
itext.class.php:154
IText\$css_size
$css_size
Definition
itext.class.php:33
IText\__construct
__construct($name='', $value='', $p_id="")
Definition
itext.class.php:36
IText\display
display()
print in html the readonly value of the widget
Definition
itext.class.php:125
table
$all table
Definition
company.inc.php:142
placeholder
$anc_filter placeholder
Definition
company.inc.php:118
title
$anc_filter title
Definition
company.inc.php:119
$t
$t
Definition
compute.php:46
readOnly
$icard readOnly
Definition
follow_up_detail_display.php:69
$readonly
$readonly
Definition
follow_up_detail_display.php:34
extra
$poste extra
Definition
lettering.card.inc.php:40
ENT_QUOTES
ENT_QUOTES
Definition
message_javascript.php:92
css_size
$name css_size
Definition
stock_cfg.inc.php:124
Generated on Wed Jun 25 2025 09:57:48 for noalyss by
1.13.2