Implement this interface to change the behavior of the GUI for some objects.
All methods are invoked by iTop for a given object. There are basically two usages:
1) To tweak the form of an object, you will have to implement a specific behavior within:
2) To tune the display of the object details, you can use:
Please note that some of the APIs can be called several times for a single page displayed. Therefore it is not recommended to perform too many operations, such as querying the database. A recommended pattern is to cache data by the mean of static members.
package | Extensibility |
---|---|
api |
EnumAllowedActions(\DBObjectSet $oSet) : \string[string]
Use this to add items to the Actions menu. You will have to specify a label and an URL.
Example:
$oObject = $oSet->fetch();
if ($oObject instanceof Sheep)
{
return array('View in my app' => 'http://myserver/view_sheeps?id='.$oObject->Get('name'));
}
else
{
return array();
}
See also iPopupMenuExtension for greater flexibility
\DBObjectSet
A set of persistent objects (DBObject)
\string[string]
EnumUsedAttributes(\DBObject $oObject) : \type
Sorry, the verb has been reserved. You must implement it, but it is not called as of now.
\DBObject
The object being displayed
\type
descGetHilightClass(\DBObject $oObject) : integer
Returns a value influencing the appearance of the object depending on its state.
Possible values are:
\DBObject
The object being displayed
integer
The value representing the mood of the objectGetIcon(\DBObject $oObject) : string
Sorry, the verb has been reserved. You must implement it, but it is not called as of now.
\DBObject
The object being displayed
string
Path of the icon, relative to the modules directory.OnDisplayProperties(\DBObject $oObject, \WebPage $oPage, boolean $bEditMode) : void
The method is called right after the main tab has been displayed. You can add output to the page, either to change the display, or to add a form input
Example:
if ($bEditMode)
{
$oPage->p('Age of the captain: <input type="text" name="captain_age"/>');
}
else
{
$oPage->p('Age of the captain: '.$iCaptainAge);
}
\DBObject
The object being displayed
\WebPage
The output context
boolean
True if the edition form is being displayed
OnDisplayRelations(\DBObject $oObject, \WebPage $oPage, boolean $bEditMode) : void
The method is called rigth after all the tabs have been displayed
\DBObject
The object being displayed
\WebPage
The output context
boolean
True if the edition form is being displayed
OnFormCancel(string $sTempId) : void
Implement here any cleanup. This is necessary when you have injected some javascript into the edition form, and if that code requires to store temporary data (this is the case when a file must be uploaded).
string
Unique temporary identifier made of session_id and transaction_id. It identifies the object in a unique way.
OnFormSubmit(\DBObject $oObject, string $sFormPrefix) : void
The method is called after the changes from the standard form have been taken into account, and before saving the changes into the database.
\DBObject
The object being edited
string
Prefix given to the HTML form inputs