25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
36 global $dolibarr_main_url_root;
42 $langs->loadLangs(array(
"eventorganization",
"other",
"projects",
"companies"));
44 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
45 $massaction =
GETPOST(
'massaction',
'alpha');
46 $show_files =
GETPOST(
'show_files',
'int');
47 $confirm =
GETPOST(
'confirm',
'alpha');
48 $cancel =
GETPOST(
'cancel',
'alpha');
49 $toselect =
GETPOST(
'toselect',
'array');
50 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'conferenceorboothlist';
51 $backtopage =
GETPOST(
'backtopage',
'alpha');
52 $optioncss =
GETPOST(
'optioncss',
'aZ');
55 $projectid =
GETPOST(
'projectid',
'int');
59 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
60 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
66 $offset = $limit * $page;
67 $pageprev = $page - 1;
68 $pagenext = $page + 1;
73 $diroutputmassaction = $conf->eventorganization->dir_output.
'/temp/massgeneration/'.$user->id;
74 $hookmanager->initHooks(array(
'conferenceorboothlist'));
77 $extrafields->fetch_name_optionals_label($object->table_element);
80 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
84 reset($object->fields);
85 $sortfield =
"t.".key($object->fields);
92 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
94 foreach ($object->fields as $key => $val) {
95 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
96 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
98 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
99 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
100 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
105 $fieldstosearchall = array();
106 foreach ($object->fields as $key => $val) {
107 if (!empty($val[
'searchall'])) {
108 $fieldstosearchall[
't.'.$key] = $val[
'label'];
113 $arrayfields = array();
114 foreach ($object->fields as $key => $val) {
116 if (!empty($val[
'visible'])) {
117 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
118 $arrayfields[
't.'.$key] = array(
119 'label'=>$val[
'label'],
120 'checked'=>(($visible < 0) ? 0 : 1),
121 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
122 'position'=>$val[
'position'],
123 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
128 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
133 $permissiontoread = $user->rights->eventorganization->read;
134 $permissiontoadd = $user->rights->eventorganization->write;
135 $permissiontodelete = $user->rights->eventorganization->delete;
138 if (empty($conf->eventorganization->enabled)) {
142 if ($user->socid > 0) {
154 if (preg_match(
'/^set/', $action) && ($projectid > 0 || $projectref) && !empty($user->rights->eventorganization->write)) {
157 $project_attr=preg_replace(
'/^set/',
'', $action);
158 if (array_key_exists($project_attr, $project->fields)) {
159 $result = $project->fetch($projectid, $projectref);
163 $project->{$project_attr}=
GETPOST($project_attr);
164 $result=$project->update($user);
175 if (
GETPOST(
'cancel',
'alpha')) {
179 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend'
180 && $massaction !=
'presend_attendees'
181 && $massaction !=
'confirm_presend'
182 && $massaction !=
'confirm_presend_attendees') {
189 $parameters = array();
190 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
195 if (empty($reshook)) {
197 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
200 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
201 foreach ($object->fields as $key => $val) {
203 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
204 $search[$key.
'_dtstart'] =
'';
205 $search[$key.
'_dtend'] =
'';
209 $search_array_options = array();
211 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
212 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
217 $objectclass =
'ConferenceOrBooth';
218 $objectlabel =
'ConferenceOrBooth';
219 $uploaddir = $conf->eventorganization->dir_output;
220 include DOL_DOCUMENT_ROOT.
'/eventorganization/core/actions_massactions_mail.inc.php';
221 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
232 $title = $langs->trans(
'ListOfConferencesOrBooths');
236 if ($projectid > 0 || $projectref) {
238 $result = $project->fetch($projectid, $projectref);
242 $projectid = $project->id;
244 $result = $project->fetch_thirdparty();
248 $result = $project->fetch_optionals();
253 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
254 $title = $langs->trans(
"Project") .
' - ' . $langs->trans(
"ListOfConferencesOrBooths") .
' - ' . $project->ref .
' ' . $project->name;
255 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $project->name) {
256 $title = $project->ref .
' ' . $project->name .
' - ' . $langs->trans(
"ListOfConferencesOrBooths");
266 if ($projectid > 0) {
269 $userWrite = $project->restrictedProjectArea($user,
'write');
274 print
dol_get_fiche_head($head,
'eventorganisation', $langs->trans(
"ConferenceOrBoothTab"), -1, ($project->public ?
'projectpub' :
'project'));
277 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
279 $morehtmlref =
'<div class="refidno">';
281 $morehtmlref .= $project->title;
283 if (isset($project->thirdparty->id) && $project->thirdparty->id > 0) {
284 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$project->thirdparty->getNomUrl(1,
'project');
286 $morehtmlref .=
'</div>';
289 if (empty($user->rights->project->all->lire)) {
290 $objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0);
291 $project->next_prev_filter =
" rowid IN (".$db->sanitize(count($objectsListId) ? join(
',', array_keys($objectsListId)) :
'0').
")";
294 dol_banner_tab($project,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
296 print
'<div class="fichecenter">';
297 print
'<div class="fichehalfleft">';
298 print
'<div class="underbanner clearboth"></div>';
300 print
'<table class="border tableforfield centpercent">';
303 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
304 print
'<tr><td class="tdtop">';
305 print $langs->trans(
"Usage");
308 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
309 print
'<input type="checkbox" disabled name="usage_opportunity"'.($project->usage_opportunity ?
' checked="checked"' :
'').
'"> ';
310 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
311 print
$form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
314 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
315 print
'<input type="checkbox" disabled name="usage_task"'.($project->usage_task ?
' checked="checked"' :
'').
'"> ';
316 $htmltext = $langs->trans(
"ProjectFollowTasks");
317 print
$form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
320 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
321 print
'<input type="checkbox" disabled name="usage_bill_time"'.($project->usage_bill_time ?
' checked="checked"' :
'').
'"> ';
322 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
323 print
$form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
326 if (!empty($conf->eventorganization->enabled)) {
327 print
'<input type="checkbox" disabled name="usage_organize_event"'.($project->usage_organize_event ?
' checked="checked"' :
'').
'"> ';
328 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
329 print
$form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
335 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
336 if ($project->public == 0) {
337 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
338 print $langs->trans(
"PrivateProject");
340 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
341 print $langs->trans(
"SharedProject");
346 print
'<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
348 print ($start ? $start :
'?');
351 print ($end ? $end :
'?');
352 if ($object->hasDelay()) {
358 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
359 if (strcmp($project->budget_amount,
'')) {
360 print
price($project->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
366 $objectconf = $object;
368 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
369 $object = $objectconf;
374 print
'<div class="fichehalfright">';
375 print
'<div class="underbanner clearboth"></div>';
377 print
'<table class="border tableforfield centpercent">';
380 print
'<tr><td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td class="valuefield">';
381 print nl2br($project->description);
386 print
'<tr><td class="titlefield valignmiddle">'.$langs->trans(
"Categories").
'</td><td class="valuefield">';
387 print
$form->showCategories($project->id, Categorie::TYPE_PROJECT, 1);
391 print
'<tr><td class="titlefield">';
392 $typeofdata =
'checkbox:'.($project->accept_conference_suggestions ?
' checked="checked"' :
'');
393 $htmltext = $langs->trans(
"AllowUnknownPeopleSuggestConfHelp");
394 print
$form->editfieldkey(
'AllowUnknownPeopleSuggestConf',
'accept_conference_suggestions',
'', $project, $permissiontoadd, $typeofdata,
'', 0, 0,
'projectid', $htmltext);
395 print
'</td><td class="valuefield">';
396 print
$form->editfieldval(
'AllowUnknownPeopleSuggestConf',
'accept_conference_suggestions',
'1', $project, $permissiontoadd, $typeofdata,
'', 0, 0,
'', 0,
'',
'projectid');
399 print
'<tr><td class="titlefield">';
400 $typeofdata =
'checkbox:'.($project->accept_booth_suggestions ?
' checked="checked"' :
'');
401 $htmltext = $langs->trans(
"AllowUnknownPeopleSuggestBoothHelp");
402 print
$form->editfieldkey(
'AllowUnknownPeopleSuggestBooth',
'accept_booth_suggestions',
'', $project, $permissiontoadd, $typeofdata,
'', 0, 0,
'projectid', $htmltext);
403 print
'</td><td class="valuefield">';
404 print
$form->editfieldval(
'AllowUnknownPeopleSuggestBooth',
'accept_booth_suggestions',
'1', $project, $permissiontoadd, $typeofdata,
'', 0, 0,
'', 0,
'',
'projectid');
407 print
'<tr><td class="titlefield">';
408 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
'PriceOfBooth'), $langs->trans(
"PriceOfBoothHelp")),
'price_booth',
'', $project, $permissiontoadd,
'amount',
'', 0, 0,
'projectid');
409 print
'</td><td class="valuefield">';
410 print
$form->editfieldval(
$form->textwithpicto($langs->trans(
'PriceOfBooth'), $langs->trans(
"PriceOfBoothHelp")),
'price_booth', $project->price_booth, $project, $permissiontoadd,
'amount',
'', 0, 0,
'', 0,
'',
'projectid');
413 print
'<tr><td class="titlefield">';
414 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
'PriceOfRegistration'), $langs->trans(
"PriceOfRegistrationHelp")),
'price_registration',
'', $project, $permissiontoadd,
'amount',
'', 0, 0,
'projectid');
415 print
'</td><td class="valuefield">';
416 print
$form->editfieldval(
$form->textwithpicto($langs->trans(
'PriceOfRegistration'), $langs->trans(
"PriceOfRegistrationHelp")),
'price_registration', $project->price_registration, $project, $permissiontoadd,
'amount',
'', 0, 0,
'', 0,
'',
'projectid');
419 print
'<tr><td class="titlefield">';
420 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
'MaxNbOfAttendees'),
''),
'max_attendees',
'', $project, $permissiontoadd,
'integer:3',
'', 0, 0,
'projectid');
421 print
'</td><td class="valuefield">';
422 print
$form->editfieldval(
$form->textwithpicto($langs->trans(
'MaxNbOfAttendees'),
''),
'max_attendees', $project->max_attendees, $project, $permissiontoadd,
'integer:3',
'', 0, 0,
'', 0,
'',
'projectid');
425 print
'<tr><td class="titlefield valignmiddle">'.$langs->trans(
"EventOrganizationICSLink").
'</td><td class="valuefield">';
427 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
428 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
431 $message =
'<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.
'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ?
"&entity=".$conf->entity :
"");
432 $message .=
'&exportkey='.urlencode(
getDolGlobalString(
'MAIN_AGENDA_XCAL_EXPORTKEY',
'...'));
433 $message .=
"&project=".$projectid.
'&module='.urlencode(
'@eventorganization').
'&status='.ConferenceOrBooth::STATUS_CONFIRMED.
'">'.$langs->trans(
'DownloadICSLink').img_picto(
'',
'download',
'class="paddingleft"').
'</a>';
438 print
'<tr><td class="titlefield">';
440 print
$form->textwithpicto($langs->trans(
"SuggestOrVoteForConfOrBooth"), $langs->trans(
"EvntOrgRegistrationHelpMessage"));
442 print
'</td><td class="valuefield">';
443 $linksuggest = $dolibarr_main_url_root.
'/public/project/index.php?id='.((int) $project->id);
444 $encodedsecurekey =
dol_hash(
getDolGlobalString(
'EVENTORGANIZATION_SECUREKEY').
'conferenceorbooth'.((
int) $project->id),
'md5');
445 $linksuggest .=
'&securekey='.urlencode($encodedsecurekey);
448 print
'<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.
'" class="quatrevingtpercent">'.$linksuggest.
'</a></div>';
449 print
'<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.
'">'.
img_picto(
'',
'globe').
'</a>';
455 print
'<tr><td class="titlefield">';
457 print $langs->trans(
"PublicAttendeeSubscriptionGlobalPage");
459 print
'</td><td class="valuefield">';
460 $link_subscription = $dolibarr_main_url_root.
'/public/eventorganization/attendee_new.php?id='.((int) $project->id).
'&type=global';
461 $encodedsecurekey =
dol_hash(
getDolGlobalString(
'EVENTORGANIZATION_SECUREKEY').
'conferenceorbooth'.((
int) $project->id),
'md5');
462 $link_subscription .=
'&securekey='.urlencode($encodedsecurekey);
465 print
'<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.
'" class="quatrevingtpercent">'.$link_subscription.
'</a></div>';
466 print
'<a target="_blank" rel="noopener noreferrer" rel="noopener noreferrer" href="'.$link_subscription.
'">'.
img_picto(
'',
'globe').
'</a>';
476 print
'<div class="clearboth"></div>';
481 if (!empty($project->id)) {
483 $tab =
'conferenceorbooth';
485 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($project->public ?
'projectpub' :
'project'), 0,
'',
'reposition');
491 $sql .= $object->getFieldList(
't');
494 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
495 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
496 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
500 $parameters = array();
501 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
502 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
503 $sql = preg_replace(
'/,\s*$/',
'', $sql);
504 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
505 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
506 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.id = ef.fk_object)";
508 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
510 $parameters = array();
511 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
512 $sql .= $hookmanager->resPrint;
513 if ($object->ismultientitymanaged == 1) {
514 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
516 $sql .=
" WHERE 1 = 1";
518 if ($projectid > 0) {
519 $sql .=
" AND t.fk_project = ".((int) $project->id);
521 foreach ($search as $key => $val) {
522 if (array_key_exists($key, $object->fields)) {
523 if ($key ==
'status' && $search[$key] == -1) {
526 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
527 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
528 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
533 if ($search[$key] !=
'') {
534 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
537 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
538 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
539 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
540 if (preg_match(
'/_dtstart$/', $key)) {
541 $sql .=
" AND t.".$columnName.
" >= '".$db->idate($search[$key]).
"'";
543 if (preg_match(
'/_dtend$/', $key)) {
544 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
552 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
556 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
558 $parameters = array();
559 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
560 $sql .= $hookmanager->resPrint;
562 $sql .= $db->order($sortfield, $sortorder);
565 $nbtotalofrecords =
'';
566 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
567 $resql = $db->query($sql);
568 $nbtotalofrecords = $db->num_rows(
$resql);
569 if (($page * $limit) > $nbtotalofrecords) {
575 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
576 $num = $nbtotalofrecords;
579 $sql .= $db->plimit($limit + 1, $offset);
582 $resql = $db->query($sql);
588 $num = $db->num_rows(
$resql);
592 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
593 $obj = $db->fetch_object(
$resql);
595 header(
"Location: ".DOL_URL_ROOT.
'/eventorganization/conferenceorbooth_card.php?id='.((
int) $id));
599 $arrayofselected = is_array($toselect) ? $toselect : array();
602 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
603 $param .=
'&contextpage='.urlencode($contextpage);
605 if ($limit > 0 && $limit != $conf->liste_limit) {
606 $param .=
'&limit='.urlencode($limit);
608 foreach ($search as $key => $val) {
609 if (is_array($search[$key]) && count($search[$key])) {
610 foreach ($search[$key] as $skey) {
611 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
614 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
617 if ($optioncss !=
'') {
618 $param .=
'&optioncss='.urlencode($optioncss);
621 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
623 $parameters = array();
624 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
625 $param .= $hookmanager->resPrint;
628 $arrayofmassactions = array(
632 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail").
' ('.$langs->trans(
"ToSpeakers").
')',
635 if ($permissiontodelete) {
636 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
638 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
639 $arrayofmassactions = array();
641 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
643 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].(!empty($projectid)?
'?projectid='.$projectid:
'').
'">'.
"\n";
644 if ($optioncss !=
'') {
645 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
647 print
'<input type="hidden" name="token" value="'.newToken().
'">';
648 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
649 print
'<input type="hidden" name="action" value="list">';
650 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
651 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
652 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
653 print
'<input type="hidden" name="page_y" value="">';
655 $title = $langs->trans(
"ListOfConferencesOrBooths");
657 $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);
659 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
663 $topicmail = $projectstatic->title;
664 $modelmail =
"conferenceorbooth";
666 $trackid =
'conferenceorbooth_'.$object->id;
667 $withmaindocfilemail = 0;
668 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
672 foreach ($fieldstosearchall as $key => $val) {
673 $fieldstosearchall[$key] = $langs->trans($val);
675 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
683 $parameters = array();
684 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
685 if (empty($reshook)) {
686 $moreforfilter .= $hookmanager->resPrint;
688 $moreforfilter = $hookmanager->resPrint;
691 if (!empty($moreforfilter)) {
692 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
693 print $moreforfilter;
697 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
698 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
699 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
702 print
'<div class="div-table-responsive">';
703 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
708 print
'<tr class="liste_titre">';
709 foreach ($object->fields as $key => $val) {
710 $searchkey = (empty($search[$key]) ?
'' : $search[$key]);
712 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
713 if ($key ==
'status') {
714 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
715 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
716 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
717 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
718 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
719 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
720 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
722 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
723 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
724 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
725 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], $searchkey, $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
726 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:')=== 0)) {
727 print $object->showInputField($val, $key, $searchkey,
'',
'',
'search_',
'maxwidth125', 1);
728 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
729 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag($searchkey).
'">';
730 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
731 print
'<div class="nowrap">';
732 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
734 print
'<div class="nowrap">';
735 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
742 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
745 $parameters = array(
'arrayfields'=>$arrayfields);
746 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
747 print $hookmanager->resPrint;
749 print
'<td class="liste_titre maxwidthsearch">';
750 $searchpicto =
$form->showFilterButtons();
758 print
'<tr class="liste_titre">';
759 foreach ($object->fields as $key => $val) {
760 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
761 if ($key ==
'status') {
762 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
763 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
764 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
765 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
766 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
767 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'ref')) && $val[
'label'] !=
'TechnicalID') {
768 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
770 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
771 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
775 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
777 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
778 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
779 print $hookmanager->resPrint;
781 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
786 $needToFetchEachLine = 0;
787 if (!empty($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
788 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
789 if (preg_match(
'/\$object/', $val)) {
790 $needToFetchEachLine++;
799 $totalarray = array();
800 while ($i < ($limit ? min($num, $limit) : $num)) {
801 $obj = $db->fetch_object(
$resql);
807 $object->setVarsFromFetchObj($obj);
810 print
'<tr class="oddeven">';
811 $totalarray[
'nbfield'] = 0;
812 foreach ($object->fields as $key => $val) {
813 $cssforfield = (empty($val[
'css']) ?
'' : $val[
'css']);
814 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
815 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
816 } elseif ($key ==
'status') {
817 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
820 if (in_array($val[
'type'], array(
'timestamp'))) {
821 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
822 } elseif ($key ==
'ref') {
823 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap left';
826 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'ref',
'status'))) {
827 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
831 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
832 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
833 if ($key ==
'status') {
834 print $object->getLibStatut(5);
835 } elseif ($key ==
'ref') {
836 print $object->getNomUrl(1, 0,
'', (($projectid > 0)?
'withproject':
''));
838 print $object->showOutputField($val, $key, $object->$key,
'');
842 $totalarray[
'nbfield']++;
844 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
846 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
848 if (!isset($totalarray[
'val'])) {
849 $totalarray[
'val'] = array();
851 if (!isset($totalarray[
'val'][
't.'.$key])) {
852 $totalarray[
'val'][
't.'.$key] = 0;
854 $totalarray[
'val'][
't.'.$key] += $object->$key;
859 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
861 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
862 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
863 print $hookmanager->resPrint;
865 print
'<td class="nowrap center">';
866 if ($massactionbutton || $massaction) {
868 if (in_array($object->id, $arrayofselected)) {
871 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
875 $totalarray[
'nbfield']++;
884 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
889 foreach ($arrayfields as $key => $val) {
890 if (!empty($val[
'checked'])) {
894 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
900 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
901 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
902 print $hookmanager->resPrint;
904 print
'</table>'.
"\n";
907 print
'</form>'.
"\n";
909 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
910 $hidegeneratedfilelistifempty = 1;
911 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
912 $hidegeneratedfilelistifempty = 0;
915 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
919 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
920 $urlsource .= str_replace(
'&',
'&', $param);
922 $filedir = $diroutputmassaction;
923 $genallowed = $permissiontoread;
924 $delallowed = $permissiontoadd;
926 print $formfile->showdocuments(
'massfilesarea_eventorganization',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);