dolibarr 19.0.3
knowledgerecord_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
4 * Copyright (C) 2023 Anthony Berton <anthony.berton@bb2a.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
27require '../main.inc.php';
28
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
33
34// load knowledgemanagement libraries
35require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
36
37// for other modules
38if (isModEnabled('categorie')) {
39 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
40}
41//dol_include_once('/othermodule/class/otherobject.class.php');
42
43// Load translation files required by the page
44$langs->loadLangs(array("knowledgemanagement", "other"));
45
46$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
47$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
48$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
49$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
50$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
51$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
52$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'knowledgerecordlist'; // To manage different context of search
53$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
54$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
55$mode = GETPOST('mode', 'aZ09');
56
57$id = GETPOST('id', 'int');
58
59$searchCategoryKnowledgemanagementList = GETPOST('search_category_knowledgemanagement_list', 'array');
60$searchCategoryKnowledgemanagementOperator = 0;
61if (GETPOSTISSET('formfilteraction')) {
62 $searchCategoryKnowledgemanagementOperator = GETPOST('search_category_knowledgemanagement_operator', 'int');
63} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) {
64 $searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
65}
66// Load variable for pagination
67$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
68$sortfield = GETPOST('sortfield', 'aZ09comma');
69$sortorder = GETPOST('sortorder', 'aZ09comma');
70$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
71if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
72 // If $page is not defined, or '' or -1 or if we click on clear filters
73 $page = 0;
74}
75$offset = $limit * $page;
76$pageprev = $page - 1;
77$pagenext = $page + 1;
78
79// Initialize technical objects
80$object = new KnowledgeRecord($db);
81$extrafields = new ExtraFields($db);
82$diroutputmassaction = $conf->knowledgemanagement->dir_output.'/temp/massgeneration/'.$user->id;
83$hookmanager->initHooks(array('knowledgerecordlist')); // Note that conf->hooks_modules contains array
84
85// Fetch optionals attributes and labels
86$extrafields->fetch_name_optionals_label($object->table_element);
87//$extrafields->fetch_name_optionals_label($object->table_element_line);
88
89$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
90
91// Default sort order (if not yet defined by previous GETPOST)
92if (!$sortfield) {
93 reset($object->fields); // Reset is required to avoid key() to return null.
94 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
95}
96if (!$sortorder) {
97 $sortorder = "ASC";
98}
99
100// Initialize array of search criterias
101$search_all = GETPOST('search_all', 'alphanohtml');
102$search = array();
103foreach ($object->fields as $key => $val) {
104 if ($key == "lang") {
105 $search[$key] = GETPOST('search_'.$key, 'alpha') != '0' ? GETPOST('search_'.$key, 'alpha') : '';
106 } else {
107 $search[$key] = GETPOST('search_'.$key, 'alpha');
108 }
109
110 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
111 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
112 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
113 }
114}
115
116// List of fields to search into when doing a "search in all"
117$fieldstosearchall = array();
118foreach ($object->fields as $key => $val) {
119 if (!empty($val['searchall'])) {
120 $fieldstosearchall['t.'.$key] = $val['label'];
121 }
122}
123
124// Definition of array of fields for columns
125$arrayfields = array();
126foreach ($object->fields as $key => $val) {
127 // If $val['visible']==0, then we never show the field
128 if (!empty($val['visible'])) {
129 $visible = (int) dol_eval($val['visible'], 1);
130 $arrayfields['t.'.$key] = array(
131 'label'=>$val['label'],
132 'checked'=>(($visible < 0) ? 0 : 1),
133 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
134 'position'=>$val['position'],
135 'help'=> isset($val['help']) ? $val['help'] : ''
136 );
137 }
138}
139// Extra fields
140include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
141
142$object->fields = dol_sort_array($object->fields, 'position');
143$arrayfields = dol_sort_array($arrayfields, 'position');
144
145$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read');
146$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
147$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete');
148
149// Security check
150if (empty($conf->knowledgemanagement->enabled)) {
151 accessforbidden('Module not enabled');
152}
153$socid = 0;
154if ($user->socid > 0) { // Protection if external user
155 //$socid = $user->socid;
157}
158$result = restrictedArea($user, 'knowledgemanagement', 0, '', 'knowledgerecord');
159//if (!$permissiontoread) accessforbidden();
160
161
162
163/*
164 * Actions
165 */
166
167if (GETPOST('cancel', 'alpha')) {
168 $action = 'list';
169 $massaction = '';
170}
171if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
172 $massaction = '';
173}
174
175$parameters = array();
176$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
177if ($reshook < 0) {
178 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
179}
180
181if (empty($reshook)) {
182 // Selection of new fields
183 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
184
185 // Purge search criteria
186 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
187 foreach ($object->fields as $key => $val) {
188 $search[$key] = '';
189 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
190 $search[$key.'_dtstart'] = '';
191 $search[$key.'_dtend'] = '';
192 }
193 }
194 $toselect = array();
195 $search_array_options = array();
196 }
197 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
198 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
199 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
200 }
201 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
202 $searchCategoryKnowledgemanagementOperator = 0;
203 $searchCategoryKnowledgemanagementList = array();
204 }
205
206 // Mass actions
207 $objectclass = 'KnowledgeRecord';
208 $objectlabel = 'KnowledgeRecord';
209 $uploaddir = $conf->knowledgemanagement->dir_output;
210 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
211}
212
213
214
215/*
216 * View
217 */
218
219$form = new Form($db);
220$user_temp = new User($db);
221$formadmin = new FormAdmin($db);
222
223$now = dol_now();
224
225//$help_url="EN:Module_KnowledgeRecord|FR:Module_KnowledgeRecord_FR|ES:Módulo_KnowledgeRecord";
226$help_url = '';
227$title = $langs->trans('KnowledgeRecords');
228$morejs = array();
229$morecss = array();
230
231
232// Build and execute select
233// --------------------------------------------------------------------
234$sql = 'SELECT ';
235$sql .= $object->getFieldList('t');
236// Add fields from extrafields
237if (!empty($extrafields->attributes[$object->table_element]['label'])) {
238 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
239 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
240 }
241}
242// Add fields from hooks
243$parameters = array();
244$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
245$sql .= $hookmanager->resPrint;
246$sql = preg_replace('/,\s*$/', '', $sql);
247
248$sqlfields = $sql; // $sql fields to remove for count total
249
250$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
251if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
252 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
253}
254// Add table from hooks
255$parameters = array();
256$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
257$sql .= $hookmanager->resPrint;
258if ($object->ismultientitymanaged == 1) {
259 $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
260} else {
261 $sql .= " WHERE 1 = 1";
262}
263foreach ($search as $key => $val) {
264 if (array_key_exists($key, $object->fields)) {
265 if ($key == 'status' && $search[$key] == -1) {
266 continue;
267 }
268 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
269 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
270 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
271 $search[$key] = '';
272 }
273 $mode_search = 2;
274 }
275 if ($search[$key] != '') {
276 $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
277 }
278 } else {
279 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
280 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
281 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
282 if (preg_match('/_dtstart$/', $key)) {
283 $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
284 }
285 if (preg_match('/_dtend$/', $key)) {
286 $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
287 }
288 }
289 }
290 }
291}
292
293// Search for tag/category ($searchCategoryKnowledgemanagementList is an array of ID)
294if (!empty($searchCategoryKnowledgemanagementList)) {
295 $searchCategoryKnowledgemanagementSqlList = array();
296 $listofcategoryid = '';
297 foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
298 if (intval($searchCategoryKnowledgemanagement) == -2) {
299 $searchCategoryKnowledgemanagementSqlList[] = "NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)";
300 } elseif (intval($searchCategoryKnowledgemanagement) > 0) {
301 if (empty($searchCategoryKnowledgemanagementOperator)) {
302 $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")";
303 } else {
304 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryKnowledgemanagement);
305 }
306 }
307 }
308 if ($listofcategoryid) {
309 $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
310 }
311 if ($searchCategoryKnowledgemanagementOperator == 1) {
312 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
313 $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")";
314 }
315 } else {
316 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
317 $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")";
318 }
319 }
320}
321
322if ($search_all) {
323 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
324}
325//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
326// Add where from extra fields
327include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
328// Add where from hooks
329$parameters = array();
330$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
331$sql .= $hookmanager->resPrint;
332
333/* If a group by is required
334$sql.= " GROUP BY ";
335foreach($object->fields as $key => $val) {
336 $sql .= "t.".$key.", ";
337}
338// Add fields from extrafields
339if (!empty($extrafields->attributes[$object->table_element]['label'])) {
340 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
341}
342// Add where from hooks
343$parameters=array();
344$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook
345$sql.=$hookmanager->resPrint;
346$sql=preg_replace('/,\s*$/','', $sql);
347*/
348
349// Count total nb of records
350$nbtotalofrecords = '';
351if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
352 /* The fast and low memory method to get and count full list converts the sql into a sql count */
353 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
354 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
355 $resql = $db->query($sqlforcount);
356 if ($resql) {
357 $objforcount = $db->fetch_object($resql);
358 $nbtotalofrecords = $objforcount->nbtotalofrecords;
359 } else {
360 dol_print_error($db);
361 }
362
363 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
364 $page = 0;
365 $offset = 0;
366 }
367 $db->free($resql);
368}
369
370// Complete request and execute it with limit
371$sql .= $db->order($sortfield, $sortorder);
372if ($limit) {
373 $sql .= $db->plimit($limit + 1, $offset);
374}
375
376$resql = $db->query($sql);
377if (!$resql) {
378 dol_print_error($db);
379 exit;
380}
381
382$num = $db->num_rows($resql);
383
384
385// Direct jump if only one record found
386if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
387 $obj = $db->fetch_object($resql);
388 $id = $obj->rowid;
389 header("Location: ".dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?id='.$id);
390 exit;
391}
392
393
394// Output page
395// --------------------------------------------------------------------
396
397llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
398
399
400$arrayofselected = is_array($toselect) ? $toselect : array();
401
402$param = '';
403if (!empty($mode)) {
404 $param .= '&mode='.urlencode($mode);
405}
406if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
407 $param .= '&contextpage='.urlencode($contextpage);
408}
409if ($limit > 0 && $limit != $conf->liste_limit) {
410 $param .= '&limit='.((int) $limit);
411}
412foreach ($search as $key => $val) {
413 if (is_array($search[$key])) {
414 foreach ($search[$key] as $skey) {
415 if ($skey != '') {
416 $param .= '&search_'.$key.'[]='.urlencode($skey);
417 }
418 }
419 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
420 $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
421 $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
422 $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
423 } elseif ($search[$key] != '') {
424 $param .= '&search_'.$key.'='.urlencode($search[$key]);
425 }
426}
427if ($optioncss != '') {
428 $param .= '&optioncss='.urlencode($optioncss);
429}
430// Add $param from extra fields
431include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
432// Add $param from hooks
433$parameters = array('param' => &$param);
434$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
435$param .= $hookmanager->resPrint;
436
437// List of mass actions available
438$arrayofmassactions = array(
439 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
440 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
441 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
442 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
443);
444if (isModEnabled('category') && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) {
445 $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
446}
447if (!empty($permissiontodelete)) {
448 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
449}
450if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
451 $arrayofmassactions = array();
452}
453$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
454
455print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
456if ($optioncss != '') {
457 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
458}
459print '<input type="hidden" name="token" value="'.newToken().'">';
460print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
461print '<input type="hidden" name="action" value="list">';
462print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
463print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
464print '<input type="hidden" name="page" value="'.$page.'">';
465print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
466print '<input type="hidden" name="page_y" value="">';
467print '<input type="hidden" name="mode" value="'.$mode.'">';
468
469$newcardbutton = '';
470$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
471$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
472$newcardbutton .= dolGetButtonTitleSeparator();
473$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
474
475print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
476
477// Add code for pre mass action (confirmation or email presend form)
478$topicmail = "SendKnowledgeRecordRef";
479$modelmail = "knowledgerecord";
480$objecttmp = new KnowledgeRecord($db);
481$trackid = 'xxxx'.$object->id;
482include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
483
484if ($search_all) {
485 $setupstring = '';
486 foreach ($fieldstosearchall as $key => $val) {
487 $fieldstosearchall[$key] = $langs->trans($val);
488 $setupstring .= $key."=".$val.";";
489 }
490 print '<!-- Search done like if KNOWLEDGEMANAGEMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
491 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
492}
493
494$moreforfilter = '';
495/*$moreforfilter.='<div class="divsearchfield">';
496$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
497$moreforfilter.= '</div>';*/
498
499// Filter on categories
500$moreforfilter = '';
501if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
502 $moreforfilter .= '<div class="divsearchfield">';
503 $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
504 $categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', '', 64, 0, 1);
505 $categoriesKnowledgeArr[-2] = '- '.$langs->trans('NotCategorized').' -';
506 $moreforfilter .= Form::multiselectarray('search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0, 'minwidth300');
507 $moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_knowledgemanagement_operator" name="search_category_knowledgemanagement_operator" value="1"'.($searchCategoryKnowledgemanagementOperator == 1 ? ' checked="checked"' : '').'/><label class="none valignmiddle" for="search_category_knowledgemanagement_operator">'.$langs->trans('UseOrOperatorForCategories').'</label>';
508 $moreforfilter .= '</div>';
509}
510
511$parameters = array();
512$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
513if (empty($reshook)) {
514 $moreforfilter .= $hookmanager->resPrint;
515} else {
516 $moreforfilter = $hookmanager->resPrint;
517}
518
519if (!empty($moreforfilter)) {
520 print '<div class="liste_titre liste_titre_bydiv centpercent">';
521 print $moreforfilter;
522 $parameters = array();
523 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
524 print $hookmanager->resPrint;
525 print '</div>';
526}
527
528$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
529$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
530$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
531
532print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
533print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
534
535
536// Fields title search
537// --------------------------------------------------------------------
538print '<tr class="liste_titre_filter">';
539// Action column
540if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
541 print '<td class="liste_titre maxwidthsearch center">';
542 $searchpicto = $form->showFilterButtons('left');
543 print $searchpicto;
544 print '</td>';
545}
546foreach ($object->fields as $key => $val) {
547 $searchkey = empty($search[$key]) ? '' : $search[$key];
548 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
549 if ($key == 'status') {
550 $cssforfield .= ($cssforfield ? ' ' : '').'center';
551 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
552 $cssforfield .= ($cssforfield ? ' ' : '').'center';
553 } elseif (in_array($val['type'], array('timestamp'))) {
554 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
555 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
556 $cssforfield .= ($cssforfield ? ' ' : '').'right';
557 }
558 if (!empty($arrayfields['t.'.$key]['checked'])) {
559 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
560 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
561 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
562 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
563 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
564 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
565 print '<div class="nowrap">';
566 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
567 print '</div>';
568 print '<div class="nowrap">';
569 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
570 print '</div>';
571 } elseif ($key == 'lang') {
572 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
573 $formadmin = new FormAdmin($db);
574 print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
575 } else {
576 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
577 }
578 print '</td>';
579 }
580}
581// Extra fields
582include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
583
584// Fields from hook
585$parameters = array('arrayfields'=>$arrayfields);
586$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
587print $hookmanager->resPrint;
588// Action column
589if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
590 print '<td class="liste_titre center maxwidthsearch">';
591 $searchpicto = $form->showFilterButtons();
592 print $searchpicto;
593 print '</td>';
594}
595print '</tr>'."\n";
596
597$totalarray = array();
598$totalarray['nbfield'] = 0;
599
600// Fields title label
601// --------------------------------------------------------------------
602print '<tr class="liste_titre">';
603if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
604 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
605 $totalarray['nbfield']++;
606}
607foreach ($object->fields as $key => $val) {
608 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
609 if ($key == 'status') {
610 $cssforfield .= ($cssforfield ? ' ' : '').'center';
611 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
612 $cssforfield .= ($cssforfield ? ' ' : '').'center';
613 } elseif (in_array($val['type'], array('timestamp'))) {
614 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
615 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
616 $cssforfield .= ($cssforfield ? ' ' : '').'right';
617 }
618 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
619 if (!empty($arrayfields['t.'.$key]['checked'])) {
620 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
621 $totalarray['nbfield']++;
622 }
623}
624// Extra fields
625include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
626// Hook fields
627$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
628$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
629print $hookmanager->resPrint;
630// Action column
631if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
632 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
633 $totalarray['nbfield']++;
634}
635print '</tr>'."\n";
636
637// Detect if we need a fetch on each output line
638$needToFetchEachLine = 0;
639if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
640 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
641 if (!is_null($val) && preg_match('/\$object/', $val)) {
642 $needToFetchEachLine++; // There is at least one compute field that use $object
643 }
644 }
645}
646
647
648// Loop on record
649// --------------------------------------------------------------------
650$i = 0;
651$savnbfield = $totalarray['nbfield'];
652$totalarray = array();
653$totalarray['nbfield'] = 0;
654$imaxinloop = ($limit ? min($num, $limit) : $num);
655while ($i < $imaxinloop) {
656 $obj = $db->fetch_object($resql);
657 if (empty($obj)) {
658 break; // Should not happen
659 }
660
661 // Store properties in $object
662 $object->setVarsFromFetchObj($obj);
663
664 if ($mode == 'kanban') {
665 if ($i == 0) {
666 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
667 print '<div class="box-flex-container kanban">';
668 }
669 // Output Kanban
670 $selected = -1;
671 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
672 $selected = 0;
673 if (in_array($object->id, $arrayofselected)) {
674 $selected = 1;
675 }
676 }
677 print $object->getKanbanView('', array('selected' => $selected));
678 if ($i == ($imaxinloop - 1)) {
679 print '</div>';
680 print '</td></tr>';
681 }
682 } else {
683 // Show here line of result
684 $j = 0;
685 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
686 // Action column
687 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
688 print '<td class="nowrap center">';
689 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
690 $selected = 0;
691 if (in_array($object->id, $arrayofselected)) {
692 $selected = 1;
693 }
694 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
695 }
696 print '</td>';
697 if (!$i) {
698 $totalarray['nbfield']++;
699 }
700 }
701 foreach ($object->fields as $key => $val) {
702 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
703 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
704 $cssforfield .= ($cssforfield ? ' ' : '').'center';
705 } elseif ($key == 'status') {
706 $cssforfield .= ($cssforfield ? ' ' : '').'center';
707 }
708
709 if (in_array($val['type'], array('timestamp'))) {
710 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
711 } elseif ($key == 'ref') {
712 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
713 }
714
715 if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
716 $cssforfield .= ($cssforfield ? ' ' : '').'right';
717 }
718 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
719 if (!empty($arrayfields['t.'.$key]['checked'])) {
720 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
721 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
722 print ' title="'.dol_escape_htmltag(dol_nl2br($object->$key, 1)).'"'; // We add dol_nl2br for the question and answer fields
723 }
724 print '>';
725 if ($key == 'status') {
726 print $object->getLibStatut(5);
727 } elseif ($key == 'rowid') {
728 print $object->showOutputField($val, $key, $object->id, '');
729 } elseif ($key == 'fk_user_creat') {
730 if ($object->fk_user_creat > 0) {
731 if (isset($conf->cache['user'][$object->fk_user_creat])) {
732 $user_temp = $conf->cache['user'][$object->fk_user_creat];
733 } else {
734 $user_temp = new User($db);
735 $user_temp->fetch($object->fk_user_creat);
736 $conf->cache['user'][$object->fk_user_creat] = $user_temp;
737 }
738 print $user_temp->getNomUrl(-1);
739 }
740 } elseif ($key == 'fk_user_modif') {
741 if ($object->fk_user_modif > 0) {
742 if (isset($conf->cache['user'][$object->fk_user_modif])) {
743 $user_temp = $conf->cache['user'][$object->fk_user_modif];
744 } else {
745 $user_temp = new User($db);
746 $user_temp->fetch($object->fk_user_modif);
747 $conf->cache['user'][$object->fk_user_modif] = $user_temp;
748 }
749 print $user_temp->getNomUrl(-1);
750 }
751 } elseif ($key == 'fk_user_valid') {
752 if ($object->fk_user_valid > 0) {
753 if (isset($conf->cache['user'][$object->fk_user_valid])) {
754 $user_temp = $conf->cache['user'][$object->fk_user_valid];
755 } else {
756 $user_temp = new User($db);
757 $user_temp->fetch($object->fk_user_valid);
758 $conf->cache['user'][$object->fk_user_valid] = $user_temp;
759 }
760 print $user_temp->getNomUrl(-1);
761 }
762 } elseif ($key == 'lang') {
763 $labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
764 print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"');
765 print $labellang;
766 } elseif ($key == 'question') {
767 print dolGetFirstLineOfText($object->$key);
768 } else {
769 print $object->showOutputField($val, $key, $object->$key, '');
770 }
771 print '</td>';
772 if (!$i) {
773 $totalarray['nbfield']++;
774 }
775 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
776 if (!$i) {
777 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
778 }
779 if (!isset($totalarray['val'])) {
780 $totalarray['val'] = array();
781 }
782 if (!isset($totalarray['val']['t.'.$key])) {
783 $totalarray['val']['t.'.$key] = 0;
784 }
785 $totalarray['val']['t.'.$key] += $object->$key;
786 }
787 }
788 }
789 // Extra fields
790 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
791 // Fields from hook
792 $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
793 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
794 print $hookmanager->resPrint;
795 // Action column
796 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
797 print '<td class="nowrap center">';
798 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
799 $selected = 0;
800 if (in_array($object->id, $arrayofselected)) {
801 $selected = 1;
802 }
803 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
804 }
805 print '</td>';
806 if (!$i) {
807 $totalarray['nbfield']++;
808 }
809 }
810
811 print '</tr>'."\n";
812 }
813 $i++;
814}
815
816// Show total line
817include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
818
819// If no record found
820if ($num == 0) {
821 $colspan = 1;
822 foreach ($arrayfields as $key => $val) {
823 if (!empty($val['checked'])) {
824 $colspan++;
825 }
826 }
827 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
828}
829
830
831$db->free($resql);
832
833$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
834$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
835print $hookmanager->resPrint;
836
837print '</table>'."\n";
838print '</div>'."\n";
839
840print '</form>'."\n";
841
842if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
843 $hidegeneratedfilelistifempty = 1;
844 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
845 $hidegeneratedfilelistifempty = 0;
846 }
847
848 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
849 $formfile = new FormFile($db);
850
851 // Show list of available documents
852 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
853 $urlsource .= str_replace('&amp;', '&', $param);
854
855 $filedir = $diroutputmassaction;
856 $genallowed = $permissiontoread;
857 $delallowed = $permissiontoadd;
858
859 print $formfile->showdocuments('massfilesarea_knowledgemanagement', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
860}
861
862// End of page
863llxFooter();
864$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage standard extra fields.
Class to generate html code for admin pages.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
static multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=-1)
Show a multiselect form from an array.
Class for KnowledgeRecord.
Class to manage Dolibarr users.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
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.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.