noalyss  Version-6.7.2
Public Member Functions | Static Public Member Functions
IAncCard Class Reference
Inheritance diagram for IAncCard:
HtmlInput

Public Member Functions

 __construct ($name="", $value="", $p_id="")
 display ()
 print in html the readonly value of the widget
 input ($p_name=null, $p_value=null)
 show the html input of the widget
 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 send If you use the plan ctl must be set to filter_anc
 set_dblclick ($p_action)
 set the extra javascript property for a double click on INPUT field
 set_function ($p_name)
 set the javascript callback function by default it is update_value called AFTER an item has been selected

Static Public Member Functions

static test_me ()

Detailed Description

Definition at line 33 of file class_ianccard.php.


Constructor & Destructor Documentation

IAncCard::__construct ( name = "",
value = "",
p_id = "" 
)

Reimplemented from HtmlInput.

Definition at line 35 of file class_ianccard.php.

References HtmlInput\$name, HtmlInput\$value, and javascript.

    {
        parent::__construct($name,$value,$p_id);
        $this->fct='update_value';
        $this->dblclick='';
        $this->callback='null';
        $this->javascript='';
        // the pa_id to filter
        $this->plan=0;
        // or the container of the Plan Analytic which contains the pa_id
        $this->plan_ctl="";
    }

Member Function Documentation

print in html the readonly value of the widget

Definition at line 139 of file class_ianccard.php.

References $r, name, and value.

Referenced by input().

    {
        $r=sprintf('
                    <INPUT TYPE="hidden" NAME="%s" VALUE="%s" SIZE="8">',
                   $this->name,
                   $this->value
                  );
        $r.='<span>'.$this->value.'</span>';
        return $r;

    }
IAncCard::input ( p_name = null,
p_value = null 
)

show the html input of the widget

Definition at line 76 of file class_ianccard.php.

References $div, $e, HtmlInput\$javascript, HtmlInput\$label, $r, create_script(), display(), HtmlInput\get_js_attr(), javascript, name, readOnly, HtmlInput\set_attribute(), size, table, td(), and value.

    {
        if ( $p_name == null && $this->name == "")
            throw (new Exception('Le nom d une icard doit ĂȘtre donne'));

        $this->value=($p_value==null)?$this->value:$p_value;
        if ( $this->readOnly==true) return $this->display();

        $this->id=($this->id=="")?$this->name:$this->id;



        $label='';
        if ( $this->dblclick != '')
        {
            $e=sprintf(' ondblclick="%s" ',
                       $this->dblclick);
            $this->dblclick=$e;
        }
        $input=sprintf('<INPUT TYPE="Text"  class="input_text"  '.
                       ' NAME="%s" ID="%s" VALUE="%s" SIZE="%d" %s %s>',
                       $this->name,
                       $this->name,
                       $this->value,
                       $this->size,
                       $this->dblclick,
                       $this->javascript
                      );


        $div=sprintf('<div id="%s_choices"  class="autocomplete"></div>',
                     $this->name);
        $query="op=autoanc&".dossier::get();

        // add parameter to search into a plan (pa_id) or get the value from
        // a HtmlObject
        if ($this->plan <> 0)
        {
            $query.="&pa_id=".$this->plan;
        } elseif ( $this->plan_ctl <> '')
        {
               $this->set_attribute("plan_ctl", $this->plan_ctl);
        }
        $attr=$this->get_js_attr();
        $javascript=sprintf('try { new Ajax.Autocompleter("%s","%s_choices","ajax_misc.php?%s",'.
                            '{paramName:"anccard",minChars:1,indicator:null, '.
                            'callback:%s, '.
                            ' afterUpdateElement:%s});} catch (e){alert(e.message);};',
                            $this->name,
                            $this->name,
                            $query,
                            $this->callback,
                            $this->fct);

        $javascript=create_script($javascript.$this->dblclick);

        $r=$label.$input.$attr.$div.$javascript;
        if ( $this->table == 1 )
            $r=td($r);
        return $r;

    }

return a string containing the button for displaying a search form.

When clicking on the result, update the input text file the common used attribute as

  • jrn the ledger
  • label the field to update
  • name name of the input text
  • price amount
  • tvaid
  • typecard (deb, cred, filter or list of value) will be set if ICard is in readOnly, the button disappears, so the return string is empty
          // search ipopup
        $search_card=new IPopup('ipop_card');
        $search_card->title=_('Recherche de fiche');
        $search_card->value='';
        echo $search_card->input();
    
        $a=new ICard('test');
        $a->search();
    
    See also:
    ajax_card.php
    Note:
    the ipopup id is hard coded : ipop_card
    Returns:
    HTML string with the button

Definition at line 177 of file class_ianccard.php.

References $a, name, and readOnly.

    {
        if ( $this->readOnly==true) return '';

        $button=new IButton($this->name.'_bt');
        $a="";
        foreach (array('typecard','jrn','label','price','tvaid') as $att)
        {
            if (isset($this->$att) )
                $a.="this.".$att."='".$this->$att."';";
        }
        if (isset($this->name))
            $a.="this.inp='".$this->name."';";
        $a.="this.popup='ipop_card';";

        $button->javascript=$a.' search_card(this)';
        return $button->input();
    }
IAncCard::set_callback ( p_name)

set the javascript callback function by default it is update_value called BEFORE the querystring is send If you use the plan ctl must be set to filter_anc

Parameters:
$p_namecallback function name

Definition at line 52 of file class_ianccard.php.

    {
        $this->callback=$p_name;
    }
IAncCard::set_dblclick ( p_action)

set the extra javascript property for a double click on INPUT field

Parameters:
$p_actionaction when a double click happens
Note:
the $p_action cannot contain a double quote

Definition at line 71 of file class_ianccard.php.

References $p_action.

    {
        $this->dblclick=$p_action;
    }
IAncCard::set_function ( p_name)

set the javascript callback function by default it is update_value called AFTER an item has been selected

Parameters:
$p_namecallback function name

Definition at line 61 of file class_ianccard.php.

    {
        $this->fct=$p_name;
    }
static IAncCard::test_me ( ) [static]

Definition at line 196 of file class_ianccard.php.

    {

    }

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations