Tabs system: Difference between revisions
| Line 27: | Line 27: | ||
Then to add your tab, create a new module descriptor file. See page [[Module development]] for this. | Then to add your tab, create a new module descriptor file. See page [[Module development]] for this. | ||
Then into the descriptor file, edit the property this->tab to add your tab using syntax | Then into the descriptor file, edit the property this->tab to add your tab using following syntax: | ||
$this->tabs = array( | |||
'objecttype:+tabname:TitleOfTab:@mymodule:conditiontoshowtab:urloftab?id=__ID__' | |||
); | |||
Example: | |||
<source lang="php"> | <source lang="php"> | ||
$this->tabs = array( | $this->tabs = array( | ||
| Line 34: | Line 39: | ||
); | ); | ||
</source> | </source> | ||
Activate module | |||
Test new tabs is visible and link open your page. | |||
= To remove an existing '''tab''' = | = To remove an existing '''tab''' = | ||
Revision as of 16:02, 12 October 2011
The system of Dolibarr tabs
Dolibarr showns information of an element into a view with several tabs.
It is possible to add your own tabs, remove or replace an existing tabs or replace.
To add your own tab
First, you must identify the type of object your tab is about, and its objecttype code. This is full list:
- 'thirdparty' to add a tab in third party view
- 'intervention' to add a tab in intervention view
- 'order_supplier' to add a tab in supplier order view
- 'invoice_supplier' to add a tab in supplier invoice view
- 'invoice' to add a tab in customer invoice view
- 'order' to add a tab in customer order view
- 'product' to add a tab in product view
- 'stock' to add a tab in stock view
- 'propal' to add a tab in propal view
- 'member' to add a tab in fundation member view
- 'contract' to add a tab in contract view
- 'user' to add a tab in user view
- 'group' to add a tab in group view
- 'contact' to add a tab in contact view
- 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
Then to add your tab, create a new module descriptor file. See page Module development for this.
Then into the descriptor file, edit the property this->tab to add your tab using following syntax: $this->tabs = array( 'objecttype:+tabname:TitleOfTab:@mymodule:conditiontoshowtab:urloftab?id=__ID__' );
Example:
$this->tabs = array(
'objecttype:+tabname1:Title1:@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
'objecttype:+tabname2:Title2:@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
);
Activate module
Test new tabs is visible and link open your page.
To remove an existing tab
Process is same than adding a tab, put into the tab array of descriptor the following syntax:
$this->tabs = array(
'objecttype:-tabname'
); // To remove an existing tab identified by code tabname
To replace a tab with yours
Just do step "To add your own tab" and process "To remove an existing tab". If your new tab as same title than removed one, illusion is perfect.