Kapitel 19. Handling common coding tasks

Inhaltsverzeichnis

The definition.xml file
Logging functions
Using the core logging in more.groupware
Notification functions
Using notification in more.groupware
Database handling
SQL portability
Date and time handling
Templates with Smarty
Session usage
Using session standards in more.groupware
Passing sessions around in more.groupware
Storing per-module information in the session
Using the settings module

This chapter has reusable code for common tasks one needs to code when working on a module. The code is not only reusable, but shows best-practice examples for using the moregroupware framework and the libraries we use.

[Anmerkung]Anmerkung

Coding the way described herein reduces your work, avoids errors and makes the code easier to read afterwards!

The definition.xml file

Modules have some important information associated with them. This information is stored in a file named defintion.xml in the modules root directory.

The type defines whether the module is a core module (type 1, always installed, not shown for selection), currently there is only one core module, the 'general' module. Modules with type 2 are base modules, and are shown on the module selection screen, but are always installed. Type 3 denotes user modules, they are selectable at the user's will.

Beispiel 19.1. The defintion.xml of the notes module.

        
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mgw PUBLIC "-//MGW//DTD Moregroupware DTD V1.0//EN" "http://130.89.166.186/mgw/mgw.dtd">
<mgw>
	<moduleDefinition>
		<module type="3">
			<name>notes</name>
			<version>0.8</version>
			<date>2003-02-28</date>
			<author>Karsten Dambekalns</author>
			<email>k.dambekalns@fishfarm.de</email>
			<description>A module for managing notes.</description>
			<compatibility>
				<version>0.6.6</version>
			</compatibility>
			<updates>
			</updates>
			<dependancies>
			</dependancies>
			<cache>
			</cache>
		</module>
	</moduleDefinition>
</mgw>