dolibarr 21.0.0-alpha
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
3 * Copyright (C) 2019-2020 Open-DSI <support@open-dsi.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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
27// General defined Options
28//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
29//if (! defined('MAIN_AUTHENTICATION_MODE')) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
30//if (! defined('MAIN_LANG_DEFAULT')) define('MAIN_LANG_DEFAULT', 'auto'); // Force LANG (language) to a particular value
31//if (! defined('MAIN_SECURITY_FORCECSP')) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
32//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
33//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34//if (! defined('NOLOGIN')) define('NOLOGIN', '1'); // Do not use login - if this page is public (can be called outside logged session). This includes the NOIPCHECK too.
35//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
36//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
37//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // Do not load html.form.class.php
38//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // Do not load and show top and left menu
39//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
40//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
41//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
42//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
43//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
44//if (! defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions
45//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
46//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
47
48
49// Load Dolibarr environment
50require '../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.'/intracommreport/class/intracommreport.class.php';
52require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
53require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
54
55// Load translation files required by the page
56$langs->loadLangs(array('intracommreport'));
57
58// Get parameters
59$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
60$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
61$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
62$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
63$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
64$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
65$optioncss = GETPOST('optioncss', 'alpha');
66$mode = GETPOST('mode', 'aZ');
67
68$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
69$search_ref = GETPOST("search_ref", 'alpha');
70$search_type = GETPOST("search_type", 'int');
71
72// Initialize context for list
73$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'intracommreportlist';
74if ((string) $type == '1') {
75 $contextpage = 'DESlist';
76 if ($search_type == '') {
77 $search_type = '1';
78 }
79}
80if ((string) $type == '0') {
81 $contextpage = 'DEBlist';
82 if ($search_type == '') {
83 $search_type = '0';
84 }
85}
86
87$diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;
88
89// Load variable for pagination
90$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
91$sortfield = GETPOST('sortfield', 'aZ09comma');
92$sortorder = GETPOST('sortorder', 'aZ09comma');
93$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
94if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
95 // If $page is not defined, or '' or -1 or if we click on clear filters
96 $page = 0;
97}
98$offset = $limit * $page;
99$pageprev = $page - 1;
100$pagenext = $page + 1;
101
102
103// Initialize a technical objects
104$object = new IntracommReport($db);
105$extrafields = new ExtraFields($db);
106$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
107$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
108
109// Fetch optionals attributes and labels
110$extrafields->fetch_name_optionals_label($object->table_element);
111//$extrafields->fetch_name_optionals_label($object->table_element_line);
112
113$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
114
115// Default sort order (if not yet defined by previous GETPOST)
116if (!$sortfield) {
117 reset($object->fields); // Reset is required to avoid key() to return null.
118 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
119}
120if (!$sortorder) {
121 $sortorder = "ASC";
122}
123
124// Initialize array of search criteria
125$search_all = trim(GETPOST('search_all', 'alphanohtml'));
126$search = array();
127foreach ($object->fields as $key => $val) {
128 if (GETPOST('search_'.$key, 'alpha') !== '') {
129 $search[$key] = GETPOST('search_'.$key, 'alpha');
130 }
131 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
132 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
133 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
134 }
135}
136
137$fieldstosearchall = array(
138 't.ref' => "Ref",
139);
140
141// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
142$object = new IntracommReport($db);
143$hookmanager->initHooks(array('intracommreportlist'));
144$extrafields = new ExtraFields($db);
145$form = new Form($db);
146
147/*
148// fetch optionals attributes and labels
149$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
150$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
151*/
152
153if (empty($action)) {
154 $action = 'list';
155}
156
157
158
159// Definition of array of fields for columns
160$arrayfields = array();
161foreach ($object->fields as $key => $val) {
162 // If $val['visible']==0, then we never show the field
163 if (!empty($val['visible'])) {
164 $visible = (int) dol_eval($val['visible'], 1);
165 $arrayfields['t.'.$key] = array(
166 'label' => $val['label'],
167 'checked' => (($visible < 0) ? 0 : 1),
168 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
169 'position' => $val['position'],
170 'help' => isset($val['help']) ? $val['help'] : ''
171 );
172 }
173}
174// Extra fields
175include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
176
177$object->fields = dol_sort_array($object->fields, 'position');
178//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
179$arrayfields = dol_sort_array($arrayfields, 'position');
180
181
182//$isInEEC = isInEEC($mysoc);
183
184
185$permissiontoread = $user->hasRight('intracommreport', 'read');
186$permissiontoadd = $user->hasRight('intracommreport', 'write');
187$permissiontodelete = $user->hasRight('intracommreport', 'delete');
188
189// Security check
190if ($search_type == '0') {
191 $result = restrictedArea($user, 'produit', '', '', '', '', '', 0);
192} elseif ($search_type == '1') {
193 $result = restrictedArea($user, 'service', '', '', '', '', '', 0);
194} else {
195 $result = restrictedArea($user, 'produit|service', '', '', '', '', '', 0);
196}
197
198if (!isModEnabled("intracommreport")) {
199 accessforbidden('Module intracommreport not enabled');
200}
201
202
203
204/*
205 * Actions
206 */
207
208if (GETPOST('cancel', 'alpha')) {
209 $action = 'list';
210 $massaction = '';
211}
212if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
213 $massaction = '';
214}
215
216$parameters = array();
217$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
218if ($reshook < 0) {
219 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
220}
221
222if (empty($reshook)) {
223 // Selection of new fields
224 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
225
226 // Purge search criteria
227 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
228 $search_all = "";
229 $search_ref = "";
230 //$search_label = "";
231 //$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
232
233 //$show_childproducts = '';
234 $search_array_options = array();
235 }
236
237 // Mass actions
238 $objectclass = 'Product';
239 if ((string) $search_type == '1') {
240 $objectlabel = 'Services';
241 }
242 if ((string) $search_type == '0') {
243 $objectlabel = 'Products';
244 }
245
246 $uploaddir = $conf->product->dir_output;
247 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
248}
249
250
251/*
252 * View
253 */
254
255$form = new Form($db);
256
257$now = dol_now();
258
259$title = $langs->trans("IntraCommReports");
260//$help_url = "EN:Module_IntraCommReport|FR:Module_IntraCommReport_FR|ES:Módulo_IntraCommReport";
261$help_url = '';
262$morejs = array();
263$morecss = array();
264
265
266// Build and execute select
267// --------------------------------------------------------------------
268$sql = 'SELECT ';
269$sql .= $object->getFieldList('t');
270// Add fields from extrafields
271if (!empty($extrafields->attributes[$object->table_element]['label'])) {
272 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
273 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
274 }
275}
276// Add fields from hooks
277$parameters = array();
278$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
279$sql .= $hookmanager->resPrint;
280$sql = preg_replace('/,\s*$/', '', $sql);
281
282$sqlfields = $sql; // $sql fields to remove for count total
283
284$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
285//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid";
286if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
287 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
288}
289// Add table from hooks
290$parameters = array();
291$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
292$sql .= $hookmanager->resPrint;
293if ($object->ismultientitymanaged == 1) {
294 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOST('search_current_entity', 'int') ? 0 : 1)).")";
295} else {
296 $sql .= " WHERE 1 = 1";
297}
298foreach ($search as $key => $val) {
299 if (array_key_exists($key, $object->fields)) {
300 if ($key == 'status' && $search[$key] == -1) {
301 continue;
302 }
303 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
304 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
305 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
306 $search[$key] = '';
307 }
308 $mode_search = 2;
309 }
310 if ($search[$key] != '') {
311 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
312 }
313 } else {
314 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
315 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
316 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
317 if (preg_match('/_dtstart$/', $key)) {
318 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
319 }
320 if (preg_match('/_dtend$/', $key)) {
321 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
322 }
323 }
324 }
325 }
326}
327if ($search_all) {
328 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
329}
330/*
331 // If the internal user must only see his customers, force searching by him
332 $search_sale = 0;
333 if (!$user->hasRight('societe', 'client', 'voir')) {
334 $search_sale = $user->id;
335 }
336 // Search on sale representative
337 if ($search_sale && $search_sale != '-1') {
338 if ($search_sale == -2) {
339 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)";
340 } elseif ($search_sale > 0) {
341 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
342 }
343 }
344 // Search on socid
345 if ($socid) {
346 $sql .= " AND t.fk_soc = ".((int) $socid);
347 }
348 */
349//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
350// Add where from extra fields
351include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
352// Add where from hooks
353$parameters = array();
354$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
355$sql .= $hookmanager->resPrint;
356
357/* If a group by is required
358 $sql .= " GROUP BY ";
359 foreach($object->fields as $key => $val) {
360 $sql .= "t.".$db->sanitize($key).", ";
361 }
362 // Add fields from extrafields
363 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
364 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
365 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
366 }
367 }
368 // Add groupby from hooks
369 $parameters = array();
370 $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
371 $sql .= $hookmanager->resPrint;
372 $sql = preg_replace('/,\s*$/', '', $sql);
373 */
374
375// Add HAVING from hooks
376/*
377 $parameters = array();
378 $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
379 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
380 */
381
382// Count total nb of records
383$nbtotalofrecords = '';
384if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
385 /* The fast and low memory method to get and count full list converts the sql into a sql count */
386 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
387 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
388
389 $resql = $db->query($sqlforcount);
390 if ($resql) {
391 $objforcount = $db->fetch_object($resql);
392 $nbtotalofrecords = $objforcount->nbtotalofrecords;
393 } else {
394 dol_print_error($db);
395 }
396
397 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
398 $page = 0;
399 $offset = 0;
400 }
401 $db->free($resql);
402}
403
404// Complete request and execute it with limit
405$sql .= $db->order($sortfield, $sortorder);
406if ($limit) {
407 $sql .= $db->plimit($limit + 1, $offset);
408}
409
410$resql = $db->query($sql);
411if (!$resql) {
412 dol_print_error($db);
413 exit;
414}
415
416$num = $db->num_rows($resql);
417
418
419// Direct jump if only one record found
420if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
421 $obj = $db->fetch_object($resql);
422 $id = $obj->rowid;
423 header("Location: ".dol_buildpath('/intracommreport/card.php', 1).'?id='.((int) $id));
424 exit;
425}
426
427
428// Output page
429// --------------------------------------------------------------------
430
431llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-mymodule page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
432
433// Example : Adding jquery code
434// print '<script type="text/javascript">
435// jQuery(document).ready(function() {
436// function init_myfunc()
437// {
438// jQuery("#myid").removeAttr(\'disabled\');
439// jQuery("#myid").attr(\'disabled\',\'disabled\');
440// }
441// init_myfunc();
442// jQuery("#mybutton").click(function() {
443// init_myfunc();
444// });
445// });
446// </script>';
447
448$arrayofselected = is_array($toselect) ? $toselect : array();
449
450$param = '';
451if (!empty($mode)) {
452 $param .= '&mode='.urlencode($mode);
453}
454if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
455 $param .= '&contextpage='.urlencode($contextpage);
456}
457if ($limit > 0 && $limit != $conf->liste_limit) {
458 $param .= '&limit='.((int) $limit);
459}
460if ($optioncss != '') {
461 $param .= '&optioncss='.urlencode($optioncss);
462}
463if ($groupby != '') {
464 $param .= '&groupby='.urlencode($groupby);
465}
466foreach ($search as $key => $val) {
467 if (is_array($search[$key])) {
468 foreach ($search[$key] as $skey) {
469 if ($skey != '') {
470 $param .= '&search_'.$key.'[]='.urlencode($skey);
471 }
472 }
473 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
474 $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
475 $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
476 $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
477 } elseif ($search[$key] != '') {
478 $param .= '&search_'.$key.'='.urlencode($search[$key]);
479 }
480}
481// Add $param from extra fields
482include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
483// Add $param from hooks
484$parameters = array('param' => &$param);
485$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
486$param .= $hookmanager->resPrint;
487
488// List of mass actions available
489$arrayofmassactions = array(
490 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
491 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
492 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
493 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
494);
495if (!empty($permissiontodelete)) {
496 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
497}
498if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
499 $arrayofmassactions = array();
500}
501$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
502
503print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
504if ($optioncss != '') {
505 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
506}
507print '<input type="hidden" name="token" value="'.newToken().'">';
508print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
509print '<input type="hidden" name="action" value="list">';
510print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
511print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
512print '<input type="hidden" name="page" value="'.$page.'">';
513print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
514print '<input type="hidden" name="page_y" value="">';
515print '<input type="hidden" name="mode" value="'.$mode.'">';
516
517
518$newcardbutton = '';
519$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'));
520$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'));
521$newcardbutton .= dolGetButtonTitleSeparator();
522$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/intracommreport/card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
523
524print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
525
526// Add code for pre mass action (confirmation or email presend form)
527$topicmail = "SendIntraCommReportRef";
528$modelmail = "intracommreport";
529$objecttmp = new IntracommReport($db);
530$trackid = 'xxxx'.$object->id;
531include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
532
533if ($search_all) {
534 $setupstring = '';
535 foreach ($fieldstosearchall as $key => $val) {
536 $fieldstosearchall[$key] = $langs->trans($val);
537 $setupstring .= $key."=".$val.";";
538 }
539 print '<!-- Search done like if INTRACOMMREPORT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
540 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
541}
542
543$moreforfilter = '';
544/*$moreforfilter.='<div class="divsearchfield">';
545 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
546 $moreforfilter.= '</div>';*/
547
548$parameters = array();
549$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
550if (empty($reshook)) {
551 $moreforfilter .= $hookmanager->resPrint;
552} else {
553 $moreforfilter = $hookmanager->resPrint;
554}
555
556if (!empty($moreforfilter)) {
557 print '<div class="liste_titre liste_titre_bydiv centpercent">';
558 print $moreforfilter;
559 print '</div>';
560}
561
562$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
563$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
564$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
565$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
566
567print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
568print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
569
570// Fields title search
571// --------------------------------------------------------------------
572print '<tr class="liste_titre_filter">';
573// Action column
574if ($conf->main_checkbox_left_column) {
575 print '<td class="liste_titre center maxwidthsearch">';
576 $searchpicto = $form->showFilterButtons('left');
577 print $searchpicto;
578 print '</td>';
579}
580foreach ($object->fields as $key => $val) {
581 //$searchkey = empty($search[$key]) ? '' : $search[$key];
582 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
583 if ($key == 'status') {
584 $cssforfield .= ($cssforfield ? ' ' : '').'center';
585 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
586 $cssforfield .= ($cssforfield ? ' ' : '').'center';
587 } elseif (in_array($val['type'], array('timestamp'))) {
588 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
589 } 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'])) {
590 $cssforfield .= ($cssforfield ? ' ' : '').'right';
591 }
592 if (!empty($arrayfields['t.'.$key]['checked'])) {
593 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
594 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
595 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
596 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
597 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
598 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
599 print '<div class="nowrap">';
600 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
601 print '</div>';
602 print '<div class="nowrap">';
603 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
604 print '</div>';
605 } elseif ($key == 'lang') {
606 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
607 $formadmin = new FormAdmin($db);
608 print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
609 } else {
610 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
611 }
612 print '</td>';
613 }
614}
615// Extra fields
616include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
617
618// Fields from hook
619$parameters = array('arrayfields' => $arrayfields);
620$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
621print $hookmanager->resPrint;
622/*if (!empty($arrayfields['anotherfield']['checked'])) {
623 print '<td class="liste_titre"></td>';
624 }*/
625// Action column
626if (!$conf->main_checkbox_left_column) {
627 print '<td class="liste_titre center maxwidthsearch">';
628 $searchpicto = $form->showFilterButtons();
629 print $searchpicto;
630 print '</td>';
631}
632print '</tr>'."\n";
633
634$totalarray = array();
635$totalarray['nbfield'] = 0;
636
637// Fields title label
638// --------------------------------------------------------------------
639print '<tr class="liste_titre">';
640// Action column
641if ($conf->main_checkbox_left_column) {
642 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
643 $totalarray['nbfield']++;
644}
645foreach ($object->fields as $key => $val) {
646 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
647 if ($key == 'status') {
648 $cssforfield .= ($cssforfield ? ' ' : '').'center';
649 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
650 $cssforfield .= ($cssforfield ? ' ' : '').'center';
651 } elseif (in_array($val['type'], array('timestamp'))) {
652 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
653 } 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'])) {
654 $cssforfield .= ($cssforfield ? ' ' : '').'right';
655 }
656 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
657 if (!empty($arrayfields['t.'.$key]['checked'])) {
658 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";
659 $totalarray['nbfield']++;
660 }
661}
662// Extra fields
663include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
664// Hook fields
665$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
666$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
667print $hookmanager->resPrint;
668/*if (!empty($arrayfields['anotherfield']['checked'])) {
669 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
670 $totalarray['nbfield']++;
671 }*/
672// Action column
673if (!$conf->main_checkbox_left_column) {
674 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
675 $totalarray['nbfield']++;
676}
677print '</tr>'."\n";
678
679// Detect if we need a fetch on each output line
680$needToFetchEachLine = 0;
681if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
682 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
683 if (!is_null($val) && preg_match('/\$object/', $val)) {
684 $needToFetchEachLine++; // There is at least one compute field that use $object
685 }
686 }
687}
688
689
690// Loop on record
691// --------------------------------------------------------------------
692$i = 0;
693$savnbfield = $totalarray['nbfield'];
694$totalarray = array();
695$totalarray['nbfield'] = 0;
696$imaxinloop = ($limit ? min($num, $limit) : $num);
697while ($i < $imaxinloop) {
698 $obj = $db->fetch_object($resql);
699 if (empty($obj)) {
700 break; // Should not happen
701 }
702
703 // Store properties in $object
704 $object->setVarsFromFetchObj($obj);
705
706 /*
707 $object->thirdparty = null;
708 if ($obj->fk_soc > 0) {
709 if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
710 $companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
711 } else {
712 $companyobj = new Societe($db);
713 $companyobj->fetch($obj->fk_soc);
714 $conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
715 }
716
717 $object->thirdparty = $companyobj;
718 }*/
719
720 if ($mode == 'kanban') {
721 if ($i == 0) {
722 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
723 print '<div class="box-flex-container kanban">';
724 }
725 // Output Kanban
726 $selected = -1;
727 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
728 $selected = 0;
729 if (in_array($object->id, $arrayofselected)) {
730 $selected = 1;
731 }
732 }
733 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
734 print $object->getKanbanView('', array('selected' => $selected));
735 if ($i == ($imaxinloop - 1)) {
736 print '</div>';
737 print '</td></tr>';
738 }
739 } else {
740 // Show line of result
741 $j = 0;
742 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
743
744 // Action column
745 if ($conf->main_checkbox_left_column) {
746 print '<td class="nowrap center">';
747 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
748 $selected = 0;
749 if (in_array($object->id, $arrayofselected)) {
750 $selected = 1;
751 }
752 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
753 }
754 print '</td>';
755 if (!$i) {
756 $totalarray['nbfield']++;
757 }
758 }
759 // Fields
760 foreach ($object->fields as $key => $val) {
761 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
762 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
763 $cssforfield .= ($cssforfield ? ' ' : '').'center';
764 } elseif ($key == 'status') {
765 $cssforfield .= ($cssforfield ? ' ' : '').'center';
766 }
767
768 if (in_array($val['type'], array('timestamp'))) {
769 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
770 } elseif ($key == 'ref') {
771 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
772 }
773
774 if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
775 $cssforfield .= ($cssforfield ? ' ' : '').'right';
776 }
777 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
778
779 if (!empty($arrayfields['t.'.$key]['checked'])) {
780 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
781 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
782 print ' title="'.dol_escape_htmltag($object->$key).'"';
783 }
784 print '>';
785 if ($key == 'status') {
786 print $object->getLibStatut(5);
787 } elseif ($key == 'rowid') {
788 print $object->showOutputField($val, $key, $object->id, '');
789 } else {
790 print $object->showOutputField($val, $key, $object->$key, '');
791 }
792 print '</td>';
793 if (!$i) {
794 $totalarray['nbfield']++;
795 }
796 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
797 if (!$i) {
798 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
799 }
800 if (!isset($totalarray['val'])) {
801 $totalarray['val'] = array();
802 }
803 if (!isset($totalarray['val']['t.'.$key])) {
804 $totalarray['val']['t.'.$key] = 0;
805 }
806 $totalarray['val']['t.'.$key] += $object->$key;
807 }
808 }
809 }
810 // Extra fields
811 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
812 // Fields from hook
813 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
814 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
815 print $hookmanager->resPrint;
816
817 /*if (!empty($arrayfields['anotherfield']['checked'])) {
818 print '<td class="right">'.$obj->anotherfield.'</td>';
819 }*/
820
821 // Action column
822 if (empty($conf->main_checkbox_left_column)) {
823 print '<td class="nowrap center">';
824 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
825 $selected = 0;
826 if (in_array($object->id, $arrayofselected)) {
827 $selected = 1;
828 }
829 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
830 }
831 print '</td>';
832 if (!$i) {
833 $totalarray['nbfield']++;
834 }
835 }
836
837 print '</tr>'."\n";
838 }
839
840 $i++;
841}
842
843// Show total line
844include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
845
846// If no record found
847if ($num == 0) {
848 $colspan = 1;
849 foreach ($arrayfields as $key => $val) {
850 if (!empty($val['checked'])) {
851 $colspan++;
852 }
853 }
854 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
855}
856
857
858$db->free($resql);
859
860$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
861$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
862print $hookmanager->resPrint;
863
864print '</table>'."\n";
865print '</div>'."\n";
866
867print '</form>'."\n";
868
869if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
870 $hidegeneratedfilelistifempty = 1;
871 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
872 $hidegeneratedfilelistifempty = 0;
873 }
874
875 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
876 $formfile = new FormFile($db);
877
878 // Show list of available documents
879 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
880 $urlsource .= str_replace('&amp;', '&', $param);
881
882 $filedir = $diroutputmassaction;
883 $genallowed = $permissiontoread;
884 $delallowed = $permissiontoadd;
885
886 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
887}
888
889// End of page
890llxFooter();
891$db->close();
$id
Definition account.php:39
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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
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.
Class to manage intracomm report.
llxFooter()
Footer empty.
Definition document.php:107
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
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.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
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.