Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Installer

The installer file is run on module install or upgrade.

Some simple tips and hints are listed below:

Database Calls

All database calls are done through the global variable $db which is a pearDB object. Simpler calls can be done through the function sql().

Screen Output Calls

There are two types of screen output calls that you cab use during install to display text to your users.

function out('')

When this function is used it will echo any output within and also return an HTML break or newline afterwards. Please remember to use localization strings (gettext, eg _('string')) when you output text

out(_("Installing My Cool Module!"));
out(_("Installing Next Part of My Cool Module!"));

The above code will output

Installing My Cool Module!
Installing Next Part of My Cool Module!

function outn('')

When this function is used it will echo any output within and however it will NOT echo out an HTML break or a newline. Please remember to use localization strings (gettext, eg _('string')) when you output text

outn(_("Upgrading Table.."));
//Upgrade Code
out(_("Done!"));

The above code will output

Upgrading Table..Done!

Adding and Removing Advanced Settings Items

Using the freepbx_conf class you can add and remove advanced settings items from install.php. Please see Advanced Settings Class for more information

$freepbx_conf =& freepbx_conf::create();
$set = array(
    "value" => false,
    "defaultval" => false,
    "readonly" => 0,
    "hidden" => 0,
    "level" => 1,
    "module" => "rawmodulename",
    "category" => "Category Name",
    "emptyok" => 0,
    "name" => "Allow PRI Discrete Channels",
    "description" => "DAHDi trunk configuration is normally done using groups for PRI configuration. If there is a need to configure trunks to specific channels, setting this to true will allow each channel to be configured. This can be useful when troubleshooting a PRI and trying to isolate a bad B Channel.",
    "type" => CONF_TYPE_BOOL
);
$freepbx_conf->define_conf_setting('CONSTANTNAME',$set,true);

Adding and Removing Feature Codes

Using the Feature Code Admin class you can add and feature codes from install.php. Please see Feature Code Admin Class for more information

$fcc = new featurecode('parking', 'parkedcall');
$fcc->setDescription('Pickup ParkedCall Prefix');
$fcc->setDefault('*85');
$fcc->setProvideDest();
$fcc->update();
unset($fcc);
  • No labels