Qual: Make some refactoring to prepare speed enhancement in menu loading.

This commit is contained in:
Laurent Destailleur 2011-02-18 09:50:45 +00:00
parent 58df0bc0d8
commit 74410b1fe1

View File

@ -57,10 +57,20 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN
// If smartphone mode, we do no show main page, we show only menu // If smartphone mode, we do no show main page, we show only menu
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone)) if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
{ {
include_once(DOL_DOCUMENT_ROOT.'/core/class/smartphone.class.php'); $smart_menu=$conf->smart_menu;
$smartphone = new Smartphone($db,$conf->browser->phone); // This class is only to know template dir according to phone type
$smartphone->title = $langs->trans("Home"); // Load the smartphone menu manager
$smartphone->smartmenu(); $result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$smart_menu);
if (! $result) // If failed to include, we try with standard
{
$conf->smart_menu='smartphone_backoffice.php';
include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$smart_menu);
}
$menusmart = new MenuSmart($db);
$menusmart->atarget=$target;
include_once(DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/menu.tpl.php');
exit; exit;
} }