noalyss  Version-6.9.1.8
 All Data Structures Namespaces Files Functions Variables Pages
class_itext.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 require_once NOALYSS_INCLUDE.'/lib/class_html_input.php';
26 class IText extends HtmlInput
27 {
29  var $title;
31  function __construct($name='',$value='',$p_id="")
32  {
33  parent::__construct($name,$value,$p_id);
34  $this->title="";
35  $this->placeholder="";
36  $this->extra="";
37  $this->style=' class="input_text" ';
38  $this->autofocus=false;
39  }
40  /*!\brief show the html input of the widget*/
41  public function input($p_name=null,$p_value=null)
42  {
43  $this->name=($p_name==null)?$this->name:$p_name;
44  $this->value=($p_value==null)?$this->value:$p_value;
45  if ( $this->readOnly==true) return $this->display();
46  $this->id=($this->id=="")?$this->name:$this->id;
47 
48  $t= 'title="'.$this->title.'" ';
49  $autofocus=($this->autofocus)?" autofocus ":"";
50  $this->value=str_replace('"','',$this->value);
51  if ( ! isset ($this->css_size))
52  {
53 
54  $r= sprintf('<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
55  Size="%s" %s %s %s>
56  ',$this->style,
57  $this->id,
58  $this->name,
59  htmlentities($this->value, ENT_COMPAT, "UTF-8"),
60  $this->placeholder,
61  $this->title,
62  $this->size,
63  $this->javascript,
64  $this->extra,
66  );
67  } else {
68  $r= sprintf('<INPUT TYPE="TEXT" %s id="%s" name="%s" value="%s" placeholder="%s" title="%s"
69  style="width:%s;" %s %s %s>
70  ',$this->style,
71  $this->id,
72  $this->name,
73  htmlentities($this->value, ENT_COMPAT, "UTF-8"),
74  $this->placeholder,
75  $this->title,
76  $this->css_size,
77  $this->javascript,
78  $this->extra,
80  );
81  }
82 
83  /* add tag for column if inside a table */
84  if ( $this->table == 1 ) $r='<td>'.$r.'</td>';
85 
86  return $r;
87 
88  }
89  /*!\brief print in html the readonly value of the widget*/
90  public function display()
91  {
92  $t= ((isset($this->title)))?'title="'.$this->title.'" ':' ';
93 
94  $extra=(isset($this->extra))?$this->extra:"";
95 
96  $readonly=" readonly ";
97  $this->value=str_replace('"','',$this->value);
98  $this->style=' class="input_text_ro" ';
99  if ( ! isset ($this->css_size))
100  {
101  $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
102  $this->id.'"'.$t.
103  'NAME="'.$this->name.'" VALUE="'.$this->value.'" '.
104  'SIZE="'.$this->size.'" '.$this->javascript." $readonly $this->extra >";
105  } else {
106  $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
107  $this->id.'"'.$t.
108  'NAME="'.$this->name.'" VALUE="'.$this->value.'" '.
109  ' style="width:'.$this->css_size.'" '.$this->javascript." $readonly $this->extra >";
110  }
111 
112  /* add tag for column if inside a table */
113  if ( $this->table == 1 ) $r='<td>'.$r.'</td>';
114 
115  return $r;
116 
117  }
118  static public function test_me()
119  {
120  }
121 }
$opd_description style
display()
print in html the readonly value of the widget
Definition: class_itext.php:90
$ret javascript
static test_me()
for($e=0;$e< count($array);$e++) $desc readOnly
$name size
$poste extra
$from_poste name
$description css_size
__construct($name='', $value='', $p_id="")
Definition: class_itext.php:31
$placeholder
Definition: class_itext.php:28
class widget This class is used to create all the HTML INPUT TYPE and some specials which works with ...
input($p_name=null, $p_value=null)
show the html input of the widget
Definition: class_itext.php:41
$select_type table