2
0
forked from Wavyzz/dolibarr

Work on multicompany

This commit is contained in:
Regis Houssin
2010-10-21 19:56:42 +00:00
parent 423f99ef15
commit 8753a8cdeb
2 changed files with 14 additions and 10 deletions

View File

@@ -1063,22 +1063,25 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8')
/** /**
* \brief Show a picto according to module/object (generic function) * Show a picto according to module/object (generic function)
* \param alt Text of alt on image * @param alt Text of alt on image
* \param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...) * @param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...)
* Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module * Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module
* @param cssclass Define a specific css class
* \return string Retourne tag img * \return string Retourne tag img
*/ */
function img_object($alt, $object) function img_object($alt, $object, $cssclass='')
{ {
global $conf,$langs; global $conf,$langs;
$cssclass = (!empty($cssclass)?'class="'.$cssclass.'"':'');
if (preg_match('/^([^@]+)@([^@]+)$/i',$object,$regs)) if (preg_match('/^([^@]+)@([^@]+)$/i',$object,$regs))
{ {
return '<img src="'.DOL_URL_ROOT.'/'.$regs[2].'/img/object_'.$regs[1].'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'">'; return '<img src="'.DOL_URL_ROOT.'/'.$regs[2].'/img/object_'.$regs[1].'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'" '.$cssclass.'>';
} }
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/object_'.$object.'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'">'; return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/object_'.$object.'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'" '.$cssclass.'>';
} }
/** /**

View File

@@ -968,10 +968,11 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$res=@include_once(DOL_DOCUMENT_ROOT.'/multicompany/class/actions_multicompany.class.php'); $res=@include_once(DOL_DOCUMENT_ROOT.'/multicompany/class/actions_multicompany.class.php');
if ($res) if ($res)
{ {
$mc = new ActionsMulticompany($db); //$mc = new ActionsMulticompany($db);
$entitytext = img_object('', 'globe','entity');
$select_entity = '<div class="loginSelectEntity">'.$mc->select_entities($conf->entity).'</div>'; print $entitytext;
if ($mc->numEntity > 1) print $select_entity; //$select_entity = '<div class="loginSelectEntity">'.$mc->select_entities($conf->entity).'</div>';
//if ($mc->numEntity >= 1) print $select_entity;
} }
} }
} }