js you have the javascript code
* - SELECT the options are passed via this->value, this array is
* build thanks the make_array function, each array (of the
* array) aka row must contains a field value and a field label
* - PASSWORD
* - CHECKBOX
* - RADIO
* - TEXTAREA
* - RICHTEXT
* - FILE
* - JS_SEARCH_POSTE call a popup window for searching the account
* - JS_SEARCH call a popup window for searching a quickcode or to add one
* - JS_SEARCH_ONLY like JS_SEARCH but without adding a quickcode
* - SPAN
* - JS_TVA open a popup window for the VAT
* - JS_CONCERNED open a popup window for search a operation, if extra == 0 then
* get the amount thx javascript
* - js_DATE show a calendar
*
* For JS_SEARCH_POST,JS_SEARCH or JS_SEARCH_ONLY
* - $extra contains 'cred', 'deb', 'all' or a list of fiche_def_ref (frd_id)
* to filter the search/add for the card
*
* - $extra2 filter on the card parameter, which are given in Avance->journaux menu,
* it is the journal id. If empty, there is no link with a ledger
*
*/
class widget {
var $type; /*!< $type type of the widget */
var $name; /*!< $name field NAME of the INPUT */
var $value; /*!< $value what the INPUT contains */
var $readonly; /*!< $readonly true : we cannot change value */
var $size; /*!< $size size of the input */
var $selected; /*!< $selected for SELECT RADIO and CHECKBOX the selected value */
var $table; /*!< $table =1 add the table tag */
var $label; /*!< $label the question before the input */
var $disabled; /*!< $disabled poss. value == true or nothing, to disable INPUT*/
var $extra; /*!< $extra different usage, it depends of the $type */
var $extra2; /*!< $extra2 different usage,
it depends of the $type */
var $javascript;
var $tabindex;
function widget($p_type="",$p_label="",$p_name="",$p_value="") {
$this->type=$p_type;
$this->name=$p_name;
$this->readonly=false;
$this->size=20;
$this->width=50;
$this->heigh=20;
$this->value=$p_value;
$this->selected="";
$this->table=0;
$this->label=$p_label;
$this->disabled=false;
$this->javascript="";
$this->extra2="all";
}
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) {
$this->value=str_replace('"','',$this->value);
$r='name.'" VALUE="'.$this->value.'" '.
'SIZE="'.$this->size.'" "'.$this->javascript." ".$disabled.">";
} else {
$r=sprintf('%s', $this->value,$this->name,$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="";
}
if ( $this->readonly==true)
{
$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="
";
}
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->name,
$this->value
);
} else { // $p_list is not null, so we have a filter
$r=sprintf('
',
$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('