28if (!defined(
'NOLOGIN')) {
29 define(
'NOLOGIN',
'1');
31if (!defined(
'NOBROWSERNOTIF')) {
32 define(
'NOBROWSERNOTIF', 1);
34if (!defined(
'NOIPCHECK')) {
35 define(
'NOIPCHECK',
'1');
39require
'../../main.inc.php';
40require_once
'../../core/lib/functions2.lib.php';
42$langs->loadLangs(array(
"main",
"install",
"other"));
44$conf->dol_hide_topmenu =
GETPOSTINT(
'dol_hide_topmenu');
45$conf->dol_hide_leftmenu =
GETPOSTINT(
'dol_hide_leftmenu');
46$conf->dol_optimize_smallscreen =
GETPOSTINT(
'dol_optimize_smallscreen');
47$conf->dol_no_mouse_hover =
GETPOSTINT(
'dol_no_mouse_hover');
48$conf->dol_use_jmobile =
GETPOSTINT(
'dol_use_jmobile');
51global $dolibarr_main_demo;
52if (empty($dolibarr_main_demo)) {
53 httponly_accessforbidden(
'Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page');
57$res = $hookmanager->initHooks(array(
'demo'));
59$demoprofiles = array();
60$alwayscheckedmodules = array();
61$alwaysuncheckedmodules = array();
62$alwayshiddencheckedmodules = array();
63$alwayshiddenuncheckedmodules = array();
66$url .= ($url ?
'&' :
'').($conf->dol_hide_topmenu ?
'dol_hide_topmenu='.$conf->dol_hide_topmenu :
'');
67$url .= ($url ?
'&' :
'').($conf->dol_hide_leftmenu ?
'dol_hide_leftmenu='.$conf->dol_hide_leftmenu :
'');
68$url .= ($url ?
'&' :
'').($conf->dol_optimize_smallscreen ?
'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen :
'');
69$url .= ($url ?
'&' :
'').($conf->dol_no_mouse_hover ?
'dol_no_mouse_hover='.$conf->dol_no_mouse_hover :
'');
70$url .= ($url ?
'&' :
'').($conf->dol_use_jmobile ?
'dol_use_jmobile='.$conf->dol_use_jmobile :
'');
71$url = DOL_URL_ROOT.
'/index.php'.($url ?
'?'.$url :
'');
76$reshook = $hookmanager->executeHooks(
'addDemoProfile', $parameters, $object, $tmpaction);
77$error = $hookmanager->error; $errors = $hookmanager->errors;
79 $demoprofiles = array(
81 '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',
89 'default'=>
'0',
'key'=>
'profmanufacture',
'label'=>
'DemoCompanyManufacturing',
90 'disablemodules'=>
'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service',
91 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-manufacturing.jpg',
96 'default'=>
'0',
'key'=>
'profdemoprodstock',
'label'=>
'DemoCompanyProductAndStocks',
97 'disablemodules'=>
'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service',
99 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-product.jpg',
104 'default'=>
'0',
'key'=>
'profdemofun2',
'label'=>
'DemoFundation2',
105 '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',
107 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-foundation.jpg',
113 'default'=>
'0',
'key'=>
'profdemoall',
'label'=>
'ChooseYourDemoProfilMore',
114 'disablemodules'=>
'adherent,cashdesk,don,externalsite,mailmanspip',
116 'icon'=>DOL_URL_ROOT.
'/public/demo/demo-profile-all.jpg',
123 $alwayscheckedmodules = array(
'barcode',
'bookmark',
'categorie',
'externalrss',
'fckeditor',
'geoipmaxmind',
'gravatar',
'memcached',
'syslog',
'user',
'webservices');
124 $alwaysuncheckedmodules = array(
'ai',
'dav',
'dynamicprices',
'incoterm',
'loan',
'multicurrency',
'paybox',
'paypal',
'stripe',
'google',
'printing',
'scanner',
'socialnetworks',
'webhook',
'webportal',
'website',
'zapier');
126 $alwayshiddencheckedmodules = array(
'accounting',
'api',
'barcode',
'blockedlog',
'bookmark',
'clicktodial',
'comptabilite',
'cron',
'document',
'domain',
'externalrss',
'externalsite',
'fckeditor',
'geoipmaxmind',
'gravatar',
'label',
'ldap',
127 'mailmanspip',
'notification',
'oauth',
'syslog',
'user',
'webservices',
'workflow',
129 'memcached',
'numberwords',
'zipautofillfr');
130 $alwayshiddenuncheckedmodules = array(
'cashdesk',
'collab',
'dav',
'debugbar',
'emailcollector',
'ftp',
'hrm',
'modulebuilder',
'printing',
'webservicesclient',
'zappier',
132 'awstats',
'bittorrent',
'bootstrap',
'cabinetmed',
'cmcic',
'concatpdf',
'customfield',
'datapolicy',
'deplacement',
'dolicloud',
'filemanager',
'lightbox',
'mantis',
'monitoring',
'moretemplates',
'multicompany',
'nltechno',
'numberingpack',
'openstreetmap',
133 'ovh',
'phenix',
'phpsysinfo',
'pibarcode',
'postnuke',
'dynamicprices',
'receiptprinter',
'selectbank',
'skincoloreditor',
'submiteverywhere',
'survey',
'thomsonphonebook',
'topten',
'tvacerfa',
'voyage',
'webcalendar',
'webmail');
137$dirlist = $conf->file->dol_document_root;
151foreach ($modulesdir as $dir) {
153 $handle = @opendir($dir);
154 if (is_resource($handle)) {
155 while (($file = readdir($handle)) !==
false) {
157 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
158 $modName = substr($file, 0,
dol_strlen($file) - 10);
162 include_once $dir.$file;
163 $objMod =
new $modName($db);
165 if ($objMod->numero > 0) {
166 $j = $objMod->numero;
171 $modulequalified = 1;
174 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
176 $modulequalified = 0;
179 $modulequalified = 0;
182 if ($modulequalified) {
183 $modules[$i] = $objMod;
184 $filename[$i] = $modName;
185 $orders[$i] = $objMod->family.
"_".$j;
191 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
206if (
GETPOST(
'action',
'aZ09') ==
'gotodemo') {
211 foreach ($demoprofiles as $profilearray) {
212 if ($profilearray[
'key'] ==
GETPOST(
"demochoice")) {
213 $disablestring = $profilearray[
'disablemodules'];
219 foreach ($modules as $val) {
220 $modulekeyname = strtolower($val->name);
221 if (!
GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) {
222 $disablestring .= $modulekeyname.
',';
223 if ($modulekeyname ==
'propale') {
224 $disablestring .=
'propal,';
230 if ($disablestring) {
232 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'urlfrom='.urlencode(
GETPOST(
'urlfrom',
'alpha'));
234 $url .= (preg_match(
'/\?/', $url) ?
'&' :
'?').
'disablemodules='.$disablestring;
236 header(
"Location: ".$url);
247$head .=
'<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'.
"\n";
248$head .=
'<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'.
"\n";
251<script type="text/javascript">
253jQuery(document).ready(function () {
254 jQuery("tr.moduleline").hide();
255 // Enable this to allow personalized setup
256 jQuery(".modulelineshow").attr("href","#a1profdemoall");
257 jQuery(".cursorpointer").css("cursor","pointer");
258 jQuery(".modulelineshow").click(function() {
259 console.log("We select the custom demo");
260 var idstring=$(this).attr("id");
261 if (typeof idstring != "undefined")
263 var currentId = idstring.substring(2);
264 jQuery("tr.moduleline").hide();
265 if (currentId != openedId)
268 jQuery("#tr1"+currentId).show();
269 jQuery("#tr2"+currentId).show();
282print
'<div class="demoban demobackground">';
283print
'<div class="right" style="padding-right: 30px; padding-top: 30px;">';
284print
'<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>';
288print
'<div class="demobantext" style="max-width: 1024px;">';
289print
'<div style="font-size: 20px; padding: 40px;">';
290print
'<div class="hideonsmartphone" style="text-align: justify;">'.$langs->trans(
"DemoDesc").
'</div><br>';
291print
'<div class="titre"><span style="font-size: 20px">'.$langs->trans(
"ChooseYourDemoProfil").
'</span></div>';
296print
'<div class="clearboth"></div>';
297print
'<div class="demobanbox">';
300foreach ($demoprofiles as $profilearray) {
301 if ($profilearray[
'default'] >= 0) {
303 if (!empty($profilearray[
'lang'])) {
304 $langs->load($profilearray[
'lang']);
307 $url = $_SERVER[
"PHP_SELF"].
'?action=gotodemo';
308 $urlwithmod = $url.
'&demochoice='.$profilearray[
'key'];
312 $urlfrom = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/i',
'', $_SERVER[
"PHP_SELF"]);
315 if (!empty($profilearray[
'url'])) {
316 $urlwithmod = $profilearray[
'url'];
317 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'urlfrom='.urlencode($urlfrom);
318 if (!empty($profilearray[
'disablemodules'])) {
319 $urlwithmod = $urlwithmod.(preg_match(
'/\?/', $urlwithmod) ?
'&' :
'?').
'disablemodules='.$profilearray[
'disablemodules'];
323 if (empty($profilearray[
'url'])) {
324 print
'<div class="clearboth"></div>';
327 print
'<form method="POST" class="valigntop inline-block" name="form'.$profilearray[
'key'].
'" id="form'.$profilearray[
'key'].
'" action="'.$_SERVER[
"PHP_SELF"].
'#a1'.$profilearray[
'key'].
'">'.
"\n";
328 print
'<input type="hidden" name="action" value="gotodemo">'.
"\n";
329 print
'<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).
'">'.
"\n";
330 print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
331 print
'<input type="hidden" name="username" value="demo">'.
"\n";
332 print
'<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.
'">'.
"\n";
333 print
'<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.
'">'.
"\n";
334 print
'<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.
'">'.
"\n";
335 print
'<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.
'">'.
"\n";
336 print
'<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.
'">'.
"\n";
338 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";
341 print
'<div id="a1'.$profilearray[
'key'].
'" class="demobox '.(empty($profilearray[
'url']) ?
'modulelineshow cursorpointer maxwidth1000' :
'nomodulelines').
'">';
343 print
'<a href="'.$urlwithmod.
'" class="'.(empty($profilearray[
'url']) ?
'modulelineshow' :
'nomodulelines').
'">';
344 print
'<div style="padding: 10px;">';
346 print
'<img class="demothumb" src="'.$profilearray[
'icon'].
'" alt="Demo '.$profilearray[
'label'].
'">';
348 print
'<div class="clearboth"></div>';
350 print
'<div class="demothumbtext">';
351 print $langs->trans($profilearray[
'label']);
359 if (empty($profilearray[
'url'])) {
360 print
'<div id="tr1'.$profilearray[
'key'].
'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:0.75em; padding-bottom: 8px">';
362 print
'<span class="opacitymedium small">'.$langs->trans(
"ThisIsListOfModules").
'</span><br><br>';
364 print
'<div class="csscolumns">';
366 $listofdisabledmodules = explode(
',', $profilearray[
'disablemodules']);
370 foreach ($orders as $index => $key) {
372 $val = $modules[$index];
373 $modulekeyname = strtolower($val->name);
375 $modulequalified = 1;
376 if (!empty($val->always_enabled) || in_array($modulekeyname, $alwayshiddenuncheckedmodules)) {
377 $modulequalified = 0;
380 $modulequalified = 0;
383 $modulequalified = 0;
385 if (!$modulequalified) {
389 if (in_array($modulekeyname, $alwayshiddencheckedmodules)) {
390 print
"\n".
'<!-- Module '.$modulekeyname.
' hidden and always checked -->';
391 print
'<input type="hidden" name="'.$modulekeyname.
'" value="1">';
395 print
'<!-- id='.$val->numero.
' -->';
396 print
'<div class="nowrap">';
397 print
'<input type="checkbox" class="checkbox valignmiddle paddingright" id="id'.$modulekeyname.
'" name="'.$modulekeyname.
'" value="1" title="'.
dol_escape_htmltag($val->getName()).
'"';
399 if (in_array($modulekeyname, $alwaysuncheckedmodules)) {
400 $disabled =
'disabled';
403 if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) {
414 print
'<label for="id'.$modulekeyname.
'" class="inline-block demomaxoveflow valignmiddle paddingleft'.($disabled ?
' opacitymedium' :
'').
'" title="'.
dol_escape_htmltag($val->getName()).
'">'.$val->getName().
'</label><br>';
423 print
'<br><div class="center">';
424 print
'<input type="submit" value=" '.$langs->trans(
"Start").
' " class="button">';
431 print
'</div></div>';
432 print
'</form>'.
"\n";
446 if (empty($conf->dol_use_jmobile)) {
447 print
'<div align="center">'.
"\n";
448 print
'<script><!--'.
"\n";
454 print
'</script>'.
"\n";
455 print
'<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>'.
"\n";
458 print
'<!-- google js advert tag disabled with jmobile -->'.
"\n";
478 top_htmlhead($head, $title, 0, 0, array(), array(
'public/demo/demo.css'), 0, 1);
480 print
'<body class="demobody"><div class="demobackgrounddiv">'.
"\n";
493 print
"</div></body>\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 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 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.
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.