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