dolibarr 21.0.3
conferenceorbooth_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
4 * Copyright (C) 2023-2024 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
28// Load Dolibarr environment
29require '../main.inc.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.'/core/lib/project.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
35require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
36require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
37require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
39
50// Load translation files required by the page
51$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
52
53// Get Parameters
54$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
55$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
56$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
57$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
58$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
59$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
60$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
61$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
62$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
63$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
64
65$id = GETPOSTINT('id');
66$projectid = GETPOSTINT('projectid');
67$projectref = GETPOST('ref', 'alpha');
68
69// Load variable for pagination
70$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
71$sortfield = GETPOST('sortfield', 'aZ09comma');
72$sortorder = GETPOST('sortorder', 'aZ09comma');
73$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
74if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
75 // If $page is not defined, or '' or -1 or if we click on clear filters
76 $page = 0;
77}
78$offset = $limit * $page;
79$pageprev = $page - 1;
80$pagenext = $page + 1;
81
82// Initialize a technical objects
83$object = new ConferenceOrBooth($db);
84$project = new Project($db);
85$extrafields = new ExtraFields($db);
86$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
87$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
88
89// Fetch optionals attributes and labels
90$extrafields->fetch_name_optionals_label($object->table_element);
91//$extrafields->fetch_name_optionals_label($object->table_element_line);
92
93$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
94
95// Default sort order (if not yet defined by previous GETPOST)
96if (!$sortfield) {
97 reset($object->fields); // Reset is required to avoid key() to return null.
98 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
99}
100if (!$sortorder) {
101 $sortorder = "ASC";
102}
103
104// Initialize array of search criteria
105$search_all = GETPOST('search_all', 'alphanohtml');
106$search = array();
107foreach ($object->fields as $key => $val) {
108 if (GETPOST('search_'.$key, 'alpha') !== '') {
109 $search[$key] = GETPOST('search_'.$key, 'alpha');
110 }
111 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
112 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
113 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
114 }
115}
116
117// List of fields to search into when doing a "search in all"
118$fieldstosearchall = array();
119foreach ($object->fields as $key => $val) {
120 if (!empty($val['searchall'])) {
121 $fieldstosearchall['t.'.$key] = $val['label'];
122 }
123}
124
125// Definition of array of fields for columns
126$arrayfields = array();
127foreach ($object->fields as $key => $val) {
128 // If $val['visible']==0, then we never show the field
129 if (!empty($val['visible'])) {
130 $visible = (int) dol_eval((string) $val['visible'], 1);
131 $arrayfields['t.'.$key] = array(
132 'label' => $val['label'],
133 'checked' => (($visible < 0) ? 0 : 1),
134 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
135 'position' => $val['position'],
136 'help' => isset($val['help']) ? $val['help'] : ''
137 );
138 }
139}
140// Extra fields
141include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
142
143$object->fields = dol_sort_array($object->fields, 'position');
144$arrayfields = dol_sort_array($arrayfields, 'position');
145
146$permissiontoread = $user->hasRight('eventorganization', 'read');
147$permissiontoadd = $user->hasRight('eventorganization', 'write');
148$permissiontodelete = $user->hasRight('eventorganization', 'delete');
149
150// Security check
151if (!isModEnabled('eventorganization')) {
152 accessforbidden('Module eventorganization not enabled');
153}
154$socid = 0;
155if ($user->socid > 0) { // Protection if external user
156 //$socid = $user->socid;
158}
159$result = restrictedArea($user, 'eventorganization');
160if (!$permissiontoread) {
162}
163
164
165/*
166 * Actions
167 */
168
169if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && $user->hasRight('eventorganization', 'write')) {
170 //If "set" fields keys is in projects fields
171 $project_attr = preg_replace('/^set/', '', $action);
172 if (array_key_exists($project_attr, $project->fields)) {
173 $result = $project->fetch($projectid, $projectref);
174 if ($result < 0) {
175 setEventMessages(null, $project->errors, 'errors');
176 } else {
177 $projectid = $project->id;
178 $project->{$project_attr} = GETPOST($project_attr);
179 $result = $project->update($user);
180 if ($result < 0) {
181 setEventMessages(null, $project->errors, 'errors');
182 }
183 }
184 }
185}
186/*if ($action=='setaccept_conference_suggestions' && !empty(GETPOST('cancel', 'alpha'))) {
187
188}*/
189//setaccept_booth_suggestions
190if (GETPOST('cancel', 'alpha')) {
191 $action = 'list';
192 $massaction = '';
193}
194if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend'
195 && $massaction != 'presend_attendees'
196 && $massaction != 'confirm_presend'
197 && $massaction != 'confirm_presend_attendees') {
198 $massaction = '';
199}
200
201
202
203
204$parameters = array();
205$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
206if ($reshook < 0) {
207 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
208}
209
210if (empty($reshook)) {
211 // Selection of new fields
212 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
213
214 // Purge search criteria
215 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
216 foreach ($object->fields as $key => $val) {
217 $search[$key] = '';
218 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
219 $search[$key.'_dtstart'] = '';
220 $search[$key.'_dtend'] = '';
221 }
222 }
223 $toselect = array();
224 $search_array_options = array();
225 }
226 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
227 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
228 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
229 }
230
231 // Mass actions
232 $objectclass = 'ConferenceOrBooth';
233 $objectlabel = 'ConferenceOrBooth';
234 $uploaddir = $conf->eventorganization->dir_output;
235 include DOL_DOCUMENT_ROOT.'/eventorganization/core/actions_massactions_mail.inc.php';
236 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
237
238 if ($permissiontoadd && (($action == 'setstatus' && $confirm == "yes") || $massaction == 'setstatus')) {
239 $db->begin();
240 $error = 0;
241 $nbok = 0;
242 $objecttmp = new $objectclass($db);
243 foreach ($toselect as $key => $idselect) {
244 $result = $objecttmp->fetch($idselect);
245 if ($result > 0) {
246 $objecttmp->status = GETPOSTINT("statusmassaction");
247 $result = $objecttmp->update($user);
248 if ($result <= 0) {
249 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
250 $error++;
251 break;
252 } else {
253 $nbok++;
254 }
255 } else {
256 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
257 $error++;
258 break;
259 }
260 }
261 if (empty($error)) {
262 if ($nbok > 1) {
263 setEventMessages($langs->trans("RecordsUpdated", $nbok), null, 'mesgs');
264 } elseif ($nbok > 0) {
265 setEventMessages($langs->trans("RecordUpdated", $nbok), null, 'mesgs');
266 } else {
267 setEventMessages($langs->trans("NoRecordUpdated"), null, 'mesgs');
268 }
269 $db->commit();
270 } else {
271 $db->rollback();
272 }
273 }
274}
275
276
277
278/*
279 * View
280 */
281
282$form = new Form($db);
283$now = dol_now();
284
285$title = $langs->trans("EventOrganizationConfOrBoothes");
286$help_url = "EN:Module_Event_Organization";
287
288$morejs = array();
289$morecss = array();
290
291if ($projectid > 0 || $projectref) {
292 $result = $project->fetch($projectid, $projectref);
293 if ($result < 0) {
294 setEventMessages(null, $project->errors, 'errors');
295 } else {
296 $projectid = $project->id;
297 }
298 $result = $project->fetch_thirdparty();
299 if ($result < 0) {
300 setEventMessages(null, $project->errors, 'errors');
301 }
302 $result = $project->fetch_optionals();
303 if ($result < 0) {
304 setEventMessages(null, $project->errors, 'errors');
305 }
306
307 $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
308 $title = $langs->trans("Project") . ' - ' . $langs->trans("EventOrganizationConfOrBoothes") . ' - ' . $project->ref . ' ' . $project->name;
309 if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $project->name) {
310 $title = $project->ref . ' ' . $project->name . ' - ' . $langs->trans("ListOfConferencesOrBooths");
311 }
312}
313
314// Output page
315// --------------------------------------------------------------------
316
317llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-list bodyforlist');
318
319
320if ($projectid > 0) {
321 // To verify role of users
322 //$userAccess = $object->restrictedProjectArea($user,'read');
323 $userWrite = $project->restrictedProjectArea($user, 'write');
324 //$userDelete = $object->restrictedProjectArea($user,'delete');
325 //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
326
327 $head = project_prepare_head($project);
328 print dol_get_fiche_head($head, 'eventorganisation', $langs->trans("ConferenceOrBoothTab"), -1, ($project->public ? 'projectpub' : 'project'));
329
330 // Project card
331 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
332
333 $morehtmlref = '<div class="refidno">';
334 // Title
335 $morehtmlref .= $project->title;
336 // Thirdparty
337 if (isset($project->thirdparty->id) && $project->thirdparty->id > 0) {
338 $morehtmlref .= '<br>'.$project->thirdparty->getNomUrl(1, 'project');
339 }
340 $morehtmlref .= '</div>';
341
342 // Define a complementary filter for search of next/prev ref.
343 if (!$user->hasRight('project', 'all', 'lire')) {
344 $objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0);
345 $project->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
346 }
347
348 dol_banner_tab($project, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
349
350 print '<div class="fichecenter">';
351 print '<div class="fichehalfleft">';
352 print '<div class="underbanner clearboth"></div>';
353
354 print '<table class="border tableforfield centpercent">';
355
356 // Usage
357 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) {
358 print '<tr><td class="tdtop">';
359 print $langs->trans("Usage");
360 print '</td>';
361 print '<td>';
362 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
363 print '<input type="checkbox" disabled name="usage_opportunity"'.($project->usage_opportunity ? ' checked="checked"' : '').'"> ';
364 $htmltext = $langs->trans("ProjectFollowOpportunity");
365 print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
366 print '<br>';
367 }
368 if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
369 print '<input type="checkbox" disabled name="usage_task"'.($project->usage_task ? ' checked="checked"' : '').'"> ';
370 $htmltext = $langs->trans("ProjectFollowTasks");
371 print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
372 print '<br>';
373 }
374 if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
375 print '<input type="checkbox" disabled name="usage_bill_time"'.($project->usage_bill_time ? ' checked="checked"' : '').'"> ';
376 $htmltext = $langs->trans("ProjectBillTimeDescription");
377 print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
378 print '<br>';
379 }
380 if (isModEnabled('eventorganization')) {
381 print '<input type="checkbox" disabled name="usage_organize_event"'.($project->usage_organize_event ? ' checked="checked"' : '').'"> ';
382 $htmltext = $langs->trans("EventOrganizationDescriptionLong");
383 print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
384 }
385 print '</td></tr>';
386 }
387
388 // Budget
389 print '<tr><td>'.$langs->trans("Budget").'</td><td>';
390 if (strcmp($project->budget_amount, '')) {
391 print '<span class="amount">'.price($project->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
392 }
393 print '</td></tr>';
394
395 // Date start - end project
396 print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Project").')</td><td>';
397 $start = dol_print_date($project->date_start, 'day');
398 print($start ? $start : '?');
399 $end = dol_print_date($project->date_end, 'day');
400 print ' - ';
401 print($end ? $end : '?');
402 if ($object->hasDelay()) {
403 print img_warning("Late");
404 }
405 print '</td></tr>';
406
407 // Date start - end of event
408 print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Event").')</td><td>';
409 $start = dol_print_date($project->date_start_event, 'day', 'tzuserrel');
410 print($start ? '<span title="'.dol_print_date($project->date_start_event, 'dayhour', 'tzuserrel').'">'.$start.'</span>' : '?');
411 $end = dol_print_date($project->date_end_event, 'day', 'tzuserrel');
412 print ' - ';
413 print($end ? '<span title="'.dol_print_date($project->date_end_event, 'dayhour', 'tzuserrel').'">'.$end.'</span>' : '?');
414 if ($object->hasDelay()) {
415 print img_warning("Late");
416 }
417 print '</td></tr>';
418
419 // Location event
420 print '<tr><td>'.$langs->trans("Location").'</td><td>';
421 print $project->location;
422 print '</td></tr>';
423
424 // Visibility
425 print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
426 if ($project->public == 0) {
427 print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
428 print $langs->trans("PrivateProject");
429 } else {
430 print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
431 print $langs->trans("SharedProject");
432 }
433 print '</td></tr>';
434
435 // Other attributes
436 $cols = 2;
437 $objectconf = $object;
438 $object = $project;
439 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
440 $object = $objectconf;
441
442 print '</table>';
443
444 print '</div>';
445 print '<div class="fichehalfright">';
446 print '<div class="underbanner clearboth"></div>';
447
448 print '<table class="border tableforfield centpercent">';
449
450 // Categories
451 if (isModEnabled('category')) {
452 print '<tr><td class="titlefield valignmiddle">'.$langs->trans("Categories").'</td><td class="valuefield">';
453 print $form->showCategories($project->id, Categorie::TYPE_PROJECT, 1);
454 print "</td></tr>";
455 }
456
457 // Description
458 print '<tr><td class="titlefield'.($project->description ? ' noborderbottom' : '').'" colspan="2">'.$langs->trans("Description").'</td></tr>';
459 if ($project->description) {
460 print '<tr><td class="nottitleforfield" colspan="2">';
461 print '<div class="longmessagecut">';
462 print dolPrintHTML($project->description);
463 print '</div>';
464 print '</td></tr>';
465 }
466
467 print '<tr><td class="titlefield">';
468 $typeofdata = 'checkbox:'.($project->accept_conference_suggestions ? ' checked="checked"' : '');
469 $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
470 print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext);
471 print '</td><td class="valuefield">';
472 print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, 0, '', 0, '', 'projectid');
473 print "</td></tr>";
474
475 print '<tr><td class="titlefield">';
476 $typeofdata = 'checkbox:'.($project->accept_booth_suggestions ? ' checked="checked"' : '');
477 $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
478 print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext);
479 print '</td><td class="valuefield">';
480 print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, 0, '', 0, '', 'projectid');
481 print "</td></tr>";
482
483 print '<tr><td class="titlefield">';
484 print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
485 print '</td><td class="valuefield">';
486 print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', null, 0, '', 0, '', 'projectid');
487 print "</td></tr>";
488
489 print '<tr><td class="titlefield">';
490 print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
491 print '</td><td class="valuefield">';
492 print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', null, 0, '', 0, '', 'projectid');
493 print "</td></tr>";
494
495 print '<tr><td class="titlefield">';
496 print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $project, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid');
497 print '</td><td class="valuefield">';
498 print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', null, 0, '', 0, '', 'projectid');
499 print "</td></tr>";
500
501 // Link to ICS for the event
502 print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLinkProject").'</td><td class="valuefield">';
503 // Define $urlwithroot
504 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
505 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
506
507 // Show message
508 $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
509 $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
510 $message .= "&project=".$projectid.'&module='.urlencode('project@eventorganization').'&file='.urlencode('calendar-'.$project->ref.'.ics').'&output=file">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
511 print $message;
512 print "</td></tr>";
513
514 // Link for ICS for conference or booth
515 print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLink");
516 // TODO Add nb of events
517 $nbofconfbooth = 0;
518 if ($nbofconfbooth > 0) {
519 print '<span class="opacitymedium">('.$nbofconfbooth.')</span>';
520 }
521 print '</td><td class="valuefield">';
522 // Define $urlwithroot
523 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
524 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
525
526 // Show message
527 $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
528 $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
529 $message .= "&project=".$projectid.'&module='.urlencode('conforbooth@eventorganization').'&file='.urlencode('calendar-'.$project->ref.'-conforbooth.ics').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'&output=file">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
530 print $message;
531 print "</td></tr>";
532
533 // Link to the submit vote/register page
534 print '<tr><td class="titlefield">';
535 //print '<span class="opacitymedium">';
536 print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
537 //print '</span>';
538 print '</td><td class="valuefield">';
539 $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $project->id);
540 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
541 $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
542 //print '<div class="urllink">';
543 //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
544 print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
545 print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
546 //print '</div>';
547 //print ajax_autoselect("linkregister");
548 print '</td></tr>';
549
550 // Link to the subscribe
551 print '<tr><td class="titlefield">';
552 //print '<span class="opacitymedium">';
553 print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
554 //print '</span>';
555 print '</td><td class="valuefield">';
556 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $project->id).'&type=global';
557 $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
558 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
559 //print '<div class="urllink">';
560 //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
561 print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
562 print '<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
563 //print '</div>';
564 //print ajax_autoselect("linkregister");
565 print '</td></tr>';
566
567 print '</table>';
568
569 print '</div>';
570 print '</div>';
571
572 print '<div class="clearboth"></div>';
573
574 print dol_get_fiche_end();
575}
576
577if (!empty($project->id)) {
578 $head = conferenceorboothProjectPrepareHead($project);
579 $tab = 'conferenceorbooth';
580
581 print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
582}
583
584// Build and execute select
585// --------------------------------------------------------------------
586$sql = 'SELECT ';
587$sql .= $object->getFieldList('t');
588
589// Add fields from extrafields
590if (!empty($extrafields->attributes[$object->table_element]['label'])) {
591 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
592 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
593 }
594}
595// Add fields from hooks
596$parameters = array();
597$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
598$sql .= $hookmanager->resPrint;
599$sql = preg_replace('/,\s*$/', '', $sql);
600//$sql .= ", COUNT(rc.rowid) as anotherfield";
601
602$sqlfields = $sql; // $sql fields to remove for count total
603
604$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
605if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
606 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.id = ef.fk_object)";
607}
608$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
609// Add table from hooks
610$parameters = array();
611$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
612$sql .= $hookmanager->resPrint;
613if ($object->ismultientitymanaged == 1) {
614 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
615} else {
616 $sql .= " WHERE 1 = 1";
617}
618if ($projectid > 0) {
619 $sql .= " AND t.fk_project = ".((int) $project->id);
620}
621foreach ($search as $key => $val) {
622 if (array_key_exists($key, $object->fields)) {
623 if ($key == 'status' && $search[$key] == -1) {
624 continue;
625 }
626 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
627 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
628 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
629 $search[$key] = '';
630 }
631 $mode_search = 2;
632 }
633 if ($search[$key] != '') {
634 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
635 }
636 } else {
637 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
638 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
639 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
640 if (preg_match('/_dtstart$/', $key)) {
641 $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
642 }
643 if (preg_match('/_dtend$/', $key)) {
644 $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
645 }
646 }
647 }
648 }
649}
650if ($search_all) {
651 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
652}
653//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
654// Add where from extra fields
655include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
656// Add where from hooks
657$parameters = array();
658$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
659$sql .= $hookmanager->resPrint;
660
661// Count total nb of records
662$nbtotalofrecords = '';
663if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
664 /* The fast and low memory method to get and count full list converts the sql into a sql count */
665 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
666 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
667 $resql = $db->query($sqlforcount);
668 if ($resql) {
669 $objforcount = $db->fetch_object($resql);
670 $nbtotalofrecords = $objforcount->nbtotalofrecords;
671 } else {
672 dol_print_error($db);
673 }
674
675 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
676 $page = 0;
677 $offset = 0;
678 }
679 $db->free($resql);
680}
681
682// Complete request and execute it with limit
683$sql .= $db->order($sortfield, $sortorder);
684if ($limit) {
685 $sql .= $db->plimit($limit + 1, $offset);
686}
687
688$resql = $db->query($sql);
689if (!$resql) {
690 dol_print_error($db);
691 exit;
692}
693
694$num = $db->num_rows($resql);
695
696// Direct jump if only one record found
697if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
698 $obj = $db->fetch_object($resql);
699 $id = $obj->rowid;
700 header("Location: ".DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.((int) $id));
701 exit;
702}
703
704$arrayofselected = is_array($toselect) ? $toselect : array();
705
706$param = '';
707if (!empty($mode)) {
708 $param .= '&mode='.urlencode($mode);
709}
710if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
711 $param .= '&contextpage='.urlencode($contextpage);
712}
713if ($limit > 0 && $limit != $conf->liste_limit) {
714 $param .= '&limit='.((int) $limit);
715}
716if ($optioncss != '') {
717 $param .= '&optioncss='.urlencode($optioncss);
718}
719if ($project->id > 0) {
720 $param .= '&projectid='.((int) $project->id);
721}
722foreach ($search as $key => $val) {
723 if (is_array($search[$key])) {
724 foreach ($search[$key] as $skey) {
725 if ($skey != '') {
726 $param .= '&search_'.$key.'[]='.urlencode($skey);
727 }
728 }
729 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
730 $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month'));
731 $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day'));
732 $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year'));
733 } elseif ($search[$key] != '') {
734 $param .= '&search_'.$key.'='.urlencode($search[$key]);
735 }
736}
737// Add $param from extra fields
738include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
739// Add $param from hooks
740$parameters = array('param' => &$param);
741$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
742$param .= $hookmanager->resPrint;
743
744// List of mass actions available
745$arrayofmassactions = array(
746 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
747 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
748 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
749 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' ('.$langs->trans("ToSpeakers").')',
750 //'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"),
751);
752if (!empty($permissiontodelete)) {
753 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
754}
755if (!empty($permissiontoadd)) {
756 $arrayofmassactions['presetstatus'] = img_picto('', 'edit', 'class="pictofixedwidth"').$langs->trans("ModifyStatus");
757}
758if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
759 $arrayofmassactions = array();
760}
761$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
762
763print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($projectid) ? '?projectid='.$projectid : '').'">'."\n";
764if ($optioncss != '') {
765 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
766}
767print '<input type="hidden" name="token" value="'.newToken().'">';
768print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
769print '<input type="hidden" name="action" value="list">';
770print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
771print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
772print '<input type="hidden" name="page" value="'.$page.'">';
773print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
774print '<input type="hidden" name="page_y" value="">';
775print '<input type="hidden" name="mode" value="'.$mode.'">';
776
777
778$newcardbutton = '';
779$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
780$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
781$newcardbutton .= dolGetButtonTitleSeparator();
782$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?action=create'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id) ? '?projectid='.$project->id : ''), '', $permissiontoadd);
783
784print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
785
786
787// Add code for pre mass action (confirmation or email presend form)
788$topicmail = '';
789$modelmail = "conferenceorbooth";
790$objecttmp = new ConferenceOrBooth($db);
791$trackid = 'conferenceorbooth_'.$object->id;
792$withmaindocfilemail = 0;
793include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
794
795if ($massaction == 'presetstatus') {
796 $formquestion = array();
797 $statuslist = array();
798 $statuslist[$objecttmp::STATUS_DRAFT] = $objecttmp->LibStatutEvent($objecttmp::STATUS_DRAFT);
799 $statuslist[$objecttmp::STATUS_SUGGESTED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_SUGGESTED);
800 $statuslist[$objecttmp::STATUS_CONFIRMED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_CONFIRMED);
801 $statuslist[$objecttmp::STATUS_NOT_QUALIFIED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_NOT_QUALIFIED);
802 $statuslist[$objecttmp::STATUS_DONE] = $objecttmp->LibStatutEvent($objecttmp::STATUS_DONE);
803 $statuslist[$objecttmp::STATUS_CANCELED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_CANCELED);
804 $formquestion[] = array('type' => 'other',
805 'name' => 'affectedcommercial',
806 'label' => $form->editfieldkey('ModifyStatus', 'status_id', '', $object, 0),
807 'value' => $form->selectarray('statusmassaction', $statuslist, GETPOST('statusmassaction')));
808 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmModifyStatus"), $langs->trans("ConfirmModifyStatusQuestion", count($toselect)), "setstatus", $formquestion, 1, 0, 200, 500, 1);
809}
810
811if ($search_all) {
812 $setupstring = '';
813 foreach ($fieldstosearchall as $key => $val) {
814 $fieldstosearchall[$key] = $langs->trans($val);
815 $setupstring .= $key."=".$val.";";
816 }
817 print '<!-- Search done like if EVENTORGANIZATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
818 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
819}
820
821$moreforfilter = '';
822/*$moreforfilter.='<div class="divsearchfield">';
823$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
824$moreforfilter.= '</div>';*/
825
826$parameters = array();
827$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
828if (empty($reshook)) {
829 $moreforfilter .= $hookmanager->resPrint;
830} else {
831 $moreforfilter = $hookmanager->resPrint;
832}
833
834if (!empty($moreforfilter)) {
835 print '<div class="liste_titre liste_titre_bydiv centpercent">';
836 print $moreforfilter;
837 print '</div>';
838}
839
840$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
841$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
842$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
843$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
844
845
846print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
847print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
848
849
850// Fields title search
851// --------------------------------------------------------------------
852print '<tr class="liste_titre_filter">';
853// Action column
854if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
855 print '<td class="liste_titre center maxwidthsearch">';
856 $searchpicto = $form->showFilterButtons('left');
857 print $searchpicto;
858 print '</td>';
859}
860foreach ($object->fields as $key => $val) {
861 $searchkey = empty($search[$key]) ? '' : $search[$key];
862 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
863 if ($key == 'status') {
864 $cssforfield .= ($cssforfield ? ' ' : '').'center';
865 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
866 $cssforfield .= ($cssforfield ? ' ' : '').'center';
867 } elseif (in_array($val['type'], array('timestamp'))) {
868 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
869 } 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'])) {
870 $cssforfield .= ($cssforfield ? ' ' : '').'right';
871 }
872 if (!empty($arrayfields['t.'.$key]['checked'])) {
873 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
874 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
875 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);
876 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
877 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
878 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
879 print '<div class="nowrap">';
880 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
881 print '</div>';
882 print '<div class="nowrap">';
883 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
884 print '</div>';
885 } elseif ($key == 'lang') {
886 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
887 $formadmin = new FormAdmin($db);
888 print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
889 } else {
890 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
891 }
892 print '</td>';
893 }
894}
895// Extra fields
896include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
897
898// Fields from hook
899$parameters = array('arrayfields' => $arrayfields);
900$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
901print $hookmanager->resPrint;
902// Action column
903if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
904 print '<td class="liste_titre center maxwidthsearch">';
905 $searchpicto = $form->showFilterButtons();
906 print $searchpicto;
907 print '</td>';
908}
909print '</tr>'."\n";
910
911$totalarray = array();
912$totalarray['nbfield'] = 0;
913
914// Fields title label
915// --------------------------------------------------------------------
916print '<tr class="liste_titre">';
917// Action column
918if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
919 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
920 $totalarray['nbfield']++;
921}
922foreach ($object->fields as $key => $val) {
923 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
924 if ($key == 'status') {
925 $cssforfield .= ($cssforfield ? ' ' : '').'center';
926 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
927 $cssforfield .= ($cssforfield ? ' ' : '').'center';
928 } elseif (in_array($val['type'], array('timestamp'))) {
929 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
930 } 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'])) {
931 $cssforfield .= ($cssforfield ? ' ' : '').'right';
932 }
933 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
934 if (!empty($arrayfields['t.'.$key]['checked'])) {
935 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";
936 $totalarray['nbfield']++;
937 }
938}
939// Extra fields
940include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
941// Hook fields
942$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
943$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
944print $hookmanager->resPrint;
945// Action column
946if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
947 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
948 $totalarray['nbfield']++;
949}
950print '</tr>'."\n";
951
952
953// Detect if we need a fetch on each output line
954$needToFetchEachLine = 0;
955if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
956 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
957 if (!is_null($val) && preg_match('/\$object/', $val)) {
958 $needToFetchEachLine++; // There is at least one compute field that use $object
959 }
960 }
961}
962
963
964// Loop on record
965// --------------------------------------------------------------------
966$i = 0;
967$savnbfield = $totalarray['nbfield'];
968$totalarray = array();
969$totalarray['nbfield'] = 0;
970$imaxinloop = ($limit ? min($num, $limit) : $num);
971while ($i < $imaxinloop) {
972 $obj = $db->fetch_object($resql);
973 if (empty($obj)) {
974 break; // Should not happen
975 }
976
977 // Store properties in $object
978 $object->setVarsFromFetchObj($obj);
979
980 if ($mode == 'kanban') {
981 if ($i == 0) {
982 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
983 print '<div class="box-flex-container kanban">';
984 }
985 // Output Kanban
986 $selected = -1;
987 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
988 $selected = 0;
989 if (in_array($object->id, $arrayofselected)) {
990 $selected = 1;
991 }
992 }
993 $thirdparty = $object->fetch_thirdparty();
994 print $object->getKanbanView('', array('selected' => $selected, 'thirdparty' => $thirdparty));
995 if ($i == ($imaxinloop - 1)) {
996 print '</div>';
997 print '</td></tr>';
998 }
999 } else {
1000 // Show line of result
1001 $j = 0;
1002 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
1003 // Action column
1004 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1005 print '<td class="nowrap center">';
1006 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1007 $selected = 0;
1008 if (in_array($object->id, $arrayofselected)) {
1009 $selected = 1;
1010 }
1011 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1012 }
1013 print '</td>';
1014 if (!$i) {
1015 $totalarray['nbfield']++;
1016 }
1017 }
1018 foreach ($object->fields as $key => $val) {
1019 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1020 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1021 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1022 } elseif ($key == 'status') {
1023 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1024 }
1025
1026 if (in_array($val['type'], array('timestamp'))) {
1027 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
1028 } elseif ($key == 'ref') {
1029 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
1030 }
1031
1032 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'])) {
1033 $cssforfield .= ($cssforfield ? ' ' : '').'right';
1034 }
1035 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
1036
1037 if (!empty($arrayfields['t.'.$key]['checked'])) {
1038 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
1039 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
1040 print ' title="'.dol_escape_htmltag($object->$key).'"';
1041 }
1042 print '>';
1043 if ($key == 'status') {
1044 print $object->getLibStatut(5);
1045 } elseif ($key == 'ref') {
1046 print $object->getNomUrl(1, 0, '', (($projectid > 0) ? 'withproject' : ''));
1047 } else {
1048 print $object->showOutputField($val, $key, $object->$key, '');
1049 }
1050 print '</td>';
1051 if (!$i) {
1052 $totalarray['nbfield']++;
1053 }
1054 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
1055 if (!$i) {
1056 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
1057 }
1058 if (!isset($totalarray['val'])) {
1059 $totalarray['val'] = array();
1060 }
1061 if (!isset($totalarray['val']['t.'.$key])) {
1062 $totalarray['val']['t.'.$key] = 0;
1063 }
1064 $totalarray['val']['t.'.$key] += $object->$key;
1065 }
1066 }
1067 }
1068 // Extra fields
1069 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1070 // Fields from hook
1071 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1072 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1073 print $hookmanager->resPrint;
1074 // Action column
1075 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1076 print '<td class="nowrap center">';
1077 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1078 $selected = 0;
1079 if (in_array($object->id, $arrayofselected)) {
1080 $selected = 1;
1081 }
1082 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1083 }
1084 print '</td>';
1085 if (!$i) {
1086 $totalarray['nbfield']++;
1087 }
1088 }
1089
1090 print '</tr>'."\n";
1091 }
1092
1093 $i++;
1094}
1095
1096// Show total line
1097include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1098
1099// If no record found
1100if ($num == 0) {
1101 $colspan = 1;
1102 foreach ($arrayfields as $key => $val) {
1103 if (!empty($val['checked'])) {
1104 $colspan++;
1105 }
1106 }
1107 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1108}
1109
1110
1111$db->free($resql);
1112
1113$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1114$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1115print $hookmanager->resPrint;
1116
1117print '</table>'."\n";
1118print '</div>'."\n";
1119
1120print '</form>'."\n";
1121
1122if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1123 $hidegeneratedfilelistifempty = 1;
1124 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1125 $hidegeneratedfilelistifempty = 0;
1126 }
1127
1128 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1129 $formfile = new FormFile($db);
1130
1131 // Show list of available documents
1132 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1133 $urlsource .= str_replace('&amp;', '&', $param);
1134
1135 $filedir = $diroutputmassaction;
1136 $genallowed = $permissiontoread;
1137 $delallowed = $permissiontoadd;
1138
1139 print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1140}
1141
1142// End of page
1143llxFooter();
1144$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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:71
Class for ConferenceOrBooth.
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 projects.
conferenceorboothProjectPrepareHead($object)
Prepare array of tabs for ConferenceOrBooth Project tab.
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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_get_fiche_end($notab=0)
Return tab footer of a card.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.
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.