/* * This file is part of PhpCompta. * * PhpCompta is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * PhpCompta is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PhpCompta; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Revision$ */ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /*! \file * \brief This class is used to create all the HTML INPUT TYPE */ /*! * \brief class widget This class is used to create all the HTML INPUT TYPE * and some specials which works with javascript like * js_search */ class widget { /*! \enum $type type of the input tag (text, select, files, js_search,...) * \enum $name name of the input tag * \enum $value value * \enum $readonly if set to false cannot modify * \enum $size size for the text type * \enum $selected selected value for the radio or select * \enum $table if we want to make a HTML table row * \enum $label text before the input tag * \enum $disabled to disable the type * \enum $extra depends of the input type * \enum $extra2 depends of the input type * \enum $tabindex the tabindex */ var $type; var $name; var $value; var $readonly; var $size; var $selected; var $table; var $label; var $disabled; var $extra; var $extra2; var $tabindex; function widget($p_type="") { $this->type=$p_type; $this->readonly=false; $this->size=20; $this->width=50; $this->heigh=20; $this->value=""; $this->selected=""; $this->table=0; $this->label=""; $this->disabled=false; $this->tabindex=32767; } function SetReadOnly($p_read) { $this->readonly=$p_read; } /*! function IOValue($p_name,$p_value="",$p_label="") ***************************************************** * \brief create the corresponding INPUT tag * * \param $p_name is the INPUT NAME * \param $p_value is the INPUT VALUE or an array for select * \param $p_label is the label of the INPUT * \return string containing the tag */ function IOValue($p_name=null,$p_value=null,$p_label="") { if ( $p_name != null) $this->name=$p_name; $this->value=($p_value===null)?$this->value:$p_value; $this->label=($p_label == "")?$this->label:$p_label; // Input text type $disabled = $this->disabled ? "DISABLED" : ""; if (strtoupper($this->type)=="TEXT") { if ( $this->readonly==false) { $r="name\" VALUE=\"$this->value\" TABINDEX=\"$this->tabindex\" SIZE=\"$this->size\" ".$disabled.">";} else { $r=sprintf('%s', $this->value,$this->name,$this->value); } if ($this->table==1) { if ( $this->label != "") { $r="
'; $r.=$this->value; $r.=sprintf('', $this->name,urlencode($this->value)); $r.='
'; } if ($this->table==1) { $r="