From eb8ac6c1b0ab6a4a57c90c98a3110b0df09b01c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jan 2010 16:58:57 +0000 Subject: [PATCH] New: Modules can add their own tab on projects cards --- ChangeLog | 6 +++--- htdocs/lib/project.lib.php | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c53d58dc1e..f000dbe026b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,9 +25,9 @@ For users: - Fix: Running sending-email.php For developers: -- Reorganize /dev directory. -- Change the way items are linked together. - +- Qual: Reorganize /dev directory. +- Qual: Change the way items are linked together. +- New: Modules can add their own tab on projects cards. ***** ChangeLog for 2.7.1 compared to 2.7 ***** diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php index 0f73b1f7982..956c3f50384 100644 --- a/htdocs/lib/project.lib.php +++ b/htdocs/lib/project.lib.php @@ -52,6 +52,23 @@ function project_prepare_head($objsoc) $h++; } + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__'); + if (is_array($conf->tabs_modules['project'])) + { + $i=0; + foreach ($conf->tabs_modules['project'] as $value) + { + $values=explode(':',$value); + if ($values[2]) $langs->load($values[2]); + $head[$h][0] = preg_replace('/__ID__/i',$objsoc->id,$values[3]); + $head[$h][1] = $langs->trans($values[1]); + $head[$h][2] = 'tab'.$values[1]; + $h++; + } + } + return $head; } @@ -83,6 +100,23 @@ function task_prepare_head($object) $head[$h][2] = 'who'; $h++; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__'); + if (is_array($conf->tabs_modules['task'])) + { + $i=0; + foreach ($conf->tabs_modules['task'] as $value) + { + $values=explode(':',$value); + if ($values[2]) $langs->load($values[2]); + $head[$h][0] = preg_replace('/__ID__/i',$objsoc->id,$values[3]); + $head[$h][1] = $langs->trans($values[1]); + $head[$h][2] = 'tab'.$values[1]; + $h++; + } + } + return $head; }