dolibarr  7.0.0-beta
Public Member Functions | List of all members
DolibarrModules Class Reference

Class DolibarrModules. More...

+ Inheritance diagram for DolibarrModules:

Public Member Functions

 __construct ($db)
 Constructor. More...
 
 _init ($array_sql, $options='')
 Enables a module. More...
 
 _remove ($array_sql, $options='')
 Disable function. More...
 
 getName ()
 Gives the translated module name if translation exists in admin.lang or into language files of module. More...
 
 getDesc ()
 Gives the translated module description if translation exists in admin.lang or the default module description. More...
 
 getDescLong ()
 Gives the long description of a module. More...
 
 getDescLongReadmeFound ()
 Return path of file if a README file was found. More...
 
 getChangeLog ()
 Gives the changelog. More...
 
 getPublisher ()
 Gives the publisher name. More...
 
 getPublisherUrl ()
 Gives the publisher url. More...
 
 getVersion ($translated=1)
 Gives module version (translated if param $translated is on) For 'experimental' modules, gives 'experimental' translation For 'dolibarr' modules, gives Dolibarr version. More...
 
 isCoreOrExternalModule ()
 Tells if module is core or external. More...
 
 getLangFilesArray ()
 Gives module related language files list. More...
 
 getExportDatasetLabel ($r)
 Gives translated label of an export dataset. More...
 
 getImportDatasetLabel ($r)
 Gives translated label of an import dataset. More...
 
 getLastActivationDate ()
 Gives the last date of activation. More...
 
 getLastActivationInfo ()
 Gives the last author of activation. More...
 
 _active ()
 Insert constants for module activation. More...
 
 _unactive ()
 Module deactivation. More...
 
 _load_tables ($reldir)
 Create tables and keys required by module. More...
 
 insert_boxes ($option='')
 Adds boxes. More...
 
 delete_boxes ()
 Removes boxes. More...
 
 insert_cronjobs ()
 Adds cronjobs. More...
 
 delete_cronjobs ()
 Removes boxes. More...
 
 delete_tabs ()
 Removes tabs. More...
 
 insert_tabs ()
 Adds tabs. More...
 
 insert_const ()
 Adds constants. More...
 
 delete_const ()
 Removes constants tagged 'deleteonunactive'. More...
 
 insert_permissions ($reinitadminperms=0, $force_entity=null, $notrigger=0)
 Adds access rights. More...
 
 delete_permissions ()
 Removes access rights. More...
 
 insert_menus ()
 Adds menu entries. More...
 
 delete_menus ()
 Removes menu entries. More...
 
 create_dirs ()
 Creates directories. More...
 
 insert_dirs ($name, $dir)
 Adds directories definitions. More...
 
 delete_dirs ()
 Removes directories. More...
 
 insert_module_parts ()
 Adds generic parts. More...
 
 delete_module_parts ()
 Removes generic parts. More...
 
 init ($options= '')
 Function called when module is enabled. More...
 
 remove ($options= '')
 Function called when module is disabled. More...
 

Detailed Description

Class DolibarrModules.

Parent class for module descriptor class files

Definition at line 35 of file DolibarrModules.class.php.

Constructor & Destructor Documentation

DolibarrModules::__construct (   $db)

Constructor.

Define names, constants, directories, boxes, permissions

Parameters
DoliDB$dbDatabase handler

Definition at line 371 of file DolibarrModules.class.php.

Member Function Documentation

DolibarrModules::_active ( )

Insert constants for module activation.

Returns
int Error count (0 if OK)

Definition at line 950 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

Referenced by _init().

DolibarrModules::_init (   $array_sql,
  $options = '' 
)
DolibarrModules::_load_tables (   $reldir)

Create tables and keys required by module.

Files module.sql and module.key.sql with create table and create keys commands must be stored in directory reldir='/module/sql/' This function is called by this->init

Parameters
string$reldirRelative directory where to scan files
Returns
int <=0 if KO, >0 if OK

Definition at line 1017 of file DolibarrModules.class.php.

References dol_syslog(), and run_sql().

Referenced by modApi\init(), modMyModule\init(), and modResource\loadTables().

DolibarrModules::_remove (   $array_sql,
  $options = '' 
)

Disable function.

Deletes the module constant and boxes from the database.

Parameters
string[]$array_sql SQL requests to be executed when module is disabled
string$optionsOptions when disabling module: 'newboxdefonly|noboxes' = We don't remove boxes.
Returns
int 1 if OK, 0 if KO

