Useful Links:

Introducing...

NagVis is a visualization addon for the well known network managment system Nagios.

NagVis can be used to visualize Nagios Data, e.g. to display IT processes like a mail system or a network infrastructure.

NagVis Developer Guidelines

These guidelines have been written to assist new developers by coding for or with NagVis. The guidelines have to be considered in NagVis 1.x by all developers to keep a clean codebase.

Code Formating

Comments

User two slashes followed by a whitespace for single line comments:
// my comment
For multi line comments use the following format:
/**
 * My multi
 * line comment
 */

Brackets

Brackets are always used like this:
if (...) {
    ...
} elseif () {
    ...
} else {
    ...
}

When there is only one command (not a whole block) after an if/else statement it is allowed to skip the brackets. But in many cases it is recommended to use the brackets because this makes the code easier to read for others.

Indenting the code: Spaces/Tabs

Since NagVis 1.6x code NagVis uses 4 spaces for indenting code (at line beginnings). Even if it is common to use the tabstop char as representative for 8 spaces we do not allow tabs as indent char. So please care about removing eventually tabstop chars from your code.

Class naming

The first char has to be upper case. Each new word is upper case too.

We seperate classes in types using the leading grouping keywords like Core, Global, NagVis. Global classes are used by several components. The other classes are used in the seperate packets. Global-Classes are manly extended by local classes in NagVis or Wui. Example for class definition:

class GlobalCore {
    ...
}

Objects

Objects are always upper case and named like the Class they are objects from. Example for object initialisation:
$MAP = new NagVisMap(...);

Methods

Methods start with lower case, the first word should be a verb like get, set, make, create, update, ... the next words begin with an upper case letter and descript what the method does. Example for a method definition:
function setRuntimeValue(...) {
    ...
}
Each method should have a useful comment before it starts which explains other developers the purpose of this function.
    // This method is used to calculate a very important thing and returns it
    public function myMethod(...) {
        ...
    }

Variables

Variables start with a lower case word, all following words begin with an upper case letter. Example for a variable:
$correctExampleVar = TRUE;