Source for file data.module.php
Documentation is available at data.module.php
* @subpackage plugins_data
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Mose <mose@users.sourceforge.net>
// | Reworked for Bitweaver by: Christian Fowler <spiderr@users.sourceforge.net>
// +----------------------------------------------------------------------+
define( 'PLUGIN_GUID_DATAMODULE', 'datamodule' );
'auto_activate' => FALSE,
'requires_pair' => FALSE,
'load_function' => 'data_datamodule',
'help_page' => 'DataPluginModule',
'description' => tra("Display a module block in content"),
'help_function' => 'datamodule_help',
'syntax' => "{module module= align='right'}",
'<table class="data help">'
. '<th>' . tra( "Key" ) . '</th>'
. '<th>' . tra( "Type" ) . '</th>'
. '<th>' . tra( "Comments" ) . '</th>'
. '<td>' . tra( "string" ) . '<br />' . tra( "(required)" ) . '</td>'
. '<td>' . tra( "Name of module you want to display.")
. '<td>' . tra( "string" ) . '<br />' . tra( "(required)" ) . '</td>'
. '<td>' . tra( "Package the module is part of.")
. '<td>' . tra( "numeric" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "Number of rows you wish to show.")
. '<td colspan="3">' . tra( "Additional arguments and values depend on the selected module." )
. tra( "Example: " ) . '{MODULE module=last_changes package=liberty title="Recent Changes"}';
global $gBitThemes, $gBitSmarty;
if( !empty( $module ) && !empty( $package )) {
if( is_file( $modules_dir. 'mod_'. $module. '.tpl' )) {
$tpl = 'bitpackage:'. $package. '/mod_'. $module. '.tpl';
return '<div class="error">'. tra( "The module / package combination you entered is not valid" ). '</div>';
return '<div class="error">'. tra( "Both paramters 'module' and 'package' are required" ). '</div>';
// Setup moduleParams the best we can.
$moduleParams['module_params'] = $pParams;
if( isset ( $pParams['rows'] )) {
$moduleParams['module_rows'] = $pParams['rows'];
$moduleParams['module_rows'] = 10;
if( isset ( $pParams['title'] )) {
$moduleParams['title'] = $pParams['title'];
$gBitSmarty->assign( 'moduleParams', $moduleParams );
if( !$out = $gBitSmarty->fetch( $tpl ) ) {
if( $gBitThemes->isCustomModule( $module ) ) {
$info = $gBitThemes->getCustomModule( $module );
$gBitSmarty->assign_by_ref( 'user_title', $info["title"] );
$gBitSmarty->assign_by_ref( 'user_data', $info["data"] );
$out = $gBitSmarty->fetch( 'modules/user_module.tpl' );
// deal with custom styling
$style_options = array( 'float', 'width', 'background', 'color' );
foreach( $pParams as $param => $value ) {
if( in_array( $param, $style_options ) ) {
$style .= $param. ':'. $value. ';';
$style = ' style="'. $style. '"';
$ret = '<div'. $style. '>'. $out. '</div>';
|