It is fairly simple to add and delete applications to/from phpGroupWare.
To make things easy for developers we go ahead and load the following files.
$phpgw->common->header
just after the system header/navbar, and allows developers to use it for whatever they need to load.$phpgw->common->footer
just before the system footer, allowing developers to close connections and whatever else they need.You will need to create the following directories for your code
(replace 'appname' with your application name)
`-- appname `-- images | `-- navbar.gif `-- inc | |-- functions.inc.php | |-- header.inc.php | |-- footer.inc.php | |-- preferences.inc.php | `-- admin.inc.php `-- templates `-- default
To make the application aware of your application, add your application details to the applications table. This can be done via the GUI administration screen, or via a SQL script.
insert into applications (app_name, app_title, app_enabled) values ('appname', 'The App name', 1);
When a user goes to the Administration page, it stats appname/inc/admin.inc.php for each application that is enabled, in alphabetical order of application title. If the file exists, it is include()d in the hopes it will display a selection of links to configure that application.
Simple Example:
<?php $img = "/" . $appname . "/images/navbar.gif"; section_start("My Application",$img); echo "<a HREF=\"" . $phpgw->link("myAdminPage.php") . "\">"; echo lang("Change myApp settings") . "</a>"; section_end(); ?>
Things to note:
$appname
in your link()
calls)There are 2 functions to coordinate the display of each application's links, section_start() and section_end()
section_start($title,$icon_url)
starts the section for your application. $title
is passed through lang()
for you. $icon_url
should be page-relative to admin/index.php or an absolute URL.
section_end()
closes the section that was started with section_start().
The mechanism to hook into the preferences page is identical to the one used to
hook into the administration page, however it looks for
appname/inc/preferences.inc.php
instead of
appname/inc/admin.inc.php
. The same functions and variables are defined.