Source for file function.formhelp.php
Documentation is available at function.formhelp.php
* Smarty {formhelp} function plugin
* - note (optional) words that are displayed, can also be an array, where: 'key: value'<br /> is printed
* only displayed if site_form_help is enabled
* - link (optional) provide a link to an internal page (avoids the problem with links being inerpreted
* prematurely by the tra() function
* <package>/<path to file>/<title>
* - package (optional) creates a page to 'Package'.ucfirst( $package ) and takes precedence over $page, should both be set.
* only dispalyed if help is enabled
* - install (optional) used for packages that require a separate installation
* package => name of package to be installed
* file => path to installation file e.g.: admin/install.php
* - page (optional) page name on bitweaver
* only dispalyed if help is enabled
* - force (optional) if set, it will always dipslay this entry regardless of the feature settings
$atts = $ret_note = $ret_page = $ret_link = $ret_install = '';
if( !empty( $pParams['hash'] ) ) {
$hash = &$pParams['hash'];
// maybe params were passed in separately
// we need to do some hash modification if we're in the installer
if( !empty( $hash['is_installer'] )) {
if( !empty( $hash['note']['upgrade'] )) {
$hash['note']['version'] = $hash['note']['upgrade'];
unset ( $hash['note']['upgrade'] );
foreach( $hash as $key => $val ) {
$atts .= $key. '="'. $val. '" ';
if( !empty( $package ) ) {
$rawHash['page'] = ucfirst( $package ). 'Package';
// if link was passed in as a string, convert it into an array
if( !empty( $rawHash['link'] ) && is_string( $rawHash['link'] ) ) {
$l = explode( '/', $rawHash['link'] );
unset ( $rawHash['link'] );
// package is first, title last, and all remaining elements file (can be 'foo/bar.php' as well)
$rawHash['link']['file'] = implode( '/', $l );
if( !empty( $rawHash ) ) {
if( !empty( $rawHash['page'] ) && ( $gBitSystem->isFeatureActive('site_online_help') || $force == 'y' ) ) {
$ret_page = '<strong>'. tra( 'Online help' ). '</strong>: <a class=\'external\' href=\'http://doc.bitweaver.org/wiki/index.php?page='. $rawHash['page']. '\'>'. $rawHash['page']. '</a><br />';
if( !empty( $rawHash['link'] ) && ( $gBitSystem->isFeatureActive('site_online_help') || $force == 'y' ) ) {
$ret_link = '<strong>'. tra( 'IntraLink' ). '</strong>: ';
$ret_link .= '<a href=\'';
$ret_link .= constant( strtoupper( $rawHash['link']['package'] ). '_PKG_URL' ). $rawHash['link']['file'];
$ret_link .= '\'>'. tra( $rawHash['link']['title'] ). '</a>';
if( ( !empty( $rawHash['note'] ) && $gBitSystem->isFeatureActive('site_form_help') ) || ( !empty( $force ) && !empty( $rawHash['note'] ) ) ) {
foreach( $rawHash['note'] as $name => $value ) {
if( $name == 'install' ) {
$ret_install = '<strong>'. tra( 'Install' ). '</strong>: '. tra( 'To use this package, you will first have to run the package specific installer' ). ': ';
$ret_install .= '<a href=\'';
$ret_install .= '\'>'. ucfirst( $value['package'] ). '</a>';
$ret_note .= '<strong>'. ucfirst( tra( $name ) ). '</strong>: '. tra( $value ). '<br />';
$ret_note .= tra( $rawHash['note'] ). '<br />';
if( !empty( $rawHash['warning'] ) ) {
$ret_note .= '<span class="warning">'. tra( $rawHash['warning'] ). '</span><br />';
// join all the output content into one string
$content = $ret_note. $ret_page. $ret_link. $ret_install;
// using the overlib popup system
if( !empty( $content ) ) {
$gBitSmarty->loadPlugin( 'smarty_modifier_popup' );
$gBitSmarty->loadPlugin( 'smarty_function_biticon' );
$gBitSmarty->assign( 'title',tra('Extended Help') );
$gBitSmarty->assign( 'content', $content );
$gBitSmarty->assign( 'closebutton', TRUE );
$text = $gBitSmarty->fetch('bitpackage:kernel/popup_box.tpl');
'iname' => 'dialog-information',
'iexplain' => 'Extended Help',
$html .= ' <span class="formhelppopup" '. $atts. '> ';
$html .= '<span class="help-block" '. $atts. '>'. $content. '</span>';
|