Chapter 23. Installing your application

Table of Contents
Overview
Automatic features
Adding files, directories and icons.
Making phpGroupWare aware of your application
Hooking into Administration page
section_start
section_end
Hooking into Preferences page

Overview

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

Automatic features

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

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
  			

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

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().

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.