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