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);
95if (!isModEnabled(
'multicompany')) {
96 $langs->load(
"admin");
97 $bookmarkList .=
'<br><span class="opacitymedium">'.$langs->trans(
"WarningModuleNotActive", $langs->transnoentitiesnoconv(
"MultiCompany")).
'</span>';
98 $bookmarkList .=
'<br><br>';
101 $hookmanager->initHooks(array(
'multicompany'));
104 $multicompanyList =
'';
108 if (is_object($mc)) {
109 $listofentities = $mc->getEntitiesList($user->login,
false,
true);
112 $multicompanyList .=
'<ul class="ullistonly left" style="list-style: none;">';
113 foreach ($listofentities as $entityid => $entitycursor) {
114 $url = DOL_URL_ROOT.
'/core/multicompany_page.php?action=switchentity&token='.newToken().
'&entity='.((int) $entityid).($backtourl ?
'&backtourl='.urlencode($backtourl) :
'');
115 $multicompanyList .=
'<li class="lilistonly" style="height: 2.5em; font-size: 1.15em;">';
116 $multicompanyList .=
'<a class="dropdown-item multicompany-item" id="multicompany-item-'.$entityid.
'" data-id="'.$entityid.
'" href="'.
dol_escape_htmltag($url).
'">';
117 $multicompanyList .=
img_picto(
'',
'entity',
'class="pictofixedwidth"');
119 if ($conf->entity == $entityid) {
120 $multicompanyList .=
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
122 $multicompanyList .=
'</a>';
123 $multicompanyList .=
'</li>';
125 $multicompanyList .=
'</ul>';
127 $searchForm .=
'<input name="bookmark" id="top-multicompany-search-input" class="dropdown-search-input" placeholder="'.$langs->trans(
'Entity').
'" autocomplete="off" >';
131 $parameters = array(
'multicompany'=>$multicompanyList);
132 $reshook = $hookmanager->executeHooks(
'printMultiCompanyEntities', $parameters);
133 if (empty($reshook)) {
134 $multicompanyList .= $hookmanager->resPrint;
136 $multicompanyList = $hookmanager->resPrint;
141 print
"<!-- Begin Multicompany list -->\n";
142 print
'<div class="center"><div class="center" style="padding: 6px;">';
143 print
'<style>.menu_titre { padding-top: 7px; }</style>';
144 print
'<div id="blockvmenusearch" class="tagtable center searchpage">'.
"\n";
145 print $multicompanyList;
147 print
'</div></div>';
148 print
"\n<!-- End SearchForm -->\n";
152print
'</body></html>'.
"\n";
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='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.