Next Previous Contents

3. Installing your application

3.1 Overview

It is fairly simple to add and delete applications to/from phpGroupWare.

3.2 Automatic features

To make things easy for developers we go ahead and load the following files.

3.3 Adding files, directories and icons.

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
  

3.4 Making phpGroupWare aware of your application

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);

3.5 Hooking into Administration page

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();
?>

Look at headlines/inc/admin.inc.php and admin/inc/admin.inc.php for more examples.

Things to note:

The standard $phpgw and $phpgw_info variables are in-scope, as is $appname which corresponds to the application name in the path.

There are 2 functions to coordinate the display of each application's links, section_start() and section_end()

section_start

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

section_end() closes the section that was started with section_start().

3.6 Hooking into Preferences page

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.


Next Previous Contents