27 if (!defined(
'NOLOGIN')) define(
'NOLOGIN',
'1');
28 if (!defined(
'NOCSRFCHECK')) define(
'NOCSRFCHECK',
'1');
29 if (!defined(
'NOBROWSERNOTIF')) define(
'NOBROWSERNOTIF', 1);
30 if (!defined(
'NOIPCHECK')) define(
'NOIPCHECK',
'1');
32 require
'../../main.inc.php';
33 require_once
'../../core/lib/functions2.lib.php';
35 $langs->loadLangs(array(
"main",
"install",
"other"));
37 $conf->dol_hide_topmenu =
GETPOST(
'dol_hide_topmenu',
'int');
38 $conf->dol_hide_leftmenu =
GETPOST(
'dol_hide_leftmenu',
'int');
39 $conf->dol_optimize_smallscreen =
GETPOST(
'dol_optimize_smallscreen',
'int');
40 $conf->dol_no_mouse_hover =
GETPOST(
'dol_no_mouse_hover',
'int');
41 $conf->dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int');
44 global $dolibarr_main_demo;
45 if (empty($dolibarr_main_demo))
accessforbidden(
'Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page', 0, 0, 1);
48 $res = $hookmanager->initHooks(array(
'demo'));
50 $demoprofiles = array();
51 $alwayscheckedmodules = array();
52 $alwaysuncheckedmodules = array();
53 $alwayshiddencheckedmodules = array();
54 $alwayshiddenuncheckedmodules = array();
57 $url .= ($url ?
'&' :
'').($conf->dol_hide_topmenu ?
'dol_hide_topmenu='.$conf->dol_hide_topmenu :
'');
58 $url .= ($url ?
'&' :
'').($conf->dol_hide_leftmenu ?
'dol_hide_leftmenu='.$conf->dol_hide_leftmenu :
'');
59 $url .= ($url ?
'&' :
'').($conf->dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen :
'');
60 $url .= ($url ?
'&' :
'').($conf->dol_no_mouse_hover ?
'dol_no_mouse_hover='.$conf->dol_no_mouse_hover :
'');
61 $url .= ($url ?
'&' :
'').($conf->dol_use_jmobile ?
'dol_use_jmobile='.$conf->dol_use_jmobile :
'');
62 $url = DOL_URL_ROOT.
'/index.php'.($url ?
'?'.$url :
'');
65 $parameters = array();
66 $object =
new stdClass();
67 $reshook = $hookmanager->executeHooks(
'addDemoProfile', $parameters, $object, $tmpaction);
68 $error = $hookmanager->error; $errors = $hookmanager->errors;
71 $demoprofiles = array(
72 array(
'default'=>
'1',
'key'=>
'profdemoservonly',
'label'=>
'DemoCompanyServiceOnly',
73 'disablemodules'=>
'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos',
75 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-service.jpg',
78 array(
'default'=>
'0',
'key'=>
'profmanufacture',
'label'=>
'DemoCompanyManufacturing',
79 'disablemodules'=>
'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service',
80 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-manufacturing.jpg',
83 array(
'default'=>
'0',
'key'=>
'profdemoprodstock',
'label'=>
'DemoCompanyProductAndStocks',
84 'disablemodules'=>
'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service',
86 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-product.jpg',
89 array(
'default'=>
'0',
'key'=>
'profdemofun2',
'label'=>
'DemoFundation2',
90 'disablemodules'=>
'barcode,cashdesk,bom,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax,takepos',
92 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-foundation.jpg',
96 array(
'default'=>
'0',
'key'=>
'profdemoall',
'label'=>
'ChooseYourDemoProfilMore',
97 'disablemodules'=>
'adherent,cashdesk,don,externalsite,mailmanspip',
99 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-all.jpg'
105 $alwayscheckedmodules = array(
'barcode',
'bookmark',
'categorie',
'externalrss',
'fckeditor',
'geoipmaxmind',
'gravatar',
'memcached',
'syslog',
'user',
'webservices');
106 $alwaysuncheckedmodules = array(
'dav',
'dynamicprices',
'incoterm',
'loan',
'multicurrency',
'paybox',
'paypal',
'stripe',
'google',
'printing',
'scanner',
'skype',
'website');
108 $alwayshiddencheckedmodules = array(
'accounting',
'api',
'barcode',
'blockedlog',
'bookmark',
'clicktodial',
'comptabilite',
'cron',
'document',
'domain',
'externalrss',
'externalsite',
'fckeditor',
'geoipmaxmind',
'gravatar',
'label',
'ldap',
109 'mailmanspip',
'notification',
'oauth',
'syslog',
'user',
'webservices',
'workflow',
111 'memcached',
'numberwords',
'zipautofillfr');
112 $alwayshiddenuncheckedmodules = array(
'collab',
'dav',
'debugbar',
'emailcollector',
'ftp',
'hrm',
'modulebuilder',
'printing',
'webservicesclient',
'zappier',
114 'awstats',
'bittorrent',
'bootstrap',
'cabinetmed',
'cmcic',
'concatpdf',
'customfield',
'datapolicy',
'deplacement',
'dolicloud',
'filemanager',
'lightbox',
'mantis',
'monitoring',
'moretemplates',
'multicompany',
'nltechno',
'numberingpack',
'openstreetmap',
115 'ovh',
'phenix',
'phpsysinfo',
'pibarcode',
'postnuke',
'dynamicprices',
'receiptprinter',
'selectbank',
'skincoloreditor',
'submiteverywhere',
'survey',
'thomsonphonebook',
'topten',
'tvacerfa',
'voyage',
'webcalendar',
'webmail');
119 $dirlist = $conf->file->dol_document_root;
134 foreach ($modulesdir as $dir)
137 $handle = @opendir($dir);
138 if (is_resource($handle))
140 while (($file = readdir($handle)) !==
false)
143 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php')
145 $modName = substr($file, 0,
dol_strlen($file) - 10);
150 include_once $dir.$file;
151 $objMod =
new $modName($db);
153 if ($objMod->numero > 0)
155 $j = $objMod->numero;
160 $modulequalified = 1;
163 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
164 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified = 0;
165 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified = 0;
167 if ($modulequalified)
169 $modules[$i] = $objMod;
170 $filename[$i] = $modName;
171 $orders[$i] = $objMod->family.
"_".$j;
173 $dirmod[$i] = $dirroot;
179 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
195 if (
GETPOST(
'action',
'aZ09') ==
'gotodemo')
202 foreach ($demoprofiles as $profilearray)
204 if ($profilearray[
'key'] ==
GETPOST(
"demochoice"))
206 $disablestring = $profilearray[
'disablemodules'];
212 foreach ($modules as $val)
214 $modulekeyname = strtolower($val->name);
215 if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules))
217 $disablestring .= $modulekeyname.
',';
218 if ($modulekeyname ==
'propale') $disablestring .=
'propal,';
225 if (
GETPOST(
'urlfrom')) $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'urlfrom='.urlencode(
GETPOST(
'urlfrom',
'alpha'));
226 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'disablemodules='.$disablestring;
228 header(
"Location: ".$url);
239 $head .=
'<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'.
"\n";
240 $head .=
'<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'.
"\n";
243 <script type="text/javascript">
245 jQuery(document).ready(function () {
246 jQuery("tr.moduleline").hide();
247 // Enable this to allow personalized setup
248 jQuery(".modulelineshow").attr("href","#a1profdemoall");
249 jQuery(".cursorpointer").css("cursor","pointer");
250 jQuery(".modulelineshow").click(function() {
251 var idstring=$(this).attr("id");
252 if (typeof idstring != "undefined")
254 var currentId = idstring.substring(2);
255 jQuery("tr.moduleline").hide();
256 if (currentId != openedId)
259 jQuery("#tr1"+currentId).show();
260 jQuery("#tr2"+currentId).show();
273 print
'<div class="demoban demobackground">';
274 print
'<div class="right" style="padding-right: 30px; padding-top: 30px;">';
275 print
'<a alt="Official portal of your ERP CRM application" targe="_blank" href="https://www.dolibarr.org?utm_medium=website&utm_source=demo"><img class="demologo" src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" alt="Dolibarr logo"></a>';
279 print
'<div class="demobantext" style="max-width: 1024px;">';
280 print
'<div style="font-size: 20px; padding: 40px;">';
281 print
'<div class="hideonsmartphone" style="text-align: justify;">'.$langs->trans(
"DemoDesc").
'</div><br>';
282 print
'<div class="titre"><font style="font-size: 20px">'.$langs->trans(
"ChooseYourDemoProfil").
'</font></div>';
287 print
'<div class="clearboth"></div>';
288 print
'<div class="demobanbox">';
291 foreach ($demoprofiles as $profilearray)
293 if ($profilearray[
'default'] >= 0)
296 if (!empty($profilearray[
'lang'])) $langs->load($profilearray[
'lang']);
298 $url =
$_SERVER[
"PHP_SELF"].
'?action=gotodemo';
299 $urlwithmod = $url.
'&demochoice='.$profilearray[
'key'];
303 $urlfrom = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/i',
'',
$_SERVER[
"PHP_SELF"]);
306 if (!empty($profilearray[
'url']))
308 $urlwithmod = $profilearray[
'url'];
309 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'urlfrom='.urlencode($urlfrom);
310 if (!empty($profilearray[
'disablemodules']))
312 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'disablemodules='.$profilearray[
'disablemodules'];
316 if (empty($profilearray[
'url']))
318 print
'<div class="clearboth"></div>';
321 print
'<form method="POST" class="valigntop inline-block" name="form'.$profilearray[
'key'].
'" id="form'.$profilearray[
'key'].
'" action="'.
$_SERVER[
"PHP_SELF"].
'#a1'.$profilearray[
'key'].
'">'.
"\n";
322 print
'<input type="hidden" name="action" value="gotodemo">'.
"\n";
323 print
'<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).
'">'.
"\n";
324 print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
325 print
'<input type="hidden" name="username" value="demo">'.
"\n";
326 print
'<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.
'">'.
"\n";
327 print
'<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.
'">'.
"\n";
328 print
'<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.
'">'.
"\n";
329 print
'<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.
'">'.
"\n";
330 print
'<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.
'">'.
"\n";
332 print
'<div id="div'.$profilearray[
'key'].
'" summary="Dolibarr online demonstration for profile '.$profilearray[
'label'].
'" class="center inline-block CTable CTableRow'.($i % 2 == 0 ?
'1' :
'0').
'">'.
"\n";
335 print
'<div id="a1'.$profilearray[
'key'].
'" class="demobox '.(empty($profilearray[
'url']) ?
'modulelineshow cursorpointer' :
'nomodulelines').
'">';
337 print
'<a href="'.$urlwithmod.
'" class="'.(empty($profilearray[
'url']) ?
'modulelineshow' :
'nomodulelines').
'">';
338 print
'<div style="padding: 10px;">';
340 print
'<img class="demothumb" src="'.$profilearray[
'icon'].
'" alt="Demo '.$profilearray[
'label'].
'">';
342 print
'<div class="clearboth"></div>';
344 print
'<div class="demothumbtext">';
345 print $langs->trans($profilearray[
'label']);
353 if (empty($profilearray[
'url']))
355 print
'<div id="tr1'.$profilearray[
'key'].
'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">';
357 print $langs->trans(
"ThisIsListOfModules").
'<br><br>';
359 print
'<div class="csscolumns">';
361 $listofdisabledmodules = explode(
',', $profilearray[
'disablemodules']);
363 $nbcolsmod = empty($conf->dol_optimize_smallscreen) ? 4 : 3;
365 foreach ($orders as $index => $key)
368 $val = $modules[$index];
369 $modulekeyname = strtolower($val->name);
371 $modulequalified = 1;
372 if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) $modulequalified = 0;
373 if ($val->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) $modulequalified = 0;
374 if ($val->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) $modulequalified = 0;
375 if (!$modulequalified)
continue;
377 if (in_array($modulekeyname, $alwayshiddencheckedmodules))
379 print
"\n".
'<!-- Module '.$modulekeyname.
' hidden and always checked -->';
380 print
'<input type="hidden" name="'.$modulekeyname.
'" value="1">';
382 $modulo = ($j % $nbcolsmod);
384 print
'<!-- id='.$val->numero.
' -->';
385 print
'<div class="nowrap">';
386 print
'<input type="checkbox" class="checkbox" id="id'.$modulekeyname.
'" name="'.$modulekeyname.
'" value="1" title="'.
dol_escape_htmltag($val->getName()).
'"';
387 if (in_array($modulekeyname, $alwaysuncheckedmodules)) print
' disabled';
388 if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) print
' checked';
389 print
'> <label for="id'.$modulekeyname.
'" class="inline-block demomaxoveflow" title="'.
dol_escape_htmltag($val->getName()).
'">'.$val->getName().
'</label><br>';
398 print
'<br><div class="center">';
399 print
'<input type="submit" value=" '.$langs->trans(
"Start").
' " class="button">';
405 print
'</div></div>';
406 print
'</form>'.
"\n";
417 if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT))
419 if (empty($conf->dol_use_jmobile))
421 print
'<div align="center">'.
"\n";
422 print
'<script><!--'.
"\n";
423 print
'google_ad_client = "'.$conf->global->MAIN_GOOGLE_AD_CLIENT.
'";'.
"\n";
424 print
'google_ad_slot = "'.$conf->global->MAIN_GOOGLE_AD_SLOT.
'";'.
"\n";
425 print
'google_ad_width = '.$conf->global->MAIN_GOOGLE_AD_WIDTH.
';'.
"\n";
426 print
'google_ad_height = '.$conf->global->MAIN_GOOGLE_AD_HEIGHT.
';'.
"\n";
428 print
'</script>'.
"\n";
429 print
'<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>'.
"\n";
432 print
'<!-- google js advert tag disabled with jmobile -->'.
"\n";
452 top_htmlhead($head, $title, 0, 0, array(), array(
'public/demo/demo.css'), 0, 1);
454 print
'<body class="demobody"><div class="demobackgrounddiv">'.
"\n";
467 print
"</div></body>\n";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolGetModulesDirs($subdir= '')
Return list of modules directories.
printCommonFooter($zone= 'private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print $_SERVER["PHP_SELF"]
Edit parameters.
llxHeaderVierge()
Header function.
print
Draft customers invoices.
llxFooterVierge()
Footer function.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...