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