noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
class_ibutton.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief Html Input
00024  */
00025 require_once('class_html_input.php');
00026 class IButton extends HtmlInput
00027 {
00028     var $label;
00029     var $class;
00030     /*!\brief show the html  input of the widget*/
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     /*!\brief print in html the readonly value of the widget*/
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     /*!\brief show the html  input of the widget*/
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 }
 All Data Structures Namespaces Files Functions Variables Enumerations