You are browsing the documentation for iTop 2.7 which is not the current version.

Consider browsing to iTop 3.2 documentation

๐Ÿ”™ Back

iApplicationUIExtension

api

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:

  • OnDisplayProperties (bEditMode = true)
  • OnFormSubmit
  • OnFormCancel

2) To tune the display of the object details, you can use:

  • OnDisplayProperties
  • OnDisplayRelations
  • GetIcon
  • GetHilightClass

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.

Public methods

EnumAllowedActions

public

Called when building the Actions menu for a single object or a list of objects

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

public EnumAllowedActions($oSet)

Parameters

types name default description
\DBObjectSet $oSet A set of persistent objects (DBObject)

Returns

\string[string]

EnumUsedAttributes

public

Not yet called by the framework!

Sorry, the verb has been reserved. You must implement it, but it is not called as of now.

public EnumUsedAttributes($oObject)

Parameters

types name default description
\DBObject $oObject The object being displayed

Returns

array<mixed,string> desc

GetHilightClass

public

Invoked when the object is displayed alone or within a list

Returns a value influencing the appearance of the object depending on its state.

Possible values are:

  • HILIGHT_CLASS_CRITICAL
  • HILIGHT_CLASS_WARNING
  • HILIGHT_CLASS_OK
  • HILIGHT_CLASS_NONE
public GetHilightClass($oObject)

Parameters

types name default description
\DBObject $oObject The object being displayed

Returns

integer The value representing the mood of the object

GetIcon

public

Not yet called by the framework!

Sorry, the verb has been reserved. You must implement it, but it is not called as of now.

public GetIcon($oObject)

Parameters

types name default description
\DBObject $oObject The object being displayed

Returns

string Path of the icon, relative to the modules directory.

OnDisplayProperties

public

Invoked when an object is being displayed (wiew or edit)

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); }

public OnDisplayProperties($oObject, $oPage, $bEditMode = false)

Parameters

types name default description
\DBObject $oObject The object being displayed
\WebPage $oPage The output context
boolean $bEditMode false True if the edition form is being displayed

OnDisplayRelations

public

Invoked when an object is being displayed (wiew or edit)

The method is called rigth after all the tabs have been displayed

public OnDisplayRelations($oObject, $oPage, $bEditMode = false)

Parameters

types name default description
\DBObject $oObject The object being displayed
\WebPage $oPage The output context
boolean $bEditMode false True if the edition form is being displayed

OnFormCancel

public

Invoked when the end-user clicks on Cancel from the object edition form

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).

public OnFormCancel($sTempId)

Parameters

types name default description
string $sTempId Unique temporary identifier made of session_id and transaction_id. It identifies the object in a unique way.

OnFormSubmit

public

Invoked when the end-user clicks on Modify from the object edition form

The method is called after the changes from the standard form have been taken into account, and before saving the changes into the database.

public OnFormSubmit($oObject, $sFormPrefix = '')

Parameters

types name default description
\DBObject $oObject The object being edited
string $sFormPrefix '' Prefix given to the HTML form inputs

๐Ÿ”™ Back

2_7_0/customization/api/extensions/iapplicationuiextension.txt ยท Last modified: 2020/04/15 15:23 by 127.0.0.1
Back to top
Contact us