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 IButton extends HtmlInput
00027 {
00028 var $label;
00029 var $class;
00030
00031 public function input($p_name=null,$p_value=null,$p_class="")
00032 {
00033 $this->name=($p_name==null)?$this->name:$p_name;
00034 $this->value=($p_value==null)?$this->value:$p_value;
00035 $this->label=(trim($this->label) != '')?$this->label:$this->value;
00036 $this->class=($p_class != "")?$p_class:$this->class;
00037 $this->class=($this->class=="")?"smallbutton ":$this->class;
00038 if ( $this->readOnly==true) return $this->display();
00039 $extra= ( isset($this->extra))?$this->extra:"";
00040 $this->id=($this->id=="")?$this->name:$this->id;
00041 $tab=(isset($this->tabindex))?' tabindex="'.$this->tabindex.'"':"";
00042 $r='<input type="BUTTON" name="'.$this->name.'"'.
00043 ' class="'.$this->class.'" '.
00044 $this->extra.
00045 $tab.
00046 ' id="'.$this->id.'"'.
00047 ' value="'.$this->label.'"'.
00048 ' onClick="'.$this->javascript.'"'.$extra.'>';
00049 $attr=$this->get_js_attr();
00050 $r.=$attr;
00051 return $r;
00052
00053 }
00054
00055
00056 public function display()
00057 {
00058 return "";
00059 }
00060 static function tooggle_checkbox($p_form)
00061 {
00062 $select_all=new IButton('select_all');
00063 $select_all->label=_('Inverser la sélection');
00064 $select_all->javascript="toggle_checkbox('$p_form')";
00065 return $select_all->input();
00066 }
00067 static function select_checkbox($p_form)
00068 {
00069 $select_all=new IButton('select_all');
00070 $select_all->label=_('Cocher tous');
00071 $select_all->javascript="select_checkbox('$p_form')";
00072 return $select_all->input();
00073 }
00074 static function unselect_checkbox($p_form)
00075 {
00076 $select_all=new IButton('select_all');
00077 $select_all->label=_('Décocher tous');
00078 $select_all->javascript="unselect_checkbox('$p_form')";
00079 return $select_all->input();
00080 }
00081 static function show_calc()
00082 {
00083 $calc=new IButton('shcalc');
00084 $calc->label=_('Calculatrice');
00085 $calc->javascript="show_calc()";
00086 return $calc->input();
00087
00088 }
00089 static public function test_me()
00090 {
00091 }
00092 }
00093 class ISmallButton extends IButton
00094 {
00095 var $label;
00096
00097 public function input($p_name=null,$p_value=null,$p_style=null)
00098 {
00099 $this->name=($p_name==null)?$this->name:$p_name;
00100 $this->value=($p_value==null)?$this->value:$p_value;
00101 $this->label=(trim($this->label) != '')?$this->label:$this->value;
00102 if ( $this->readOnly==true) return $this->display();
00103 $extra= ( isset($this->extra))?$this->extra:"";
00104 $this->id=($this->id=="")?$this->name:$this->id;
00105 $tab=(isset($this->tabindex))?' tabindex="'.$this->tabindex.'"':"";
00106 $r='<input type="BUTTON" name="'.$this->name.'"'.
00107 ' class="smallbutton" '.
00108 $this->extra.
00109 $tab.
00110 ' id="'.$this->id.'"'.
00111 ' value="'.$this->label.'"'.
00112 ' onClick="'.$this->javascript.'"'.$extra.'>';
00113 $attr=$this->get_js_attr();
00114 $r.=$attr;
00115 return $r;
00116
00117 }
00118 }