journaux menu, * it is the journal id. If empty, there is no link with a ledger * */ 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 the value is return with <TD> * \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 * \brief */ var $type; /*! \enum $type type of the widget */ var $name; /*! \enum $name field NAME of the INPUT */ var $value; /*! \enum $value what the INPUT contains */ var $readonly; /*! \enum $readonly true : we cannot change value */ var $size; /*! \enum $size size of the input */ var $selected; /*! \enum $selected for SELECT RADIO and CHECKBOX the selected value */ var $table; /*! \enum $table =1 add the table tag */ var $label; /*! \enum $label the question before the input */ var $disabled; /*! \enum $disabled poss. value == true or nothing, to disable INPUT*/ var $extra; /*! \enum $extra different usage, it depends of the $type */ var $extra2; /*! \enum $extra2 different usage, it depends of the $type */ 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; } 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\" SIZE=\"$this->size\" ".$disabled.">";} else { $r=sprintf('%s', $this->value,$this->name,$this->value); } if ($this->table==1) { if ( $this->label != "") { $r="".$this->label."".$r.""; }else { $r="".$r.""; } } return $r; } // Hidden field if (strtoupper($this->type)=="HIDDEN") { $r=''; if ( $this->readonly==true) return ""; return $r; } // Select value if ( strtoupper($this->type) == "SELECT") { if ($this->readonly==false ) { //echo "Selected ".$this->selected; $r=""; } else { $r=""; echo_debug('class_widget.php',__LINE__,"this->selected = ".$this->selected); for ( $i=0;$ivalue);$i++) { echo_debug('class_widget.php',__LINE__,"check for ".$this->value[$i]['value']); if ($this->selected==$this->value[$i]['value'] ) { $r=$this->value[$i]['label']; } } } if ( $this->table==1) { $r=" $r "; if ( $this->label != "") $r=" $this->label".$r; } return $r; } // Password if (strtoupper($this->type)=="PASSWORD") { if ( $this->readonly==true) return ""; $r=''; if ($this->table==1) { $r=" $this->label $r "; } return $r; } // Checkbox if (strtoupper($this->type)=="CHECKBOX") { if ( $this->readonly == true) { $check=( $this->selected==true )?"checked":"unchecked"; $r='selected==true )?"checked":"unchecked"; $r=''; } if ($this->table==1) { $r=" $this->label $r "; } else { $r=$r." $this->label"; } return $r; } //radio if (strtoupper($this->type)=="RADIO") { if ( $this->readonly == true) { $check=( $this->selected==true || $this->selected=='t' )?"Yes":"no"; $r=$check; } else { $check=( $this->selected==true||$this->selected=='t' )?"checked":"unchecked"; $r='value\""; $r.=" $check"; $r.=' '.$disabled.'>'; } if ($this->table==1) { $r=" $this->label $r "; } else { $r=$this->label.$r; } return $r; } //textarea if (strtoupper($this->type)=="TEXTAREA") { if ( $this->readonly == false ) { $r=""; $r.='"; } else { $r='

'; $r.=$this->value; $r.=sprintf('', $this->name,urlencode($this->value)); $r.='

'; } if ($this->table==1) { $r=" $this->label $r "; } return $r; } //---------------------------------------------------------------------- //---------------------------------------------------------------------- // Rich Text /*!\brief * \note for the type RICHTEXT we need to include the javascript file * into the head \see commercial.php html_page_start($_SESSION['g_theme'],"","richtext.js"); */ if ( strtoupper($this->type)=='RICHTEXT') { $r= ' '. ''. 'Note Interne : '. '"; echo_debug ('class_widget',__LINE__,"writeRichText '$r'"); return $r; } //---------------------------------------------------------------------- //file if (strtoupper($this->type)=="FILE") { if ( $this->readonly == false ) { $r=''; } if ( $this->table==1) $r="$this->label$r"; return $r; } // input type == js_search_poste => button search for the account if ( strtolower($this->type)=="js_search_poste") { $l_sessid=$_REQUEST['PHPSESSID']; if ( $this->readonly == false ) { // Do we need to filter ?? if ( $this->extra2 == null ) { $r=sprintf(' %s ', $l_sessid, $this->name, $this->extra, $this->label, $this->name, $this->value ); } else { // $p_list is not null, so we have a filter $r=sprintf(' %s ', $l_sessid, $this->name, $this->extra2, $this->extra, $this->label, $this->name, $this->value ); } //else } else { $r=sprintf(' %s ', $this->name, $this->value , $this->value ); } //else if readonly == true return $r; } // end js_search_poste // input type == js_search => button search for card if ( strtolower($this->type)=="js_search") { $l_sessid=$_REQUEST['PHPSESSID']; if ( $this->readonly == false ) { $r=sprintf(' %s ', $l_sessid, $this->extra, // deb or cred $this->name, $this->extra2, //jrn $l_sessid, $this->extra, $this->name, $this->extra2, $this->label, $this->name, $this->value ); } else { // readonly == true $r=sprintf(' %s ', $this->label, $this->name, $this->value ); } return $r; }// poste==js_search // input type == js_search => button search for card /*!\brief js_search_only only for searching a card no new button */ if ( strtolower($this->type)=="js_search_only") { $l_sessid=$_REQUEST['PHPSESSID']; if ( $this->readonly == false ) { if ( $this->table==1) { $r=sprintf(' %s ', $l_sessid, $this->extra, $this->name, $this->extra2, $this->label, $this->name, $this->value ); } else { $r=sprintf(' %s ', $l_sessid, $this->extra, $this->name, $this->extra2, $this->label, $this->name, $this->value ); } } else { // readonly == true if ( $this->table == 1 ) { $r=sprintf(' %s %s ', $this->label, $this->value, $this->name, $this->value ); } else { // readonly == true and table == 0 $r=sprintf('%s', $this->value ); } } return $r; }// poste==js_search_only // type=span if ( strtolower($this->type)=="span") { $r=sprintf('%s ', $this->name, $this->value ); return $r; }// end type = span // input type == js_tva if ( strtolower($this->type)=="js_tva") { $id=sprintf("",$this->label); $r=sprintf('%sTva ', $id, $this->name, $this->value, $this->label, $this->name); $l_sessid=$_REQUEST['PHPSESSID']; $r.=sprintf("", $l_sessid,$this->name); return $r; } // input type == js_concerned => button search for the concerned operations if ( strtolower($this->type)=="js_concerned") { $td="";$etd=""; if ( $this->table == 1 ) { $td=''; $etd='';} if ( $this->readonly == false) { $l_sessid=$_REQUEST['PHPSESSID']; $r=sprintf("$td %s $etd $td $etd", $l_sessid, $this->name, $this->extra, $this->label, $this->name, $this->value ); } else { $r=sprintf("$td%s %s",$this->label,$this->value); $r.=sprintf(''.$etd, $this->name,$this->value); } return $r; }// end js_concerned return "INVALID WIDGET $this->type "; } //end function /* Debug */ function debug() { echo "Type ".$this->type."
"; echo "name ".$this->name."
"; echo "value". $this->value."
"; $readonly=($this->readonly==false)?"false":"true"; echo "read only".$readonly."
"; } function Submit ($p_name,$p_value) { return ''; } function Reset ($p_value) { return ''; } }