118require_once NOALYSS_INCLUDE.
'/lib/function_javascript.php';
164 $this->fct=
'update_value';
166 $this->callback=
'null';
170 $this->indicator=
null;
171 $this->choice_create=1;
172 $this->autocomplete=1;
177 $this->typecard=
'all';
178 $this->autocomplete_file=
"fid_card.php";
196 if ( $this->choice==
null) {
197 return sprintf(
"%s_choices", $this->
id);
402 $this->callback=$p_name;
436 $ip_card=
new IPopup($p_name);
438 $ip_card->set_width(
'45%');
439 $ip_card->title=
'Fiche ';
442 return $ip_card->input();
458 public function input($p_name=
null, $p_value=
null)
460 if ($p_name==
null&&$this->
name==
"")
461 throw (
new Exception(_(
'Le nom d une icard doit être donne')));
462 $this->
value=($p_value==
null)?$this->
value:$p_value;
466 $this->
id=($this->
id==
"")?$this->
name:$this->
id;
467 $this->choice=($this->choice==
null)?sprintf(
"%s_choices", $this->
id):
$this->choice;
468 $this->indicator=($this->indicator==
null)?sprintf(
"%s_ind", $this->
id):
$this->indicator;
472 if ($this->dblclick!=
'')
474 $e=sprintf(
' ondblclick="%s" ', $this->dblclick);
478 $input=
'<div class="d-none d-lg-inline">'.
483 <INPUT TYPE="Text" class="input_text icard"
484 NAME="%s" ID="%s" VALUE="%s" %s %s %s>',
488 if ($this->autocomplete==1)
491 $this->indicator=
"ind_".$this->id;
492 $ind=sprintf(
'<span id="%s" class="autocomplete" style="position:absolute;display:none;margin-left:-20px"><img src="image/ajax-loader.gif" alt="Chargement..."/></span>',
496 $div=($this->choice_create==1)?sprintf(
'<div id="%s" class="autocomplete"></div>',
499 $query=http_build_query([
'gDossier'=>
Dossier::id(),
'e'=>$this->typecard,
'limit'=>$this->limit]);
501 $javascript=sprintf(
'try { new Ajax.Autocompleter("%s","%s","%s?%s",'.
502 '{paramName:"FID",minChars:1,indicator:%s, '.
505 ' afterUpdateElement:%s});} catch (e){alert(e.message);};',
506 $this->
id, $this->choice, $this->autocomplete_file,
$query, $this->indicator,
507 $this->callback, $this->limit, $this->fct);
511 $r=
$label.$input.$attr.$ind.$div.$javascript;
527 $r=sprintf(
' <INPUT TYPE="hidden" NAME="%s" id="%s" VALUE="%s" SIZE="8">',
530 $r.=
'<span>'.$this->value.
'</span>';
565 if (!isset($this->
id))
568 foreach (array(
'typecard',
'jrn',
'label',
'price',
'tvaid',
'accvis',
'amount_from_type') as
571 if (isset($this->$att))
572 $a.=
"this.".$att.
"='".$this->$att.
"';";
574 if (isset($this->
id)&&$this->
id!=
"")
575 $a.=
"this.inp='".$this->id.
"';";
577 $a.=
"this.inp='".$this->name.
"';";
578 $a.=
"this.popup='ipop_card';";
588 $_SESSION[SESSION_KEY.
'isValid']=1;
591 $a->set_attribute(
'label',
'ctl_label');
592 $a->set_attribute(
'tvaid',
'ctl_tvaid');
593 $a->set_attribute(
'price',
'ctl_price');
594 $a->set_attribute(
'purchase',
'ctl_purchase');
595 $a->set_attribute(
'type',
'all');
597 <div
id=
"debug" style=
"border:solid 1px black;overflow:auto"></div>
598 <script
type=
"text/javascript" language=
"javascript" src=
"js/prototype.js">
600 <script
type=
"text/javascript" language=
"javascript" src=
"js/scriptaculous.js">
602 <script
type=
"text/javascript" language=
"javascript" src=
"js/effects.js">
604 <script
type=
"text/javascript" language=
"javascript" src=
"js/controls.js">
606 <script
type=
"text/javascript" language=
"javascript" src=
"js/ajax_fid.js">
608 <script
type=
"text/javascript" language=
"javascript" >
609 function test_value(text,li)
611 alert(
"premier"+li.id);
643 $t=
new IText(
'ctl_tvaid');
647 echo
"Label ".$l->input().
'<br>';
648 echo
"Tva id ".$t->input().
'<br>';
649 echo
"Price ".$p->input().
'<br>';
650 echo
"Purchase ".$b->input().
'<br>';
654 $a->set_function(
'test_value');
655 $a->javascript=
' onchange="alert(\'onchange\');" onblur="alert(\'onblur\');" ';
657 echo dossier::hidden();
td($p_string='', $p_extra='')
surround the string with td
alert($p_msg, $buffer=false)
alert in javascript
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
for($i=0;$i<=6;$i++) $ind
if(! isset($_GET['submit_query'])) $p_action
static id()
return the 'gDossier' value after a check
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
display()
print in html the readonly value of the widget
$fct
< $fct ,by default it is update_value called BEFORE the querystring is send
__construct($name="", $value="", $p_id="")
get_amount_from_type()
amount_from_type : accountancy , sell or purchase price
$choice
$indicator, text displaid when searching
$style
$accvis account_visible =1 otherwise 0, default 1
get_style()
CSS Style of the INPUT TEXT element.
set_choice_create($choice_create)
1 if you want to create automatically the autocomplete DIV to fill with the the output of "autocomple...
set_amount_from_type($amount_from_type)
amount_from_type : accountancy , sell or purchase price @parameter $amount_from_type ACH VEN or GL
hide_accounting()
in the search box, the accounting will be hidden
input($p_name=null, $p_value=null)
show the html input of the widget
set_dblclick($p_action)
set the extra javascript property for a double click on INPUT field
get_fct()
Function javascript by default it is update_value called BEFORE the querystring is send in ajax.
set_style($style)
CSS Style of the INPUT TEXT element.
get_autocomplete()
1 autocomplete enable ; 0 autocomplete disable
$amount_from_type
$typecard : type of card
get_autocomplete_file()
php file to call to complete info from the card
set_autocomplete_file($autocomplete_file)
php file to call to complete info from the card
set_choice($choice)
id_of_div_to_populate with the output of the autocomplete_file, it is the autocomplete div presenting...
set_typecard($typecard)
argument "e" passed to autocomplete_file ,
$autocomplete
$style supplemental CSS
search()
return a string containing the button for displaying a search form.
set_callback($p_name)
set the javascript callback function by default it is update_value called BEFORE the querystring is s...
get_choice_create()
1 if you want to create automatically the autocomplete DIV to fill with the the output of "autocomple...
set_indicator($indicator)
Id of the element to show that it is seaching.
show_accounting()
in the search box, the accounting will be shown it is the default
$typecard
$autocomplete_file , ajax file used for autocompletion (see Ajax.Autocompleter)
get_choice()
id_of_div_to_populate with the output of the autocomplete_file, it is the autocomplete div presenting...
set_autocomplete($autocomplete)
1 autocomplet enable ; 0 autocomplete disable
$choice_create
$autocomplete : 1 enable - 0 disable
$limit
$amount_from_type : accountancy , sell or purchase price
set_function($p_name)
set the javascript callback function by default it is update_value called AFTER an item has been sele...
get_indicator()
Id of the element to show that it is seaching.
$accvis
$limit Max of row show
static ipopup($p_name)
return the html string for creating the ipopup, this ipopup can be used for adding,...
$indicator
$choice_create 1 , display a (+) button , default 1
static clean_zone($id, $p_javascript, $p_style="")
static button_magnifier($id, $p_javascript, $p_style="")
Display a icon with a magnify glass.
create_script($p_string)
create the HTML for adding the script tags around of the script