11. Extension system

Integria IMS has an extension system that allows you to expand its features depending on the needs of each user. These extensions allow expansion or creation of new sections easily.

As of now extensions can be of three types:

  • Menu
  • Preferences
  • Tabs

Extensions of this type appear on the side menu of Integria IMS, just before the calendar box. It's possible to add menu extensions on any section.

Creating a menu extension

With PHP knowledge, it's possible to create an extension. To do this it's necessary to create a .php script in the “Extensions” folder, which can be found inside Integria's root directory. This file will take charge of the log and load of the features.

So that an extension can be registered, certain functions need to be added to the load file.

extensions_add_side_menu_option ([Nombre], [sección]);

With this function, the extensions box will appear in the marked section, with the designated name. The parameters to be introduced are string type.

To get the name of the section where you are introducing the expansion, first look at the sec parameter on Integria's URLs.

http://[host]/integria/index.php?sec=customers&sec2=operation/companies/
company_detail

Here you can see, for example, that the name of the customer section is “Customers”.

Once it appears, you have to indicate what happens when it's clicked.

extensions_add_main_function ([Nombre de función]);

With this function we indicate, through a string type variable, which function must be executed to show the extension information.

With a function that shows the resulting information on HTML, one to indicate the section on which it has to appear, and another to indicate what to do when it's clicked, all written on a .php file and placed in the extensions folder, it's possible to create an extension. If libraries or additional resources are needed, it's enough to add them in a folder with the same name as the file and placed in the same directory.

Example:

<?php
function extension1_main() {
	echo "Hola Mundo";
}
extensions_add_side_menu_option ('Extensión 1', 'customers');
extensions_add_main_function ('extension1_main');
?>

Preference extensions

This is a special type of extension which is very similar to the menu one, but with the difference that it has been designed to appear in Integria IMS preferences. This makes it prone to act as a configuration section for extensions.

Creating a preference extension

Just like menu extensions, it must be registered:

extensions_add_godmode_side_menu_option ([Name]);

And you must indicate which function will load the information:

extensions_add_godmode_function ([Function name]);

Example:

<?php
function extension1_main() {
	echo "<div style='color:".$config['color'].";'>Hola Mundo</div>";
}
function extension1_setup() {
	$color = (string) $_POST['e1_color'];
	if ($color) {
		update_config_token('color', $color);
	}
	echo "<form>";
	echo "	<input name='e1_color' type='text' value='$color'>";
	echo "	<input type='submit' name='upd_button' value='Actualizar'>";
	echo "</form>";
}
extensions_add_side_menu_option ('Extensión 1', 'customers');
extensions_add_main_function ('extension1_main');
extensions_add_godmode_side_menu_option ('Configuración de extensión 1');
extensions_add_godmode_function ('extension1_setup');
?>

Tab extensions

This type of extension will appear on the selected tab list.

Creating a tab extension

Very similar to a menu extension, with the distinction of being able to receive parameters from a subsection. The most complicated process is gathering all the necessary data to link it to the tab list.

To register, this function must be used:

extensions_add_tab_option ([Tab ID], [Name], 
[Subsection of the tab list], [Icon route], [Tab list ID]);

The icon route is optional and begins from the /extensions subdirectory. As well as the ID for the tab list, which is needed in case the subsection there is more than one tab list.

To get the name of the subsection where you want to put the expansion, you'll need to look at the sec2 parameter in the Integria URLs.

http://[host]/integria/index.php?sec=incidents&sec2=operation/incidents/
incident_dashboard_detail&id=[id de ticket]

Here you can see, for example, that the subsection name for the detailed view of a ticket is operation/incidents/incident_dashboard_detail.

To indicate which function to run to show the extension information:

extensions_add_tab_function ([Function name]);

Example:

<?php
function extension1_main() {
	echo "<div style='color:".$config['color'].";'>Hola Mundo</div>";
}
function extension1_setup() {
	$color = (string) $_POST['e1_color'];
	if ($color) {
		update_config_token('color', $color);
	}
	echo "<form>";
	echo "	<input name='e1_color' type='text' value='$color'>";
	echo "	<input type='submit' name='upd_button' value='Actualizar'>";
	echo "</form>";
}
extensions_add_side_menu_option ('Extensión 1', 'customers');
extensions_add_main_function ('extension1_main');
extensions_add_godmode_side_menu_option ('Configuración de extensión 1');
extensions_add_godmode_function ('extension1_setup');
extensions_add_tab_option ('extension1', 'Extensión 1', "operation/
incidents/incident_dashboard_detail",   "extension1/images/
integria_mini_logo.png", "incident-details-view");
extensions_add_tab_function ('extension1_main');
?>

Lists of available tabs

For now, the only tab list that can hold extensions is the main tab list for a ticket's detailed view.

Detailed view for a ticket

  • Received parameters: ID (ticket ID).
  • Subsection: operation/incidents/incident_dashboard_detail.
  • Tab list ID: incident-details-view.

Integria Documentation