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';
48$langs->loadLangs(array(
"main",
"install",
"other"));
52$conf->dol_optimize_smallscreen =
GETPOSTINT(
'dol_optimize_smallscreen');
57global $dolibarr_main_demo;
58if (empty($dolibarr_main_demo)) {
59 httponly_accessforbidden(
'Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page');
64$res = $hookmanager->initHooks(array(
'demo'));
66$demoprofiles = array();
67$alwayscheckedmodules = array();
68$alwaysuncheckedmodules = array();
69$alwayshiddencheckedmodules = array();
70$alwayshiddenuncheckedmodules = array();
73$url .= ($url ?
'&' :
'').(
$conf->dol_hide_topmenu ?
'dol_hide_topmenu='.$conf->dol_hide_topmenu :
'');
74$url .= ($url ?
'&' :
'').(
$conf->dol_hide_leftmenu ?
'dol_hide_leftmenu='.$conf->dol_hide_leftmenu :
'');
75$url .= ($url ?
'&' :
'').(
$conf->dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen :
'');
76$url .= ($url ?
'&' :
'').(
$conf->dol_no_mouse_hover ?
'dol_no_mouse_hover='.$conf->dol_no_mouse_hover :
'');
77$url .= ($url ?
'&' :
'').(
$conf->dol_use_jmobile ?
'dol_use_jmobile='.$conf->dol_use_jmobile :
'');
78$url = DOL_URL_ROOT.
'/index.php'.($url ?
'?'.$url :
'');
83$reshook = $hookmanager->executeHooks(
'addDemoProfile', $parameters, $object, $tmpaction);
84$error = $hookmanager->error;
85$errors = $hookmanager->errors;
87 $demoprofiles = array(
89 'default' =>
'1',
'key' =>
'profdemoservonly',
'label' =>
'DemoCompanyServiceOnly',
90 'disablemodules' =>
'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos',
92 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-service.jpg',
97 'default' =>
'0',
'key' =>
'profmanufacture',
'label' =>
'DemoCompanyManufacturing',
98 'disablemodules' =>
'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service',
99 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-manufacturing.jpg',
104 'default' =>
'0',
'key' =>
'profdemoprodstock',
'label' =>
'DemoCompanyProductAndStocks',
105 'disablemodules' =>
'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service',
107 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-product.jpg',
112 'default' =>
'0',
'key' =>
'profdemofun2',
'label' =>
'DemoFundation2',
113 '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',
115 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-foundation.jpg',
121 'default' =>
'0',
'key' =>
'profdemoall',
'label' =>
'ChooseYourDemoProfilMore',
122 'disablemodules' =>
'adherent,cashdesk,don,externalsite,mailmanspip',
124 'icon' => DOL_URL_ROOT.
'/public/demo/demo-profile-all.jpg',
131 $alwayscheckedmodules = array(
'barcode',
'bookmark',
'categorie',
'externalrss',
'fckeditor',
'geoipmaxmind',
'gravatar',
'memcached',
'syslog',
'user',
'webservices');
132 $alwaysuncheckedmodules = array(
'ai',
'dav',
'dynamicprices',
'incoterm',
'loan',
'multicurrency',
'paybox',
'paypal',
'stripe',
'google',
'printing',
'scanner',
'socialnetworks',
'webhook',
'webportal',
'website',
'zapier');
134 $alwayshiddencheckedmodules = array(
'accounting',
'api',
'barcode',
'blockedlog',
'bookmark',
'clicktodial',
'comptabilite',
'cron',
'document',
'domain',
'externalrss',
'externalsite',
'fckeditor',
'geoipmaxmind',
'gravatar',
'label',
'ldap',
135 'mailmanspip',
'notification',
'oauth',
'syslog',
'user',
'webservices',
'workflow',
137 'memcached',
'numberwords',
'zipautofillfr');
138 $alwayshiddenuncheckedmodules = array(
'cashdesk',
'collab',
'dav',
'debugbar',
'emailcollector',
'ftp',
'hrm',
'modulebuilder',
'printing',
'webservicesclient',
'zappier',
140 'awstats',
'bittorrent',
'bootstrap',
'cabinetmed',
'cmcic',
'concatpdf',
'customfield',
'datapolicy',
'deplacement',
'dolicloud',
'filemanager',
'lightbox',
'mantis',
'monitoring',
'moretemplates',
'multicompany',
'nltechno',
'numberingpack',
'openstreetmap',
141 'ovh',
'phenix',
'phpsysinfo',
'pibarcode',
'postnuke',
'dynamicprices',
'receiptprinter',
'selectbank',
'skincoloreditor',
'submiteverywhere',
'survey',
'thomsonphonebook',
'topten',
'tvacerfa',
'voyage',
'webcalendar',
'webmail');
145$dirlist =
$conf->file->dol_document_root;
159foreach ($modulesdir as $dir) {
161 $handle = @opendir($dir);
162 if (is_resource($handle)) {
163 while (($file = readdir($handle)) !==
false) {
165 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
166 $modName = substr($file, 0,
dol_strlen($file) - 10);
170 include_once $dir.$file;
171 $objMod =
new $modName($db);
173 if ($objMod->numero > 0) {
174 $j = $objMod->numero;
179 $modulequalified = 1;
182 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
184 $modulequalified = 0;
187 $modulequalified = 0;
190 if ($modulequalified) {
191 $modules[$i] = $objMod;
192 $filename[$i] = $modName;
193 $orders[$i] = $objMod->family.
"_".$j;
199 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
207'@phan-var-force DolibarrModules[] $modules';
215if (
GETPOST(
'action',
'aZ09') ==
'gotodemo') {
220 foreach ($demoprofiles as $profilearray) {
221 if ($profilearray[
'key'] ==
GETPOST(
"demochoice")) {
222 $disablestring = $profilearray[
'disablemodules'];
228 foreach ($modules as $val) {
229 $modulekeyname = strtolower($val->name);
230 if (!
GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) {
231 $disablestring .= $modulekeyname.
',';
232 if ($modulekeyname ==
'propale') {
233 $disablestring .=
'propal,';
239 if ($disablestring) {
241 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'urlfrom='.urlencode(
GETPOST(
'urlfrom',
'alpha'));
243 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'disablemodules='.$disablestring;
245 header(
"Location: ".$url);
256$head .=
'<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'.
"\n";
257$head .=
'<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'.
"\n";
260<script type="text/javascript">
262jQuery(document).ready(function () {
263 jQuery("tr.moduleline").hide();
264 // Enable this to allow personalized setup
265 jQuery(".modulelineshow").attr("href","#a1profdemoall");
266 jQuery(".cursorpointer").css("cursor","pointer");
267 jQuery(".modulelineshow").click(function() {
268 console.log("We select the custom demo");
269 var idstring=$(this).attr("id");
270 if (typeof idstring != "undefined")
272 var currentId = idstring.substring(2);
273 jQuery("tr.moduleline").hide();
274 if (currentId != openedId)
277 jQuery("#tr1"+currentId).show();
278 jQuery("#tr2"+currentId).show();
291print
'<div class="demoban demobackground">';
292print
'<div class="right" style="padding-right: 30px; padding-top: 30px;">';
293print
'<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>';
297print
'<div class="demobantext" style="max-width: 1024px;">';
298print
'<div style="font-size: 20px; padding: 40px;">';
299print
'<div class="hideonsmartphone" style="text-align: justify;">'.$langs->trans(
"DemoDesc").
'</div><br>';
300print
'<div class="titre"><span style="font-size: 20px">'.$langs->trans(
"ChooseYourDemoProfil").
'</span></div>';
305print
'<div class="clearboth"></div>';
306print
'<div class="demobanbox">';
309foreach ($demoprofiles as $profilearray) {
310 if ($profilearray[
'default'] >= 0) {
312 if (!empty($profilearray[
'lang'])) {
313 $langs->load($profilearray[
'lang']);
316 $url = $_SERVER[
"PHP_SELF"].
'?action=gotodemo';
317 $urlwithmod = $url.
'&demochoice='.$profilearray[
'key'];
321 $urlfrom = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/i',
'', $_SERVER[
"PHP_SELF"]);
324 if (!empty($profilearray[
'url'])) {
325 $urlwithmod = $profilearray[
'url'];
326 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'urlfrom='.urlencode($urlfrom);
327 if (!empty($profilearray[
'disablemodules'])) {
328 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'disablemodules='.$profilearray[
'disablemodules'];
332 if (empty($profilearray[
'url'])) {
333 print
'<div class="clearboth"></div>';
336 print
'<form method="POST" class="valigntop inline-block" name="form'.$profilearray[
'key'].
'" id="form'.$profilearray[
'key'].
'" action="'.$_SERVER[
"PHP_SELF"].
'#a1'.$profilearray[
'key'].
'">'.
"\n";
337 print
'<input type="hidden" name="action" value="gotodemo">'.
"\n";
338 print
'<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).
'">'.
"\n";
339 print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
340 print
'<input type="hidden" name="username" value="demo">'.
"\n";
341 print
'<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.
'">'.
"\n";
342 print
'<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.
'">'.
"\n";
343 print
'<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.
'">'.
"\n";
344 print
'<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.
'">'.
"\n";
345 print
'<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.
'">'.
"\n";
347 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";
350 print
'<div id="a1'.$profilearray[
'key'].
'" class="demobox '.(empty($profilearray[
'url']) ?
'modulelineshow cursorpointer maxwidth1000' :
'nomodulelines').
'">';
352 print
'<a href="'.$urlwithmod.
'" class="'.(empty($profilearray[
'url']) ?
'modulelineshow' :
'nomodulelines').
'">';
353 print
'<div style="padding: 10px;">';
355 print
'<img class="demothumb" src="'.$profilearray[
'icon'].
'" alt="Demo '.$profilearray[
'label'].
'">';
357 print
'<div class="clearboth"></div>';
359 print
'<div class="demothumbtext">';
360 print $langs->trans($profilearray[
'label']);
368 if (empty($profilearray[
'url'])) {
369 print
'<div id="tr1'.$profilearray[
'key'].
'" class="moduleline hidden" style="text-align: justify; font-size:0.75em; padding-bottom: 8px">';
371 print
'<span class="opacitymedium small">'.$langs->trans(
"ThisIsListOfModules").
'</span><br><br>';
373 print
'<div class="csscolumns">';
375 $listofdisabledmodules = explode(
',', $profilearray[
'disablemodules']);
379 foreach ($orders as $index => $key) {
381 $val = $modules[$index];
382 $modulekeyname = strtolower($val->name);
384 $modulequalified = 1;
385 if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) {
386 $modulequalified = 0;
389 $modulequalified = 0;
392 $modulequalified = 0;
394 if (!$modulequalified) {
398 if (in_array($modulekeyname, $alwayshiddencheckedmodules)) {
399 print
"\n".
'<!-- Module '.$modulekeyname.
' hidden and always checked -->';
400 print
'<input type="hidden" name="'.$modulekeyname.
'" value="1">';
404 print
'<!-- id='.$val->numero.
' -->';
405 print
'<div class="nowrap">';
406 print
'<input type="checkbox" class="checkbox valignmiddle paddingright" id="id'.$modulekeyname.
'" name="'.$modulekeyname.
'" value="1" title="'.
dol_escape_htmltag($val->getName()).
'"';
408 if (in_array($modulekeyname, $alwaysuncheckedmodules)) {
409 $disabled =
'disabled';
412 if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) {
423 print
'<label for="id'.$modulekeyname.
'" class="inline-block demomaxoveflow valignmiddle paddingleft'.($disabled ?
' opacitymedium' :
'').
'" title="'.
dol_escape_htmltag($val->getName()).
'">'.$val->getName().
'</label><br>';
432 print
'<br><div class="center">';
433 print
'<input type="submit" value=" '.$langs->trans(
"Start").
' " class="button">';
440 print
'</div></div>';
441 print
'</form>'.
"\n";
455 if (empty(
$conf->dol_use_jmobile)) {
456 print
'<div align="center">'.
"\n";
457 print
'<script><!--'.
"\n";
463 print
'</script>'.
"\n";
464 print
'<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>'.
"\n";
467 print
'<!-- google js advert tag disabled with jmobile -->'.
"\n";
487function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
491 top_htmlhead($head, $title, 0, 0, array(), array(
'public/demo/demo.css'), 0, 1);
493 print
'<body class="demobody"><div class="demobackgrounddiv">'.
"\n";
506 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.