Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once('class_html_input.php');
00026 class ICheckBox extends HtmlInput
00027 {
00028
00029 public function input($p_name=null,$p_value=null)
00030 {
00031 $this->name=($p_name==null)?$this->name:$p_name;
00032 $this->value=($p_value==null)?$this->value:$p_value;
00033 if ( $this->readOnly==true) return $this->display();
00034 $this->id=($this->id=="")?$this->name:$this->id;
00035
00036 $check=( $this->selected==true )?"checked":"unchecked";
00037 $r='<input type="CHECKBOX" id="'.$this->id.'" name="'.$this->name.'"'.' value="'.$this->value.'"';
00038 $r.=" $check";
00039 $r.=' '.$this->disabled." ".$this->javascript.'>';
00040
00041 $r=$r." $this->label";
00042
00043 return $r;
00044
00045
00046 }
00047
00048 public function display()
00049 {
00050 $check=( $this->selected==true )?"checked":"unchecked";
00051 $r='<input type="CHECKBOX" id="'.$this->name.'" name="'.$this->name.'"';
00052 $r.=" $check";
00053 $r.=' disabled>';
00054
00055 return $r;
00056
00057 }
00058
00059
00060
00061
00062 public function set_check($p_value)
00063 {
00064 if ($this->value==$p_value)$this->selected=true;
00065 }
00066 static function toggle_checkbox($p_name,$p_form) {
00067 $a=new ICheckBox($p_name);
00068 $a->javascript='onclick="toggle_checkbox(\''.$p_form.'\')"';
00069 return $a->input();
00070 }
00071 static public function test_me()
00072 {
00073 }
00074 }