This guide walks you step-by-step through creating a new functional module that adds a Monitor class (representing screens) to the physical hardware (CI) category in iTOP.
Minimum requirement: iTOP 2.1.0
What You Will Do
- Create an iTOP extension module
- Define a new class object
- Add the new class to the iTOP dashboard
For this tutorial, a new CI class called Monitor will be created, modeled similarly to the existing Peripheral class but with an additional field named technology to distinguish CRT and LCD screen types.
Prerequisites
- iTOP installed locally or on a server
- A code editor capable of PHP, XML, and UTF-8 (e.g., Notepad++, VSCode)
Step-by-Step Process
- Set up iTOP in a development environment (recommended)
- Install the iTop toolkit for customization support
- Use the module creation wizard to create a new module
- Copy the generated module folder into the
extensionsdirectory of iTOP - Open the iTOP setup URL and activate the new module
- Edit the module and update code with the toolkit as needed
Creating the Extension Module
- Access the module creation wizard
- Enter values for your module:
- Module name: lowercase, no accents, hyphen-separated (avoid prefixes like itop- or combodo-). Example:
sample-add-class - Module label: display name during setup. Example:
Add Class Example - Module version: e.g.,
1.0.0 - Category: for modules modifying the data model, choose
business - Dependencies: specify like
itop-config-mgmt/2.0.0,itop-endusers-devices/2.0.0
- Module name: lowercase, no accents, hyphen-separated (avoid prefixes like itop- or combodo-). Example:
- Click Generate
Installing the Module
- Unzip the generated package to obtain files such as:
datamodel.sample-add-class.xmlmodule.sample-add-class.phpen.dict.sample-add-class.phpmodel.sample-add-class.php
- Move this folder to iTOP’s
extensionsdirectory - Ensure
conf/production/config-itop.phpis editable - Visit
http://your_itop/setup/and progress until you can activate your extension by selecting its name
Adding the Monitor Class
- Open
datamodel.sample-add-class.xmlfor editing within your module folder - Insert the following XML snippet inside the
<classes></classes>tag:
<class id="Monitor" _delta="define">
<parent>PhysicalDevice</parent>
<properties>
<category>bizmodel,searchable</category>
<abstract>false</abstract>
<key_type>autoincrement</key_type>
<db_table>monitor</db_table>
<db_key_field>id</db_key_field>
<db_final_class_field/>
<naming>
<format>%1$s</format>
<attributes>
<attribute id="name"/>
</attributes>
</naming>
<display_template/>
<icon>images/monitor.png</icon>
<reconciliation>
<attributes>
<attribute id="name"/>
<attribute id="org_id"/>
<attribute id="organization_name"/>
</attributes>
</reconciliation>
</properties>
<fields>
<field id="technology" xsi:type="AttributeEnum">
<values>
<value>crt</value>
<value>lcd</value>
</values>
<sql>technology</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
<display_style>radio_horizontal</display_style>
</field>
</fields>
<methods/>
</class>
This defines a new database table monitor with an auto-increment id, a name field, and a new enum field technology for selecting screen types.