Sidebar

iTop Customization

"How to" examples
DataModel

User Interface

Automation & Ticket management

Portal Customization

:: Version 3.2.0 ::

Extensibility interfaces

Extensibility interfaces are one way to customize iTop behaviors. To learn more about the others, check Extensibility API

Interfaces reference documentation

There are several interfaces for extending iTop. Each interface corresponds to a specific type of extension. Here are some examples:

Interface Description
iApplicationUIExtension Implement this interface to change the behavior of the GUI for some objects (when displaying the details or editing an object).
iApplicationObjectExtension Old interface to perform specific actions on objects during CRUD, replaced by the events handling
iPageUIBlockExtension Implement this interface to add content to any iTopWebPage
iPortalUIExtension Implement this interface to add content to any portal page
iPopupMenuExtension Add menu items on iTop objects and list, in console and portal
iRestServiceProvider Add verbs to the REST API.
Since iTop 2.7.0 some corresponding abstract classes are also available, so that you could override only the method you need and not all the ones defined in the interface.

Those interfaces and abstract classes are defined in the application/applicationextension.inc.php file.

Here is a reference documentation of those interfaces: API Reference for extensions

iPopupMenuExtension example

Let's imagine that we have web based application which provides some advanced reporting on the availability of Servers. We would like to provide an hyperlink so that end-users can quickly jump from the details of a Server in iTop into the corresponding report in the monitoring application.

One possible solution is to show this an hyperlink to the monitoring application into the “Actions” popup-menu on all Servers.

The implementation consists in implementing the interface iPopupMenuExtension:

main.mymodule.php
class MyPopupExtension implements iPopupMenuExtension
{
   public static function EnumItems($iMenuId, $param)
   {
      if ($iMenuId == self::MENU_OBJDETAILS_ACTIONS)
      {
         $oObject = $param;
         if ($oObject instanceof Server)
         {
             $sUID = 'MyPopupExtension-Monitoring'; 
             // Make sure that each menu item has a unique "ID"
             $sLabel = 'Monthly report';
             $sURL = 'http://myapp/show_report?server_fqdn='.$oObject->Get('name');
             $sTarget = '_blank';
             $oMenuItem = new URLPopupMenuItem($sUID, $sLabel, $sURL, $sTarget);
             return array($oMenuItem);
         }
      }
      return array();
   }
}

The method EnumItems will be called by iTop in several circumstances. When displaying the details of an object, $params is the target object.

As our method will be called for any kind of object, we have to filter out the classes of objects that are not relevant for this action.

As you can see, one can handle several types of objects and several types of menus with the same extension (depending on $iMenuId and $param).

The outcome of this plugin is an additional menu entry on the details page of any server:

Other examples

Those tutorials are using the iTop interface API:

3_2_0/customization/extensions_api/interfaces.txt · Last modified: 2024/09/10 10:25 by 127.0.0.1
Back to top
Contact us