27 if (!defined(
'NOLOGIN')) {
28 define(
'NOLOGIN',
'1');
30 if (!defined(
'NOBROWSERNOTIF')) {
31 define(
'NOBROWSERNOTIF', 1);
33 if (!defined(
'NOIPCHECK')) {
34 define(
'NOIPCHECK',
'1');
38 require
'../../main.inc.php';
39 require_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');
50 global $dolibarr_main_demo;
51 if (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 :
'');
73 $parameters = array();
74 $object =
new stdClass();
75 $reshook = $hookmanager->executeHooks(
'addDemoProfile', $parameters, $object, $tmpaction);
76 $error = $hookmanager->error; $errors = $hookmanager->errors;
77 if (empty($reshook)) {
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',
'skype',
'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;
141 foreach ($modulesdir as $dir) {
143 $handle = @opendir($dir);
144 if (is_resource($handle)) {
145 while (($file = readdir($handle)) !==
false) {
147 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
148 $modName = substr($file, 0,
dol_strlen($file) - 10);
152 include_once $dir.$file;
153 $objMod =
new $modName($db);
155 if ($objMod->numero > 0) {
156 $j = $objMod->numero;
161 $modulequalified = 1;
164 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
165 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) {
166 $modulequalified = 0;
168 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) {
169 $modulequalified = 0;
172 if ($modulequalified) {
173 $modules[$i] = $objMod;
174 $filename[$i] = $modName;
175 $orders[$i] = $objMod->family.
"_".$j;
177 $dirmod[$i] = $dirroot;
182 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
198 if (
GETPOST(
'action',
'aZ09') ==
'gotodemo') {
203 foreach ($demoprofiles as $profilearray) {
204 if ($profilearray[
'key'] ==
GETPOST(
"demochoice")) {
205 $disablestring = $profilearray[
'disablemodules'];
211 foreach ($modules as $val) {
212 $modulekeyname = strtolower($val->name);
213 if (!
GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) {
214 $disablestring .= $modulekeyname.
',';
215 if ($modulekeyname ==
'propale') {
216 $disablestring .=
'propal,';
222 if ($disablestring) {
224 $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 console.log("We select the custom demo");
252 var idstring=$(this).attr("id");
253 if (typeof idstring != "undefined")
255 var currentId = idstring.substring(2);
256 jQuery("tr.moduleline").hide();
257 if (currentId != openedId)
260 jQuery("#tr1"+currentId).show();
261 jQuery("#tr2"+currentId).show();
274 print
'<div class="demoban demobackground">';
275 print
'<div class="right" style="padding-right: 30px; padding-top: 30px;">';
276 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>';
280 print
'<div class="demobantext" style="max-width: 1024px;">';
281 print
'<div style="font-size: 20px; padding: 40px;">';
282 print
'<div class="hideonsmartphone" style="text-align: justify;">'.$langs->trans(
"DemoDesc").
'</div><br>';
283 print
'<div class="titre"><span style="font-size: 20px">'.$langs->trans(
"ChooseYourDemoProfil").
'</span></div>';
288 print
'<div class="clearboth"></div>';
289 print
'<div class="demobanbox">';
292 foreach ($demoprofiles as $profilearray) {
293 if ($profilearray[
'default'] >= 0) {
295 if (!empty($profilearray[
'lang'])) {
296 $langs->load($profilearray[
'lang']);
299 $url = $_SERVER[
"PHP_SELF"].
'?action=gotodemo';
300 $urlwithmod = $url.
'&demochoice='.$profilearray[
'key'];
304 $urlfrom = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/i',
'', $_SERVER[
"PHP_SELF"]);
307 if (!empty($profilearray[
'url'])) {
308 $urlwithmod = $profilearray[
'url'];
309 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'urlfrom='.urlencode($urlfrom);
310 if (!empty($profilearray[
'disablemodules'])) {
311 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'disablemodules='.$profilearray[
'disablemodules'];
315 if (empty($profilearray[
'url'])) {
316 print
'<div class="clearboth"></div>';
319 print
'<form method="POST" class="valigntop inline-block" name="form'.$profilearray[
'key'].
'" id="form'.$profilearray[
'key'].
'" action="'.$_SERVER[
"PHP_SELF"].
'#a1'.$profilearray[
'key'].
'">'.
"\n";
320 print
'<input type="hidden" name="action" value="gotodemo">'.
"\n";
321 print
'<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).
'">'.
"\n";
322 print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
323 print
'<input type="hidden" name="username" value="demo">'.
"\n";
324 print
'<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.
'">'.
"\n";
325 print
'<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.
'">'.
"\n";
326 print
'<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.
'">'.
"\n";
327 print
'<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.
'">'.
"\n";
328 print
'<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.
'">'.
"\n";
330 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";
333 print
'<div id="a1'.$profilearray[
'key'].
'" class="demobox '.(empty($profilearray[
'url']) ?
'modulelineshow cursorpointer' :
'nomodulelines').
'">';
335 print
'<a href="'.$urlwithmod.
'" class="'.(empty($profilearray[
'url']) ?
'modulelineshow' :
'nomodulelines').
'">';
336 print
'<div style="padding: 10px;">';
338 print
'<img class="demothumb" src="'.$profilearray[
'icon'].
'" alt="Demo '.$profilearray[
'label'].
'">';
340 print
'<div class="clearboth"></div>';
342 print
'<div class="demothumbtext">';
343 print $langs->trans($profilearray[
'label']);
351 if (empty($profilearray[
'url'])) {
352 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">';
354 print
'<span class="opacitymedium">'.$langs->trans(
"ThisIsListOfModules").
'</span><br><br>';
356 print
'<div class="csscolumns">';
358 $listofdisabledmodules = explode(
',', $profilearray[
'disablemodules']);
362 foreach ($orders as $index => $key) {
364 $val = $modules[$index];
365 $modulekeyname = strtolower($val->name);
367 $modulequalified = 1;
368 if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) {
369 $modulequalified = 0;
371 if ($val->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) {
372 $modulequalified = 0;
374 if ($val->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) {
375 $modulequalified = 0;
377 if (!$modulequalified) {
381 if (in_array($modulekeyname, $alwayshiddencheckedmodules)) {
382 print
"\n".
'<!-- Module '.$modulekeyname.
' hidden and always checked -->';
383 print
'<input type="hidden" name="'.$modulekeyname.
'" value="1">';
387 print
'<!-- id='.$val->numero.
' -->';
388 print
'<div class="nowrap">';
389 print
'<input type="checkbox" class="checkbox valignmiddle paddingright" id="id'.$modulekeyname.
'" name="'.$modulekeyname.
'" value="1" title="'.
dol_escape_htmltag($val->getName()).
'"';
391 if (in_array($modulekeyname, $alwaysuncheckedmodules)) {
392 $disabled =
'disabled';
395 if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) {
406 print
'<label for="id'.$modulekeyname.
'" class="inline-block demomaxoveflow valignmiddle paddingleft'.($disabled ?
' opacitymedium' :
'').
'" title="'.
dol_escape_htmltag($val->getName()).
'">'.$val->getName().
'</label><br>';
415 print
'<br><div class="center">';
416 print
'<input type="submit" value=" '.$langs->trans(
"Start").
' " class="button">';
423 print
'</div></div>';
424 print
'</form>'.
"\n";
437 if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
438 if (empty($conf->dol_use_jmobile)) {
439 print
'<div align="center">'.
"\n";
440 print
'<script><!--'.
"\n";
441 print
'google_ad_client = "'.$conf->global->MAIN_GOOGLE_AD_CLIENT.
'";'.
"\n";
442 print
'google_ad_slot = "'.$conf->global->MAIN_GOOGLE_AD_SLOT.
'";'.
"\n";
443 print
'google_ad_width = '.$conf->global->MAIN_GOOGLE_AD_WIDTH.
';'.
"\n";
444 print
'google_ad_height = '.$conf->global->MAIN_GOOGLE_AD_HEIGHT.
';'.
"\n";
446 print
'</script>'.
"\n";
447 print
'<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>'.
"\n";
450 print
'<!-- google js advert tag disabled with jmobile -->'.
"\n";
470 top_htmlhead($head, $title, 0, 0, array(), array(
'public/demo/demo.css'), 0, 1);
472 print
'<body class="demobody"><div class="demobackgrounddiv">'.
"\n";
485 print
"</div></body>\n";
dolGetModulesDirs($subdir='')
Return list of modules directories.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
llxFooterVierge()
Show footer for demo.
llxHeaderVierge($title, $head="")
Show header for demo.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.