29if (!defined(
'NOLOGIN')) {
30 define(
'NOLOGIN',
'1');
32if (!defined(
'NOBROWSERNOTIF')) {
33 define(
'NOBROWSERNOTIF', 1);
35if (!defined(
'NOIPCHECK')) {
36 define(
'NOIPCHECK',
'1');
40require
'../../main.inc.php';
41require_once
'../../core/lib/functions2.lib.php';
43$langs->loadLangs(array(
"main",
"install",
"other"));
45$conf->dol_hide_topmenu =
GETPOSTINT(
'dol_hide_topmenu');
46$conf->dol_hide_leftmenu =
GETPOSTINT(
'dol_hide_leftmenu');
47$conf->dol_optimize_smallscreen =
GETPOSTINT(
'dol_optimize_smallscreen');
48$conf->dol_no_mouse_hover =
GETPOSTINT(
'dol_no_mouse_hover');
49$conf->dol_use_jmobile =
GETPOSTINT(
'dol_use_jmobile');
52global $dolibarr_main_demo;
53if (empty($dolibarr_main_demo)) {
54 httponly_accessforbidden(
'Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page');
59$res = $hookmanager->initHooks(array(
'demo'));
61$demoprofiles = array();
62$alwayscheckedmodules = array();
63$alwaysuncheckedmodules = array();
64$alwayshiddencheckedmodules = array();
65$alwayshiddenuncheckedmodules = array();
68$url .= ($url ?
'&' :
'').($conf->dol_hide_topmenu ?
'dol_hide_topmenu='.$conf->dol_hide_topmenu :
'');
69$url .= ($url ?
'&' :
'').($conf->dol_hide_leftmenu ?
'dol_hide_leftmenu='.$conf->dol_hide_leftmenu :
'');
70$url .= ($url ?
'&' :
'').($conf->dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen :
'');
71$url .= ($url ?
'&' :
'').($conf->dol_no_mouse_hover ?
'dol_no_mouse_hover='.$conf->dol_no_mouse_hover :
'');
72$url .= ($url ?
'&' :
'').($conf->dol_use_jmobile ?
'dol_use_jmobile='.$conf->dol_use_jmobile :
'');
73$url = DOL_URL_ROOT.
'/index.php'.($url ?
'?'.$url :
'');
78$reshook = $hookmanager->executeHooks(
'addDemoProfile', $parameters, $object, $tmpaction);
79$error = $hookmanager->error;
80$errors = $hookmanager->errors;
82 $demoprofiles = array(
84 'default' =>
'1',
'key' =>
'profdemoservonly',
'label' =>
'DemoCompanyServiceOnly',
85 'disablemodules' =>
'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos',
87 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-service.jpg',
92 'default' =>
'0',
'key' =>
'profmanufacture',
'label' =>
'DemoCompanyManufacturing',
93 'disablemodules' =>
'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service',
94 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-manufacturing.jpg',
99 'default' =>
'0',
'key' =>
'profdemoprodstock',
'label' =>
'DemoCompanyProductAndStocks',
100 'disablemodules' =>
'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service',
102 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-product.jpg',
107 'default' =>
'0',
'key' =>
'profdemofun2',
'label' =>
'DemoFundation2',
108 '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',
110 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-foundation.jpg',
116 'default' =>
'0',
'key' =>
'profdemoall',
'label' =>
'ChooseYourDemoProfilMore',
117 'disablemodules' =>
'adherent,cashdesk,don,externalsite,mailmanspip',
119 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-all.jpg',
126 $alwayscheckedmodules = array(
'barcode',
'bookmark',
'categorie',
'externalrss',
'fckeditor',
'geoipmaxmind',
'gravatar',
'memcached',
'syslog',
'user',
'webservices');
127 $alwaysuncheckedmodules = array(
'ai',
'dav',
'dynamicprices',
'incoterm',
'loan',
'multicurrency',
'paybox',
'paypal',
'stripe',
'google',
'printing',
'scanner',
'socialnetworks',
'webhook',
'webportal',
'website',
'zapier');
129 $alwayshiddencheckedmodules = array(
'accounting',
'api',
'barcode',
'blockedlog',
'bookmark',
'clicktodial',
'comptabilite',
'cron',
'document',
'domain',
'externalrss',
'externalsite',
'fckeditor',
'geoipmaxmind',
'gravatar',
'label',
'ldap',
130 'mailmanspip',
'notification',
'oauth',
'syslog',
'user',
'webservices',
'workflow',
132 'memcached',
'numberwords',
'zipautofillfr');
133 $alwayshiddenuncheckedmodules = array(
'cashdesk',
'collab',
'dav',
'debugbar',
'emailcollector',
'ftp',
'hrm',
'modulebuilder',
'printing',
'webservicesclient',
'zappier',
135 'awstats',
'bittorrent',
'bootstrap',
'cabinetmed',
'cmcic',
'concatpdf',
'customfield',
'datapolicy',
'deplacement',
'dolicloud',
'filemanager',
'lightbox',
'mantis',
'monitoring',
'moretemplates',
'multicompany',
'nltechno',
'numberingpack',
'openstreetmap',
136 'ovh',
'phenix',
'phpsysinfo',
'pibarcode',
'postnuke',
'dynamicprices',
'receiptprinter',
'selectbank',
'skincoloreditor',
'submiteverywhere',
'survey',
'thomsonphonebook',
'topten',
'tvacerfa',
'voyage',
'webcalendar',
'webmail');
140$dirlist = $conf->file->dol_document_root;
154foreach ($modulesdir as $dir) {
156 $handle = @opendir($dir);
157 if (is_resource($handle)) {
158 while (($file = readdir($handle)) !==
false) {
160 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
161 $modName = substr($file, 0,
dol_strlen($file) - 10);
165 include_once $dir.$file;
166 $objMod =
new $modName($db);
168 if ($objMod->numero > 0) {
169 $j = $objMod->numero;
174 $modulequalified = 1;
177 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
179 $modulequalified = 0;
182 $modulequalified = 0;
185 if ($modulequalified) {
186 $modules[$i] = $objMod;
187 $filename[$i] = $modName;
188 $orders[$i] = $objMod->family.
"_".$j;
194 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
202'@phan-var-force DolibarrModules[] $modules';
210if (
GETPOST(
'action',
'aZ09') ==
'gotodemo') {
215 foreach ($demoprofiles as $profilearray) {
216 if ($profilearray[
'key'] ==
GETPOST(
"demochoice")) {
217 $disablestring = $profilearray[
'disablemodules'];
223 foreach ($modules as $val) {
224 $modulekeyname = strtolower($val->name);
225 if (!
GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) {
226 $disablestring .= $modulekeyname.
',';
227 if ($modulekeyname ==
'propale') {
228 $disablestring .=
'propal,';
234 if ($disablestring) {
236 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'urlfrom='.urlencode(
GETPOST(
'urlfrom',
'alpha'));
238 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'disablemodules='.$disablestring;
240 header(
"Location: ".$url);
251$head .=
'<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'.
"\n";
252$head .=
'<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'.
"\n";
255<script type="text/javascript">
257jQuery(document).ready(function () {
258 jQuery("tr.moduleline").hide();
259 // Enable this to allow personalized setup
260 jQuery(".modulelineshow").attr("href","#a1profdemoall");
261 jQuery(".cursorpointer").css("cursor","pointer");
262 jQuery(".modulelineshow").click(function() {
263 console.log("We select the custom demo");
264 var idstring=$(this).attr("id");
265 if (typeof idstring != "undefined")
267 var currentId = idstring.substring(2);
268 jQuery("tr.moduleline").hide();
269 if (currentId != openedId)
272 jQuery("#tr1"+currentId).show();
273 jQuery("#tr2"+currentId).show();
286print
'<div class="demoban demobackground">';
287print
'<div class="right" style="padding-right: 30px; padding-top: 30px;">';
288print
'<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>';
292print
'<div class="demobantext" style="max-width: 1024px;">';
293print
'<div style="font-size: 20px; padding: 40px;">';
294print
'<div class="hideonsmartphone" style="text-align: justify;">'.$langs->trans(
"DemoDesc").
'</div><br>';
295print
'<div class="titre"><span style="font-size: 20px">'.$langs->trans(
"ChooseYourDemoProfil").
'</span></div>';
300print
'<div class="clearboth"></div>';
301print
'<div class="demobanbox">';
304foreach ($demoprofiles as $profilearray) {
305 if ($profilearray[
'default'] >= 0) {
307 if (!empty($profilearray[
'lang'])) {
308 $langs->load($profilearray[
'lang']);
311 $url = $_SERVER[
"PHP_SELF"].
'?action=gotodemo';
312 $urlwithmod = $url.
'&demochoice='.$profilearray[
'key'];
316 $urlfrom = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/i',
'', $_SERVER[
"PHP_SELF"]);
319 if (!empty($profilearray[
'url'])) {
320 $urlwithmod = $profilearray[
'url'];
321 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'urlfrom='.urlencode($urlfrom);
322 if (!empty($profilearray[
'disablemodules'])) {
323 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'disablemodules='.$profilearray[
'disablemodules'];
327 if (empty($profilearray[
'url'])) {
328 print
'<div class="clearboth"></div>';
331 print
'<form method="POST" class="valigntop inline-block" name="form'.$profilearray[
'key'].
'" id="form'.$profilearray[
'key'].
'" action="'.$_SERVER[
"PHP_SELF"].
'#a1'.$profilearray[
'key'].
'">'.
"\n";
332 print
'<input type="hidden" name="action" value="gotodemo">'.
"\n";
333 print
'<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).
'">'.
"\n";
334 print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
335 print
'<input type="hidden" name="username" value="demo">'.
"\n";
336 print
'<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.
'">'.
"\n";
337 print
'<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.
'">'.
"\n";
338 print
'<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.
'">'.
"\n";
339 print
'<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.
'">'.
"\n";
340 print
'<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.
'">'.
"\n";
342 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";
345 print
'<div id="a1'.$profilearray[
'key'].
'" class="demobox '.(empty($profilearray[
'url']) ?
'modulelineshow cursorpointer maxwidth1000' :
'nomodulelines').
'">';
347 print
'<a href="'.$urlwithmod.
'" class="'.(empty($profilearray[
'url']) ?
'modulelineshow' :
'nomodulelines').
'">';
348 print
'<div style="padding: 10px;">';
350 print
'<img class="demothumb" src="'.$profilearray[
'icon'].
'" alt="Demo '.$profilearray[
'label'].
'">';
352 print
'<div class="clearboth"></div>';
354 print
'<div class="demothumbtext">';
355 print $langs->trans($profilearray[
'label']);
363 if (empty($profilearray[
'url'])) {
364 print
'<div id="tr1'.$profilearray[
'key'].
'" class="moduleline hidden" style="text-align: justify; font-size:0.75em; padding-bottom: 8px">';
366 print
'<span class="opacitymedium small">'.$langs->trans(
"ThisIsListOfModules").
'</span><br><br>';
368 print
'<div class="csscolumns">';
370 $listofdisabledmodules = explode(
',', $profilearray[
'disablemodules']);
374 foreach ($orders as $index => $key) {
376 $val = $modules[$index];
377 $modulekeyname = strtolower($val->name);
379 $modulequalified = 1;
380 if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) {
381 $modulequalified = 0;
384 $modulequalified = 0;
387 $modulequalified = 0;
389 if (!$modulequalified) {
393 if (in_array($modulekeyname, $alwayshiddencheckedmodules)) {
394 print
"\n".
'<!-- Module '.$modulekeyname.
' hidden and always checked -->';
395 print
'<input type="hidden" name="'.$modulekeyname.
'" value="1">';
399 print
'<!-- id='.$val->numero.
' -->';
400 print
'<div class="nowrap">';
401 print
'<input type="checkbox" class="checkbox valignmiddle paddingright" id="id'.$modulekeyname.
'" name="'.$modulekeyname.
'" value="1" title="'.
dol_escape_htmltag($val->getName()).
'"';
403 if (in_array($modulekeyname, $alwaysuncheckedmodules)) {
404 $disabled =
'disabled';
407 if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) {
418 print
'<label for="id'.$modulekeyname.
'" class="inline-block demomaxoveflow valignmiddle paddingleft'.($disabled ?
' opacitymedium' :
'').
'" title="'.
dol_escape_htmltag($val->getName()).
'">'.$val->getName().
'</label><br>';
427 print
'<br><div class="center">';
428 print
'<input type="submit" value=" '.$langs->trans(
"Start").
' " class="button">';
435 print
'</div></div>';
436 print
'</form>'.
"\n";
450 if (empty($conf->dol_use_jmobile)) {
451 print
'<div align="center">'.
"\n";
452 print
'<script><!--'.
"\n";
458 print
'</script>'.
"\n";
459 print
'<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>'.
"\n";
462 print
'<!-- google js advert tag disabled with jmobile -->'.
"\n";
482function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
486 top_htmlhead($head, $title, 0, 0, array(), array(
'public/demo/demo.css'), 0, 1);
488 print
'<body class="demobody"><div class="demobackgrounddiv">'.
"\n";
501 print
"</div></body>\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 a 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)
Output 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.
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show header for booking.
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.