27 if (!defined(
'NOLOGIN')) {
28 define(
'NOLOGIN',
'1');
30 if (!defined(
'NOCSRFCHECK')) {
31 define(
'NOCSRFCHECK',
'1');
33 if (!defined(
'NOBROWSERNOTIF')) {
34 define(
'NOBROWSERNOTIF', 1);
36 if (!defined(
'NOIPCHECK')) {
37 define(
'NOIPCHECK',
'1');
40 require
'../../main.inc.php';
41 require_once
'../../core/lib/functions2.lib.php';
43 $langs->loadLangs(array(
"main",
"install",
"other"));
45 $conf->dol_hide_topmenu =
GETPOST(
'dol_hide_topmenu',
'int');
46 $conf->dol_hide_leftmenu =
GETPOST(
'dol_hide_leftmenu',
'int');
47 $conf->dol_optimize_smallscreen =
GETPOST(
'dol_optimize_smallscreen',
'int');
48 $conf->dol_no_mouse_hover =
GETPOST(
'dol_no_mouse_hover',
'int');
49 $conf->dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int');
52 global $dolibarr_main_demo;
53 if (empty($dolibarr_main_demo)) {
54 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);
58 $res = $hookmanager->initHooks(array(
'demo'));
60 $demoprofiles = array();
61 $alwayscheckedmodules = array();
62 $alwaysuncheckedmodules = array();
63 $alwayshiddencheckedmodules = array();
64 $alwayshiddenuncheckedmodules = array();
67 $url .= ($url ?
'&' :
'').($conf->dol_hide_topmenu ?
'dol_hide_topmenu='.$conf->dol_hide_topmenu :
'');
68 $url .= ($url ?
'&' :
'').($conf->dol_hide_leftmenu ?
'dol_hide_leftmenu='.$conf->dol_hide_leftmenu :
'');
69 $url .= ($url ?
'&' :
'').($conf->dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen :
'');
70 $url .= ($url ?
'&' :
'').($conf->dol_no_mouse_hover ?
'dol_no_mouse_hover='.$conf->dol_no_mouse_hover :
'');
71 $url .= ($url ?
'&' :
'').($conf->dol_use_jmobile ?
'dol_use_jmobile='.$conf->dol_use_jmobile :
'');
72 $url = DOL_URL_ROOT.
'/index.php'.($url ?
'?'.$url :
'');
75 $parameters = array();
76 $object =
new stdClass();
77 $reshook = $hookmanager->executeHooks(
'addDemoProfile', $parameters, $object, $tmpaction);
78 $error = $hookmanager->error; $errors = $hookmanager->errors;
79 if (empty($reshook)) {
80 $demoprofiles = array(
81 array(
'default'=>
'1',
'key'=>
'profdemoservonly',
'label'=>
'DemoCompanyServiceOnly',
82 'disablemodules'=>
'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos',
84 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-service.jpg',
87 array(
'default'=>
'0',
'key'=>
'profmanufacture',
'label'=>
'DemoCompanyManufacturing',
88 'disablemodules'=>
'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service',
89 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-manufacturing.jpg',
92 array(
'default'=>
'0',
'key'=>
'profdemoprodstock',
'label'=>
'DemoCompanyProductAndStocks',
93 'disablemodules'=>
'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service',
95 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-product.jpg',
98 array(
'default'=>
'0',
'key'=>
'profdemofun2',
'label'=>
'DemoFundation2',
99 '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',
101 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-foundation.jpg',
105 array(
'default'=>
'0',
'key'=>
'profdemoall',
'label'=>
'ChooseYourDemoProfilMore',
106 'disablemodules'=>
'adherent,cashdesk,don,externalsite,mailmanspip',
108 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-all.jpg'
114 $alwayscheckedmodules = array(
'barcode',
'bookmark',
'categorie',
'externalrss',
'fckeditor',
'geoipmaxmind',
'gravatar',
'memcached',
'syslog',
'user',
'webservices');
115 $alwaysuncheckedmodules = array(
'dav',
'dynamicprices',
'incoterm',
'loan',
'multicurrency',
'paybox',
'paypal',
'stripe',
'google',
'printing',
'scanner',
'skype',
'website');
117 $alwayshiddencheckedmodules = array(
'accounting',
'api',
'barcode',
'blockedlog',
'bookmark',
'clicktodial',
'comptabilite',
'cron',
'document',
'domain',
'externalrss',
'externalsite',
'fckeditor',
'geoipmaxmind',
'gravatar',
'label',
'ldap',
118 'mailmanspip',
'notification',
'oauth',
'syslog',
'user',
'webservices',
'workflow',
120 'memcached',
'numberwords',
'zipautofillfr');
121 $alwayshiddenuncheckedmodules = array(
'cashdesk',
'collab',
'dav',
'debugbar',
'emailcollector',
'ftp',
'hrm',
'modulebuilder',
'printing',
'webservicesclient',
'zappier',
123 'awstats',
'bittorrent',
'bootstrap',
'cabinetmed',
'cmcic',
'concatpdf',
'customfield',
'datapolicy',
'deplacement',
'dolicloud',
'filemanager',
'lightbox',
'mantis',
'monitoring',
'moretemplates',
'multicompany',
'nltechno',
'numberingpack',
'openstreetmap',
124 'ovh',
'phenix',
'phpsysinfo',
'pibarcode',
'postnuke',
'dynamicprices',
'receiptprinter',
'selectbank',
'skincoloreditor',
'submiteverywhere',
'survey',
'thomsonphonebook',
'topten',
'tvacerfa',
'voyage',
'webcalendar',
'webmail');
128 $dirlist = $conf->file->dol_document_root;
143 foreach ($modulesdir as $dir) {
145 $handle = @opendir($dir);
146 if (is_resource($handle)) {
147 while (($file = readdir($handle)) !==
false) {
149 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
150 $modName = substr($file, 0,
dol_strlen($file) - 10);
154 include_once $dir.$file;
155 $objMod =
new $modName($db);
157 if ($objMod->numero > 0) {
158 $j = $objMod->numero;
163 $modulequalified = 1;
166 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
167 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) {
168 $modulequalified = 0;
170 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) {
171 $modulequalified = 0;
174 if ($modulequalified) {
175 $modules[$i] = $objMod;
176 $filename[$i] = $modName;
177 $orders[$i] = $objMod->family.
"_".$j;
179 $dirmod[$i] = $dirroot;
184 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
200 if (
GETPOST(
'action',
'aZ09') ==
'gotodemo') {
205 foreach ($demoprofiles as $profilearray) {
206 if ($profilearray[
'key'] ==
GETPOST(
"demochoice")) {
207 $disablestring = $profilearray[
'disablemodules'];
213 foreach ($modules as $val) {
214 $modulekeyname = strtolower($val->name);
215 if (!
GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) {
216 $disablestring .= $modulekeyname.
',';
217 if ($modulekeyname ==
'propale') {
218 $disablestring .=
'propal,';
224 if ($disablestring) {
226 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'urlfrom='.urlencode(
GETPOST(
'urlfrom',
'alpha'));
228 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'disablemodules='.$disablestring;
230 header(
"Location: ".$url);
241 $head .=
'<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'.
"\n";
242 $head .=
'<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'.
"\n";
245 <script type="text/javascript">
247 jQuery(document).ready(function () {
248 jQuery("tr.moduleline").hide();
249 // Enable this to allow personalized setup
250 jQuery(".modulelineshow").attr("href","#a1profdemoall");
251 jQuery(".cursorpointer").css("cursor","pointer");
252 jQuery(".modulelineshow").click(function() {
253 console.log("We select the custom demo");
254 var idstring=$(this).attr("id");
255 if (typeof idstring != "undefined")
257 var currentId = idstring.substring(2);
258 jQuery("tr.moduleline").hide();
259 if (currentId != openedId)
262 jQuery("#tr1"+currentId).show();
263 jQuery("#tr2"+currentId).show();
276 print
'<div class="demoban demobackground">';
277 print
'<div class="right" style="padding-right: 30px; padding-top: 30px;">';
278 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>';
282 print
'<div class="demobantext" style="max-width: 1024px;">';
283 print
'<div style="font-size: 20px; padding: 40px;">';
284 print
'<div class="hideonsmartphone" style="text-align: justify;">'.$langs->trans(
"DemoDesc").
'</div><br>';
285 print
'<div class="titre"><span style="font-size: 20px">'.$langs->trans(
"ChooseYourDemoProfil").
'</span></div>';
290 print
'<div class="clearboth"></div>';
291 print
'<div class="demobanbox">';
294 foreach ($demoprofiles as $profilearray) {
295 if ($profilearray[
'default'] >= 0) {
297 if (!empty($profilearray[
'lang'])) {
298 $langs->load($profilearray[
'lang']);
301 $url = $_SERVER[
"PHP_SELF"].
'?action=gotodemo';
302 $urlwithmod = $url.
'&demochoice='.$profilearray[
'key'];
306 $urlfrom = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/i',
'', $_SERVER[
"PHP_SELF"]);
309 if (!empty($profilearray[
'url'])) {
310 $urlwithmod = $profilearray[
'url'];
311 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'urlfrom='.urlencode($urlfrom);
312 if (!empty($profilearray[
'disablemodules'])) {
313 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'disablemodules='.$profilearray[
'disablemodules'];
317 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'])) {
354 print
'<div id="tr1'.$profilearray[
'key'].
'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:0.75em; line-height: 130%; padding-bottom: 8px">';
356 print
'<span class="opacitymedium">'.$langs->trans(
"ThisIsListOfModules").
'</span><br><br>';
358 print
'<div class="csscolumns">';
360 $listofdisabledmodules = explode(
',', $profilearray[
'disablemodules']);
364 foreach ($orders as $index => $key) {
366 $val = $modules[$index];
367 $modulekeyname = strtolower($val->name);
369 $modulequalified = 1;
370 if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) {
371 $modulequalified = 0;
373 if ($val->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) {
374 $modulequalified = 0;
376 if ($val->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) {
377 $modulequalified = 0;
379 if (!$modulequalified) {
383 if (in_array($modulekeyname, $alwayshiddencheckedmodules)) {
384 print
"\n".
'<!-- Module '.$modulekeyname.
' hidden and always checked -->';
385 print
'<input type="hidden" name="'.$modulekeyname.
'" value="1">';
389 print
'<!-- id='.$val->numero.
' -->';
390 print
'<div class="nowrap">';
391 print
'<input type="checkbox" class="checkbox valignmiddle paddingright" id="id'.$modulekeyname.
'" name="'.$modulekeyname.
'" value="1" title="'.
dol_escape_htmltag($val->getName()).
'"';
393 if (in_array($modulekeyname, $alwaysuncheckedmodules)) {
394 $disabled =
'disabled';
397 if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) {
408 print
'<label for="id'.$modulekeyname.
'" class="inline-block demomaxoveflow valignmiddle paddingleft'.($disabled ?
' opacitymedium' :
'').
'" title="'.
dol_escape_htmltag($val->getName()).
'">'.$val->getName().
'</label><br>';
417 print
'<br><div class="center">';
418 print
'<input type="submit" value=" '.$langs->trans(
"Start").
' " class="button">';
425 print
'</div></div>';
426 print
'</form>'.
"\n";
439 if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
440 if (empty($conf->dol_use_jmobile)) {
441 print
'<div align="center">'.
"\n";
442 print
'<script><!--'.
"\n";
443 print
'google_ad_client = "'.$conf->global->MAIN_GOOGLE_AD_CLIENT.
'";'.
"\n";
444 print
'google_ad_slot = "'.$conf->global->MAIN_GOOGLE_AD_SLOT.
'";'.
"\n";
445 print
'google_ad_width = '.$conf->global->MAIN_GOOGLE_AD_WIDTH.
';'.
"\n";
446 print
'google_ad_height = '.$conf->global->MAIN_GOOGLE_AD_HEIGHT.
';'.
"\n";
448 print
'</script>'.
"\n";
449 print
'<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>'.
"\n";
452 print
'<!-- google js advert tag disabled with jmobile -->'.
"\n";
472 top_htmlhead($head, $title, 0, 0, array(), array(
'public/demo/demo.css'), 0, 1);
474 print
'<body class="demobody"><div class="demobackgrounddiv">'.
"\n";
487 print
"</div></body>\n";