Procedural File: atkmoduletools.inc
Source Location: /modules/atkmoduletools.inc
Page Details
This file is part of the Achievo ATK distribution.
Detailed copyright and licensing information can be found in the doc/COPYRIGHT and doc/LICENSE files which should be included in the distribution.
| Version: | $Revision: 6139 $ $Id: atkmoduletools.inc 6465 2009-08-14 14:01:01Z peter $ |
| Copyright: | (c)2000-2004 Ibuildings.nl BV |
| Todo: | Move the global methods to classes |
| License: | ATK Open Source License |
Functions
atkGetModule [line 157]
Retrieve the atkModule with the given name.
Parameters:
|
String |
$modname: |
The name of the module |
API Tags:
| Return: | An instance of the atkModule |
atkGetModules [line 145]
Retrieves all the registered atkModules
API Tags:
atkGetNode [line 109]
atkNode &atkGetNode(
String $node, [bool $init = TRUE], [String $cache_id = "default"], [bool $reset = false]
)
|
|
Get an instance of a node. If an instance doesn't exist, it is created. Note that nodes are cached (unless $reset is true); multiple requests for the same node will return exactly the same node object.
Parameters:
|
String |
$node: |
The node string |
|
bool |
$init: |
Initialize the node? |
|
String |
$cache_id: |
The cache id in the node repository |
|
bool |
$reset: |
Whether or not to reset the particular node in the repository |
API Tags:
atkGetNodeController [line 439]
object (is_subclass_of &atkGetNodeController(
String $node
)
|
|
Returns a registered node controller.
Parameters:
|
String |
$node: |
the name of the node |
API Tags:
| Return: | atkController) NULL if no controller exists for the specified node |
atkGetNodeHandler [line 394]
handler &atkGetNodeHandler(
$node $node, $action $action
)
|
|
Returns a registered node action handler.
Parameters:
|
$node |
$node: |
the name of the node |
|
$action |
$action: |
the node action |
API Tags:
| Return: | functionname or object (is_subclass_of atkActionHandler) or NULL if no handler exists for the specified action |
atkHarvestModules [line 483]
array atkHarvestModules(
String $function, [mixed $param = ""], [boolean $associative = false]
)
|
|
Perform a member function on all active modules, and return the collective result.
Example:
This will return the result of the getStuff calls for all modules in a single array.
Parameters:
|
String |
$function: |
The name of the module member function to be called. The function does not have to exist for all modules, as atkHarvestModules will check if it exists before it makes the call. |
|
mixed |
$param: |
Parameter to be passed to all functions. It is only possible to pass zero or one parameter. |
|
boolean |
$associative: |
If true, return is an associative array with the results indexed by modulename. If false, results are put together in one array. |
API Tags:
| Return: | The result of the harvest. |
atkPreloadModule [line 558]
void atkPreloadModule(
String $modname, String $modpath
)
|
|
Preload the module
Parameters:
|
String |
$modname: |
The modulename |
|
String |
$modpath: |
The path to the module. |
API Tags:
atkPreloadModules [line 606]
void atkPreloadModules(
)
|
|
Preloads all modules. If a module_preload.inc file exists in the module directory, this file will be included. If no module_preload.inc file exists in the module directory the module.inc file will be used instead (to remain backwards compatible).
atkReadOptimizer [line 536]
boolean atkReadOptimizer(
[$newvalue $newvalue = NULL]
)
|
|
Get/set the status of the readoptimizer.
If you need the dataread-functionality of atkNode but don't need the ui stuff, or the data write stuff, you can turn on the read optimizer, so nodes load faster. If you call this function without parameters (or NULL as param) the optimizer value is not changed, and the function will just return the current setting. If you do specify a parameter, the function will return the OLD setting (so you might reset it to the old value after you're finished with the current node.
Parameters:
|
$newvalue |
$newvalue: |
New value of the readoptimizer. true turns the optimizer on. Falls turns it off. |
API Tags:
| Return: | The old value of the optimizer setting, if a new setting was passed OR The current value if no new setting was passed. |
atkRegisterNodeController [line 453]
bool atkRegisterNodeController(
String $node, &$controller, atkController $controller
)
|
|
Registers a new node controller.
Parameters:
|
String |
$node: |
the name of the node (* matches all) |
|
atkController |
$controller: |
object (is_subclass_of atkController) |
|
|
&$controller: |
|
API Tags:
| Return: | true if there is no known handler |
atkRegisterNodeHandler [line 410]
bool atkRegisterNodeHandler(
String $node, String $action, &$handler, String/atkActionHandler $handler
)
|
|
Registers a new node action handler.
Parameters:
|
String |
$node: |
the name of the node (* matches all) |
|
String |
$action: |
the node action |
|
String/atkActionHandler |
$handler: |
handler functionname or object (is_subclass_of atkActionHandler) |
|
|
&$handler: |
|
API Tags:
| Return: | true if there is no known handler |
atkRegisterNodeHandlerClass [line 428]
bool atkRegisterNodeHandlerClass(
string $node, string $action, string $class
)
|
|
Registers a new node action handler.
Parameters:
|
string |
$node: |
the name of the node (* matches all) |
|
string |
$action: |
the node action |
|
string |
$class: |
node handler class ATK path |
API Tags:
| Return: | true if there is no known handler |
atkSetNode [line 132]
atkNode &atkSetNode(
String $nodename, &$node, [String $cache_id = "default"], atkNode $node
)
|
|
Replace, at runtime, the in-memory instance of a node.
This is useful to replace nodes with mocks for testing purposes.
Parameters:
|
String |
$nodename: |
The full name of the node (module.nodename) |
|
atkNode |
$node: |
The node instance to replace the current one |
|
String |
$cache_id: |
If set, replaces only the instance with a certain cache_id |
|
|
&$node: |
|
API Tags:
| Return: | The current node, useful to restore afterwards. Can be NULL. |
getModule [line 218]
Retrieve the atkModule with the given name.
Parameters:
|
String |
$modname: |
The name of the module |
API Tags:
| Return: | an instance of the atkModule |
| Deprecated: | Use atkGetModule instead. |
getNode [line 93]
atkNode &getNode(
String $node, [bool $init = TRUE], [String $cache_id = "default"], [bool $reset = false]
)
|
|
Get an instance of a node. If an instance doesn't exist, it is created.
Parameters:
|
String |
$node: |
The node string |
|
bool |
$init: |
Initialize the node? |
|
String |
$cache_id: |
The cache id in the node repository |
|
bool |
$reset: |
Wether or not to reset the particulair node in the repository |
API Tags:
| Return: | the created instance |
| Deprecated: | Use atkGetNode instead. |
getNodeHandler [line 369]
handler &getNodeHandler(
$node $node, $action $action
)
|
|
Returns a registered node action handler.
Parameters:
|
$node |
$node: |
the name of the node |
|
$action |
$action: |
the node action |
API Tags:
| Return: | functionname or object (is_subclass_of atkActionHandler) or NULL if no handler exists for the specified action |
| Deprecated: | Use atkGetNodeHandler instead |
getNodeModule [line 77]
String getNodeModule(
String $node
)
|
|
Gets the module of the node
Parameters:
|
String |
$node: |
the node name |
API Tags:
| Return: | the node's module |
getNodeType [line 65]
String getNodeType(
String $node
)
|
|
Gets the node type of a node string
Parameters:
|
String |
$node: |
the node name |
API Tags:
moduleDir [line 326]
String moduleDir(
String $module
)
|
|
Return the physical directory of a module..
Parameters:
|
String |
$module: |
name of the module. |
API Tags:
| Return: | The path to the module. |
moduleExists [line 355]
bool moduleExists(
String $module
)
|
|
Check wether a module is installed
Parameters:
|
String |
$module: |
The modulename. |
API Tags:
| Return: | True if it is, false otherwise |
module_url [line 344]
URL module_url(
$module $module, $file $file
)
|
|
Creates an URL to a file within the modules directory
Parameters:
|
$module |
$module: |
the module name |
|
$file |
$file: |
the directory/filename |
API Tags:
| Return: | to file within modules directory |
newNode [line 272]
atkNode &newNode(
String $node, [bool $init = TRUE]
)
|
|
Construct a new node
Parameters:
|
String |
$node: |
the node type |
|
bool |
$init: |
initialize the node? |
API Tags:
nodeExists [line 304]
bool nodeExists(
String $node
)
|
|
Checks if a certain node exists.
Parameters:
|
String |
$node: |
the node type |
API Tags:
nodeFile [line 229]
String nodeFile(
String $node
)
|
|
Retrieve the full filename containing the given node.
Parameters:
|
String |
$node: |
The name of the node (nodename or module.nodename) |
API Tags:
registerNodeHandler [line 382]
true registerNodeHandler(
$node $node, $action $action, $handler &$handler
)
|
|
Registers a new node action handler.
Parameters:
|
$node |
$node: |
the name of the node (* matches all) |
|
$action |
$action: |
the node action |
|
$handler |
&$handler: |
handler functionname or object (is_subclass_of atkActionHandler) |
API Tags:
| Return: | if there is no known handler |
| Deprecated: | Use atkRegisterNodeHandler instead |