27if (!defined(
'NOLOGIN')) {
28 define(
'NOLOGIN',
'1');
30if (!defined(
'NOBROWSERNOTIF')) {
31 define(
'NOBROWSERNOTIF', 1);
33if (!defined(
'NOIPCHECK')) {
34 define(
'NOIPCHECK',
'1');
38require
'../../main.inc.php';
39require_once
'../../core/lib/functions2.lib.php';
41$langs->loadLangs(array(
"main",
"install",
"other"));
43$conf->dol_hide_topmenu =
GETPOST(
'dol_hide_topmenu',
'int');
44$conf->dol_hide_leftmenu =
GETPOST(
'dol_hide_leftmenu',
'int');
45$conf->dol_optimize_smallscreen =
GETPOST(
'dol_optimize_smallscreen',
'int');
46$conf->dol_no_mouse_hover =
GETPOST(
'dol_no_mouse_hover',
'int');
47$conf->dol_use_jmobile =
GETPOST(
'dol_use_jmobile',
'int');
50global $dolibarr_main_demo;
51if (empty($dolibarr_main_demo)) {
52 httponly_accessforbidden(
'Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page');
56$res = $hookmanager->initHooks(array(
'demo'));
58$demoprofiles = array();
59$alwayscheckedmodules = array();
60$alwaysuncheckedmodules = array();
61$alwayshiddencheckedmodules = array();
62$alwayshiddenuncheckedmodules = array();
65$url .= ($url ?
'&' :
'').($conf->dol_hide_topmenu ?
'dol_hide_topmenu='.$conf->dol_hide_topmenu :
'');
66$url .= ($url ?
'&' :
'').($conf->dol_hide_leftmenu ?
'dol_hide_leftmenu='.$conf->dol_hide_leftmenu :
'');
67$url .= ($url ?
'&' :
'').($conf->dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen :
'');
68$url .= ($url ?
'&' :
'').($conf->dol_no_mouse_hover ?
'dol_no_mouse_hover='.$conf->dol_no_mouse_hover :
'');
69$url .= ($url ?
'&' :
'').($conf->dol_use_jmobile ?
'dol_use_jmobile='.$conf->dol_use_jmobile :
'');
70$url = DOL_URL_ROOT.
'/index.php'.($url ?
'?'.$url :
'');
75$reshook = $hookmanager->executeHooks(
'addDemoProfile', $parameters, $object, $tmpaction);
76$error = $hookmanager->error; $errors = $hookmanager->errors;
78 $demoprofiles = array(
79 array(
'default'=>
'1',
'key'=>
'profdemoservonly',
'label'=>
'DemoCompanyServiceOnly',
80 'disablemodules'=>
'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos',
82 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-service.jpg',
85 array(
'default'=>
'0',
'key'=>
'profmanufacture',
'label'=>
'DemoCompanyManufacturing',
86 'disablemodules'=>
'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service',
87 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-manufacturing.jpg',
90 array(
'default'=>
'0',
'key'=>
'profdemoprodstock',
'label'=>
'DemoCompanyProductAndStocks',
91 'disablemodules'=>
'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service',
93 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-product.jpg',
96 array(
'default'=>
'0',
'key'=>
'profdemofun2',
'label'=>
'DemoFundation2',
97 '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',
99 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-foundation.jpg',
103 array(
'default'=>
'0',
'key'=>
'profdemoall',
'label'=>
'ChooseYourDemoProfilMore',
104 'disablemodules'=>
'adherent,cashdesk,don,externalsite,mailmanspip',
106 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-all.jpg'
112 $alwayscheckedmodules = array(
'barcode',
'bookmark',
'categorie',
'externalrss',
'fckeditor',
'geoipmaxmind',
'gravatar',
'memcached',
'syslog',
'user',
'webservices');
113 $alwaysuncheckedmodules = array(
'dav',
'dynamicprices',
'incoterm',
'loan',
'multicurrency',
'paybox',
'paypal',
'stripe',
'google',
'printing',
'scanner',
'socialnetworks',
'website');
115 $alwayshiddencheckedmodules = array(
'accounting',
'api',
'barcode',
'blockedlog',
'bookmark',
'clicktodial',
'comptabilite',
'cron',
'document',
'domain',
'externalrss',
'externalsite',
'fckeditor',
'geoipmaxmind',
'gravatar',
'label',
'ldap',
116 'mailmanspip',
'notification',
'oauth',
'syslog',
'user',
'webservices',
'workflow',
118 'memcached',
'numberwords',
'zipautofillfr');
119 $alwayshiddenuncheckedmodules = array(
'cashdesk',
'collab',
'dav',
'debugbar',
'emailcollector',
'ftp',
'hrm',
'modulebuilder',
'printing',
'webservicesclient',
'zappier',
121 'awstats',
'bittorrent',
'bootstrap',
'cabinetmed',
'cmcic',
'concatpdf',
'customfield',
'datapolicy',
'deplacement',
'dolicloud',
'filemanager',
'lightbox',
'mantis',
'monitoring',
'moretemplates',
'multicompany',
'nltechno',
'numberingpack',
'openstreetmap',
122 'ovh',
'phenix',
'phpsysinfo',
'pibarcode',
'postnuke',
'dynamicprices',
'receiptprinter',
'selectbank',
'skincoloreditor',
'submiteverywhere',
'survey',
'thomsonphonebook',
'topten',
'tvacerfa',
'voyage',
'webcalendar',
'webmail');
126$dirlist = $conf->file->dol_document_root;
140foreach ($modulesdir as $dir) {
142 $handle = @opendir($dir);
143 if (is_resource($handle)) {
144 while (($file = readdir($handle)) !==
false) {
146 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
147 $modName = substr($file, 0,
dol_strlen($file) - 10);
151 include_once $dir.$file;
152 $objMod =
new $modName($db);
154 if ($objMod->numero > 0) {
155 $j = $objMod->numero;
160 $modulequalified = 1;
163 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
165 $modulequalified = 0;
168 $modulequalified = 0;
171 if ($modulequalified) {
172 $modules[$i] = $objMod;
173 $filename[$i] = $modName;
174 $orders[$i] = $objMod->family.
"_".$j;
180 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
196if (
GETPOST(
'action',
'aZ09') ==
'gotodemo') {
201 foreach ($demoprofiles as $profilearray) {
202 if ($profilearray[
'key'] ==
GETPOST(
"demochoice")) {
203 $disablestring = $profilearray[
'disablemodules'];
209 foreach ($modules as $val) {
210 $modulekeyname = strtolower($val->name);
211 if (!
GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) {
212 $disablestring .= $modulekeyname.
',';
213 if ($modulekeyname ==
'propale') {
214 $disablestring .=
'propal,';
220 if ($disablestring) {
222 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'urlfrom='.urlencode(
GETPOST(
'urlfrom',
'alpha'));
224 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'disablemodules='.$disablestring;
226 header(
"Location: ".$url);
237$head .=
'<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'.
"\n";
238$head .=
'<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'.
"\n";
241<script type="text/javascript">
243jQuery(document).ready(function () {
244 jQuery("tr.moduleline").hide();
245 // Enable this to allow personalized setup
246 jQuery(".modulelineshow").attr("href","#a1profdemoall");
247 jQuery(".cursorpointer").css("cursor","pointer");
248 jQuery(".modulelineshow").click(function() {
249 console.log("We select the custom demo");
250 var idstring=$(this).attr("id");
251 if (typeof idstring != "undefined")
253 var currentId = idstring.substring(2);
254 jQuery("tr.moduleline").hide();
255 if (currentId != openedId)
258 jQuery("#tr1"+currentId).show();
259 jQuery("#tr2"+currentId).show();
272print
'<div class="demoban demobackground">';
273print
'<div class="right" style="padding-right: 30px; padding-top: 30px;">';
274print
'<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>';
278print
'<div class="demobantext" style="max-width: 1024px;">';
279print
'<div style="font-size: 20px; padding: 40px;">';
280print
'<div class="hideonsmartphone" style="text-align: justify;">'.$langs->trans(
"DemoDesc").
'</div><br>';
281print
'<div class="titre"><span style="font-size: 20px">'.$langs->trans(
"ChooseYourDemoProfil").
'</span></div>';
286print
'<div class="clearboth"></div>';
287print
'<div class="demobanbox">';
290foreach ($demoprofiles as $profilearray) {
291 if ($profilearray[
'default'] >= 0) {
293 if (!empty($profilearray[
'lang'])) {
294 $langs->load($profilearray[
'lang']);
297 $url = $_SERVER[
"PHP_SELF"].
'?action=gotodemo';
298 $urlwithmod = $url.
'&demochoice='.$profilearray[
'key'];
302 $urlfrom = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/i',
'', $_SERVER[
"PHP_SELF"]);
305 if (!empty($profilearray[
'url'])) {
306 $urlwithmod = $profilearray[
'url'];
307 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'urlfrom='.urlencode($urlfrom);
308 if (!empty($profilearray[
'disablemodules'])) {
309 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'disablemodules='.$profilearray[
'disablemodules'];
313 if (empty($profilearray[
'url'])) {
314 print
'<div class="clearboth"></div>';
317 print
'<form method="POST" class="valigntop inline-block" name="form'.$profilearray[
'key'].
'" id="form'.$profilearray[
'key'].
'" action="'.$_SERVER[
"PHP_SELF"].
'#a1'.$profilearray[
'key'].
'">'.
"\n";
318 print
'<input type="hidden" name="action" value="gotodemo">'.
"\n";
319 print
'<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).
'">'.
"\n";
320 print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
321 print
'<input type="hidden" name="username" value="demo">'.
"\n";
322 print
'<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.
'">'.
"\n";
323 print
'<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.
'">'.
"\n";
324 print
'<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.
'">'.
"\n";
325 print
'<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.
'">'.
"\n";
326 print
'<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.
'">'.
"\n";
328 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";
331 print
'<div id="a1'.$profilearray[
'key'].
'" class="demobox '.(empty($profilearray[
'url']) ?
'modulelineshow cursorpointer' :
'nomodulelines').
'">';
333 print
'<a href="'.$urlwithmod.
'" class="'.(empty($profilearray[
'url']) ?
'modulelineshow' :
'nomodulelines').
'">';
334 print
'<div style="padding: 10px;">';
336 print
'<img class="demothumb" src="'.$profilearray[
'icon'].
'" alt="Demo '.$profilearray[
'label'].
'">';
338 print
'<div class="clearboth"></div>';
340 print
'<div class="demothumbtext">';
341 print $langs->trans($profilearray[
'label']);
349 if (empty($profilearray[
'url'])) {
350 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">';
352 print
'<span class="opacitymedium">'.$langs->trans(
"ThisIsListOfModules").
'</span><br><br>';
354 print
'<div class="csscolumns">';
356 $listofdisabledmodules = explode(
',', $profilearray[
'disablemodules']);
360 foreach ($orders as $index => $key) {
362 $val = $modules[$index];
363 $modulekeyname = strtolower($val->name);
365 $modulequalified = 1;
366 if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) {
367 $modulequalified = 0;
370 $modulequalified = 0;
373 $modulequalified = 0;
375 if (!$modulequalified) {
379 if (in_array($modulekeyname, $alwayshiddencheckedmodules)) {
380 print
"\n".
'<!-- Module '.$modulekeyname.
' hidden and always checked -->';
381 print
'<input type="hidden" name="'.$modulekeyname.
'" value="1">';
385 print
'<!-- id='.$val->numero.
' -->';
386 print
'<div class="nowrap">';
387 print
'<input type="checkbox" class="checkbox valignmiddle paddingright" id="id'.$modulekeyname.
'" name="'.$modulekeyname.
'" value="1" title="'.
dol_escape_htmltag($val->getName()).
'"';
389 if (in_array($modulekeyname, $alwaysuncheckedmodules)) {
390 $disabled =
'disabled';
393 if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) {
404 print
'<label for="id'.$modulekeyname.
'" class="inline-block demomaxoveflow valignmiddle paddingleft'.($disabled ?
' opacitymedium' :
'').
'" title="'.
dol_escape_htmltag($val->getName()).
'">'.$val->getName().
'</label><br>';
413 print
'<br><div class="center">';
414 print
'<input type="submit" value=" '.$langs->trans(
"Start").
' " class="button">';
421 print
'</div></div>';
422 print
'</form>'.
"\n";
436 if (empty($conf->dol_use_jmobile)) {
437 print
'<div align="center">'.
"\n";
438 print
'<script><!--'.
"\n";
444 print
'</script>'.
"\n";
445 print
'<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>'.
"\n";
448 print
'<!-- google js advert tag disabled with jmobile -->'.
"\n";
468 top_htmlhead($head, $title, 0, 0, array(), array(
'public/demo/demo.css'), 0, 1);
470 print
'<body class="demobody"><div class="demobackgrounddiv">'.
"\n";
483 print
"</div></body>\n";
if(!defined( 'NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined( 'NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined( 'NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined( 'NOIPCHECK')) llxHeaderVierge()
Header function.
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-...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
llxFooterVierge()
Show footer for demo.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.