Definition at line 482 of file DolibarrModules.class.php.

References _unactive(), delete_boxes(), delete_const(), delete_cronjobs(), delete_dirs(), delete_menus(), delete_module_parts(), delete_permissions(), delete_tabs(), and dol_syslog().

Referenced by modExternalRss\remove(), modBlockedLog\remove(), modSupplierProposal\remove(), modMultiCurrency\remove(), modMyModule\remove(), and remove().

DolibarrModules::_unactive ( )

Module deactivation.

Returns
int Error count (0 if OK)

Definition at line 988 of file DolibarrModules.class.php.

References dol_syslog().

Referenced by _remove().

DolibarrModules::create_dirs ( )

Creates directories.

Returns
int Error count (0 if OK)

Definition at line 1939 of file DolibarrModules.class.php.

References dol_mkdir(), dol_syslog(), and insert_dirs().

Referenced by _init().

DolibarrModules::delete_boxes ( )

Removes boxes.

Returns
int Error count (0 if OK)

Definition at line 1229 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

Referenced by _remove().

DolibarrModules::delete_const ( )

Removes constants tagged 'deleteonunactive'.

Returns
int <0 if KO, 0 if OK

Definition at line 1602 of file DolibarrModules.class.php.

References dol_syslog().

Referenced by _remove().

DolibarrModules::delete_cronjobs ( )

Removes boxes.

Returns
int Error count (0 if OK)

Definition at line 1413 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

Referenced by _remove().

DolibarrModules::delete_dirs ( )

Removes directories.

Returns
int Error count (0 if OK)

Definition at line 2041 of file DolibarrModules.class.php.

References dol_syslog().

Referenced by _remove().

DolibarrModules::delete_menus ( )

Removes menu entries.

Returns
int Error count (0 if OK)

Definition at line 1910 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

Referenced by _remove().

DolibarrModules::delete_module_parts ( )

Removes generic parts.

Returns
int Error count (0 if OK)

Definition at line 2142 of file DolibarrModules.class.php.

References dol_syslog().

Referenced by _remove().

DolibarrModules::delete_permissions ( )

Removes access rights.

Returns
int Error count (0 if OK)

Definition at line 1778 of file DolibarrModules.class.php.

References dol_syslog().

Referenced by _remove().

DolibarrModules::delete_tabs ( )

Removes tabs.

Returns
int Error count (0 if OK)

Definition at line 1442 of file DolibarrModules.class.php.

References dol_syslog().

Referenced by _remove().

DolibarrModules::getChangeLog ( )

Gives the changelog.

First check ChangeLog-la_LA.md then ChangeLog.md

Returns
string Content of ChangeLog

Definition at line 721 of file DolibarrModules.class.php.

References dol_buildpath(), dol_is_file(), dolMd2Html(), and name.

DolibarrModules::getDesc ( )

Gives the translated module description if translation exists in admin.lang or the default module description.

Returns
string Translated module description

Definition at line 589 of file DolibarrModules.class.php.

References description, and name.

DolibarrModules::getDescLong ( )

Gives the long description of a module.

First check README-la_LA.md then README.md If not markdown files found, it return translated value of the key ->descriptionlong.

Returns
string Long description of a module from README.md of from property.

Definition at line 627 of file DolibarrModules.class.php.

References dol_buildpath(), dolMd2Html(), getDescLongReadmeFound(), and name.

DolibarrModules::getDescLongReadmeFound ( )

Return path of file if a README file was found.

Returns
string Path of file if a README file was found.

Definition at line 681 of file DolibarrModules.class.php.

References dol_buildpath(), dol_is_file(), and name.

Referenced by getDescLong().

DolibarrModules::getExportDatasetLabel (   $r)

Gives translated label of an export dataset.

Parameters
int$rDataset index
Returns
string Translated databaset label

Definition at line 844 of file DolibarrModules.class.php.

DolibarrModules::getImportDatasetLabel (   $r)

Gives translated label of an import dataset.

Parameters
int$rDataset index
Returns
string Translated dataset label

Definition at line 869 of file DolibarrModules.class.php.

DolibarrModules::getLangFilesArray ( )

Gives module related language files list.

Returns
string[] Language files list

Definition at line 832 of file DolibarrModules.class.php.

DolibarrModules::getLastActivationDate ( )

Gives the last date of activation.

Returns
timestamp Date of last activation

