dolibarr  7.0.0-beta
Public Member Functions | Static Public Member Functions | Public Attributes | 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')
 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...
 

Public Attributes

 $element ='ecm_directories'
 Id that identify managed objects.
 

Detailed Description

Class to manage ECM directories.

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

Constructor & Destructor Documentation

EcmDirectory::__construct (   $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

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

Member Function Documentation

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 654 of file ecmdirectory.class.php.

Referenced by get_full_arbo().

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 741 of file ecmdirectory.class.php.

Referenced by create(), delete(), and update().

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 246 of file ecmdirectory.class.php.

References $resql, and dol_syslog().

EcmDirectory::create (   $user)

Create record into database.

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

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

References $resql, call_trigger(), description, dol_mkdir(), dol_now(), dol_sanitizeFileName(), dol_syslog(), and getRelativePath().

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

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)
Returns
int <0 if KO, >0 if OK

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

References $resql, call_trigger(), dol_delete_dir(), dol_osencode(), dol_syslog(), and getRelativePath().

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 278 of file ecmdirectory.class.php.

References $resql, description, and dol_syslog().

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 565 of file ecmdirectory.class.php.

References $resql, build_path_from_id_categ(), dol_print_error(), dol_sort_array(), dol_syslog(), and load_motherof().

Referenced by getRelativePath().

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 527 of file ecmdirectory.class.php.

References LibStatut().

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 418 of file ecmdirectory.class.php.

References dol_escape_htmltag(), dol_trunc(), and img_object().

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 451 of file ecmdirectory.class.php.

References dol_sanitizeFileName(), and get_full_arbo().

Referenced by create(), delete(), and refreshcachenboffile().

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 398 of file ecmdirectory.class.php.

References description.

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 539 of file ecmdirectory.class.php.

Referenced by getLibStatut().

EcmDirectory::load_motherof ( )

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

Returns
int <0 if KO, >0 if OK

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

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

Referenced by get_full_arbo().

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 693 of file ecmdirectory.class.php.

References $resql, dol_dir_list(), dol_syslog(), and getRelativePath().

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 188 of file ecmdirectory.class.php.

References $resql, call_trigger(), description, and dol_syslog().


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