* Copyright (C) 2006-2009 Laurent Destailleur * * 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 * the Free Software Foundation; either version 2 of the License, or * (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 * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/public/demo/index.php * \ingroup core * \brief File to access demo * \author Laurent Destailleur * \version $Id$ */ require("../../master.inc.php"); $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); $langs->setDefaultLang($langcode); $langs->load("main"); $langs->load("other"); $demoprofiles=array( array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation', 'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,facture,ficheinter,fournisseur,prelevement,produit,projet,propal,propale,service,societe,stock,tax', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'), array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', 'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,facture,ficheinter,fournisseur,prelevement,produit,projet,propal,propale,service,societe,stock', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'), array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', 'disablemodules'=>'adherent,barcode,boutique,cashdesk,don,expedition,prelevement,projet,stock', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'), array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', 'disablemodules'=>'adherent,boutique,don,ficheinter,prelevement,produit,stock', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', 'disablemodules'=>'adherent,boutique,cashdesk,don,ficheinter,prelevement,service', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'), array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll', 'disablemodules'=>'adherent,boutique,cashdesk,don', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'), ); function llxHeaderVierge($title, $head = "") { global $user, $conf, $langs; header("Content-type: text/html; charset=".$conf->file->character_set_client); print ''; //print ''; print "\n"; print "\n"; print "\n"; print ''."\n"; print ''."\n"; print ''."\n"; print "".$title."\n"; print ''."\n"; if ($head) print $head."\n"; print ''; print "\n"; print ''."\n"; } function llxFooter() { print "\n"; print "\n"; } /* * Actions */ if ($_REQUEST["action"] == 'gotodemo') { //print 'ee'.$_POST["demochoice"]; $disablestring=''; foreach ($demoprofiles as $profilearray) { if ($profilearray['key'] == $_REQUEST["demochoice"]) { $disablestring=$profilearray['disablemodules']; break; } } if ($disablestring) { $url=DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring; if (! empty($_REQUEST["urlfrom"])) $url.='&urlfrom='.$_REQUEST["urlfrom"]; if (! empty($conf->global->MAIN_DEMO)) $url.='&username='.urlencode($conf->global->MAIN_DEMO); header("Location: ".$url); exit; } } /* * View */ llxHeaderVierge($langs->trans("DolibarrDemo")); // Search modules $dirlist=$conf->file->dol_document_root; $filename = array(); $modules = array(); $orders = array(); $categ = array(); $dirmod = array(); $i = 0; // is a sequencer of modules found $j = 0; // j is module number. Automatically affeted if module number not defined. foreach ($dirlist as $dirroot) { $dir = $dirroot . "/includes/modules/"; // Charge tableaux modules, nom, numero, orders depuis r�pertoire dir $handle=opendir($dir); while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') { $modName = substr($file, 0, strlen($file) - 10); if ($modName) { include_once($dir.$file); $objMod = new $modName($db); if ($objMod->numero > 0) { $j = $objMod->numero; } else { $j = 1000 + $i; } $modulequalified=1; // We discard modules that does not respect constraint on menu handlers if ($objMod->needleftmenu && sizeof($objMod->needleftmenu) && ! in_array($conf->left_menu,$objMod->needleftmenu)) $modulequalified=0; if ($objMod->needtopmenu && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0; // We discard modules according to features level (PS: if module is activated we always show it) $const_name = 'MAIN_MODULE_'.strtoupper(eregi_replace('^mod','',get_class($objMod))); if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $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
"; $categ[$objMod->special]++; // Array of all different modules categories $dirmod[$i] = $dirroot; $j++; $i++; } } } } } asort($orders); //var_dump($orders); print '
'; print ''; print "\n"; print ''; print ''; print ''; print ''; // Description print ''; // Button /* print ''; */ print '
'; print '
Dolibarr logo

'; print '
'; print $langs->trans("DemoDesc").'
'; print '
'; print ''.$langs->trans("ChooseYourDemoProfil").''; print '
'; $NBOFCOLS=2; print ''."\n"; $i=0; foreach ($demoprofiles as $profilarray) { if ($profilarray['default'] >= 0) { $url=$_SERVER["PHP_SELF"].'?action=gotodemo&demochoice='.$profilarray['key'].'&urlfrom='.urlencode($_SERVER["PHP_SELF"]); //if ($i % $NBOFCOLS == 0) print ''; print ''; print ''; //if ($i % $NBOFCOLS == ($NBOFCOLS-1)) print ''."\n"; print ''."\n"; $i++; } } print '
'; print ''."\n"; print ''; print ''; //print ''; print ''; print '
Demo '.$profilarray['label'].''.$langs->trans($profilarray['label']).'
'; print '
'; print '
'; print '
'; print ''; print ' ">'; print '
'; print '
'; $db->close(); llxFooter('$Date$ - $Revision$'); ?>