phpBB

Development Wiki

Mcp/info

From phpBB Development Wiki

The mcp/info/ directory is used to contain the install, uninstall and title information for modes of modules installed in the Moderator Control Panel

Contents

Example Info Page

An example of a file within this directory should follow similar suit to this:

/** 
*
* @author Original Author author@example.com
* @package mcp
* @version $Id: $
* @copyright (c) Original Author Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

/**
* @package module_install
*/
class mcp_page_name_info
{
    function 
module()
    {
        return array(
            
'filename'    => 'mcp_page_name',
            
'title'        => 'MCP_PAGE_TITLE',
            
'version'    => '1.2.3',
            
'modes'        => array(
                
'mode1'        => array('title' => 'MCP_PAGE_MODE_ONE_TITLE''auth' => 'acl_m_,$id''cat' => array('MCP_PAGE_TITLE')),
                
'mode2'        => array('title' => 'MCP_PAGE_MODE_TWO_TITLE''auth' => 'acl_m_,$id''cat' => array('MCP_PAGE_TITLE')),
            ),
        );
    }

    function 
install()
    {
    }

    function 
uninstall()
    {
    }
}

Filename

'filename' => 'mcp_page_name',

Filename is the name of the file this info file is used for.

Title

'title' => 'MCP_PAGE_TITLE',

Title

Version

See Version Numbering

Modes

Every module can have multiple submodes (the mode will be passed as parameter to $module->main($id, $mode)). Every submode is represented as an associative array with the keys 'title', 'auth' and 'cat' which are described below.

Title

array('title' => 'MCP_PAGE_MODE_ONE_TITLE',

As you might guess, this is the title of the mode which will be displayed in the navigation tree. You can (and should!) use language constants here. The language constants should be defined in acp/common.php, mcp.php and ucp.php depending on what kind of module you're creating.


Authenthication/Conditional Display

The 'auth' value is responsible for whom/when the module is displayed in the navigation tree. You can use the following elements:

(, ), && and ||
operators that work like in php, e.g (a && b) || c
acl_foo
evaluates to $auth->acl_get('foo'), i.e. module is shown if user has global permission foo
acl_foo,$id
evaluates to $auth->acl_get('foo', $forum_id), i.e. module is shown if user has permission foo in the current forum (only useful for mcp modules)
$id
evaluates to (int)$forum_id, i.e. module is shown if a forum_id is available (only useful for mcp modules)
aclf_foo
evaluates to $auth->acl_getf_global('foo'), i.e. module is shown if user has permission foo in at least one forum
cfg_foo
evaluates to (int)$config['foo'], i.e. module is shown if the board configuration value 'foo' is a nonzero integer
request_foo (latest cvs only)
evaluates to !empty($_REQUEST['foo']), i.e. module is shown if a request parameter 'foo' exists (useful for "edit item" pages)

Category

'cat' => array('MCP_PAGE_TITLE')),

The parent category this mode will be placed in. Note: This value is only used when you install a new phpBB and only works if the category is one of those defined in install.php. In other words, if your module is meant to be installed in its own category or it is not available during the installation, you can omit this information because it won't be used anyway.

Functions

Leave the module(), install(), and uninstall() functions in place. These are necessary for installing and managing the modules by the admin.

This article is a stub. You can help in improving Olympus Documentation by expanding it.