2019-03-16 16:27:14 +01:00
< ? php
/* 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 3 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 , see < http :// www . gnu . org / licenses />.
*/
/**
* \defgroup debugbar Debug bar
* \brief debugbar module descriptor .
*
* \file htdocs / core / modules / modDebugBar . class . php
* \ingroup debugbar
* \brief Description and activation file for module debugbar
*/
include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php' ;
/**
* Class to describe and enable module
*/
class modDebugBar extends DolibarrModules
{
/**
* Constructor . Define names , constants , directories , boxes , permissions
*
* @ param DoliDB $db Database handler
*/
public function __construct ( $db )
{
$this -> db = $db ;
$this -> numero = 43 ;
$this -> rights_class = 'debugbar' ;
$this -> family = " base " ;
$this -> module_position = '75' ;
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this -> name = preg_replace ( '/^mod/i' , '' , get_class ( $this ));
2019-03-17 00:32:39 +01:00
$this -> description = " A tool for developper adding a debug bar in your browser. " ;
2019-03-16 16:27:14 +01:00
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this -> version = 'dolibarr' ;
$this -> const_name = 'MAIN_MODULE_' . strtoupper ( $this -> name );
$this -> picto = 'technic' ;
$this -> module_parts = array (
// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
'hooks' => array (
'data' => array (
'main' ,
'login' ,
),
'entity' => '0' ,
),
// Set this to 1 if feature of module are opened to external users
'moduleforexternal' => 0 ,
);
// Data directories to create when module is enabled
$this -> dirs = array ();
// Dependencies
$this -> depends = array (); // May be used for product or service or third party module
$this -> requiredby = array ();
// Config pages
2019-03-17 00:32:39 +01:00
$this -> config_page_url = array ( " debugbar.php " );
2019-03-16 16:27:14 +01:00
// 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 (
0 => array ( 'DEBUGBAR_LOGS_LINES_NUMBER' , 'chaine' , '100' , 'Number of log lines to show in debug bar' , 1 )
);
// Boxes
$this -> boxes = array ();
// Permissions
$this -> rights = array ();
$this -> rights [ 1 ][ 0 ] = 430 ; // id de la permission
$this -> rights [ 1 ][ 1 ] = 'Use Debug Bar' ; // libelle de la permission
$this -> rights [ 1 ][ 2 ] = 'u' ; // type de la permission (deprecie a ce jour)
$this -> rights [ 1 ][ 3 ] = 1 ; // La permission est-elle une permission par defaut
$this -> rights [ 1 ][ 4 ] = 'read' ;
}
/**
* Function called when module is enabled .
* The init function add constants , boxes , permissions and menus ( defined in constructor ) into Dolibarr database .
* It also creates data directories .
*
* @ param string $options Options when enabling module ( '' , 'noboxes' )
* @ return int 1 if OK , 0 if KO
*/
public function init ( $options = '' )
{
// Permissions
$this -> remove ( $options );
$sql = array (
);
return $this -> _init ( $sql , $options );
}
/**
* Function called after module configuration .
*
2019-03-16 20:10:22 +01:00
* @ return void
2019-03-16 16:27:14 +01:00
*/
public function loadSettings ()
{
$this -> addPermission ( " use " , " UseDebugBar " , " u " );
$this -> enableHooks ( array (
'main' ,
'login'
));
}
}