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