![]() |
Xataface 2.0
Xataface Application Framework
|
Public Member Functions | |
getDbVersion ($modname) | |
Returns the current database version of the module. | |
getFsVersion ($modname, $path) | |
Returns the file system version of the specified module. | |
updateModule ($modname, $path) | |
Updates a module so that the database version is the same as the file system version. | |
getModuleURL ($file) | |
Returns the URL of the module that contains the given file. This will either return a URL in the DATAFACE_SITE_URL/modules directory or the DATAFACE_URL/modules depending on where the file is located. | |
displayBlock ($blockName, $params=array()) | |
& | loadModule ($name, $path=null) |
loadModules () | |
getMigrations () | |
migrate ($modules=array()) | |
install ($modules=array()) | |
getInstalledModules () | |
getUninstalledModules () | |
Static Public Member Functions | |
static & | getInstance () |
Data Fields | |
$_modules | |
$_db_versions |
A tool to help manage and work with modules. Use this class to load and install modules, and perform maintenance on them.
Definition at line 6 of file ModuleTool.php.
displayBlock | ( | $ | blockName, |
$ | params = array() |
||
) |
Displays a block as defined in all of the registered modules.
string | $blockName | The name of the block. |
array | $params | Parameters that are passed to the block. |
Definition at line 171 of file ModuleTool.php.
getDbVersion | ( | $ | modname | ) |
Returns the current database version of the module.
Definition at line 28 of file ModuleTool.php.
getFsVersion | ( | $ | modname, |
$ | path | ||
) |
Returns the file system version of the specified module.
The file system version should be stored in a file named version.txt inside the module's directory. It should be in the format:
string | $modname | The name of the module (e.g. modules_grid) |
string | $path | The path to the module's file (e.g. modules/grid/grid.php) |
Definition at line 65 of file ModuleTool.php.
getInstalledModules | ( | ) |
Indicates whether a given module is currently installed.
/** Returns a list of names of modules that are currently installed.
Definition at line 337 of file ModuleTool.php.
static& getInstance | ( | ) | [static] |
Definition at line 13 of file ModuleTool.php.
getMigrations | ( | ) |
Returns an array of modules that require migrations. [Module Name] -> [Description of migration] performed.
Definition at line 266 of file ModuleTool.php.
getModuleURL | ( | $ | file | ) |
Returns the URL of the module that contains the given file. This will either return a URL in the DATAFACE_SITE_URL/modules directory or the DATAFACE_URL/modules depending on where the file is located.
This method is designed for modules to be able to figure out where they are so that they can include resources like stylesheets and javascripts.
string | $file | The path to a file in the module's directory. |
Exception | If this doesn't appear to be in the module's directory. |
Inside the module modules_tagger, the method to include javascripts contains:
$baseURL = Dataface_ModuleTool::getInstance()->getModuleURL(__FILE__); $app->addHeadContent( '<script src="'.htmlspecialchars($baseURL.'/js/tagger.js').'"></script>' );
Definition at line 150 of file ModuleTool.php.
getUninstalledModules | ( | ) |
Returns an array of names of modules that have not been installed, but can be installed.
Definition at line 350 of file ModuleTool.php.
install | ( | $ | modules = array() | ) |
Installs the specified modules.
array | $modules | Array of module names to install. |
Definition at line 307 of file ModuleTool.php.
& loadModule | ( | $ | name, |
$ | path = null |
||
) |
Loads a module and returns a reference to it.
string | $name | The name of the module's class. |
Definition at line 198 of file ModuleTool.php.
loadModules | ( | ) |
Load modules.
Definition at line 252 of file ModuleTool.php.
migrate | ( | $ | modules = array() | ) |
Performs migrations on the specified modules.
$modules | The names of the modules to migrate. If omitted, all modules will be migrated. |
Definition at line 287 of file ModuleTool.php.
updateModule | ( | $ | modname, |
$ | path | ||
) |
Updates a module so that the database version is the same as the file system version.
string | $modname | The name of the module. |
string | $path | The path to the module. |
Definition at line 82 of file ModuleTool.php.
$_db_versions |
Definition at line 10 of file ModuleTool.php.
$_modules |
Definition at line 8 of file ModuleTool.php.