Module HowTo - Basic concepts




1. Licensing

LAM is licensed under the GNU General Public License. This means your plugins need a compatible license.
LAM is distributed with a copy of the GPL license.

2. Naming and position in directory structure


Module names are usually named after the object class they manage. However, you can use any name you want, it should be short and containing only a-z and 0-9. The module name is only shown in the configuration dialog, on all other pages LAM will show a provided alias name.
All account modules are stored in lib/modules. The filename must end with .inc and the file must have the same name as its inside class.

Example: Our example module will provide the class ieee802Device, therefore the file will be called lib/modules/ieee802Device.inc.


3. Defining the class

All module classes have baseModule as parent class. This provides common functionality and dummy functions for all required class functions.

Example:

/**
* Provides MAC addresses for hosts.
*
* @package modules
*/
class
ieee802Device extends baseModule {

}

4. Meta data

The module interface includes a lot of required and optional functions. Many of these functions do not need to be implemented directly in the module, you can define meta data for them and the baseModule will do the rest.
Providing meta data is optional, you can implement the required functions in your class, too.

The baseModule reads the meta data by calling get_metaData() in your class.

Example:

    /**
    * Returns meta data that is interpreted by parent class
    *
    * @return array array with meta data
    */
    function get_metaData() {
        $return = array();
        // icon
        $return['icon'] = 'user.png';
    }

You will see this functions several times in the next parts of this HowTo.