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