noalyss  Version-6.9.1.8
 All Data Structures Namespaces Files Functions Variables Pages
class_icheckbox.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 ICheckBox extends HtmlInput
27 {
28  /*!\brief show the html input of the widget*/
29  public function input($p_name=null,$p_value=null)
30  {
31  $this->name=($p_name==null)?$this->name:$p_name;
32  $this->value=($p_value==null)?$this->value:$p_value;
33  if ( $this->readOnly==true) return $this->display();
34  $this->id=($this->id=="")?$this->name:$this->id;
35 
36  $check=( $this->selected==true )?"checked":"unchecked";
37  $r='<input type="CHECKBOX" id="'.$this->id.'" name="'.$this->name.'"'.' value="'.$this->value.'"';
38  $r.=" $check";
39  $r.=' '.$this->disabled." ".$this->javascript.'>';
40 
41  $r=$r." $this->label";
42 
43  return $r;
44 
45 
46  }
47  /*!\brief print in html the readonly value of the widget*/
48  public function display()
49  {
50  $check=( $this->selected==true )?"checked":"unchecked";
51  $r='<input type="CHECKBOX" id="'.$this->name.'" name="'.$this->name.'"';
52  $r.=" $check";
53  $r.=' disabled>';
54 
55  return $r;
56 
57  }
58  /**
59  *set selected to true (checked) if the value equal the parameter
60  * @param $p_value value to compare
61  */
62  public function set_check($p_value)
63  {
64  if ($this->value==$p_value)$this->selected=true;
65  }
66  static function toggle_checkbox($p_name,$p_form) {
67  $a=new ICheckBox($p_name);
68  $a->javascript='onclick="toggle_checkbox(\''.$p_form.'\')"';
69  return $a->input();
70  }
71  static public function test_me()
72  {
73  }
74 }
display()
print in html the readonly value of the widget
$ret javascript
set_check($p_value)
set selected to true (checked) if the value equal the parameter
for($e=0;$e< count($array);$e++) $desc readOnly
input($p_name=null, $p_value=null)
show the html input of the widget
$from_poste name
$check
class widget This class is used to create all the HTML INPUT TYPE and some specials which works with ...
$me_code selected
static toggle_checkbox($p_name, $p_form)