Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#108 a xoops foreign key combo

XOOPS_2.2
closed
Jan Pedersen
XOOPS 2.1.x (9)
5
2012-09-25
2005-05-25
Bruno
No

Here is 2 classes to display a combo mapping to a
class. One extend the seconds with a combo implementation.

Here is a example :
$f_qualification_id = new XoopsFormComboForeignClass
(_FO_QUALIFICATION_ID, 'qualification_id',
50,150,$'qualification_id,'ox_qualification');

There 2 conditions to uses it :
- a 'ox_qualification' class exist with it's handler
respecting the xoopsObjetc modčle
- a toString() methode must be implemented in the
xoopsObject (here the ox_qualification class.

Discussion

  • Bruno
    Bruno
    2005-05-25

    form foreignkey element

     
    Attachments
  • Jan Pedersen
    Jan Pedersen
    2005-05-26

    Logged In: YES
    user_id=841117

    Can you elaborate on its use?

     
  • Bruno
    Bruno
    2005-05-27

    Logged In: YES
    user_id=1093822

    I made a sample module witch use this foreign key combo.

    In this module, there is 2 classes :
    FKS_classification : the foreign table, basicly a
    classification.
    FKS_use_classif : A class witch use the classification as
    foreign key.

    The foreign key form is used in the form named
    FKSample\form\form_fks_use_classif.php in the
    add_fields_fks_use_classif method.
    To use it, install the module and type the index

    NB : There is no main menu but only a block to install

     
  • Bruno
    Bruno
    2005-05-27

    module using the foregn key form

     
    Attachments
  • Jan Pedersen
    Jan Pedersen
    2005-05-27

    Logged In: YES
    user_id=841117

    yes, but what is it for?

     
  • Bruno
    Bruno
    2005-05-27

    Logged In: YES
    user_id=1093822

    It is a generique combo mapping directly to a database
    table. For exemple actualy in xoops the is several
    XoopsFormSelectxxxx. XoopsFormComboForeignClass can render
    the same service

    For example pour class "group" :
    1/ you implement in the class the toSting function like that

    class XoopsGroup extends XoopsObject
    {
    function toString()
    {
    return $this->getVar('name');
    }

    2/ you use directly a combo with all group

    include XOOPS_ROOT_PATH.'kernel/group.php';
    $f_group = new XoopsFormComboForeignClass (_FO_GROUPE, '
    groupid', 50,150,$groupid,'group');
    $form->addElement($f_group);

    In my modules exemple after modify the kernel\group.php you
    can add this code in 84 of form\form_fks_use_classif.php

     
  • Jan Pedersen
    Jan Pedersen
    2005-05-27

    Logged In: YES
    user_id=841117

    Ahh - so it is a way to get a list of [generic item] in a

     
  • Jan Pedersen
    Jan Pedersen
    2005-06-25

    Logged In: YES
    user_id=841117

    I have added a XoopsFormSelectList element that will use
    xoops_getmodulehandler to get the handler to use.

    This handler must have a getList() method to retrieve the list.
    See XoopsPersistableObjectHandler child classes constructors
    for how to set the identifier used for getList()