mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Qual: Usage of smarty templates by some modules is now cleaner.
This commit is contained in:
parent
378b96d504
commit
1d600dd2f8
|
|
@ -88,8 +88,8 @@ class modMyModule extends DolibarrModules
|
|||
|
||||
// Constants
|
||||
$this->const = array(); // List of particular constants to add when module is enabled
|
||||
//Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0),
|
||||
// 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
|
||||
//Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
|
||||
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array('entity:Title:@mymodule:/mymodule/mynewtab.php?id=__ID__');
|
||||
|
|
@ -132,7 +132,7 @@ class modMyModule extends DolibarrModules
|
|||
|
||||
|
||||
// Main menu entries
|
||||
$this->menu = array(); // List of menus to add
|
||||
$this->menus = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
|
|
|
|||
|
|
@ -104,20 +104,6 @@ else if ($_POST["action"] == 'viewProdDescInForm')
|
|||
{
|
||||
dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $_POST["activate_viewProdDescInForm"],'chaine',0,'',$conf->entity);
|
||||
}
|
||||
/*
|
||||
else if ($_POST["action"] == 'confirmDeleteProdLineInForm')
|
||||
{
|
||||
dolibarr_set_const($db, "PRODUIT_CONFIRM_DELETE_LINE", $_POST["activate_confirmDeleteProdLineInForm"],'chaine',0,'',$conf->entity);
|
||||
}
|
||||
*/
|
||||
else if ($_POST["action"] == 'ProductCanvasAbility')
|
||||
{
|
||||
// Create temp directory for smarty
|
||||
if (! empty($dolibarr_smarty_compile)) create_exdir($dolibarr_smarty_compile);
|
||||
if (! empty($dolibarr_smarty_cache)) create_exdir($dolibarr_smarty_cache);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_NEED_SMARTY", $_POST["ProductCanvasAbility"],'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if ($_POST["action"] == 'usesearchtoselectproduct')
|
||||
{
|
||||
dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectproduct"],'chaine',0,'',$conf->entity);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class Conf
|
|||
|
||||
var $css_modules=array();
|
||||
var $tabs_modules=array();
|
||||
var $need_smarty=array();
|
||||
var $modules=array();
|
||||
|
||||
var $logbuffer=array();
|
||||
|
|
@ -139,13 +140,19 @@ class Conf
|
|||
//print '->'.$module.'->'.$dir_name.' = '.$this->$module->$dir_name.'<br>';
|
||||
}
|
||||
}
|
||||
// If this is constant for a smarty need by a module
|
||||
if (eregi('^MAIN_MODULE_([A-Z_]+)_NEEDSMARTY$',$key) && $value)
|
||||
{
|
||||
$module=strtolower($reg[1]);
|
||||
// Add this module in list of module that need smarty
|
||||
$this->need_smarty[]=$module;
|
||||
}
|
||||
// If this is a module constant
|
||||
if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value)
|
||||
{
|
||||
$module=strtolower($reg[1]);
|
||||
//print "Module ".$module." is enabled<br>\n";
|
||||
$this->$module->enabled=true;
|
||||
|
||||
// Add this module in list of enabled modules
|
||||
$this->modules[]=$module;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,16 +73,10 @@ class modDroitPret extends DolibarrModules
|
|||
// Config pages
|
||||
$this->config_page_url = array("droitpret.php");
|
||||
|
||||
// Constantes
|
||||
$this->const=array();
|
||||
$r=0;
|
||||
|
||||
$r++;
|
||||
$this->const[$r][0] = "MAIN_NEED_SMARTY";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = 1;
|
||||
$this->const[$r][3] = 'Need smarty';
|
||||
$this->const[$r][4] = 0;
|
||||
// Constants
|
||||
//Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
|
||||
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
|
||||
$this->const=array(1=>array('MAIN_MODULE_DROITPRET_NEEDSMARTY',"chaine",1,'Need smarty',0));
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
|
|
|
|||
|
|
@ -75,10 +75,12 @@ class modEditeur extends DolibarrModules
|
|||
$this->needtotopmenu = array();
|
||||
$this->langfiles = array("orders","bills","companies");
|
||||
|
||||
// Constantes
|
||||
$this->const=array(1=>array('MAIN_NEED_SMARTY','chaine',1,'Need smarty',0));
|
||||
// Constants
|
||||
//Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
|
||||
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
|
||||
$this->const=array(1=>array('MAIN_MODULE_DROITPRET_NEEDSMARTY','chaine',1,'Need smarty',0));
|
||||
|
||||
// Boites
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
|
||||
// Permissions
|
||||
|
|
|
|||
|
|
@ -569,11 +569,10 @@ else // Si utilisateur externe
|
|||
}
|
||||
|
||||
|
||||
// For modules using Smarty
|
||||
if ($conf->global->MAIN_NEED_SMARTY)
|
||||
// If there is at least one module using Smarty
|
||||
if (sizeof($conf->need_smarty) > 0)
|
||||
{
|
||||
// SMARTY
|
||||
// Definit dans le fichier de conf
|
||||
// SMARTY (Defined into conf file)
|
||||
// $dolibarr_smarty_libs_dir="/home/www/dolibarr/external-libs/smarty/libs/";
|
||||
// $dolibarr_smarty_compile="/home/www/dolibarr/documents/smarty/templates/temp";
|
||||
// $dolibarr_smarty_cache="/home/www/dolibarr/documents/smarty/cache/temp";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user