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