dolibarr  9.0.0
ecmdirectory.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2008-2012 Regis Houssin <regis.houssin@inodbox.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
28 class EcmDirectory // extends CommonObject
29 {
33  public $element='ecm_directories';
34 
38  //public $table_element='ecm_directories';
39 
43  public $picto = 'dir';
44 
48  public $id;
49 
53  public $label;
54 
58  public $fk_parent;
59 
63  public $description;
64 
65  public $cachenbofdoc=-1; // By default cache initialized with value 'not calculated'
66  public $date_c;
67  public $date_m;
68 
72  public $fk_user_m;
73 
77  public $fk_user_c;
78 
82  public $ref;
83 
84  public $cats=array();
85  public $motherof=array();
86 
87  public $forbiddenchars = array('<','>',':','/','\\','?','*','|','"');
88  public $forbiddencharsdir = array('<','>',':','?','*','|','"');
89 
90  public $full_arbo_loaded;
91 
95  public $error;
96 
100  public $errors = array();
101 
102 
108  function __construct($db)
109  {
110  $this->db = $db;
111  return 1;
112  }
113 
114 
121  function create($user)
122  {
123  global $conf, $langs;
124 
125  $error=0;
126  $now=dol_now();
127 
128  // Clean parameters
129  $this->label=dol_sanitizeFileName(trim($this->label));
130  $this->fk_parent=trim($this->fk_parent);
131  $this->description=trim($this->description);
132  $this->date_c=$now;
133  $this->fk_user_c=$user->id;
134  if ($this->fk_parent <= 0) $this->fk_parent=0;
135 
136 
137  // Check if same directory does not exists with this name
138  $relativepath=$this->label;
139  if ($this->fk_parent)
140  {
141  $parent = new EcmDirectory($this->db);
142  $parent->fetch($this->fk_parent);
143  $relativepath=$parent->getRelativePath().$relativepath;
144  }
145  $relativepath=preg_replace('/([\/])+/i','/',$relativepath); // Avoid duplicate / or \
146  //print $relativepath.'<br>';
147 
148  $cat = new EcmDirectory($this->db);
149  $cate_arbo = $cat->get_full_arbo(1);
150  $pathfound=0;
151  foreach ($cate_arbo as $key => $categ)
152  {
153  $path=str_replace($this->forbiddencharsdir, '_', $categ['fullrelativename']);
154  //print $relativepath.' - '.$path.'<br>';
155  if ($path == $relativepath)
156  {
157  $pathfound=1;
158  break;
159  }
160  }
161 
162  if ($pathfound)
163  {
164  $this->error="ErrorDirAlreadyExists";
165  dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING);
166  return -1;
167  }
168  else
169  {
170  $this->db->begin();
171 
172  // Insert request
173  $sql = "INSERT INTO ".MAIN_DB_PREFIX."ecm_directories(";
174  $sql.= "label,";
175  $sql.= "entity,";
176  $sql.= "fk_parent,";
177  $sql.= "description,";
178  $sql.= "cachenbofdoc,";
179  $sql.= "date_c,";
180  $sql.= "fk_user_c";
181  $sql.= ") VALUES (";
182  $sql.= " '".$this->db->escape($this->label)."',";
183  $sql.= " '".$this->db->escape($conf->entity)."',";
184  $sql.= " '".$this->db->escape($this->fk_parent)."',";
185  $sql.= " '".$this->db->escape($this->description)."',";
186  $sql.= " ".$this->cachenbofdoc.",";
187  $sql.= " '".$this->db->idate($this->date_c)."',";
188  $sql.= " '".$this->db->escape($this->fk_user_c)."'";
189  $sql.= ")";
190 
191  dol_syslog(get_class($this)."::create", LOG_DEBUG);
192  $resql=$this->db->query($sql);
193  if ($resql)
194  {
195  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories");
196 
197  $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
198  $result=dol_mkdir($dir);
199  if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; }
200 
201  // Call trigger
202  $result=$this->call_trigger('MYECMDIR_CREATE',$user);
203  if ($result < 0) { $error++; }
204  // End call triggers
205 
206  if (! $error)
207  {
208  $this->db->commit();
209  return $this->id;
210  }
211  else
212  {
213  $this->db->rollback();
214  return -1;
215  }
216  }
217  else
218  {
219  $this->error="Error ".$this->db->lasterror();
220  $this->db->rollback();
221  return -1;
222  }
223  }
224  }
225 
233  function update($user=null, $notrigger=0)
234  {
235  global $conf, $langs;
236 
237  $error=0;
238 
239  // Clean parameters
240  $this->label=trim($this->label);
241  $this->fk_parent=trim($this->fk_parent);
242  $this->description=trim($this->description);
243 
244  // Check parameters
245  // Put here code to add control on parameters values
246 
247  $this->db->begin();
248 
249  // Update request
250  $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
251  $sql.= " label='".$this->db->escape($this->label)."',";
252  $sql.= " fk_parent='".$this->db->escape($this->fk_parent)."',";
253  $sql.= " description='".$this->db->escape($this->description)."'";
254  $sql.= " WHERE rowid=".$this->id;
255 
256  dol_syslog(get_class($this)."::update", LOG_DEBUG);
257  $resql = $this->db->query($sql);
258  if (! $resql)
259  {
260  $error++;
261  $this->error="Error ".$this->db->lasterror();
262  }
263 
264  if (! $error && ! $notrigger)
265  {
266  // Call trigger
267  $result=$this->call_trigger('MYECMDIR_MODIFY',$user);
268  if ($result < 0) { $error++; }
269  // End call triggers
270  }
271 
272  if (! $error)
273  {
274  $this->db->commit();
275  return 1;
276  }
277  else
278  {
279  $this->db->rollback();
280  return -1;
281  }
282  }
283 
284 
291  function changeNbOfFiles($value)
292  {
293  // Update request
294  $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
295  if (preg_match('/[0-9]+/', $value)) $sql.= " cachenbofdoc = ".(int) $value;
296  else $sql.= " cachenbofdoc = cachenbofdoc ".$value." 1";
297  $sql.= " WHERE rowid = ".$this->id;
298 
299  dol_syslog(get_class($this)."::changeNbOfFiles", LOG_DEBUG);
300  $resql = $this->db->query($sql);
301  if (! $resql)
302  {
303  $this->error="Error ".$this->db->lasterror();
304  return -1;
305  }
306  else
307  {
308  if (preg_match('/[0-9]+/', $value)) $this->cachenbofdoc = (int) $value;
309  else if ($value == '+') $this->cachenbofdoc++;
310  else if ($value == '-') $this->cachenbofdoc--;
311  }
312 
313  return 1;
314  }
315 
316 
323  function fetch($id)
324  {
325  $sql = "SELECT";
326  $sql.= " t.rowid,";
327  $sql.= " t.label,";
328  $sql.= " t.fk_parent,";
329  $sql.= " t.description,";
330  $sql.= " t.cachenbofdoc,";
331  $sql.= " t.fk_user_c,";
332  $sql.= " t.fk_user_m,";
333  $sql.= " t.date_c as date_c,";
334  $sql.= " t.date_m as date_m";
335  $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t";
336  $sql.= " WHERE t.rowid = ".$id;
337 
338  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
339  $resql=$this->db->query($sql);
340  if ($resql)
341  {
342  $obj = $this->db->fetch_object($resql);
343  if ($obj)
344  {
345  $this->id = $obj->rowid;
346  $this->ref = $obj->rowid;
347 
348  $this->label = $obj->label;
349  $this->fk_parent = $obj->fk_parent;
350  $this->description = $obj->description;
351  $this->cachenbofdoc = $obj->cachenbofdoc;
352  $this->fk_user_m = $obj->fk_user_m;
353  $this->fk_user_c = $obj->fk_user_c;
354  $this->date_c = $this->db->jdate($obj->date_c);
355  $this->date_m = $this->db->jdate($obj->date_m);
356  }
357 
358  $this->db->free($resql);
359 
360  return $obj?1:0;
361  }
362  else
363  {
364  $this->error="Error ".$this->db->lasterror();
365  return -1;
366  }
367  }
368 
369 
378  function delete($user, $mode='all', $deletedirrecursive=0)
379  {
380  global $conf, $langs;
381  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
382 
383  $error=0;
384 
385  if ($mode != 'databaseonly') $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3
386 
387  dol_syslog(get_class($this)."::delete remove directory id=".$this->id." mode=".$mode.(($mode == 'databaseonly')?'':' relativepath='.$relativepath));
388 
389  $this->db->begin();
390 
391  $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories";
392  $sql.= " WHERE rowid=".$this->id;
393 
394  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
395  $resql = $this->db->query($sql);
396  if (! $resql)
397  {
398  $this->db->rollback();
399  $this->error="Error ".$this->db->lasterror();
400  return -2;
401  }
402  else
403  {
404  // Call trigger
405  $result=$this->call_trigger('MYECMDIR_DELETE',$user);
406  if ($result < 0)
407  {
408  $this->db->rollback();
409  return -2;
410  }
411  // End call triggers
412  }
413 
414  if ($mode != 'databaseonly')
415  {
416  $file = $conf->ecm->dir_output . "/" . $relativepath;
417  if ($deletedirrecursive)
418  {
419  $result=@dol_delete_dir_recursive($file, 0, 0);
420  }
421  else
422  {
423  $result=@dol_delete_dir($file, 0);
424  }
425  }
426 
427  if ($result || ! @is_dir(dol_osencode($file)))
428  {
429  $this->db->commit();
430  }
431  else
432  {
433  $this->error='ErrorFailToDeleteDir';
434  dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
435  $this->db->rollback();
436  $error++;
437  }
438 
439  if (! $error) return 1;
440  else return -1;
441  }
442 
443 
451  function initAsSpecimen()
452  {
453  $this->id=0;
454 
455  $this->label='MyDirectory';
456  $this->fk_parent='0';
457  $this->description='This is a directory';
458  }
459 
460 
471  function getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0)
472  {
473  global $langs;
474 
475  $result='';
476  //$newref=str_replace('_',' ',$this->ref);
477  $newref=$this->ref;
478  $label=$langs->trans("ShowECMSection").': '.$newref;
479  $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
480 
481  $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/dir_card.php?section='.$this->id.$linkclose;
482  if ($option == 'index') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;
483  if ($option == 'indexexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false'.$linkclose;
484  if ($option == 'indexnotexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;
485  $linkend='</a>';
486 
487  //$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
488  $picto='dir';
489 
490  $result .= $linkstart;
491  if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
492  if ($withpicto != 2) $result.= ($max?dol_trunc($newref,$max,'middle'):$newref);
493  $result .= $linkend;
494 
495  return $result;
496  }
497 
504  function getRelativePath($force=0)
505  {
506  $this->get_full_arbo($force);
507 
508  $ret='';
509  $idtosearch=$this->id;
510  $i=0;
511  do {
512  // Get index cursor in this->cats for id_mere
513  $cursorindex=-1;
514  foreach ($this->cats as $key => $val)
515  {
516  if ($this->cats[$key]['id'] == $idtosearch)
517  {
518  $cursorindex=$key;
519  break;
520  }
521  }
522  //print "c=".$idtosearch."-".$cursorindex;
523 
524  if ($cursorindex >= 0)
525  {
526  // Path is label sanitized (no space and no special char) and concatenated
527  $ret=dol_sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
528 
529  $idtosearch=$this->cats[$cursorindex]['id_mere'];
530  $i++;
531  }
532  }
533  while ($cursorindex >= 0 && ! empty($idtosearch) && $i < 100); // i avoid infinite loop
534 
535  return $ret;
536  }
537 
538  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
544  function load_motherof()
545  {
546  // phpcs:enable
547  global $conf;
548 
549  $this->motherof=array();
550 
551  // Load array[child]=parent
552  $sql = "SELECT fk_parent as id_parent, rowid as id_son";
553  $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories";
554  $sql.= " WHERE fk_parent != 0";
555  $sql.= " AND entity = ".$conf->entity;
556 
557  dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG);
558  $resql = $this->db->query($sql);
559  if ($resql)
560  {
561  // This assignment in condition is not a bug. It allows walking the results.
562  while ($obj=$this->db->fetch_object($resql))
563  {
564  $this->motherof[$obj->id_son]=$obj->id_parent;
565  }
566  return 1;
567  }
568  else
569  {
570  dol_print_error($this->db);
571  return -1;
572  }
573  }
574 
575 
582  function getLibStatut($mode=0)
583  {
584  return $this->LibStatut($this->status,$mode);
585  }
586 
587  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
595  static function LibStatut($status,$mode=0)
596  {
597  // phpcs:enable
598  global $langs;
599  return '';
600  }
601 
602 
603  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
623  function get_full_arbo($force=0)
624  {
625  // phpcs:enable
626  global $conf;
627 
628  if (empty($force) && ! empty($this->full_arbo_loaded))
629  {
630  return $this->cats;
631  }
632 
633  // Init this->motherof that is array(id_son=>id_parent, ...)
634  $this->load_motherof();
635 
636  // Charge tableau des categories
637  $sql = "SELECT c.rowid as rowid, c.label as label,";
638  $sql.= " c.description as description, c.cachenbofdoc,";
639  $sql.= " c.fk_user_c,";
640  $sql.= " c.date_c,";
641  $sql.= " u.login as login_c,";
642  $sql.= " ca.rowid as rowid_fille";
643  $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."ecm_directories as c";
644  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."ecm_directories as ca";
645  $sql.= " ON c.rowid = ca.fk_parent";
646  $sql.= " WHERE c.fk_user_c = u.rowid";
647  $sql.= " AND c.entity = ".$conf->entity;
648  $sql.= " ORDER BY c.label, c.rowid";
649 
650  dol_syslog(get_class($this)."::get_full_arbo", LOG_DEBUG);
651  $resql = $this->db->query($sql);
652  if ($resql)
653  {
654  $this->cats = array();
655  $i=0;
656  // This assignment in condition is not a bug. It allows walking the results.
657  while ($obj = $this->db->fetch_object($resql))
658  {
659  $this->cats[$obj->rowid]['id'] = $obj->rowid;
660  $this->cats[$obj->rowid]['id_mere'] = (isset($this->motherof[$obj->rowid])?$this->motherof[$obj->rowid]:'');
661  $this->cats[$obj->rowid]['label'] = $obj->label;
662  $this->cats[$obj->rowid]['description'] = $obj->description;
663  $this->cats[$obj->rowid]['cachenbofdoc'] = $obj->cachenbofdoc;
664  $this->cats[$obj->rowid]['date_c'] = $this->db->jdate($obj->date_c);
665  $this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;
666  $this->cats[$obj->rowid]['login_c'] = $obj->login_c;
667 
668  if (! empty($obj->rowid_fille))
669  {
670  if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children']))
671  {
672  $newelempos=count($this->cats[$obj->rowid]['id_children']);
673  //print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements<br>";
674  $this->cats[$obj->rowid]['id_children'][$newelempos]=$obj->rowid_fille;
675  }
676  else
677  {
678  //print "this->cats[".$obj->rowid."]['id_children'] n'est pas encore un tableau<br>";
679  $this->cats[$obj->rowid]['id_children']=array($obj->rowid_fille);
680  }
681  }
682  $i++;
683  }
684  }
685  else
686  {
687  dol_print_error($this->db);
688  return -1;
689  }
690 
691  // We add properties fullxxx to all elements
692  foreach($this->cats as $key => $val)
693  {
694  if (isset($motherof[$key])) continue;
695  $this->build_path_from_id_categ($key,0);
696  }
697 
698  $this->cats=dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
699  $this->full_arbo_loaded=1;
700 
701  return $this->cats;
702  }
703 
704  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
713  function build_path_from_id_categ($id_categ,$protection=0)
714  {
715  // phpcs:enable
716  // Define fullpath
717  if (! empty($this->cats[$id_categ]['id_mere']))
718  {
719  $this->cats[$id_categ]['fullpath'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];
720  $this->cats[$id_categ]['fullpath'].='_'.$id_categ;
721  $this->cats[$id_categ]['fullrelativename'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fullrelativename'];
722  $this->cats[$id_categ]['fullrelativename'].='/'.$this->cats[$id_categ]['label'];
723  $this->cats[$id_categ]['fulllabel'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fulllabel'];
724  $this->cats[$id_categ]['fulllabel'].=' >> '.$this->cats[$id_categ]['label'];
725  }
726  else
727  {
728  $this->cats[$id_categ]['fullpath']='_'.$id_categ;
729  $this->cats[$id_categ]['fullrelativename']=$this->cats[$id_categ]['label'];
730  $this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
731  }
732  // We count number of _ to have level (we use strlen that is faster than dol_strlen)
733  $this->cats[$id_categ]['level']=strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath']));
734 
735  // Traite ces enfants
736  $protection++;
737  if ($protection > 20) return; // On ne traite pas plus de 20 niveaux
738  if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children']))
739  {
740  foreach($this->cats[$id_categ]['id_children'] as $key => $val)
741  {
742  $this->build_path_from_id_categ($val,$protection);
743  }
744  }
745  }
746 
753  function refreshcachenboffile($all=0)
754  {
755  global $conf;
756  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
757 
758  $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
759  $filelist=dol_dir_list($dir,'files',0,'','(\.meta|_preview.*\.png)$');
760 
761  // Test if filelist is in database
762 
763 
764  // Update request
765  $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
766  $sql.= " cachenbofdoc = '".count($filelist)."'";
767  if (empty($all)) // By default
768  {
769  $sql.= " WHERE rowid = ".$this->id;
770  }
771  else
772  {
773  $sql.= " WHERE entity = ".$conf->entity;
774  }
775 
776  dol_syslog(get_class($this)."::refreshcachenboffile", LOG_DEBUG);
777  $resql = $this->db->query($sql);
778  if ($resql)
779  {
780  $this->cachenbofdoc=count($filelist);
781  return $this->cachenbofdoc;
782  }
783  else
784  {
785  $this->error="Error ".$this->db->lasterror();
786  return -1;
787  }
788  }
789 
790  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
802  function call_trigger($trigger_name, $user)
803  {
804  // phpcs:enable
805  global $langs,$conf;
806 
807  include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
808  $interface=new Interfaces($this->db);
809  $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
810  if ($result < 0) {
811  if (!empty($this->errors))
812  {
813  $this->errors=array_merge($this->errors,$interface->errors);
814  }
815  else
816  {
817  $this->errors=$interface->errors;
818  }
819  }
820  return $result;
821  }
822 }
print $object label
hash of file content (md5_file(dol_osencode($destfull))
Definition: edit.php:153
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding &#39;...&#39; if string larger than length.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
get_full_arbo($force=0)
Reconstruit l&#39;arborescence des categories sous la forme d&#39;un tableau à partir de la base de donnée Re...
</td >< td class="liste_titre" align="right"></td ></tr >< tr class="liste_titre">< input type="checkbox" onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< tr class="oddeven">< td >< input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td >< td >< input type="checkbox" class="check" name="choose'.$i.'"></td >< td class="nowrap"></td >< td >< input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:573
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
build_path_from_id_categ($id_categ, $protection=0)
Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all it...
getRelativePath($force=0)
Return relative path of a directory on disk.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
refreshcachenboffile($all=0)
Refresh value for cachenboffile.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
initAsSpecimen()
Initialise an instance with random values.
fetch($id)
Load object in memory from database.
getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0)
Return directory name you can click (and picto)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
getLibStatut($mode=0)
Retourne le libelle du status d&#39;un user (actif, inactif)
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories) ...
Definition: files.lib.php:1273
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:59
__construct($db)
Constructor.
static LibStatut($status, $mode=0)
Return the status.
dol_now($mode='gmt')
Return date for now.
create($user)
Create record into database.
call_trigger($trigger_name, $user)
Call trigger based on this instance.
changeNbOfFiles($value)
Update cache of nb of documents into database.
dol_mkdir($dir, $dataroot='', $newmask=null)
Creation of a directory (this can create recursive subdir)
update($user=null, $notrigger=0)
Update database.
load_motherof()
Load this->motherof that is array(id_son=>id_parent, ...)
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
Definition: files.lib.php:1249
Class to manage ECM directories.
Class to manage triggers.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)