noalyss Version-9
ibutton.class.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
26/*!
27 * \class IButton
28 * \brief Html Input
29 */
30class IButton extends HtmlInput
31{
32 var $label;
33 var $class;
34 /*!\brief show the html input of the widget*/
35 public function input($p_name=null,$p_value=null,$p_class="")
36 {
37 $this->name=($p_name==null)?$this->name:$p_name;
38 $this->value=($p_value==null)?$this->value:$p_value;
39 $this->label=(!empty($this->label))?$this->label:$this->value;
40 $this->class=($p_class != "")?$p_class:$this->class;
41 $this->class=($this->class=="")?"smallbutton ":$this->class;
42 if ( $this->readOnly==true) return $this->display();
43 $extra= ( isset($this->extra))?$this->extra:"";
44 $this->id=($this->id=="")?$this->name:$this->id;
45 $tab=(isset($this->tabindex))?' tabindex="'.$this->tabindex.'"':"";
46 $r='<input type="BUTTON" name="'.$this->name.'"'.
47 ' class="'.$this->class.'" '.
48 $this->extra.
49 $tab.
50 ' id="'.$this->id.'"'.
51 ' value="'.$this->label.'"'.
52 ' onClick="'.$this->javascript.'"'.$extra.'>';
53 $attr=$this->get_js_attr();
54 $r.=$attr;
55 return $r;
56
57 }
58
59 /*!\brief print in html the readonly value of the widget*/
60 public function display()
61 {
62 return "";
63 }
64 static function tooggle_checkbox($p_form)
65 {
66 $select_all=new IButton('select_all');
67 $select_all->label=_('Inverser la sélection');
68 $select_all->javascript="toggle_checkbox('$p_form')";
69 return $select_all->input();
70 }
71 static function select_checkbox($p_form)
72 {
73 $select_all=new IButton('select_all');
74 $select_all->label=_('Cocher tous');
75 $select_all->javascript="select_checkbox('$p_form')";
76 return $select_all->input();
77 }
78 static function unselect_checkbox($p_form)
79 {
80 $select_all=new IButton('select_all');
81 $select_all->label=_('Décocher tous');
82 $select_all->javascript="unselect_checkbox('$p_form')";
83 return $select_all->input();
84 }
85 static function show_calc()
86 {
87 $calc='<span class="button icon" onclick="show_calc();">&#xf1ec;</span>';
88 return $calc;
89
90 }
91 static public function test_me()
92 {
93 }
94}
95class ISmallButton extends IButton
96{
97 var $label;
98 /*!\brief show the html input of the widget*/
99 public function input($p_name=null,$p_value=null,$p_style=null)
100 {
101 $this->name=($p_name==null)?$this->name:$p_name;
102 $this->value=($p_value==null)?$this->value:$p_value;
103 $this->label=(trim($this->label) != '')?$this->label:$this->value;
104 if ( $this->readOnly==true) return $this->display();
105 $extra= ( isset($this->extra))?$this->extra:"";
106 $this->id=($this->id=="")?$this->name:$this->id;
107 $tab=(isset($this->tabindex))?' tabindex="'.$this->tabindex.'"':"";
108 $r='<input type="BUTTON" name="'.$this->name.'"'.
109 ' class="smallbutton" '.
110 $this->extra.
111 $tab.
112 ' id="'.$this->id.'"'.
113 ' value="'.$this->label.'"'.
114 ' onClick="'.$this->javascript.'"'.$extra.'>';
115 $attr=$this->get_js_attr();
116 $r.=$attr;
117 return $r;
118
119 }
120}
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$ret label
$from_poste name
class widget This class is used to create all the HTML INPUT TYPE and some specials which works with ...
Html Input.
static select_checkbox($p_form)
display()
print in html the readonly value of the widget
static tooggle_checkbox($p_form)
static test_me()
input($p_name=null, $p_value=null, $p_class="")
show the html input of the widget
static unselect_checkbox($p_form)
static show_calc()
input($p_name=null, $p_value=null, $p_style=null)
show the html input of the widget
$icard readOnly
$poste extra