dolibarr  20.0.0-beta
index_auto.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2008-2010 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
5  * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 // Load Dolibarr environment
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
34 
35 // Load translation files required by the page
36 $langs->loadLangs(array("ecm", "companies", "other", "users", "orders", "propal", "bills", "contracts"));
37 
38 // Get parameters
39 $socid = GETPOSTINT('socid');
40 $action = GETPOST('action', 'aZ09');
41 $section = GETPOSTINT('section') ? GETPOSTINT('section') : GETPOSTINT('section_id');
42 $module = GETPOST('module', 'alpha');
43 if (!$section) {
44  $section = 0;
45 }
46 $section_dir = GETPOST('section_dir', 'alpha');
47 
48 $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
49 
50 $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
51 $sortfield = GETPOST('sortfield', 'aZ09comma');
52 $sortorder = GETPOST('sortorder', 'aZ09comma');
53 $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
54 if (empty($page) || $page == -1) {
55  $page = 0;
56 } // If $page is not defined, or '' or -1
57 $offset = $limit * $page;
58 $pageprev = $page - 1;
59 $pagenext = $page + 1;
60 if (!$sortorder) {
61  $sortorder = "ASC";
62 }
63 if (!$sortfield) {
64  $sortfield = "fullname";
65 }
66 if ($module == 'invoice_supplier' && $sortfield == "fullname") {
67  $sortfield = "level1name";
68 }
69 
70 $ecmdir = new EcmDirectory($db);
71 if ($section) {
72  $result = $ecmdir->fetch($section);
73  if (!($result > 0)) {
74  dol_print_error($db, $ecmdir->error);
75  exit;
76  }
77 }
78 
79 $form = new Form($db);
80 $ecmdirstatic = new EcmDirectory($db);
81 $userstatic = new User($db);
82 
83 $error = 0;
84 
85 // Security check
86 if ($user->socid) {
87  $socid = $user->socid;
88 }
89 $result = restrictedArea($user, 'ecm', 0);
90 
91 
92 /*
93  * Actions
94  */
95 
96 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
97 $hookmanager->initHooks(array('ecmautocard', 'globalcard'));
98 
99 // Purge search criteria
100 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
101  $search_doc_ref = '';
102 }
103 
104 
105 
106 
107 // Add directory
108 if ($action == 'add' && $user->hasRight('ecm', 'setup')) {
109  $ecmdir->ref = 'NOTUSEDYET';
110  $ecmdir->label = GETPOST("label");
111  $ecmdir->description = GETPOST("desc");
112 
113  $id = $ecmdir->create($user);
114  if ($id > 0) {
115  header("Location: ".$_SERVER["PHP_SELF"]);
116  exit;
117  } else {
118  setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors');
119  $action = "create";
120  }
121 
122  clearstatcache();
123 }
124 
125 // Remove file
126 if ($action == 'confirm_deletefile') {
127  if (GETPOST('confirm') == 'yes') {
128  $langs->load("other");
129  if ($section) {
130  $result = $ecmdir->fetch($section);
131  if (!($result > 0)) {
132  dol_print_error($db, $ecmdir->error);
133  exit;
134  }
135  $relativepath = $ecmdir->getRelativePath();
136  } else {
137  $relativepath = '';
138  }
139  $upload_dir = $conf->ecm->dir_output.($relativepath ? '/'.$relativepath : '');
140  $file = $upload_dir."/".GETPOST('urlfile');
141 
142  $ret = dol_delete_file($file);
143  if ($ret) {
144  setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
145  } else {
146  setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
147  }
148 
149  $result = $ecmdir->changeNbOfFiles('-');
150 
151  clearstatcache();
152  }
153  $action = 'file_manager';
154 }
155 
156 // Remove directory
157 if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') {
158  $result = $ecmdir->delete($user);
159  setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
160 
161  clearstatcache();
162 }
163 
164 // Refresh directory view
165 // This refresh list of dirs, not list of files (for performance reason). List of files is refresh only if dir was not synchronized.
166 // To refresh content of dir with cache, just open the dir in edit mode.
167 if ($action == 'refreshmanual') {
168  $ecmdirtmp = new EcmDirectory($db);
169 
170  // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate
171  clearstatcache();
172 
173  $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output);
174  $diroutputslash .= '/';
175 
176  // Scan directory tree on disk
177  $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0);
178 
179  // Scan directory tree in database
180  $sqltree = $ecmdirstatic->get_full_arbo(0);
181 
182  $adirwascreated = 0;
183 
184  // Now we compare both trees to complete missing trees into database
185  //var_dump($disktree);
186  //var_dump($sqltree);
187  foreach ($disktree as $dirdesc) { // Loop on tree onto disk
188  $dirisindatabase = 0;
189  foreach ($sqltree as $dirsqldesc) {
190  if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname']) {
191  $dirisindatabase = 1;
192  break;
193  }
194  }
195 
196  if (!$dirisindatabase) {
197  $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
198  dol_syslog($txt);
199  //print $txt."<br>\n";
200 
201  // We must first find the fk_parent of directory to create $dirdesc['fullname']
202  $fk_parent = -1;
203  $relativepathmissing = str_replace($diroutputslash, '', $dirdesc['fullname']);
204  $relativepathtosearchparent = $relativepathmissing;
205  //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent);
206  if (preg_match('/\//', $relativepathtosearchparent)) {
207  //while (preg_match('/\//',$relativepathtosearchparent))
208  $relativepathtosearchparent = preg_replace('/\/[^\/]*$/', '', $relativepathtosearchparent);
209  $txt = "Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?";
210  dol_syslog($txt);
211  //print $txt." -> ";
212  $parentdirisindatabase = 0;
213  foreach ($sqltree as $dirsqldesc) {
214  if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent) {
215  $parentdirisindatabase = $dirsqldesc['id'];
216  break;
217  }
218  }
219  if ($parentdirisindatabase > 0) {
220  dol_syslog("Yes with id ".$parentdirisindatabase);
221  //print "Yes with id ".$parentdirisindatabase."<br>\n";
222  $fk_parent = $parentdirisindatabase;
223  //break; // We found parent, we can stop the while loop
224  } else {
225  dol_syslog("No");
226  //print "No<br>\n";
227  }
228  } else {
229  dol_syslog("Parent is root");
230  $fk_parent = 0; // Parent is root
231  }
232 
233  if ($fk_parent >= 0) {
234  $ecmdirtmp->ref = 'NOTUSEDYET';
235  $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
236  $ecmdirtmp->description = '';
237  $ecmdirtmp->fk_parent = $fk_parent;
238 
239  $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
240  dol_syslog($txt);
241  //print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
242  $id = $ecmdirtmp->create($user);
243  if ($id > 0) {
244  $newdirsql = array('id' => $id,
245  'id_mere' => $ecmdirtmp->fk_parent,
246  'label' => $ecmdirtmp->label,
247  'description' => $ecmdirtmp->description,
248  'fullrelativename' => $relativepathmissing);
249  $sqltree[] = $newdirsql; // We complete fulltree for following loops
250  //var_dump($sqltree);
251  $adirwascreated = 1;
252  } else {
253  dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
254  }
255  } else {
256  $txt = "Parent of ".$dirdesc['fullname']." not found";
257  dol_syslog($txt);
258  //print $txt."<br>\n";
259  }
260  }
261  }
262 
263  // Loop now on each sql tree to check if dir exists
264  foreach ($sqltree as $dirdesc) { // Loop on each sqltree to check dir is on disk
265  $dirtotest = $conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
266  if (!dol_is_dir($dirtotest)) {
267  $ecmdirtmp->id = $dirdesc['id'];
268  $ecmdirtmp->delete($user, 'databaseonly');
269  //exit;
270  }
271  }
272 
273  $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cache counting, we set to value -1 = "unknown"
274  dol_syslog("sql = ".$sql);
275  $db->query($sql);
276 
277  // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
278  // it to be sure that fulltree array is not used without reloading it.
279  if ($adirwascreated) {
280  $sqltree = null;
281  }
282 }
283 
284 
285 
286 /*
287  * View
288  */
289 
290 // Define height of file area (depends on $_SESSION["dol_screenheight"])
291 //print $_SESSION["dol_screenheight"];
292 $maxheightwin = (isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466) ? ($_SESSION["dol_screenheight"] - 136) : 660; // Also into index.php file
293 
294 $moreheadcss = '';
295 $moreheadjs = '';
296 
297 //$morejs=array();
298 $morejs = array('includes/jquery/plugins/blockUI/jquery.blockUI.js', 'core/js/blockUI.js'); // Used by ecm/tpl/enabledfiletreeajax.tpl.pgp
299 if (!getDolGlobalString('MAIN_ECM_DISABLE_JS')) {
300  $morejs[] = "includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js";
301 }
302 
303 $moreheadjs .= '<script type="text/javascript">'."\n";
304 $moreheadjs .= 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'\';'."\n";
305 $moreheadjs .= '</script>'."\n";
306 
307 llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0);
308 
309 
310 // Add sections to manage
311 $rowspan = 0;
312 $sectionauto = array();
313 if (!getDolGlobalString('ECM_AUTO_TREE_HIDEN')) {
314  if (isModEnabled("product") || isModEnabled("service")) {
315  $langs->load("products");
316  $rowspan++;
317  $sectionauto[] = array('position' => 10, 'level' => 1, 'module' => 'product', 'test' => (isModEnabled("product") || isModEnabled("service")), 'label' => $langs->trans("ProductsAndServices"), 'desc' => $langs->trans("ECMDocsByProducts"));
318  }
319  if (isModEnabled("societe")) {
320  $rowspan++;
321  $sectionauto[] = array('position' => 20, 'level' => 1, 'module' => 'company', 'test' => isModEnabled('societe'), 'label' => $langs->trans("ThirdParties"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
322  }
323  if (isModEnabled("propal")) {
324  $rowspan++;
325  $sectionauto[] = array('position' => 30, 'level' => 1, 'module' => 'propal', 'test' => isModEnabled('propal'), 'label' => $langs->trans("Proposals"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
326  }
327  if (isModEnabled('contract')) {
328  $rowspan++;
329  $sectionauto[] = array('position' => 40, 'level' => 1, 'module' => 'contract', 'test' => isModEnabled('contract'), 'label' => $langs->trans("Contracts"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
330  }
331  if (isModEnabled('order')) {
332  $rowspan++;
333  $sectionauto[] = array('position' => 50, 'level' => 1, 'module' => 'order', 'test' => isModEnabled('order'), 'label' => $langs->trans("CustomersOrders"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
334  }
335  if (isModEnabled('invoice')) {
336  $rowspan++;
337  $sectionauto[] = array('position' => 60, 'level' => 1, 'module' => 'invoice', 'test' => isModEnabled('invoice'), 'label' => $langs->trans("CustomersInvoices"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
338  }
339  if (isModEnabled('supplier_proposal')) {
340  $langs->load("supplier_proposal");
341  $rowspan++;
342  $sectionauto[] = array('position' => 70, 'level' => 1, 'module' => 'supplier_proposal', 'test' => isModEnabled('supplier_proposal'), 'label' => $langs->trans("SupplierProposals"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
343  }
344  if (isModEnabled("supplier_order")) {
345  $rowspan++;
346  $sectionauto[] = array('position' => 80, 'level' => 1, 'module' => 'order_supplier', 'test' => isModEnabled("supplier_order"), 'label' => $langs->trans("SuppliersOrders"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
347  }
348  if (isModEnabled("supplier_invoice")) {
349  $rowspan++;
350  $sectionauto[] = array('position' => 90, 'level' => 1, 'module' => 'invoice_supplier', 'test' => isModEnabled("supplier_invoice"), 'label' => $langs->trans("SuppliersInvoices"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
351  }
352  if (isModEnabled('tax')) {
353  $langs->load("compta");
354  $rowspan++;
355  $sectionauto[] = array('position' => 100, 'level' => 1, 'module' => 'tax', 'test' => isModEnabled('tax'), 'label' => $langs->trans("SocialContributions"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
356  $rowspan++;
357  $sectionauto[] = array('position' => 110, 'level' => 1, 'module' => 'tax-vat', 'test' => isModEnabled('tax'), 'label' => $langs->trans("VAT"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("VAT")));
358  }
359  if (isModEnabled('salaries')) {
360  $langs->load("compta");
361  $rowspan++;
362  $sectionauto[] = array('position' => 120, 'level' => 1, 'module' => 'salaries', 'test' => isModEnabled('salaries'), 'label' => $langs->trans("Salaries"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Salaries")));
363  }
364  if (isModEnabled('project')) {
365  $rowspan++;
366  $sectionauto[] = array('position' => 130, 'level' => 1, 'module' => 'project', 'test' => isModEnabled('project'), 'label' => $langs->trans("Projects"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
367  $rowspan++;
368  $sectionauto[] = array('position' => 140, 'level' => 1, 'module' => 'project_task', 'test' => isModEnabled('project'), 'label' => $langs->trans("Tasks"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
369  }
370  if (isModEnabled('intervention')) {
371  $langs->load("interventions");
372  $rowspan++;
373  $sectionauto[] = array('position' => 150, 'level' => 1, 'module' => 'fichinter', 'test' => isModEnabled('intervention'), 'label' => $langs->trans("Interventions"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
374  }
375  if (isModEnabled('expensereport')) {
376  $langs->load("trips");
377  $rowspan++;
378  $sectionauto[] = array('position' => 160, 'level' => 1, 'module' => 'expensereport', 'test' => isModEnabled('expensereport'), 'label' => $langs->trans("ExpenseReports"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
379  }
380  if (isModEnabled('holiday')) {
381  $langs->load("holiday");
382  $rowspan++;
383  $sectionauto[] = array('position' => 170, 'level' => 1, 'module' => 'holiday', 'test' => isModEnabled('holiday'), 'label' => $langs->trans("Holidays"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
384  }
385  if (isModEnabled("bank")) {
386  $langs->load("banks");
387  $rowspan++;
388  $sectionauto[] = array('position' => 180, 'level' => 1, 'module' => 'banque', 'test' => isModEnabled('bank'), 'label' => $langs->trans("BankAccount"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
389  $rowspan++;
390  $sectionauto[] = array('position' => 190, 'level' => 1, 'module' => 'chequereceipt', 'test' => isModEnabled('bank'), 'label' => $langs->trans("CheckReceipt"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
391  }
392  if (isModEnabled('mrp')) {
393  $langs->load("mrp");
394  $rowspan++;
395  $sectionauto[] = array('position' => 200, 'level' => 1, 'module' => 'mrp-mo', 'test' => isModEnabled('mrp'), 'label' => $langs->trans("MOs"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
396  }
397  if (isModEnabled('recruitment')) {
398  $langs->load("recruitment");
399  $rowspan++;
400  $sectionauto[] = array('position' => 210, 'level' => 1, 'module' => 'recruitment-recruitmentcandidature', 'test' => isModEnabled('recruitment'), 'label' => $langs->trans("Candidatures"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
401  }
402  $rowspan++;
403  $sectionauto[] = array('position' => 220, 'level' => 1, 'module' => 'user', 'test' => 1, 'label' => $langs->trans("Users"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
404 
405  $parameters = array();
406  $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
407  if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
408  $sectionauto[] = $hookmanager->resArray;
409  $rowspan += count($hookmanager->resArray);
410  }
411 }
412 
413 $head = ecm_prepare_dasboard_head(null);
414 print dol_get_fiche_head($head, 'index_auto', '', -1, '');
415 
416 
417 
418 // Confirm remove file (for non javascript users)
419 if ($action == 'deletefile' && empty($conf->use_javascript_ajax)) {
420  print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1);
421 }
422 
423 // Start container of all panels
424 ?>
425 <!-- Begin div id="containerlayout" -->
426 <div id="containerlayout">
427 <div id="ecm-layout-north" class="toolbar largebutton">
428 <?php
429 
430 // Start top panel, toolbar
431 print '<div class="inline-block toolbarbutton centpercent">';
432 
433 // Toolbar
434 $url = ((!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&amp;module='.$module : '').($section ? '&amp;section='.$section : '')));
435 print '<a href="'.$url.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
436 print img_picto('', 'refresh', 'id="refreshbutton"', false, 0, 0, '', 'size15x marginrightonly');
437 print '</a>';
438 
439 print '</div>';
440 // End top panel, toolbar
441 
442 ?>
443 </div>
444 <div id="ecm-layout-west" class="inline-block">
445 <?php
446 // Start left area
447 
448 
449 // Confirmation de la suppression d'une ligne categorie
450 if ($action == 'delete_section') {
451  print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1);
452 }
453 // End confirm
454 
455 
456 if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'deletefile') {
457  print '<table class="liste centpercent">'."\n";
458 
459  print '<!-- Title for auto directories -->'."\n";
460  print '<tr class="liste_titre">'."\n";
461  print '<th class="liste_titre" align="left" colspan="6">';
462  print '&nbsp;'.$langs->trans("ECMSections");
463  print '</th></tr>';
464 
465  $showonrightsize = '';
466  // Auto section
467  if (count($sectionauto)) {
468  $htmltooltip = $langs->trans("ECMAreaDesc2");
469  $htmltooltip .= '<br>'.$langs->trans("ECMAreaDesc2b");
470 
471  $sectionauto = dol_sort_array($sectionauto, 'label', 'ASC', true, false);
472 
473  print '<tr>';
474  print '<td colspan="6">';
475  print '<div id="filetreeauto" class="ecmfiletree"><ul class="ecmjqft">';
476 
477  $nbofentries = 0;
478  $oldvallevel = 0;
479  foreach ($sectionauto as $key => $val) {
480  if (empty($val['test'])) {
481  continue; // If condition to show the ECM auto directory is ok
482  }
483 
484  print '<li class="directory collapsed">';
485  print '<a class="fmdirlia jqft ecmjqft" href="'.$_SERVER["PHP_SELF"].'?module='.urlencode($val['module']).'">';
486  print $val['label'];
487  print '</a>';
488 
489  print '<div class="ecmjqft">';
490  // Info
491  $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
492  $htmltooltip .= '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionAuto").'<br>';
493  $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$langs->trans("ECMTypeAuto").'<br>';
494  $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['desc'];
495  print $form->textwithpicto('', $htmltooltip, 1, 'info');
496  print '</div>';
497 
498  print '</li>';
499 
500  $nbofentries++;
501  }
502 
503  print '</ul></div></td></tr>';
504  }
505 
506  print "</table>";
507 }
508 
509 
510 // End left panel
511 ?>
512 </div>
513 <div id="ecm-layout-center" class="inline-block">
514 <div class="pane-in ecm-in-layout-center">
515 <div id="ecmfileview" class="ecmfileview">
516 <?php
517 // Start right panel
518 
519 $mode = 'noajax';
520 $url = DOL_URL_ROOT.'/ecm/index_auto.php';
521 include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
522 
523 
524 // End right panel
525 ?>
526 </div>
527 </div>
528 
529 </div>
530 </div> <!-- End div id="containerlayout" -->
531 <?php
532 // End of page
533 
534 if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) {
535  include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php';
536 }
537 
538 
539 print dol_get_fiche_end();
540 
541 llxFooter();
542 
543 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:69
print $object position
Definition: edit.php:195
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:50
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:745
dol_basename($pathfile)
Make a basename working with all page code (default PHP basenamed fails with cyrillic).
Definition: files.lib.php:38
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
Definition: files.lib.php:1458
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:63
dol_is_dir($folder)
Test if filename is a directory.
Definition: files.lib.php:489
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db user
Active Directory does not allow anonymous connections.
Definition: repair.php:127
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.