dolibarr  9.0.0
Public Member Functions | Static Public Member Functions | List of all members
EcmDirectory Class Reference

Class to manage ECM directories. More...

Public Member Functions

 __construct ($db)
 Constructor. More...
 
 create ($user)
 Create record into database. More...
 
 update ($user=null, $notrigger=0)
 Update database. More...
 
 changeNbOfFiles ($value)
 Update cache of nb of documents into database. More...
 
 fetch ($id)
 Load object in memory from database. More...
 
 delete ($user, $mode='all', $deletedirrecursive=0)
 Delete object on database and/or on disk. More...
 
 initAsSpecimen ()
 Initialise an instance with random values. More...
 
 getNomUrl ($withpicto=0, $option='', $max=0, $more='', $notooltip=0)
 Return directory name you can click (and picto) More...
 
 getRelativePath ($force=0)
 Return relative path of a directory on disk. More...
 
 load_motherof ()
 Load this->motherof that is array(id_son=>id_parent, ...) More...
 
 getLibStatut ($mode=0)
 Retourne le libelle du status d'un user (actif, inactif) More...
 
 get_full_arbo ($force=0)
 Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: id Id de la categorie id_mere Id de la categorie mere id_children Tableau des id enfant label Name of directory cachenbofdoc Nb of documents date_c Date creation fk_user_c User creation login_c Login creation fullpath Full path of id (Added by build_path_from_id_categ call) fullrelativename Full path name (Added by build_path_from_id_categ call) fulllabel Full label (Added by build_path_from_id_categ call) level Level of line (Added by build_path_from_id_categ call) More...
 
 build_path_from_id_categ ($id_categ, $protection=0)
 Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs. More...
 
 refreshcachenboffile ($all=0)
 Refresh value for cachenboffile. More...
 
 call_trigger ($trigger_name, $user)
 Call trigger based on this instance. More...
 

Static Public Member Functions

static LibStatut ($status, $mode=0)
 Return the status. More...
 

Detailed Description

Class to manage ECM directories.

Definition at line 28 of file ecmdirectory.class.php.

Constructor & Destructor Documentation

◆ __construct()

EcmDirectory::__construct (   $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 108 of file ecmdirectory.class.php.

Member Function Documentation

◆ build_path_from_id_categ()

EcmDirectory::build_path_from_id_categ (   $id_categ,
  $protection = 0 
)

Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs.

Separator between directories is always '/', whatever is OS.

Parameters
int$id_categid_categ entry to update
int$protectionDeep counter to avoid infinite loop
Returns
void

Definition at line 713 of file ecmdirectory.class.php.

◆ call_trigger()

EcmDirectory::call_trigger (   $trigger_name,
  $user 
)

Call trigger based on this instance.

NB: Error from trigger are stacked in errors NB2: if trigger fail, action should be canceled. NB3: Should be deleted if EcmDirectory extend CommonObject

Parameters
string$trigger_nametrigger's name to execute
User$userObject user
Returns
int Result of run_triggers

Definition at line 802 of file ecmdirectory.class.php.

◆ changeNbOfFiles()

EcmDirectory::changeNbOfFiles (   $value)

Update cache of nb of documents into database.

Parameters
string$value'+' or '-' or new number
Returns
int <0 if KO, >0 if OK

Definition at line 291 of file ecmdirectory.class.php.

◆ create()

EcmDirectory::create (   $user)

Create record into database.

Parameters
User$userUser that create
Returns
int <0 if KO, >0 if OK

Definition at line 121 of file ecmdirectory.class.php.

◆ delete()

EcmDirectory::delete (   $user,
  $mode = 'all',
  $deletedirrecursive = 0 
)

Delete object on database and/or on disk.

Parameters
User$userUser that delete
string$mode'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented)
int$deletedirrecursive1=Agree to delete content recursiveley (otherwise an error will be returned when trying to delete)
Returns
int <0 if KO, >0 if OK

Definition at line 378 of file ecmdirectory.class.php.

◆ fetch()

EcmDirectory::fetch (   $id)

Load object in memory from database.

Parameters
int$idId of object
Returns
int <0 if KO, 0 if not found, >0 if OK

Definition at line 323 of file ecmdirectory.class.php.

◆ get_full_arbo()

EcmDirectory::get_full_arbo (   $force = 0)

Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: id Id de la categorie id_mere Id de la categorie mere id_children Tableau des id enfant label Name of directory cachenbofdoc Nb of documents date_c Date creation fk_user_c User creation login_c Login creation fullpath Full path of id (Added by build_path_from_id_categ call) fullrelativename Full path name (Added by build_path_from_id_categ call) fulllabel Full label (Added by build_path_from_id_categ call) level Level of line (Added by build_path_from_id_categ call)

Parameters
int$forceForce reload of full arbo even if already loaded in cache $this->cats
Returns
array Tableau de array

Definition at line 623 of file ecmdirectory.class.php.

Referenced by getRelativePath().

◆ getLibStatut()

EcmDirectory::getLibStatut (   $mode = 0)

Retourne le libelle du status d'un user (actif, inactif)

Parameters
int$mode0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
Returns
string Label of status

Definition at line 582 of file ecmdirectory.class.php.

References LibStatut().

◆ getNomUrl()

EcmDirectory::getNomUrl (   $withpicto = 0,
  $option = '',
  $max = 0,
  $more = '',
  $notooltip = 0 
)

Return directory name you can click (and picto)

Parameters
int$withpicto0=Pas de picto, 1=Include picto into link, 2=Only picto
string$optionSur quoi pointe le lien
int$maxMax length
string$moreAdd more param on a link
int$notooltip1=Disable tooltip
Returns
string Chaine avec URL

Definition at line 471 of file ecmdirectory.class.php.

◆ getRelativePath()

EcmDirectory::getRelativePath (   $force = 0)

Return relative path of a directory on disk.

Parameters
int$forceForce reload of full arbo even if already loaded
Returns
string Relative physical path

Definition at line 504 of file ecmdirectory.class.php.

References get_full_arbo().

◆ initAsSpecimen()

EcmDirectory::initAsSpecimen ( )

Initialise an instance with random values.

Used to build previews or test instances. id must be 0 if object instance is a specimen.

Returns
void

Definition at line 451 of file ecmdirectory.class.php.

References description, and label.

◆ LibStatut()

static EcmDirectory::LibStatut (   $status,
  $mode = 0 
)
static

Return the status.

Parameters
int$statusId status
int$mode0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto
Returns
string Label of status

Definition at line 595 of file ecmdirectory.class.php.

Referenced by getLibStatut().

◆ load_motherof()

EcmDirectory::load_motherof ( )

Load this->motherof that is array(id_son=>id_parent, ...)

Returns
int <0 if KO, >0 if OK

Definition at line 544 of file ecmdirectory.class.php.

◆ refreshcachenboffile()

EcmDirectory::refreshcachenboffile (   $all = 0)

Refresh value for cachenboffile.

This scan and count files into directory.

Parameters
int$all0=refresh record using this->id , 1=refresh record using this->entity
Returns
int -1 if KO, Nb of files in directory if OK

Definition at line 753 of file ecmdirectory.class.php.

◆ update()

EcmDirectory::update (   $user = null,
  $notrigger = 0 
)

Update database.

Parameters
User$userUser that modify
int$notrigger0=no, 1=yes (no update trigger)
Returns
int <0 if KO, >0 if OK

Definition at line 233 of file ecmdirectory.class.php.


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