noalyss  Version-6.9.1.8
 All Data Structures Namespaces Files Functions Variables Pages
class_inum.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 for the numeric input text field
24  */
25 require_once NOALYSS_INCLUDE.'/lib/class_itext.php';
26 /*!\brief
27  * This class handles only the numeric input, the input will
28  * call a javascript
29  * to change comma to period and will round it (2 decimal), the precision is given by
30  * the attribute prec
31  * attribute
32  * extra = extra code (free)
33  * size = size of the field
34  * prec = precision default = 2
35  * name = name of the html object
36  * javascript = javascript to execute (default = onchange="format_number(this,2);)
37  * value = value of the widget
38  *
39  */
40 class INum extends IText
41 {
42  function __construct($name='',$value='')
43  {
44  parent::__construct($name,$value);
45 
46  $this->size=9;
47  $this->style='class="inum"';
48  $this->javascript= 'onchange="format_number(this,2);"';
49  }
50  /*!\brief print in html the readonly value of the widget*/
51  public function display()
52  {
53 
54  $readonly=" readonly ";
55  $this->id=($this->id=="")?$this->name:$this->id;
56 
57  //$style='style="border:solid 1px blue;color:black;background:#EDEDED;text-align:right"';
58  $style=' class="inum input_text_ro"';
59  $this->value=str_replace('"','',$this->value);
60  $r='<INPUT '.$style.' TYPE="TEXT" id="'.
61  $this->id.'"'.
62  'NAME="'.$this->name.'" VALUE="'.$this->value.'" '.
63  'SIZE="'.$this->size.'" '.$this->javascript." $readonly $this->extra >";
64 
65  /* add tag for column if inside a table */
66  if ( $this->table == 1 ) $r='<td>'.$r.'</td>';
67 
68  return $r;
69 
70  }
71  /*!\brief show the html input of the widget*/
72  public function input($p_name=null,$p_value=null)
73  {
74  if ( isset ($this->prec)) {
75  $this->javascript= 'onchange="format_number(this,'.$this->prec.');"';
76  }
77  $this->name=($p_name==null)?$this->name:$p_name;
78  $this->value=($p_value==null)?$this->value:$p_value;
79  $this->id=($this->id=="")?$this->name:$this->id;
80 
81  if ( $this->readOnly==true) return $this->display();
82 
83  $t= ((isset($this->title)))?'title="'.$this->title.'" ':' ';
84 
85  $extra=(isset($this->extra))?$this->extra:"";
86 
87  $this->value=str_replace('"','',$this->value);
88  if ( ! isset ($this->css_size))
89  {
90  $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
91  $this->id.'"'.$t.
92  'NAME="'.$this->name.'" VALUE="'.$this->value.'" '.
93  'SIZE="'.$this->size.'" '.$this->javascript." $this->extra >";
94  /* add tag for column if inside a table */
95  } else {
96  $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
97  $this->id.'"'.$t.
98  'NAME="'.$this->name.'" VALUE="'.$this->value.'" '.
99  ' style="width:'.$this->css_size.';" '.$this->javascript." $this->extra >";
100 
101  }
102 
103  if ( $this->table == 1 ) $r='<td>'.$r.'</td>';
104 
105  return $r;
106 
107  }
108 
109 }
110 
111 
$opd_description style
$ret javascript
display()
print in html the readonly value of the widget
Definition: class_inum.php:51
for($e=0;$e< count($array);$e++) $desc readOnly
input($p_name=null, $p_value=null)
show the html input of the widget
Definition: class_inum.php:72
$name size
$poste extra
$from_poste name
$description css_size
$select_type table
__construct($name='', $value='')
Definition: class_inum.php:42
This class handles only the numeric input, the input will call a javascript to change comma to period...
Definition: class_inum.php:40