31if (!defined(
'NOCSRFCHECK')) {
32 define(
'NOCSRFCHECK', 1);
34if (!defined(
'NOTOKENRENEWAL')) {
35 define(
'NOTOKENRENEWAL', 1);
38if (!defined(
'NOREQUIREMENU')) {
39 define(
'NOREQUIREMENU', 1);
43require_once
'../main.inc.php';
45$action =
GETPOST(
'action',
'aZ');
47$backtourl =
GETPOST(
'backtourl');
48if (empty($backtourl)) {
49 $backtourl = DOL_URL_ROOT;
53 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
58$right = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'left' :
'right');
59$left = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'right' :
'left');
67if ($action ==
'switchentity') {
69 $mc->switchEntity($entityid);
72 header(
"Location: ".$backtourl);
82$title = $langs->trans(
"Multicompanies");
85$head =
'<!-- Multicompany selection -->'.
"\n";
88top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
97if (!isModEnabled(
'multicompany')) {
98 $langs->load(
"admin");
99 $bookmarkList .=
'<br><span class="opacitymedium">'.$langs->trans(
"WarningModuleNotActive", $langs->transnoentitiesnoconv(
"MultiCompany")).
'</span>';
100 $bookmarkList .=
'<br><br>';
103 $hookmanager->initHooks(array(
'multicompany'));
106 $multicompanyList =
'';
110 if (is_object($mc)) {
111 $listofentities = $mc->getEntitiesList($user->login,
false,
true);
113 $listofentities = array();
116 $multicompanyList .=
'<ul class="ullistonly left" style="list-style: none;">';
117 foreach ($listofentities as $entityid => $entitycursor) {
118 $url = DOL_URL_ROOT.
'/core/multicompany_page.php?action=switchentity&token='.newToken().
'&entity='.((int) $entityid).($backtourl ?
'&backtourl='.urlencode($backtourl) :
'');
119 $multicompanyList .=
'<li class="lilistonly" style="height: 2.5em; font-size: 1.15em;">';
120 $multicompanyList .=
'<a class="dropdown-item multicompany-item" id="multicompany-item-'.$entityid.
'" data-id="'.$entityid.
'" href="'.
dol_escape_htmltag($url).
'">';
121 $multicompanyList .=
img_picto(
'',
'entity',
'class="pictofixedwidth"');
123 if ($conf->entity == $entityid) {
124 $multicompanyList .=
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
126 $multicompanyList .=
'</a>';
127 $multicompanyList .=
'</li>';
129 $multicompanyList .=
'</ul>';
131 $searchForm .=
'<input name="bookmark" id="top-multicompany-search-input" class="dropdown-search-input" placeholder="'.$langs->trans(
'Entity').
'" autocomplete="off" >';
135 $parameters = array(
'multicompany' => $multicompanyList);
136 $reshook = $hookmanager->executeHooks(
'printMultiCompanyEntities', $parameters);
137 if (empty($reshook)) {
138 $multicompanyList .= $hookmanager->resPrint;
140 $multicompanyList = $hookmanager->resPrint;
145 print
"<!-- Begin Multicompany list -->\n";
146 print
'<div class="center"><div class="center" style="padding: 6px;">';
147 print
'<style>.menu_titre { padding-top: 7px; }</style>';
148 print
'<div id="blockvmenusearch" class="tagtable center searchpage">'.
"\n";
149 print $multicompanyList;
151 print
'</div></div>';
152 print
"\n<!-- End SearchForm -->\n";
156print
'</body></html>'.
"\n";
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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)
Output html header of a page.