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