30if (!defined(
'NOCSRFCHECK')) {
31 define(
'NOCSRFCHECK', 1);
33if (!defined(
'NOTOKENRENEWAL')) {
34 define(
'NOTOKENRENEWAL', 1);
37if (!defined(
'NOREQUIREMENU')) {
38 define(
'NOREQUIREMENU', 1);
42require_once
'../main.inc.php';
44$action =
GETPOST(
'action',
'aZ');
45$entityid =
GETPOST(
'entity',
'int');
46$backtourl =
GETPOST(
'backtourl');
47if (empty($backtourl)) {
48 $backtourl = DOL_URL_ROOT;
52 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
57$right = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'left' :
'right');
58$left = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'right' :
'left');
66if ($action ==
'switchentity') {
68 $mc->switchEntity($entityid);
71 header(
"Location: ".$backtourl);
81$title = $langs->trans(
"Multicompanies");
84$head =
'<!-- Multicompany selection -->'.
"\n";
87top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
95$multicompanyList =
'';
97if (!isModEnabled(
'multicompany')) {
98 $langs->load(
"admin");
99 $multicompanyList .=
'<br><span class="opacitymedium">'.$langs->trans(
"WarningModuleNotActive", $langs->transnoentitiesnoconv(
"MultiCompany")).
'</span>';
100 $multicompanyList .=
'<br><br>';
101} elseif (!empty($user->entity) && !
getDolGlobalInt(
'MULTICOMPANY_TRANSVERSE_MODE')) {
102 $langs->load(
"errors");
103 $multicompanyList .=
'<br><span class="opacitymedium">'.$langs->trans(
"ErrorForbidden").
'</span>';
104 $multicompanyList .=
'<br><br>';
107 $hookmanager->initHooks(array(
'multicompany'));
109 if (is_object($mc)) {
110 $listofentities = $mc->getEntitiesList(
true,
false,
true);
113 $multicompanyList .=
'<ul class="ullistonly left" style="list-style: none;">';
114 foreach ($listofentities as $entityid => $entitycursor) {
116 if (
getDolGlobalInt(
'MULTICOMPANY_TRANSVERSE_MODE') && !empty($user->entity) && $mc->checkRight($user->id, $entityid) < 0) {
119 $url = DOL_URL_ROOT.
'/core/multicompany_page.php?action=switchentity&token='.newToken().
'&entity='.((int) $entityid).($backtourl ?
'&backtourl='.urlencode($backtourl) :
'');
120 $multicompanyList .=
'<li class="lilistonly" style="height: 2.5em; font-size: 1.15em;">';
121 $multicompanyList .=
'<a class="dropdown-item multicompany-item" id="multicompany-item-'.$entityid.
'" data-id="'.$entityid.
'" href="'.
dol_escape_htmltag($url).
'">';
122 $multicompanyList .=
img_picto(
'',
'entity',
'class="pictofixedwidth"');
124 if ($conf->entity == $entityid) {
125 $multicompanyList .=
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
127 $multicompanyList .=
'</a>';
128 $multicompanyList .=
'</li>';
130 $multicompanyList .=
'</ul>';
133 $parameters = array(
'multicompany'=>$multicompanyList);
134 $reshook = $hookmanager->executeHooks(
'printMultiCompanyEntities', $parameters);
135 if (empty($reshook)) {
136 $multicompanyList .= $hookmanager->resPrint;
138 $multicompanyList = $hookmanager->resPrint;
143print
"<!-- Begin Multicompany list -->\n";
144print
'<div class="center"><div class="center" style="padding: 6px;">';
145print
'<style>.menu_titre { padding-top: 7px; }</style>';
146print
'<div id="blockvmenusearch" class="tagtable center searchpage">'.
"\n";
147print $multicompanyList;
150print
"\n<!-- End Multicompany list -->\n";
153print
'</body></html>'.
"\n";
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.