2008-12-02 15:16:18 +01:00
< ? php
2015-08-31 17:42:08 +02:00
/* Copyright ( C ) 2001 - 2002 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2006 - 2013 Laurent Destailleur < eldy @ users . sourceforge . net >
2018-10-27 14:43:12 +02:00
* Copyright ( C ) 2010 Regis Houssin < regis . houssin @ inodbox . com >
2015-08-31 17:42:08 +02:00
* Copyright ( C ) 2015 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2008-12-02 15:16:18 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2008-12-02 15:16:18 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2008-12-02 15:16:18 +01:00
*/
2009-01-21 19:15:08 +01:00
2008-12-02 15:16:18 +01:00
/**
2009-02-11 21:44:00 +01:00
* \file htdocs / public / demo / index . php
* \ingroup core
2009-07-15 15:32:01 +02:00
* \brief Entry page to access demo
2009-02-11 21:44:00 +01:00
*/
2008-12-02 15:16:18 +01:00
2020-01-30 01:48:28 +01:00
define ( " NOLOGIN " , 1 ); // This means this output page does not require to be logged.
define ( " NOCSRFCHECK " , 1 ); // We accept to go on this page from external web site.
2008-12-03 19:47:00 +01:00
2012-08-22 23:24:21 +02:00
require '../../main.inc.php' ;
2015-08-31 17:42:08 +02:00
require_once '../../core/lib/functions2.lib.php' ;
2008-12-02 15:16:18 +01:00
2018-10-01 08:22:23 +02:00
$langs -> loadLangs ( array ( " main " , " install " , " other " ));
2008-12-02 15:16:18 +01:00
2020-01-30 01:48:28 +01:00
$conf -> dol_hide_topmenu = GETPOST ( 'dol_hide_topmenu' , 'int' );
$conf -> dol_hide_leftmenu = GETPOST ( 'dol_hide_leftmenu' , 'int' );
$conf -> dol_optimize_smallscreen = GETPOST ( 'dol_optimize_smallscreen' , 'int' );
$conf -> dol_no_mouse_hover = GETPOST ( 'dol_no_mouse_hover' , 'int' );
$conf -> dol_use_jmobile = GETPOST ( 'dol_use_jmobile' , 'int' );
2013-05-02 17:41:10 +02:00
2009-07-15 15:02:51 +02:00
// Security check
2009-08-25 16:01:43 +02:00
global $dolibarr_main_demo ;
2019-01-27 11:55:16 +01:00
if ( empty ( $dolibarr_main_demo )) accessforbidden ( 'Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page' , 0 , 0 , 1 );
2009-07-15 15:32:01 +02:00
2017-06-10 12:56:28 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
2020-01-30 01:48:28 +01:00
$res = $hookmanager -> initHooks ( array ( 'demo' ));
$demoprofiles = array ();
$alwayscheckedmodules = array ();
$alwaysuncheckedmodules = array ();
$alwayshiddencheckedmodules = array ();
$alwayshiddenuncheckedmodules = array ();
$url = '' ;
$url .= ( $url ? '&' : '' ) . ( $conf -> dol_hide_topmenu ? 'dol_hide_topmenu=' . $conf -> dol_hide_topmenu : '' );
$url .= ( $url ? '&' : '' ) . ( $conf -> dol_hide_leftmenu ? 'dol_hide_leftmenu=' . $conf -> dol_hide_leftmenu : '' );
$url .= ( $url ? '&' : '' ) . ( $conf -> dol_optimize_smallscreen ? 'dol_optimize_smallscreen=' . $conf -> dol_optimize_smallscreen : '' );
$url .= ( $url ? '&' : '' ) . ( $conf -> dol_no_mouse_hover ? 'dol_no_mouse_hover=' . $conf -> dol_no_mouse_hover : '' );
$url .= ( $url ? '&' : '' ) . ( $conf -> dol_use_jmobile ? 'dol_use_jmobile=' . $conf -> dol_use_jmobile : '' );
$url = DOL_URL_ROOT . '/index.php' . ( $url ? '?' . $url : '' );
2017-02-03 14:48:16 +01:00
2012-01-25 23:16:17 +01:00
$tmpaction = 'view' ;
2020-01-30 01:48:28 +01:00
$parameters = array ();
$object = new stdClass ();
$reshook = $hookmanager -> executeHooks ( 'addDemoProfile' , $parameters , $object , $tmpaction ); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager -> error ; $errors = $hookmanager -> errors ;
2013-04-26 19:13:39 +02:00
if ( empty ( $reshook ))
{
2020-01-30 01:48:28 +01:00
$demoprofiles = array (
array ( 'default' => '1' , 'key' => 'profdemoservonly' , 'label' => 'DemoCompanyServiceOnly' ,
2020-01-21 13:01:49 +01:00
'disablemodules' => 'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos' ,
2017-02-03 14:48:16 +01:00
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png',
'icon' => DOL_URL_ROOT . '/public/demo/demo-profile-service.jpg' ,
'url' => $url
),
2020-01-30 01:48:28 +01:00
array ( 'default' => '0' , 'key' => 'profmanufacture' , 'label' => 'DemoCompanyManufacturing' ,
2020-01-21 13:25:38 +01:00
'disablemodules' => 'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service' ,
'icon' => DOL_URL_ROOT . '/public/demo/demo-profile-manufacturing.jpg' ,
'url' => $url
),
2020-01-30 01:48:28 +01:00
array ( 'default' => '0' , 'key' => 'profdemoprodstock' , 'label' => 'DemoCompanyProductAndStocks' ,
2020-01-21 13:25:38 +01:00
'disablemodules' => 'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service' ,
2017-02-03 14:48:16 +01:00
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png',
'icon' => DOL_URL_ROOT . '/public/demo/demo-profile-product.jpg' ,
'url' => $url
),
2020-01-30 01:48:28 +01:00
array ( 'default' => '0' , 'key' => 'profdemofun2' , 'label' => 'DemoFundation2' ,
2020-01-21 13:01:49 +01:00
'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' ,
2017-02-03 14:48:16 +01:00
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png',
'icon' => DOL_URL_ROOT . '/public/demo/demo-profile-foundation.jpg' ,
'url' => $url
),
2020-09-07 10:18:17 +02:00
// All demo profile
array ( 'default' => '0' , 'key' => 'profdemoall' , 'label' => 'ChooseYourDemoProfilMore' ,
2020-01-21 13:25:38 +01:00
'disablemodules' => 'adherent,cashdesk,don,externalsite,mailmanspip' ,
2020-09-07 10:18:17 +02:00
//'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'
2017-02-03 14:48:16 +01:00
'icon' => DOL_URL_ROOT . '/public/demo/demo-profile-all.jpg'
2020-09-07 10:18:17 +02:00
)
2013-04-26 19:13:39 +02:00
);
2013-12-31 10:48:15 +01:00
2017-06-13 13:22:05 +02:00
2013-04-26 19:13:39 +02:00
// Visible
2020-01-30 01:48:28 +01:00
$alwayscheckedmodules = array ( 'barcode' , 'bookmark' , 'categorie' , 'externalrss' , 'fckeditor' , 'geoipmaxmind' , 'gravatar' , 'memcached' , 'syslog' , 'user' , 'webservices' ); // Technical module we always want
$alwaysuncheckedmodules = array ( 'dav' , 'dynamicprices' , 'incoterm' , 'loan' , 'multicurrency' , 'paybox' , 'paypal' , 'stripe' , 'google' , 'printing' , 'scanner' , 'skype' , 'website' ); // Module we dont want by default
2013-04-26 19:13:39 +02:00
// Not visible
2020-01-30 01:48:28 +01:00
$alwayshiddencheckedmodules = array ( 'accounting' , 'api' , 'barcode' , 'blockedlog' , 'bookmark' , 'clicktodial' , 'comptabilite' , 'cron' , 'document' , 'domain' , 'externalrss' , 'externalsite' , 'fckeditor' , 'geoipmaxmind' , 'gravatar' , 'label' , 'ldap' ,
'mailmanspip' , 'notification' , 'oauth' , 'syslog' , 'user' , 'webservices' , 'workflow' ,
2020-09-07 10:18:17 +02:00
// Extended modules
'memcached' , 'numberwords' , 'zipautofillfr' );
2020-08-18 11:20:02 +02:00
$alwayshiddenuncheckedmodules = array ( 'collab' , 'dav' , 'debugbar' , 'emailcollector' , 'ftp' , 'hrm' , 'modulebuilder' , 'printing' , 'webservicesclient' , 'zappier' ,
2020-09-07 10:18:17 +02:00
// Extended modules
'awstats' , 'bittorrent' , 'bootstrap' , 'cabinetmed' , 'cmcic' , 'concatpdf' , 'customfield' , 'datapolicy' , 'deplacement' , 'dolicloud' , 'filemanager' , 'lightbox' , 'mantis' , 'monitoring' , 'moretemplates' , 'multicompany' , 'nltechno' , 'numberingpack' , 'openstreetmap' ,
'ovh' , 'phenix' , 'phpsysinfo' , 'pibarcode' , 'postnuke' , 'dynamicprices' , 'receiptprinter' , 'selectbank' , 'skincoloreditor' , 'submiteverywhere' , 'survey' , 'thomsonphonebook' , 'topten' , 'tvacerfa' , 'voyage' , 'webcalendar' , 'webmail' );
2013-04-26 19:13:39 +02:00
}
2008-12-02 15:16:18 +01:00
2010-09-29 09:32:09 +02:00
// Search modules
2020-01-30 01:48:28 +01:00
$dirlist = $conf -> file -> dol_document_root ;
2008-12-02 15:16:18 +01:00
2012-02-11 01:48:27 +01:00
// Search modules dirs
2015-08-31 17:42:08 +02:00
$modulesdir = dolGetModulesDirs ();
2012-02-11 01:48:27 +01:00
2010-09-29 09:32:09 +02:00
$filename = array ();
$modules = array ();
$orders = array ();
$categ = array ();
$dirmod = array ();
$i = 0 ; // is a sequencer of modules found
2010-12-15 18:40:57 +01:00
$j = 0 ; // j is module number. Automatically affected if module number not defined.
2010-09-29 09:32:09 +02:00
2012-02-11 01:48:27 +01:00
foreach ( $modulesdir as $dir )
{
2020-09-07 10:18:17 +02:00
// Charge tableaux modules, nom, numero, orders depuis repertoire dir
$handle = @ opendir ( $dir );
if ( is_resource ( $handle ))
{
while (( $file = readdir ( $handle )) !== false )
{
//print "$i ".$file."\n<br>";
if ( is_readable ( $dir . $file ) && substr ( $file , 0 , 3 ) == 'mod' && substr ( $file , dol_strlen ( $file ) - 10 ) == '.class.php' )
{
$modName = substr ( $file , 0 , dol_strlen ( $file ) - 10 );
if ( $modName )
{
try {
include_once $dir . $file ;
$objMod = new $modName ( $db );
if ( $objMod -> numero > 0 )
{
$j = $objMod -> numero ;
} else {
$j = 1000 + $i ;
}
$modulequalified = 1 ;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_' . strtoupper ( preg_replace ( '/^mod/i' , '' , get_class ( $objMod )));
if ( $objMod -> version == 'development' && $conf -> global -> MAIN_FEATURES_LEVEL < 2 && empty ( $conf -> global -> $const_name )) $modulequalified = 0 ;
if ( $objMod -> version == 'experimental' && $conf -> global -> MAIN_FEATURES_LEVEL < 1 && empty ( $conf -> global -> $const_name )) $modulequalified = 0 ;
if ( $modulequalified )
{
$modules [ $i ] = $objMod ;
$filename [ $i ] = $modName ;
$orders [ $i ] = $objMod -> family . " _ " . $j ; // Tri par famille puis numero module
//print "x".$modName." ".$orders[$i]."\n<br>";
$dirmod [ $i ] = $dirroot ;
$j ++ ;
$i ++ ;
}
} catch ( Exception $e )
{
dol_syslog ( " Failed to load " . $dir . $file . " " . $e -> getMessage (), LOG_ERR );
}
}
}
}
}
2008-12-02 15:16:18 +01:00
}
2010-09-29 09:32:09 +02:00
asort ( $orders );
//var_dump($orders);
2008-12-02 15:16:18 +01:00
/*
* Actions
*/
2019-01-27 11:55:16 +01:00
if ( GETPOST ( 'action' , 'aZ09' ) == 'gotodemo' ) // Action run when we click on "Start" after selection modules
2008-12-02 15:16:18 +01:00
{
2010-09-28 23:28:28 +02:00
//print 'ee'.GETPOST("demochoice");
2020-01-30 01:48:28 +01:00
$disablestring = '' ;
2010-09-28 23:28:28 +02:00
// If we disable modules using a profile choice
if ( GETPOST ( " demochoice " ))
2008-12-02 15:16:18 +01:00
{
2020-09-07 10:18:17 +02:00
foreach ( $demoprofiles as $profilearray )
{
if ( $profilearray [ 'key' ] == GETPOST ( " demochoice " ))
{
$disablestring = $profilearray [ 'disablemodules' ];
break ;
}
}
2010-09-28 23:28:28 +02:00
}
2010-09-29 09:32:09 +02:00
// If we disable modules using personalized list
2020-01-30 01:48:28 +01:00
foreach ( $modules as $val )
2010-09-28 23:28:28 +02:00
{
2020-09-07 10:18:17 +02:00
$modulekeyname = strtolower ( $val -> name );
if ( empty ( $_POST [ $modulekeyname ]) && empty ( $val -> always_enabled ) && ! in_array ( $modulekeyname , $alwayscheckedmodules ))
{
$disablestring .= $modulekeyname . ',' ;
if ( $modulekeyname == 'propale' ) $disablestring .= 'propal,' ;
}
2008-12-02 15:16:18 +01:00
}
2011-05-24 10:15:07 +02:00
2020-09-07 10:18:17 +02:00
// Do redirect to login page
2008-12-02 15:16:18 +01:00
if ( $disablestring )
{
2020-01-30 01:48:28 +01:00
if ( GETPOST ( 'urlfrom' )) $url .= ( preg_match ( '/\?/' , $url ) ? '&' : '?' ) . 'urlfrom=' . urlencode ( GETPOST ( 'urlfrom' , 'alpha' ));
$url .= ( preg_match ( '/\?/' , $url ) ? '&' : '?' ) . 'disablemodules=' . $disablestring ;
2020-09-07 10:18:17 +02:00
//var_dump($url);exit;
2008-12-10 15:56:05 +01:00
header ( " Location: " . $url );
2008-12-02 15:16:18 +01:00
exit ;
}
}
/*
* View
*/
2009-01-21 19:15:08 +01:00
2020-01-30 01:48:28 +01:00
$head = '' ;
$head .= '<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">' . " \n " ;
$head .= '<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">' . " \n " ;
2013-05-02 17:41:10 +02:00
2020-01-30 01:48:28 +01:00
$head .= '
2013-06-05 16:24:32 +02:00
< script type = " text/javascript " >
var openedId = " " ;
jQuery ( document ) . ready ( function () {
2017-06-13 13:22:05 +02:00
jQuery ( " tr.moduleline " ) . hide ();
// Enable this to allow personalized setup
jQuery ( " .modulelineshow " ) . attr ( " href " , " #a1profdemoall " );
jQuery ( " .cursorpointer " ) . css ( " cursor " , " pointer " );
jQuery ( " .modulelineshow " ) . click ( function () {
var idstring = $ ( this ) . attr ( " id " );
if ( typeof idstring != " undefined " )
{
var currentId = idstring . substring ( 2 );
jQuery ( " tr.moduleline " ) . hide ();
if ( currentId != openedId )
{
openedId = currentId ;
jQuery ( " #tr1 " + currentId ) . show ();
jQuery ( " #tr2 " + currentId ) . show ();
}
else openedId = " " ;
}
});
2013-06-05 16:24:32 +02:00
});
2013-05-02 17:41:10 +02:00
</ script > ' ;
llxHeaderVierge ( $langs -> trans ( " DolibarrDemo " ), $head );
2010-09-28 23:28:28 +02:00
2008-12-08 01:31:51 +01:00
print " \n " ;
2008-12-02 15:16:18 +01:00
2017-02-03 14:48:16 +01:00
print '<div class="demoban demobackground">' ;
print '<div class="right" style="padding-right: 30px; padding-top: 30px;">' ;
2020-05-15 12:43:48 +02:00
print '<a alt="Official portal of your ERP CRM application" targe="_blank" href="https://www.dolibarr.org"><img class="demologo" src="' . DOL_URL_ROOT . '/theme/dolibarr_logo.svg" alt="Dolibarr logo"></a>' ;
2017-02-03 14:48:16 +01:00
print '</div>' ;
print '</div>' ;
2008-12-02 15:16:18 +01:00
2017-02-03 14:48:16 +01:00
print '<div class="demobantext" style="max-width: 1024px;">' ;
print '<div style="font-size: 20px; padding: 40px;">' ;
2020-05-15 11:58:50 +02:00
print '<div class="hideonsmartphone" style="text-align: justify;">' . $langs -> trans ( " DemoDesc " ) . '</div><br>' ;
2017-06-18 12:48:58 +02:00
print '<div class="titre"><font style="font-size: 20px">' . $langs -> trans ( " ChooseYourDemoProfil " ) . '</font></div>' ;
2017-02-03 14:48:16 +01:00
print '</div>' ;
print '</div>' ;
2008-12-02 15:16:18 +01:00
2017-02-03 14:48:16 +01:00
print '<div class="clearboth"></div>' ;
print '<div class="demobanbox">' ;
2008-12-02 15:16:18 +01:00
2020-01-30 01:48:28 +01:00
$i = 0 ;
2012-01-27 12:19:37 +01:00
foreach ( $demoprofiles as $profilearray )
2008-12-02 15:16:18 +01:00
{
2012-01-27 12:19:37 +01:00
if ( $profilearray [ 'default' ] >= 0 )
2008-12-02 15:16:18 +01:00
{
2020-09-07 10:18:17 +02:00
//print $profilearray['lang'];
if ( ! empty ( $profilearray [ 'lang' ])) $langs -> load ( $profilearray [ 'lang' ]);
2012-01-27 12:19:37 +01:00
2020-01-30 01:48:28 +01:00
$url = $_SERVER [ " PHP_SELF " ] . '?action=gotodemo' ;
$urlwithmod = $url . '&demochoice=' . $profilearray [ 'key' ];
2010-12-19 19:05:38 +01:00
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
//print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>';
2017-06-13 13:22:05 +02:00
2020-09-07 10:18:17 +02:00
$urlfrom = preg_replace ( '/^' . preg_quote ( DOL_URL_ROOT , '/' ) . '/i' , '' , $_SERVER [ " PHP_SELF " ]);
2010-12-19 19:05:38 +01:00
//print $urlfrom;
2017-06-13 13:22:05 +02:00
2020-01-30 01:48:28 +01:00
if ( ! empty ( $profilearray [ 'url' ]))
2017-06-13 13:22:05 +02:00
{
2020-09-07 10:18:17 +02:00
$urlwithmod = $profilearray [ 'url' ];
$urlwithmod = $urlwithmod . ( preg_match ( '/\?/' , $urlwithmod ) ? '&' : '?' ) . 'urlfrom=' . urlencode ( $urlfrom );
if ( ! empty ( $profilearray [ 'disablemodules' ]))
{
$urlwithmod = $urlwithmod . ( preg_match ( '/\?/' , $urlwithmod ) ? '&' : '?' ) . 'disablemodules=' . $profilearray [ 'disablemodules' ];
}
2017-06-13 13:22:05 +02:00
}
2011-02-06 18:48:35 +01:00
2017-02-03 14:48:16 +01:00
if ( empty ( $profilearray [ 'url' ]))
{
2020-09-07 10:18:17 +02:00
print '<div class="clearboth"></div>' ;
2017-02-03 14:48:16 +01:00
}
2017-06-10 15:21:49 +02:00
2018-02-25 11:00:50 +01:00
print '<form method="POST" class="valigntop inline-block" name="form' . $profilearray [ 'key' ] . '" id="form' . $profilearray [ 'key' ] . '" action="' . $_SERVER [ " PHP_SELF " ] . '#a1' . $profilearray [ 'key' ] . '">' . " \n " ;
2010-12-19 19:05:38 +01:00
print '<input type="hidden" name="action" value="gotodemo">' . " \n " ;
2020-09-07 10:18:17 +02:00
print '<input type="hidden" name="urlfrom" value="' . dol_escape_htmltag ( $urlfrom ) . '">' . " \n " ;
print '<input type="hidden" name="token" value="' . newToken () . '">' . " \n " ;
print '<input type="hidden" name="username" value="demo">' . " \n " ;
print '<input type="hidden" name="dol_hide_topmenu" value="' . $conf -> dol_hide_topmenu . '">' . " \n " ;
print '<input type="hidden" name="dol_hide_leftmenu" value="' . $conf -> dol_hide_leftmenu . '">' . " \n " ;
print '<input type="hidden" name="dol_optimize_smallscreen" value="' . $conf -> dol_optimize_smallscreen . '">' . " \n " ;
print '<input type="hidden" name="dol_no_mouse_hover" value="' . $conf -> dol_no_mouse_hover . '">' . " \n " ;
print '<input type="hidden" name="dol_use_jmobile" value="' . $conf -> dol_use_jmobile . '">' . " \n " ;
2013-12-31 10:48:15 +01:00
2020-09-07 10:18:17 +02:00
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 " ;
2017-06-10 15:21:49 +02:00
2017-02-03 14:48:16 +01:00
2020-09-07 10:18:17 +02:00
print '<div id="a1' . $profilearray [ 'key' ] . '" class="demobox ' . ( empty ( $profilearray [ 'url' ]) ? 'modulelineshow cursorpointer' : 'nomodulelines' ) . '">' ;
2017-02-03 14:48:16 +01:00
2020-09-07 10:18:17 +02:00
print '<a href="' . $urlwithmod . '" class="' . ( empty ( $profilearray [ 'url' ]) ? 'modulelineshow' : 'nomodulelines' ) . '">' ;
2017-02-03 14:48:16 +01:00
print '<div style="padding: 10px;">' ;
2017-06-10 15:21:49 +02:00
2017-02-03 14:48:16 +01:00
print '<img class="demothumb" src="' . $profilearray [ 'icon' ] . '" alt="Demo ' . $profilearray [ 'label' ] . '">' ;
2017-06-10 15:21:49 +02:00
2017-02-03 14:48:16 +01:00
print '<div class="clearboth"></div>' ;
2017-06-10 15:21:49 +02:00
2017-02-03 16:01:06 +01:00
print '<div class="demothumbtext">' ;
2020-09-07 10:18:17 +02:00
print $langs -> trans ( $profilearray [ 'label' ]);
print '</div>' ;
2017-06-10 15:21:49 +02:00
2020-09-07 10:18:17 +02:00
print '</div>' ;
print '</a>' ;
2017-06-10 15:21:49 +02:00
2020-09-07 10:18:17 +02:00
// Modules (a profile you must choose modules)
if ( empty ( $profilearray [ 'url' ]))
{
print '<div id="tr1' . $profilearray [ 'key' ] . '" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">' ;
print $langs -> trans ( " ThisIsListOfModules " ) . '<br><br>' ;
print '<div class="csscolumns">' ;
$listofdisabledmodules = explode ( ',' , $profilearray [ 'disablemodules' ]);
$j = 0 ;
$nbcolsmod = empty ( $conf -> dol_optimize_smallscreen ) ? 4 : 3 ;
//var_dump($modules);
foreach ( $orders as $index => $key ) // Loop on qualified (enabled) modules
{
//print $index.' '.$key;
$val = $modules [ $index ];
$modulekeyname = strtolower ( $val -> name );
$modulequalified = 1 ;
if ( ! empty ( $val -> always_enabled ) || in_array ( $modulekeyname , $alwayshiddenuncheckedmodules )) $modulequalified = 0 ;
if ( $val -> version == 'development' && $conf -> global -> MAIN_FEATURES_LEVEL < 2 && ! $conf -> global -> $const_name ) $modulequalified = 0 ;
if ( $val -> version == 'experimental' && $conf -> global -> MAIN_FEATURES_LEVEL < 1 && ! $conf -> global -> $const_name ) $modulequalified = 0 ;
if ( ! $modulequalified ) continue ;
if ( in_array ( $modulekeyname , $alwayshiddencheckedmodules ))
{
print " \n " . '<!-- Module ' . $modulekeyname . ' hidden and always checked -->' ;
print '<input type="hidden" name="' . $modulekeyname . '" value="1">' ;
} else {
$modulo = ( $j % $nbcolsmod );
//if ($modulo == 0) print '<tr>';
print '<!-- id=' . $val -> numero . ' -->' ;
print '<div class="nowrap">' ;
print '<input type="checkbox" class="checkbox" id="id' . $modulekeyname . '" name="' . $modulekeyname . '" value="1" title="' . dol_escape_htmltag ( $val -> getName ()) . '"' ;
if ( in_array ( $modulekeyname , $alwaysuncheckedmodules )) print ' disabled' ;
if ( ! in_array ( $modulekeyname , $alwaysuncheckedmodules ) && ( ! in_array ( $modulekeyname , $listofdisabledmodules ) || in_array ( $modulekeyname , $alwayscheckedmodules ))) print ' checked' ;
print '> <label for="id' . $modulekeyname . '" class="inline-block demomaxoveflow" title="' . dol_escape_htmltag ( $val -> getName ()) . '">' . $val -> getName () . '</label><br>' ;
print '</div>' ;
//if ($modulo == ($nbcolsmod - 1)) print '</tr>';
$j ++ ;
}
}
print '</div>' ;
print '<br><div class="center">' ;
print '<input type="submit" value=" ' . $langs -> trans ( " Start " ) . ' " class="button">' ;
print '</div>' ;
print '</div>' ;
}
2017-02-03 14:48:16 +01:00
2020-09-07 10:18:17 +02:00
print '</div></div>' ;
2013-12-31 10:48:15 +01:00
print '</form>' . " \n " ;
2010-09-28 23:28:28 +02:00
2008-12-08 16:37:05 +01:00
$i ++ ;
}
2008-12-02 15:16:18 +01:00
}
2017-02-03 14:48:16 +01:00
print '</div>' ;
2008-12-02 15:16:18 +01:00
2013-12-31 10:48:15 +01:00
// TODO Replace this with a hook
2011-02-20 17:35:35 +01:00
// Google Adsense (need Google module)
2020-01-30 01:48:28 +01:00
if ( ! empty ( $conf -> google -> enabled ) && ! empty ( $conf -> global -> MAIN_GOOGLE_AD_CLIENT ) && ! empty ( $conf -> global -> MAIN_GOOGLE_AD_SLOT ))
2009-07-12 09:06:24 +02:00
{
2013-12-31 10:48:15 +01:00
if ( empty ( $conf -> dol_use_jmobile ))
{
print '<div align="center">' . " \n " ;
2020-08-16 22:03:11 +02:00
print '<script><!--' . " \n " ;
2013-12-31 10:48:15 +01:00
print 'google_ad_client = "' . $conf -> global -> MAIN_GOOGLE_AD_CLIENT . '";' . " \n " ;
print 'google_ad_slot = "' . $conf -> global -> MAIN_GOOGLE_AD_SLOT . '";' . " \n " ;
print 'google_ad_width = ' . $conf -> global -> MAIN_GOOGLE_AD_WIDTH . ';' . " \n " ;
print 'google_ad_height = ' . $conf -> global -> MAIN_GOOGLE_AD_HEIGHT . ';' . " \n " ;
print '//-->' . " \n " ;
print '</script>' . " \n " ;
2020-08-16 22:03:11 +02:00
print '<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>' . " \n " ;
2013-12-31 10:48:15 +01:00
print '</div>' . " \n " ;
2020-05-21 15:05:19 +02:00
} else {
2016-08-17 11:39:11 +02:00
print '<!-- google js advert tag disabled with jmobile -->' . " \n " ;
2013-12-31 10:48:15 +01:00
}
2009-07-12 09:06:24 +02:00
}
2011-08-27 21:15:14 +02:00
llxFooterVierge ();
2010-09-29 09:32:09 +02:00
2013-01-10 08:27:12 +01:00
$db -> close ();
2012-12-28 22:05:36 +01:00
2010-09-29 09:32:09 +02:00
2011-10-18 16:40:44 +02:00
/**
* Show header for demo
*
2012-01-08 00:52:07 +01:00
* @ param string $title Title
* @ param string $head Head string
2011-10-18 16:40:44 +02:00
* @ return void
*/
2010-09-29 09:32:09 +02:00
function llxHeaderVierge ( $title , $head = " " )
{
2020-09-07 10:18:17 +02:00
global $user , $conf , $langs ;
2010-09-29 09:32:09 +02:00
2020-09-07 10:18:17 +02:00
top_httphead ();
2013-12-31 10:48:15 +01:00
2020-09-07 10:18:17 +02:00
top_htmlhead ( $head , $title , 0 , 0 , array (), array ( 'public/demo/demo.css' ));
2013-12-31 10:48:15 +01:00
2020-09-07 10:18:17 +02:00
print '<body class="demobody"><div class="demobackgrounddiv">' . " \n " ;
2010-09-29 09:32:09 +02:00
}
2011-10-18 16:40:44 +02:00
/**
* Show footer for demo
*
* @ return void
*/
2010-09-29 09:32:09 +02:00
function llxFooterVierge ()
{
2020-09-07 10:18:17 +02:00
printCommonFooter ( 'public' );
2011-10-18 16:26:40 +02:00
2020-09-07 10:18:17 +02:00
print " \n " ;
print " </div></body> \n " ;
print " </html> \n " ;
2010-09-29 09:32:09 +02:00
}