|
|
| Line 137: |
Line 137: |
|
| |
|
| *Part 2: A code to identify tab to add (start with +tabname1) or to remove (start with -tabname1) | | *Part 2: A code to identify tab to add (start with +tabname1) or to remove (start with -tabname1) |
| *Part 3: The title of the tab(Title1); // To remove an existing tab identified by code tabname | | *Part 3: The title of the tab(Title1). This can be a hardcoded read or better a code translation in module lang file . |
| </syntaxhighlight>. This can be a hardcoded read or better a code translation in module lang file .
| | *Part 4: The name of the file "*.lang" (mylangfile@mymodule) which contains correspondence between the code translation and language to display. If this name is followed with @mymodule, Dolibarr will search translation file "*.lang" within the module in htdocs/custom/mymodule/langs/code_CODE/mylangfile.lang, otherwise Dolibarr will look for file in htdocs/langs/code_CODE/mylangfile.lang |
| *Part 4: The name of the file "*.lang" (<syntaxhighlight lang="PHP"> | | *Part 5: A condition to test if tab must be visible($user->rights->mymodule->read) '''or''' put 1 to be always visible. |
| // Array to add new pages in new tabs or remove existing one
| | *Part 6: The URL of the page to display when you click on the tab (/mymodule/mypagetab1.php). The __ID__ string will be replaced automatically by the Id of the element concerned. |
| $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // To add a new tab identified by code tabname1
| |
| 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // To add a new tab identified by code tabname2
| |
| 'objecttype:-tabname'); // To remove an existing tab identified by code tabname
| |
| </syntaxhighlight> which contains correspondence between the code translation and language to display. If this name is followed with @mymodule, Dolibarr will search translation file "*.lang" within the module in htdocs/custom/mymodule/langs/code_CODE/mylangfile.lang, otherwise Dolibarr will look for file in htdocs/langs/code_CODE/mylangfile.lang
| |
| *Part 5: A condition to test if tab must be visible(<syntaxhighlight lang="PHP"> | |
| // Array to add new pages in new tabs or remove existing one
| |
| $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // To add a new tab identified by code tabname1
| |
| 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // To add a new tab identified by code tabname2
| |
| 'objecttype:-tabname'); // To remove an existing tab identified by code tabname
| |
| </syntaxhighlight>) '''or''' put 1 to be always visible.
| |
| *Part 6: The URL of the page to display when you click on the tab(<syntaxhighlight lang="PHP"> | |
| // Array to add new pages in new tabs or remove existing one
| |
| $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // To add a new tab identified by code tabname1
| |
| 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // To add a new tab identified by code tabname2
| |
| 'objecttype:-tabname'); // To remove an existing tab identified by code tabname
| |
| </syntaxhighlight>. The __ID__ string will be replaced automatically by the Id of the element concerned.
| |
|
| |
|
| To feed the contents of the tab with data from the database, see the next chapter. | | To feed the contents of the tab with data from the database, see the next chapter. |