Jump to content

ATK Module: Difference between revisions

From NusaATK
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
A module has several special modulefiles:
The dictionary defines module as:
a separable component, frequently one that is interchangeable with others, for assembly into units of differing size, complexity, or function.
- [http://dictionary.reference.com/search?q=module dictionary.reference.com] (see also [http://en.wikipedia.org/wiki/Modular_design Modular design on Wikipedia])
 
A module, in the context of ATK, is a related set of nodes (attributes/relations/classes/...), for instance [[Achievo]] is a project management solution, but is sub-divided into the following modules:
* employees (for all employee related nodes)
* projects (for all project related nodes)
* reports (for all reporting nodes)
etc... ([http://svn.ibuildings.nl/achievo/achievo/trunk/modules/ SVN])
 
All ATK applications are modular by design and will always have at least 1 module.<br />
 
A module is registered to ATK with the '''[http://www.atk-framework.com/docs/atk/trunk/atk/_class.atkconfig.inc.html#functionmodule module]''' function, which you should call in your module config (modules/config.modules.inc) or in your application configuration (config.inc.php).
 
A module has several special module files:


module.inc
module.inc
Line 21: Line 35:


module_preload.inc
module_preload.inc
== Utility functions ==
; module_url
; moduleExists
; moduleDir
; atkGetModule
; atkGetModules
; atkHarvestModules
== Tips ==
* A good module should not have more than 15 nodes, if you have more it is likely a sign you need to move some nodes to their own module.

Latest revision as of 15:52, 14 March 2011

The dictionary defines module as:

a separable component, frequently one that is interchangeable with others, for assembly into units of differing size, complexity, or function.

- dictionary.reference.com (see also Modular design on Wikipedia)

A module, in the context of ATK, is a related set of nodes (attributes/relations/classes/...), for instance Achievo is a project management solution, but is sub-divided into the following modules:

  • employees (for all employee related nodes)
  • projects (for all project related nodes)
  • reports (for all reporting nodes)

etc... (SVN)

All ATK applications are modular by design and will always have at least 1 module.

A module is registered to ATK with the module function, which you should call in your module config (modules/config.modules.inc) or in your application configuration (config.inc.php).

A module has several special module files:

module.inc

A typical module.inc looks like this:

class mod_mymodule extends atkModule
{
  public function getMenuItems()
  {
    $this->menuitem('mynode',dispatch_url('mymodule.mynode','admin'));
  }

  public function registerNodes()
  {
    registerNode('module.mynode',array('admin','add','delete','edit'));
  }
}

module_preload.inc

Utility functions

module_url
moduleExists
moduleDir
atkGetModule
atkGetModules
atkHarvestModules

Tips

  • A good module should not have more than 15 nodes, if you have more it is likely a sign you need to move some nodes to their own module.