dolibarr  19.0.0-dev
Functions
modulebuilder.lib.php File Reference

Set of function for modulebuilder management. More...

Go to the source code of this file.

Functions

 rebuildObjectClass ($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array(), $delfieldentry='')
 Regenerate files .class.php. More...
 
 rebuildObjectSql ($destdir, $module, $objectname, $newmask, $readdir='', $object=null, $moduletype='external')
 Save data into a memory area shared by all users, all sessions on server. More...
 
 dolGetListOfObjectClasses ($destdir)
 Get list of existing objects from directory. More...
 
 deletePerms ($file)
 Delete all permissions. More...
 
 compareFirstValue ($a, $b)
 Compare two value. More...
 
 reWriteAllPermissions ($file, $permissions, $key, $right, $objectname, $module, $action)
 Rewriting all permissions after any actions. More...
 
 writePropsInAsciiDoc ($file, $objectname, $destfile)
 Write all properties of the object in AsciiDoc format. More...
 
 deletePropsFromDoc ($file, $objectname)
 Delete property from documentation if we delete object. More...
 
 getFromFile ($file, $start, $end)
 Search a string and return all lines needed from file. More...
 
 writePermsInAsciiDoc ($file, $destfile)
 Write all permissions of each object in AsciiDoc format. More...
 
 addObjectsToApiFile ($file, $objects, $modulename)
 Add Object in ModuleApi File. More...
 
 removeObjectFromApiFile ($file, $objectname, $modulename)
 Remove Object variables and methods from API_Module File. More...
 
 reWriteAllMenus ($file, $menus, $menuWantTo, $key, $action)
 

Detailed Description

Set of function for modulebuilder management.

Definition in file modulebuilder.lib.php.

Function Documentation

◆ addObjectsToApiFile()

addObjectsToApiFile (   $file,
  $objects,
  $modulename 
)

Add Object in ModuleApi File.

Parameters
string$filepath of file
array$objectsarray of objects in the module
string$modulenamename of module
Returns
int 1 if OK, -1 if KO

Definition at line 830 of file modulebuilder.lib.php.

◆ compareFirstValue()

compareFirstValue (   $a,
  $b 
)

Compare two value.

Parameters
int | string$avalue 1
int | string$bvalue 2
Returns
int less 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

Definition at line 491 of file modulebuilder.lib.php.

◆ deletePerms()

deletePerms (   $file)

Delete all permissions.

Parameters
string$filefile with path
Returns
void

Definition at line 458 of file modulebuilder.lib.php.

◆ deletePropsFromDoc()

deletePropsFromDoc (   $file,
  $objectname 
)

Delete property from documentation if we delete object.

Parameters
string$filefile or path
string$objectnamename of object wants to deleted
Returns
void

Definition at line 700 of file modulebuilder.lib.php.

◆ dolGetListOfObjectClasses()

dolGetListOfObjectClasses (   $destdir)

Get list of existing objects from directory.

Parameters
string$destdirDirectory
Returns
array|int <=0 if KO, array if OK

Definition at line 426 of file modulebuilder.lib.php.

References dol_dir_list().

◆ getFromFile()

getFromFile (   $file,
  $start,
  $end 
)

Search a string and return all lines needed from file.

Parameters
string$filefile for searching
string$startstart line if exist
string$endend line if exist
Returns
string return the content needed

Definition at line 718 of file modulebuilder.lib.php.

◆ rebuildObjectClass()

rebuildObjectClass (   $destdir,
  $module,
  $objectname,
  $newmask,
  $readdir = '',
  $addfieldentry = array(),
  $delfieldentry = '' 
)

Regenerate files .class.php.

Parameters
string$destdirDirectory
string$moduleModule name
string$objectnameName of object
string$newmaskNew mask
string$readdirDirectory source (use $destdir when not defined)
string$addfieldentryArray of 1 field entry to add array('key'=>,'type'=>,''label'=>,'visible'=>,'enabled'=>,'position'=>,'notnull'=>','index'=>,'searchall'=>,'comment'=>,'help'=>,'isameasure')
string$delfieldentryId of field to remove
Returns
int|object <=0 if KO, Object if OK
See also
rebuildObjectSql()

Definition at line 38 of file modulebuilder.lib.php.

◆ rebuildObjectSql()

rebuildObjectSql (   $destdir,
  $module,
  $objectname,
  $newmask,
  $readdir = '',
  $object = null,
  $moduletype = 'external' 
)

Save data into a memory area shared by all users, all sessions on server.

Parameters
string$destdirDirectory
string$moduleModule name
string$objectnameName of object
string$newmaskNew mask
string$readdirDirectory source (use $destdir when not defined)
Object$objectIf object was already loaded/known, it is pass to avoid another include and new.
string$moduletype'external' or 'internal'
Returns
int <=0 if KO, >0 if OK
See also
rebuildObjectClass()

Definition at line 255 of file modulebuilder.lib.php.

◆ removeObjectFromApiFile()

removeObjectFromApiFile (   $file,
  $objectname,
  $modulename 
)

Remove Object variables and methods from API_Module File.

Parameters
string$filefile api module
string$objectnamename of object whant to remove
string$modulenamename of module
Returns
int 1 if OK, -1 if KO

Definition at line 889 of file modulebuilder.lib.php.

◆ reWriteAllMenus()

reWriteAllMenus (   $file,
  $menus,
  $menuWantTo,
  $key,
  $action 
)
Parameters
string$filepath of filename
mixed$menusall menus for module
mixed | null$menuWantTomenu get for do actions
int | null$keykey for the concerned menu
int$actionfor specify what action (0 = delete, 1 = add, 2 = update, -1 = when delete object)
Returns
int 1 if OK, -1 if KO

Definition at line 937 of file modulebuilder.lib.php.

◆ reWriteAllPermissions()

reWriteAllPermissions (   $file,
  $permissions,
  $key,
  $right,
  $objectname,
  $module,
  $action 
)

Rewriting all permissions after any actions.

Parameters
string$filefilename or path
array$permissionspermissions existing in file
int | null$keykey for permission needed
array | null$right$right to update or add
string | null$objectnamename of object
string | null$modulename of module
int$action0 for delete, 1 for add, 2 for update, -1 when delete object completly, -2 for generate rights after add
Returns
int 1 if OK,-1 if KO

Definition at line 506 of file modulebuilder.lib.php.

◆ writePermsInAsciiDoc()

writePermsInAsciiDoc (   $file,
  $destfile 
)

Write all permissions of each object in AsciiDoc format.

Parameters
string$filepath of the class
string$destfilefile where write table of permissions
Returns
int 1 if OK, -1 if KO

Definition at line 746 of file modulebuilder.lib.php.

◆ writePropsInAsciiDoc()

writePropsInAsciiDoc (   $file,
  $objectname,
  $destfile 
)

Write all properties of the object in AsciiDoc format.

Parameters
string$filepath of the class
string$objectnamename of the objectClass
string$destfilefile where write table of properties
Returns
int 1 if OK, -1 if KO

Definition at line 625 of file modulebuilder.lib.php.