dolibarr  17.0.4
ajaxdirtree.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
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 <https://www.gnu.org/licenses/>.
17  */
18 
26 // This script is called with a POST method.
27 // Directory to scan (full path) is inside POST['dir'] and encode by js escape() if ajax is used or encoded by urlencode if mode=noajax
28 
29 if (!defined('NOTOKENRENEWAL')) {
30  define('NOTOKENRENEWAL', 1); // Disables token renewal
31 }
32 if (!defined('NOREQUIREMENU')) {
33  define('NOREQUIREMENU', '1');
34 }
35 if (!defined('NOREQUIREHTML')) {
36  define('NOREQUIREHTML', '1');
37 }
38 if (!defined('NOREQUIREAJAX')) {
39  define('NOREQUIREAJAX', '1');
40 }
41 
42 if (!isset($mode) || $mode != 'noajax') { // For ajax call
43  $res = @include '../../main.inc.php';
44  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
45  include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
46  include_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
47  include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
48  include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
49 
50  $openeddir = GETPOST('openeddir');
51  $modulepart = GETPOST('modulepart');
52  $selecteddir = jsUnEscape(GETPOST('dir')); // relative path. We must decode using same encoding function used by javascript: escape()
53 
54  $preopened = GETPOST('preopened');
55 
56  if ($selecteddir != '/') {
57  $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/'
58  }
59 } else {
60  // For no ajax call
61 
62  $openeddir = GETPOST('openeddir');
63  $modulepart = GETPOST('modulepart');
64  $selecteddir = GETPOST('dir');
65 
66  $preopened = GETPOST('preopened');
67 
68  if ($selecteddir != '/') {
69  $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/'
70  }
71  if (empty($url)) {
72  $url = DOL_URL_ROOT.'/ecm/index.php';
73  }
74 }
75 
76 $websitekey = GETPOST('websitekey', 'alpha');
77 $pageid = GETPOST('pageid', 'int');
78 
79 // Load translation files required by the page
80 $langs->load("ecm");
81 
82 // Define fullpathselecteddir.
83 $fullpathselecteddir = '<none>';
84 if ($modulepart == 'ecm') {
85  $fullpathselecteddir = $conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
86  $fullpathpreopened = $conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : '');
87 } elseif ($modulepart == 'medias' || $modulepart == 'website') {
88  $fullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : '');
89  $fullpathpreopened = $dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : '');
90 }
91 
92 
93 // Security:
94 // On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers.
95 if (preg_match('/\.\./', $fullpathselecteddir) || preg_match('/[<>|]/', $fullpathselecteddir)) {
96  dol_syslog("Refused to deliver file ".$original_file);
97  // Do no show plain path in shown error message
98  dol_print_error(0, $langs->trans("ErrorFileNameInvalid", GETPOST("file")));
99  exit;
100 }
101 
102 if (empty($modulepart)) {
103  $modulepart = $module;
104 }
105 
106 // Check permissions
107 if ($modulepart == 'ecm') {
108  if (!$user->hasRight('ecm', 'read')) {
109  accessforbidden();
110  }
111 } elseif ($modulepart == 'medias' || $modulepart == 'website') {
112  // Always allowed
113 } else {
114  accessforbidden();
115 }
116 
117 /*
118  * Actions
119  */
120 
121 // None
122 
123 
124 /*
125  * View
126  */
127 
128 if (!isset($mode) || $mode != 'noajax') { // if ajax mode
129  top_httphead();
130 }
131 
132 //print '<!-- selecteddir (relative dir we click on) = '.$selecteddir.', openeddir = '.$openeddir.', modulepart='.$modulepart.', preopened='.$preopened.' -->'."\n";
133 $userstatic = new User($db);
134 $form = new Form($db);
135 $ecmdirstatic = new EcmDirectory($db);
136 
137 // Load full manual tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir
138 if (empty($sqltree)) {
139  $sqltree = $ecmdirstatic->get_full_arbo(0);
140 }
141 
142 // Try to find selected dir id into $sqltree and save it into $current_ecmdir_id
143 $current_ecmdir_id = -1;
144 foreach ($sqltree as $keycursor => $val) {
145  //print $val['fullrelativename']." == ".$selecteddir;
146  if ($val['fullrelativename'] == $selecteddir) {
147  $current_ecmdir_id = $keycursor;
148  }
149 }
150 
151 if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
152  treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened);
153 
154  // TODO Find a solution to not output this code for each leaf we open
155  // Enable jquery handlers on new generated HTML objects (same code than into lib_footer.js.php)
156  // Because the content is reloaded by ajax call, we must also reenable some jquery hooks
157  print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip (reload into ajaxdirtree) -->\n";
158  print '<script type="text/javascript">
159  jQuery(document).ready(function () {
160  jQuery(".classfortooltip").tooltip({
161  show: { collision: "flipfit", effect:\'toggle\', delay:50 },
162  hide: { delay: 50 }, /* If I enable effect:\'toggle\' here, a bug appears: the tooltip is shown when collpasing a new dir if it was shown before */
163  tooltipClass: "mytooltip",
164  content: function () {
165  return $(this).prop(\'title\'); /* To force to get title as is */
166  }
167  });
168  });
169  </script>';
170 
171  // This ajax service is called only when a directory $selecteddir is opened but not when closed.
172  //print '<script type="text/javascript">';
173  //print "loadandshowpreview('".dol_escape_js($selecteddir)."');";
174  //print '</script>';
175 }
176 
177 
178 if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_JS)) {
179  print '<ul class="ecmjqft">';
180 
181  // Load full manual tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
182  if (empty($sqltree)) {
183  $sqltree = $ecmdirstatic->get_full_arbo(0); // Slow
184  }
185 
186  // ----- This section will show a tree from a fulltree array -----
187  // $section must also be defined
188  // ----------------------------------------------------------------
189 
190  // Define fullpathselected ( _x_y_z ) of $section parameter (!! not into ajaxdirtree)
191  $fullpathselected = '';
192  foreach ($sqltree as $key => $val) {
193  //print $val['id']."-".$section."<br>";
194  if ($val['id'] == $section) {
195  $fullpathselected = $val['fullpath'];
196  break;
197  }
198  }
199  //print "fullpathselected=".$fullpathselected."<br>";
200 
201  // Update expandedsectionarray in session
202  $expandedsectionarray = array();
203  if (isset($_SESSION['dol_ecmexpandedsectionarray'])) {
204  $expandedsectionarray = explode(',', $_SESSION['dol_ecmexpandedsectionarray']);
205  }
206 
207  if ($section && GETPOST('sectionexpand') == 'true') {
208  // We add all sections that are parent of opened section
209  $pathtosection = explode('_', $fullpathselected);
210  foreach ($pathtosection as $idcursor) {
211  if ($idcursor && !in_array($idcursor, $expandedsectionarray)) { // Not already in array
212  $expandedsectionarray[] = $idcursor;
213  }
214  }
215  $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray);
216  }
217  if ($section && GETPOST('sectionexpand') == 'false') {
218  // We removed all expanded sections that are child of the closed section
219  $oldexpandedsectionarray = $expandedsectionarray;
220  $expandedsectionarray = array(); // Reset
221  foreach ($oldexpandedsectionarray as $sectioncursor) {
222  // TODO is_in_subtree(fulltree,sectionparent,sectionchild) does nox exists. Enable or remove this...
223  //if ($sectioncursor && ! is_in_subtree($sqltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor;
224  }
225  $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray);
226  }
227  //print $_SESSION['dol_ecmexpandedsectionarray'].'<br>';
228 
229  $nbofentries = 0;
230  $oldvallevel = 0;
231  foreach ($sqltree as $key => $val) {
232  $ecmdirstatic->id = $val['id'];
233  $ecmdirstatic->ref = $val['label'];
234 
235  // Refresh cache
236  if (preg_match('/refresh/i', $action)) {
237  $result = $ecmdirstatic->fetch($val['id']);
238  $ecmdirstatic->ref = $ecmdirstatic->label;
239 
240  $result = $ecmdirstatic->refreshcachenboffile(0);
241  $val['cachenbofdoc'] = $result;
242  }
243 
244  //$fullpathparent=preg_replace('/(_[^_]+)$/i','',$val['fullpath']);
245 
246  // Define showline
247  $showline = 0;
248 
249  // If directory is son of expanded directory, we show line
250  if (in_array($val['id_mere'], $expandedsectionarray)) {
251  $showline = 4;
252  } elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) {
253  // If directory is brother of selected directory, we show line
254  $showline = 3;
255  } elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) {
256  // If directory is parent of selected directory or is selected directory, we show line
257  $showline = 2;
258  } elseif ($val['level'] < 2) {
259  // If we are level one we show line
260  $showline = 1;
261  }
262 
263  if ($showline) {
264  if (in_array($val['id'], $expandedsectionarray)) {
265  $option = 'indexexpanded';
266  } else {
267  $option = 'indexnotexpanded';
268  }
269  //print $option;
270 
271  print '<li class="directory collapsed">';
272 
273  // Show tree graph pictos
274  $cpt = 1;
275  while ($cpt < $sqltree[$key]['level']) {
276  print ' &nbsp; &nbsp;';
277  $cpt++;
278  }
279  $resarray = tree_showpad($sqltree, $key, 1);
280  $a = $resarray[0];
281  $nbofsubdir = $resarray[1];
282  $nboffilesinsubdir = $resarray[2];
283 
284  // Show link
285  print $ecmdirstatic->getNomUrl(0, $option, 32, 'class="fmdirlia jqft ecmjqft"');
286 
287  print '<div class="ecmjqft">';
288 
289  // Nb of docs
290  print '<table class="nobordernopadding"><tr>';
291 
292  print '<!-- nb of docs -->';
293  print '<td>';
294  print $val['cachenbofdoc'];
295  print '</td>';
296 
297  print '<!-- nb in subdir -->';
298  print '<td class="left">';
299  if ($nbofsubdir && $nboffilesinsubdir) {
300  print '<span style="color: #AAAAAA">+'.$nboffilesinsubdir.'</span> ';
301  }
302  print '</td>';
303 
304  // Info
305  print '<!-- info -->';
306  print '<td class="center">';
307  $userstatic->id = $val['fk_user_c'];
308  $userstatic->lastname = $val['login_c'];
309  $userstatic->statut = $val['statut_c'];
310  $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
311  $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
312  $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
313  $htmltooltip .= '<b>'.$langs->trans("ECMCreationDate").'</b>: '.dol_print_date($val['date_c'], "dayhour").'<br>';
314  $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
315  $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>';
316  if ($nbofsubdir) {
317  $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
318  } else {
319  $htmltooltip .= '<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.$nbofsubdir.'<br>';
320  }
321  print $form->textwithpicto('', $htmltooltip, 1, 'info');
322  print "</td>";
323 
324  print '</tr></table>';
325 
326  print '</div>';
327 
328  print "</li>\n";
329  }
330 
331  $oldvallevel = $val['level'];
332  $nbofentries++;
333  }
334 
335  // If nothing to show
336  if ($nbofentries == 0) {
337  print '<li class="directory collapsed">';
338  print '<div class="ecmjqft">';
339  print $langs->trans("ECMNoDirectoryYet");
340  print '</div>';
341  print "</li>\n";
342  }
343 
344  print '</ul>';
345 }
346 
347 
348 // Close db if mode is not noajax
349 if ((!isset($mode) || $mode != 'noajax') && is_object($db)) {
350  $db->close();
351 }
352 
353 
354 
369 function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth = 0)
370 {
371  global $conf, $db, $langs, $form;
372  global $dolibarr_main_data_root;
373 
374  $ecmdirstatic = new EcmDirectory($db);
375  $userstatic = new User($db);
376 
377  if (file_exists($fullpathselecteddir)) {
378  $files = @scandir($fullpathselecteddir);
379 
380  if (!empty($files)) {
381  natcasesort($files);
382  if (count($files) > 2) { /* The 2 accounts for . and .. */
383  echo '<ul class="ecmjqft" style="display: none;">'."\n";
384 
385  // All dirs
386  foreach ($files as $file) { // $file can be '.', '..', or 'My dir' or 'My file'
387  if ($file == 'temp') {
388  continue;
389  }
390 
391  $nbofsubdir = 0;
392  $nboffilesinsubdir = 0;
393 
394  $val = array();
395 
396  // Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
397  foreach ($sqltree as $key => $tmpval) {
398  //print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n";
399  if ($tmpval['fullrelativename'] == (($selecteddir != '/' ? $selecteddir.'/' : '').$file)) { // We found equivalent record into database
400  $val = $tmpval;
401  $resarray = tree_showpad($sqltree, $key, 1);
402 
403  // Refresh cache for this subdir
404  if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) { // Cache is not up to date, so we update it for this directory t
405  $result = $ecmdirstatic->fetch($val['id']);
406  $ecmdirstatic->ref = $ecmdirstatic->label;
407 
408  $result = $ecmdirstatic->refreshcachenboffile(0);
409  $val['cachenbofdoc'] = $result;
410  }
411 
412  $a = $resarray[0];
413  $nbofsubdir = $resarray[1];
414  $nboffilesinsubdir = $resarray[2];
415  break;
416  }
417  }
418 
419  //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
420  if ($file != '.' && $file != '..' && ((!empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir.(preg_match('/\/$/', $fullpathselecteddir) ? '' : '/').$file))) {
421  if (empty($val['fullrelativename'])) { // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
422  $val['fullrelativename'] = (($selecteddir && $selecteddir != '/') ? $selecteddir.'/' : '').$file;
423  $val['id'] = 0;
424  $val['label'] = $file;
425  $val['description'] = '';
426  $nboffilesinsubdir = $langs->trans("Unknown");
427  }
428 
429  $collapsedorexpanded = 'collapsed';
430  if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) {
431  $collapsedorexpanded = 'expanded';
432  }
433  print '<li class="directory '.$collapsedorexpanded.' lidirecm">'; // collapsed is opposite if expanded
434 
435  //print '<div class="divfmdirlia inline-block">'; // Disabled, this break the javascrip component
436  print '<a class="fmdirlia jqft ecmjqft" href="';
437  print "#";
438  print "\" rel=\"".dol_escape_htmltag($val['fullrelativename'].'/')."\" id=\"fmdirlia_id_".$val['id']."\"";
439  print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")";
440  print "\">";
441  print dol_escape_htmltag($file);
442  print '</a>';
443  //print '</div>';
444 
445  print '<div class="ecmjqft">';
446 
447  print '<table class="nobordernopadding"><tr>';
448 
449  /*print '<td class="left">';
450  print dol_escape_htmltag($file);
451  print '</td>';*/
452 
453  // Nb of docs
454  print '<!-- nb of docs -->';
455  print '<td class="right">';
456  print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0) ? $val['cachenbofdoc'] : '&nbsp;';
457  print '</td>';
458 
459  print '<!-- nb of subdirs -->';
460  print '<td class="left">';
461  if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) {
462  print '<span class="opacitymedium">+'.$nboffilesinsubdir.'</span> ';
463  }
464  print '</td>';
465 
466  // Edit link
467  print '<!-- edit link -->';
468  print '<td class="right" width="18"><a class="editfielda" href="';
469  print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'&section='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
470  print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
471  print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
472 
473  // Add link
474  //print '<td class="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
475  //print '<td class="right" width="14">&nbsp;</td>';
476 
477  // Info
478  if ($modulepart == 'ecm') {
479  print '<!-- info -->';
480  print '<td class="right" width="18">';
481  $userstatic->id = isset($val['fk_user_c']) ? $val['fk_user_c'] : 0;
482  $userstatic->lastname = isset($val['login_c']) ? $val['login_c'] : 0;
483  $userstatic->statut = isset($val['statut_c']) ? $val['statut_c'] : 0;
484  $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
485  $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
486  $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
487  $htmltooltip .= '<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c']) ?dol_print_date($val['date_c'], "dayhour") : $langs->trans("NeedRefresh")).'<br>';
488  $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
489  $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0) ? $val['cachenbofdoc'] : $langs->trans("NeedRefresh")).'<br>';
490  if ($nboffilesinsubdir > 0) {
491  $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
492  } else {
493  $htmltooltip .= '<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>';
494  }
495  print $form->textwithpicto('', $htmltooltip, 1, "info");
496  print "</td>";
497  }
498 
499  print "</tr></table>\n";
500  print '</div>';
501 
502  //print 'selecteddir='.$selecteddir.' preopened='.$preopened.' $val[\'fullrelativename\']='.$val['fullrelativename']."<br>\n";
503  if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) {
504  //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
505  $newselecteddir = $val['fullrelativename'];
506  $newfullpathselecteddir = '';
507  if ($modulepart == 'ecm') {
508  $newfullpathselecteddir = $conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
509  } elseif ($modulepart == 'medias') {
510  $newfullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
511  }
512 
513  if ($newfullpathselecteddir) {
514  treeOutputForAbsoluteDir($sqltree, $newselecteddir, $newfullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth + 1);
515  }
516  }
517 
518  print "</li>\n";
519  }
520  }
521 
522  echo "</ul>\n";
523  }
524  } else {
525  print "PermissionDenied";
526  }
527  }
528 }
foreach($sqltree as $keycursor=> $val) if(!empty($conf->use_javascript_ajax) &&empty($conf->global->MAIN_ECM_DISABLE_JS)) if(empty($conf->use_javascript_ajax)||!empty($conf->global->MAIN_ECM_DISABLE_JS)) if((!isset($mode)|| $mode !='noajax') &&is_object($db)) treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth=0)
treeOutputForAbsoluteDir
Class to manage ECM directories.
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
Definition: user.class.php:47
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_is_dir($folder)
Test if filename is a directory.
Definition: files.lib.php:451
jsUnEscape($source)
Same function than javascript unescape() function but in PHP.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1440
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
tree_showpad(&$fulltree, $key, $silent=0)
Show indent and picto of a tree line.