noalyss Version-9
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 */
29class IText extends HtmlInput
30{
32 var $title;
35
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 }
47 /*!\brief show the html input of the widget*/
48 public function input($p_name=null,$p_value=null)
49 {
50 $this->name=($p_name==null)?$this->name:$p_name;
51 $this->value=($p_value==null)?$this->value:$p_value;
52 if ( $this->readOnly==true) return $this->display();
53 $this->id=($this->id=="")?$this->name:$this->id;
54
55 // Double quote makes troubles
56 $this->value=noalyss_str_replace('"','',$this->value);
57
58 // compute attribute used by javascript
59 $strAttribute=$this->get_node_attribute();
60 $t= 'title="'.$this->title.'" ';
61 $autofocus=($this->autofocus)?" autofocus ":"";
62 $require=($this->require)?"required":"";
63 if ( ! isset ($this->css_size) || empty ($this->css_size))
64 {
65
66 $r= sprintf('<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
67 Size="%s" %s %s %s %s %s>
68 ',$this->style,
69 $this->id,
70 $this->name,
71 htmlentities($this->value, ENT_COMPAT|ENT_QUOTES, "UTF-8"),
72 $this->placeholder,
73 $this->title,
74 $this->size,
75 $this->javascript,
76 $this->extra,
77 $autofocus,
79 $strAttribute
80 );
81 } else {
82 $r= sprintf('<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
83 style="width:%s;" %s %s %s %s %s>
84 ',$this->style,
85 $this->id,
86 $this->name,
87 htmlentities($this->value, ENT_COMPAT|ENT_QUOTES, "UTF-8"),
88 $this->placeholder,
89 $this->title,
90 $this->css_size,
91 $this->javascript,
92 $this->extra,
93 $autofocus,
95 $strAttribute
96 );
97 }
98
99 /* add tag for column if inside a table */
100 if ( $this->table == 1 ) $r='<td>'.$r.'</td>';
101
102 return $r;
103
104 }
105 /*!\brief print in html the readonly value of the widget*/
106 public function display()
107 {
108 $t= ((isset($this->title)))?'title="'.$this->title.'" ':' ';
109
110 $extra=(isset($this->extra))?$this->extra:"";
111
112 $readonly=" readonly ";
113 $this->value=htmlentities($this->value??"", ENT_COMPAT|ENT_QUOTES, "UTF-8");
114 $this->style=' class="input_text_ro" ';
115 if ( ! isset ($this->css_size))
116 {
117 $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
118 $this->id.'"'.$t.
119 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '.
120 'SIZE="'.$this->size.'" '.$this->javascript." $readonly $this->extra >";
121 } else {
122 $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
123 $this->id.'"'.$t.
124 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '.
125 ' style="width:'.$this->css_size.'" '.$this->javascript." $readonly $this->extra >";
126 }
127
128 /* add tag for column if inside a table */
129 if ( $this->table == 1 ) $r='<td>'.$r.'</td>';
130
131 return $r;
132
133 }
134 function set_require($p_boolean)
135 {
136 $this->require=$p_boolean;
137 }
138 static public function test_me()
139 {
140 }
141}
noalyss_str_replace($search, $replace, $string)
Definition: ac_common.php:1553
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$ret javascript
$opd_description style
$name size
$description css_size
$from_poste name
class widget This class is used to create all the HTML INPUT TYPE and some specials which works with ...
get_node_attribute()
Insert attribute inside a INPUT TYPE, these attribute can be retrieved in javascript with element....
Html Input.
Definition: itext.class.php:30
$placeholder
Definition: itext.class.php:31
input($p_name=null, $p_value=null)
show the html input of the widget
Definition: itext.class.php:48
static test_me()
set_require($p_boolean)
__construct($name='', $value='', $p_id="")
Definition: itext.class.php:36
display()
print in html the readonly value of the widget
$all table
$anc_filter placeholder
$anc_filter title
$icard readOnly
$poste extra