Definition at line 893 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

DolibarrModules::getLastActivationInfo ( )

Gives the last author of activation.

Returns
array Array array('authorid'=>Id of last activation user, 'lastactivationdate'=>Date of last activation)

Definition at line 919 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

DolibarrModules::getName ( )

Gives the translated module name if translation exists in admin.lang or into language files of module.

Otherwise return the module key name.

Returns
string Translated module name

Definition at line 551 of file DolibarrModules.class.php.

References name.

DolibarrModules::getPublisher ( )

Gives the publisher name.

Returns
string Publisher name

Definition at line 770 of file DolibarrModules.class.php.

DolibarrModules::getPublisherUrl ( )

Gives the publisher url.

Returns
string Publisher url

Definition at line 780 of file DolibarrModules.class.php.

DolibarrModules::getVersion (   $translated = 1)

Gives module version (translated if param $translated is on) For 'experimental' modules, gives 'experimental' translation For 'dolibarr' modules, gives Dolibarr version.

Parameters
int$translated1=Special version keys are translated, 0=Special version keys are not translated
Returns
string Module version

Definition at line 793 of file DolibarrModules.class.php.

DolibarrModules::init (   $options = '')

Function called when module is enabled.

The init function adds tabs, constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. It also creates data directories

Parameters
string$optionsOptions when enabling module ('', 'newboxdefonly', 'noboxes') 'noboxes' = Do not insert boxes 'newboxdefonly' = For boxes, insert def of boxes only and not boxes activation
Returns
int 1 if OK, 0 if KO

Definition at line 2181 of file DolibarrModules.class.php.

References _init().

DolibarrModules::insert_boxes (   $option = '')

Adds boxes.

Parameters
string$optionOptions when disabling module ('newboxdefonly'=insert only boxes definition)
Returns
int Error count (0 if OK)

Definition at line 1133 of file DolibarrModules.class.php.

References $resql, dol_syslog(), and InfoBox\getListOfPagesForBoxes().

Referenced by _init().

DolibarrModules::insert_const ( )

Adds constants.

Returns
int Error count (0 if OK)

Definition at line 1533 of file DolibarrModules.class.php.

References dol_syslog(), and if.

Referenced by _init().

DolibarrModules::insert_cronjobs ( )

Adds cronjobs.

Returns
int Error count (0 if OK)

Definition at line 1304 of file DolibarrModules.class.php.

References $resql, dol_now(), and dol_syslog().

Referenced by _init().

DolibarrModules::insert_dirs (   $name,
  $dir 
)

Adds directories definitions.

Parameters
string$nameName
string$dirDirectory
Returns
int Error count (0 if OK)

Definition at line 2000 of file DolibarrModules.class.php.

References dol_syslog(), and name.

Referenced by create_dirs().

DolibarrModules::insert_menus ( )

Adds menu entries.

Returns
int Error count (0 if OK)

Definition at line 1803 of file DolibarrModules.class.php.

References dol_syslog().

Referenced by _init().

DolibarrModules::insert_module_parts ( )

Adds generic parts.

Returns
int Error count (0 if OK)

Definition at line 2066 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

Referenced by _init().

DolibarrModules::insert_permissions (   $reinitadminperms = 0,
  $force_entity = null,
  $notrigger = 0 
)

Adds access rights.

Parameters
int$reinitadminpermsIf 1, we also grant them to all admin users
int$force_entityForce current entity
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
int Error count (0 if OK)

Definition at line 1640 of file DolibarrModules.class.php.

References $resql, dol_print_error(), dol_strlen(), dol_syslog(), and name.

Referenced by _init().

DolibarrModules::insert_tabs ( )

Adds tabs.

Returns
int Error count (0 if ok)

Definition at line 1467 of file DolibarrModules.class.php.

References $resql, and dol_syslog().

Referenced by _init().

DolibarrModules::isCoreOrExternalModule ( )

Tells if module is core or external.

Returns
string 'core', 'external' or 'unknown'

Definition at line 817 of file DolibarrModules.class.php.

DolibarrModules::remove (   $options = '')

Function called when module is disabled.

The remove function removes tabs, constants, boxes, permissions and menus from Dolibarr database. Data directories are not deleted

Parameters
string$optionsOptions when enabling module ('', 'noboxes')
Returns
int 1 if OK, 0 if KO

Definition at line 2194 of file DolibarrModules.class.php.

References _remove().


The documentation for this class was generated from the following file: