phpBMS

phpBMS Module Development

phpBMS was designed to allow for customization and expansion through modules. Modules represent a set of common functionality that can be optionally installed into phpBMS.

Customize phpBMS through Modules

We recommend that any customizations to phpBMS be done in a separate module. This way, integration with new versions of phpBMS will not override any work done. Create a module, and copy the files you intend to customize to it. You will need to modify any table definition records to point any add/edit files to the custom file, and not to the standard file.

Creating a Module

Creating a module requires creating and naming a subdirectory under the modules directory of phpBMS. The module should also be registered with the phpBMS database through the modules table.

Folder and File Structure

The following files and locations are needed for modules, and should be included inside the module folder:

  • install folder
    • install.php - This file is used to install the module from the main phpBMS install page
  • include folder
    • adminsettings_include.php - This file is used by the configuration file to process any settings that you may have
  • adminsettings.php - This file is included on the configuration page, and used to configure any settings your module may need.
  • snapshot.php - This file is included by the base modules snapshot.php so that you can include any information on the snapshot page that is pertinent to your module.

Example

Let's say you have phpbms installed in a /var/www/phpbms folder. If you were creating a work order module, you would need (at least) the following file/folder structure

  • /var/www/phpbms/modules/workorder/ (create initial folder)
  • /var/www/phpbms/modules/workorder/adminsettings.php (copy and modify from bms module)
  • /var/www/phpbms/modules/workorder/snapshot.php (copy and modify from bms module)
  • /var/www/phpbms/modules/workorder/include/
  • /var/www/phpbms/modules/workorder/include/adminsettings_include.php (copy and modify from bms module)

Creating the Module Record

In addition to creating the necessary files/folders for the module, you will need to add the module to the phpBMS database. While developing the module, you may want to inject the record manually through a MySQL client. Once the module is complete, this task should be performed during the installation process. When entering the folder name/location, enter it relative to the modules directory. For example, if you are creating an inventory module and the directory your created was "phpbmsRoot/modules/inventory", then enter "inventory" for the folder name/location.

Integrating Data and Adding Tables

Now that you have a module created, you may need to add additional data tables to your module.

see PhpbmsDev/DataIntegration

Coding Styles and Naming Conventions

We always recommend that you use the same coding style and naming conventions as the phpBMS core. This ensures better readability, and reuse, and curbs many headaches when you are trying to troubleshoot your code. If you are coding a module for consideration in the phpBMS core, you will be required to follow these guidelines.

For a list of the styles and conventions, see PhpbmsDev.

Copyright © 2010 Kreotek, LLC. All Rights reserved.