Add: external module tab

This commit is contained in:
Regis Houssin
2010-09-17 05:18:01 +00:00
parent 30ed46efd0
commit adab5f7722
3 changed files with 77 additions and 21 deletions

View File

@@ -111,6 +111,9 @@ class modMyModule extends DolibarrModules
// 'propal' to add a tab in propal view // 'propal' to add a tab in propal view
// 'member' to add a tab in fundation member view // 'member' to add a tab in fundation member view
// 'contract' to add a tab in contract 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
// Boxes // Boxes

View File

@@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -28,17 +29,17 @@
/** /**
* Enter description here... * Enter description here...
* *
* @param $contrat * @param $object
* @return array * @return array
*/ */
function contact_prepare_head($contrat) function contact_prepare_head($object)
{ {
global $langs, $conf; global $langs, $conf;
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$object->id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'general'; $head[$h][2] = 'general';
$h++; $h++;
@@ -47,26 +48,43 @@ function contact_prepare_head($contrat)
{ {
$langs->load("ldap"); $langs->load("ldap");
$head[$h][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$object->id;
$head[$h][1] = $langs->trans("LDAPCard"); $head[$h][1] = $langs->trans("LDAPCard");
$head[$h][2] = 'ldap'; $head[$h][2] = 'ldap';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$object->id;
$head[$h][1] = $langs->trans("PersonalInformations"); $head[$h][1] = $langs->trans("PersonalInformations");
$head[$h][2] = 'perso'; $head[$h][2] = 'perso';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$object->id;
$head[$h][1] = $langs->trans("ExportImport"); $head[$h][1] = $langs->trans("ExportImport");
$head[$h][2] = 'exportimport'; $head[$h][2] = 'exportimport';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['contact']))
{
$i=0;
foreach ($conf->tabs_modules['contact'] as $value)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = DOL_URL_ROOT . preg_replace('/__ID__/i',$object->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head; return $head;
} }

View File

@@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -23,7 +24,7 @@
* \brief Ensemble de fonctions de base pour la gestion des utilisaterus et groupes * \brief Ensemble de fonctions de base pour la gestion des utilisaterus et groupes
* \version $Id$ * \version $Id$
*/ */
function user_prepare_head($user) function user_prepare_head($object)
{ {
global $langs, $conf; global $langs, $conf;
$langs->load("users"); $langs->load("users");
@@ -31,7 +32,7 @@ function user_prepare_head($user)
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$user->id; $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserCard"); $head[$h][1] = $langs->trans("UserCard");
$head[$h][2] = 'user'; $head[$h][2] = 'user';
$h++; $h++;
@@ -39,52 +40,69 @@ function user_prepare_head($user)
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE) if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
{ {
$langs->load("ldap"); $langs->load("ldap");
$head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$user->id; $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id;
$head[$h][1] = $langs->trans("LDAPCard"); $head[$h][1] = $langs->trans("LDAPCard");
$head[$h][2] = 'ldap'; $head[$h][2] = 'ldap';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$user->id; $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserRights"); $head[$h][1] = $langs->trans("UserRights");
$head[$h][2] = 'rights'; $head[$h][2] = 'rights';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$user->id; $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserGUISetup"); $head[$h][1] = $langs->trans("UserGUISetup");
$head[$h][2] = 'guisetup'; $head[$h][2] = 'guisetup';
$h++; $h++;
if ($conf->clicktodial->enabled) if ($conf->clicktodial->enabled)
{ {
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$user->id; $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
$head[$h][1] = $langs->trans("ClickToDial"); $head[$h][1] = $langs->trans("ClickToDial");
$head[$h][2] = 'clicktodial'; $head[$h][2] = 'clicktodial';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$user->id; $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
$head[$h][1] = $langs->trans("Note"); $head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$user->id; $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['user']))
{
$i=0;
foreach ($conf->tabs_modules['user'] as $value)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = DOL_URL_ROOT . preg_replace('/__ID__/i',$object->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head; return $head;
} }
function group_prepare_head($group) function group_prepare_head($object)
{ {
global $langs, $conf; global $langs, $conf;
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/user/group/fiche.php?id='.$group->id; $head[$h][0] = DOL_URL_ROOT.'/user/group/fiche.php?id='.$object->id;
$head[$h][1] = $langs->trans("GroupCard"); $head[$h][1] = $langs->trans("GroupCard");
$head[$h][2] = 'group'; $head[$h][2] = 'group';
$h++; $h++;
@@ -92,16 +110,33 @@ function group_prepare_head($group)
if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE) if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE)
{ {
$langs->load("ldap"); $langs->load("ldap");
$head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$group->id; $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id;
$head[$h][1] = $langs->trans("LDAPCard"); $head[$h][1] = $langs->trans("LDAPCard");
$head[$h][2] = 'ldap'; $head[$h][2] = 'ldap';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$group->id; $head[$h][0] = DOL_URL_ROOT.'/user/group/perms.php?id='.$object->id;
$head[$h][1] = $langs->trans("GroupRights"); $head[$h][1] = $langs->trans("GroupRights");
$head[$h][2] = 'rights'; $head[$h][2] = 'rights';
$h++; $h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['group']))
{
$i=0;
foreach ($conf->tabs_modules['group'] as $value)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = DOL_URL_ROOT . preg_replace('/__ID__/i',$object->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head; return $head;
} }