ATK Module
From Achievo/ATK Wiki
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.