46require
'../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
52require_once __DIR__.
'/class/calendar.class.php';
58$langs->loadLangs(array(
"bookcal@bookcal",
"other"));
60$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
61$massaction =
GETPOST(
'massaction',
'alpha');
62$show_files =
GETPOST(
'show_files',
'int');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$cancel =
GETPOST(
'cancel',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
67$backtopage =
GETPOST(
'backtopage',
'alpha');
68$optioncss =
GETPOST(
'optioncss',
'aZ');
75$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
76$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
77$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
78$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
79if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
83$offset = $limit * $page;
90$diroutputmassaction = $conf->bookcal->dir_output.
'/temp/massgeneration/'.$user->id;
91$hookmanager->initHooks(array($contextpage));
94$extrafields->fetch_name_optionals_label($object->table_element);
97$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
101 reset($object->fields);
102 $sortfield =
"t.".key($object->fields);
109$search_all =
GETPOST(
'search_all',
'alphanohtml');
111foreach ($object->fields as $key => $val) {
112 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
113 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
115 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
116 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
117 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
137$arrayfields = array();
138foreach ($object->fields as $key => $val) {
140 if (!empty($val[
'visible'])) {
141 $visible = (int)
dol_eval($val[
'visible'], 1);
142 $arrayfields[
't.'.$key] = array(
143 'label'=>$val[
'label'],
144 'checked'=>(($visible < 0) ? 0 : 1),
145 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
146 'position'=>$val[
'position'],
147 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
152include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
160$enablepermissioncheck = 0;
161if ($enablepermissioncheck) {
162 $permissiontoread = $user->hasRight(
'bookcal',
'calendar',
'read');
163 $permissiontoadd = $user->hasRight(
'bookcal',
'calendar',
'write');
164 $permissiontodelete = $user->hasRight(
'bookcal',
'calendar',
'delete');
166 $permissiontoread = 1;
167 $permissiontoadd = 1;
168 $permissiontodelete = 1;
172if ($user->socid > 0) {
179if (!isModEnabled(
"bookcal")) {
182if (!$permissiontoread) {
191if (
GETPOST(
'cancel',
'alpha')) {
195if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
199$parameters = array();
200$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
205if (empty($reshook)) {
207 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
211 foreach ($object->fields as $key => $val) {
213 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
214 $search[$key.
'_dtstart'] =
'';
215 $search[$key.
'_dtend'] =
'';
219 $search_array_options = array();
221 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
222 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
227 $objectclass =
'Calendar';
228 $objectlabel =
'Calendar';
229 $uploaddir = $conf->bookcal->dir_output;
230 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
242$form =
new Form($db);
246$title = $langs->trans(
"Calendars");
256$sql .= $object->getFieldList(
't');
258if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
259 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
260 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
264$parameters = array();
265$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
266$sql .= $hookmanager->resPrint;
267$sql = preg_replace(
'/,\s*$/',
'', $sql);
272$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
274if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
275 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
278$parameters = array();
279$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
280$sql .= $hookmanager->resPrint;
281if ($object->ismultientitymanaged == 1) {
282 $sql .=
" WHERE t.entity IN (".getEntity($object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
284 $sql .=
" WHERE 1 = 1";
286foreach ($search as $key => $val) {
287 if (array_key_exists($key, $object->fields)) {
288 if ($key ==
'status' && $search[$key] == -1) {
291 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
292 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
293 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
298 if ($search[$key] !=
'') {
299 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
302 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
303 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
304 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
305 if (preg_match(
'/_dtstart$/', $key)) {
306 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
308 if (preg_match(
'/_dtend$/', $key)) {
309 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
316 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
320include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
322$parameters = array();
323$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
324$sql .= $hookmanager->resPrint;
352$nbtotalofrecords =
'';
355 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
356 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
357 $resql = $db->query($sqlforcount);
359 $objforcount = $db->fetch_object($resql);
360 $nbtotalofrecords = $objforcount->nbtotalofrecords;
365 if (($page * $limit) > $nbtotalofrecords) {
373$sql .= $db->order($sortfield, $sortorder);
375 $sql .= $db->plimit($limit + 1, $offset);
378$resql = $db->query($sql);
384$num = $db->num_rows($resql);
388if ($num == 1 && !
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
389 $obj = $db->fetch_object($resql);
391 header(
"Location: ".
dol_buildpath(
'/bookcal/calendar_card.php', 1).
'?id='.$id);
399llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
416$arrayofselected = is_array($toselect) ? $toselect : array();
420 $param .=
'&mode='.urlencode($mode);
422if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
423 $param .=
'&contextpage='.urlencode($contextpage);
425if ($limit > 0 && $limit != $conf->liste_limit) {
426 $param .=
'&limit='.((int) $limit);
428if ($optioncss !=
'') {
429 $param .=
'&optioncss='.urlencode($optioncss);
431foreach ($search as $key => $val) {
432 if (is_array($search[$key])) {
433 foreach ($search[$key] as $skey) {
435 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
438 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
439 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
440 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
441 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
442 } elseif ($search[$key] !=
'') {
443 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
447include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
449$parameters = array(
'param' => &$param);
450$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
451$param .= $hookmanager->resPrint;
454$arrayofmassactions = array(
460if (!empty($permissiontodelete)) {
461 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
463if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
464 $arrayofmassactions = array();
466$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
468print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
469if ($optioncss !=
'') {
470 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
472print
'<input type="hidden" name="token" value="'.newToken().
'">';
473print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
474print
'<input type="hidden" name="action" value="list">';
475print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
476print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
477print
'<input type="hidden" name="page" value="'.$page.
'">';
478print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
479print
'<input type="hidden" name="page_y" value="">';
480print
'<input type="hidden" name="mode" value="'.$mode.
'">';
484$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
485$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
487$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/bookcal/calendar_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
489print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
492$topicmail =
"SendCalendarRef";
493$modelmail =
"calendar";
495$trackid =
'xxxx'.$object->id;
496include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
500 foreach ($fieldstosearchall as $key => $val) {
501 $fieldstosearchall[$key] = $langs->trans($val);
502 $setupstring .= $key.
"=".$val.
";";
504 print
'<!-- Search done like if CALENDAR_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
505 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
513$parameters = array();
514$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
515if (empty($reshook)) {
516 $moreforfilter .= $hookmanager->resPrint;
518 $moreforfilter = $hookmanager->resPrint;
521if (!empty($moreforfilter)) {
522 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
523 print $moreforfilter;
524 $parameters = array();
525 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
526 print $hookmanager->resPrint;
530$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
531$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
532$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
534print
'<div class="div-table-responsive">';
535print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
539print
'<tr class="liste_titre_filter">';
542 print
'<td class="liste_titre center maxwidthsearch">';
543 $searchpicto = $form->showFilterButtons(
'left');
547foreach ($object->fields as $key => $val) {
548 $searchkey = empty($search[$key]) ?
'' : $search[$key];
549 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
550 if ($key ==
'status') {
551 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
552 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
553 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
554 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
555 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
556 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
557 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
559 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
560 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
561 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
562 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);
563 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
564 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
565 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
566 print
'<div class="nowrap">';
567 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
569 print
'<div class="nowrap">';
570 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
572 } elseif ($key ==
'lang') {
573 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
575 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
577 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
583include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
586$parameters = array(
'arrayfields'=>$arrayfields);
587$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
588print $hookmanager->resPrint;
594 print
'<td class="liste_titre center maxwidthsearch">';
595 $searchpicto = $form->showFilterButtons();
601$totalarray = array();
602$totalarray[
'nbfield'] = 0;
606print
'<tr class="liste_titre">';
609 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
610 $totalarray[
'nbfield']++;
612foreach ($object->fields as $key => $val) {
613 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
614 if ($key ==
'status') {
615 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
616 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
617 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
618 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
619 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
620 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
621 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
623 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
624 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
625 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";
626 $totalarray[
'nbfield']++;
630include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
632$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
633$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
634print $hookmanager->resPrint;
641 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
642 $totalarray[
'nbfield']++;
647$needToFetchEachLine = 0;
648if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
649 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
650 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
651 $needToFetchEachLine++;
660$savnbfield = $totalarray[
'nbfield'];
661$totalarray = array();
662$totalarray[
'nbfield'] = 0;
663$imaxinloop = ($limit ? min($num, $limit) : $num);
664while ($i < $imaxinloop) {
665 $obj = $db->fetch_object($resql);
671 $object->setVarsFromFetchObj($obj);
673 if ($mode ==
'kanban') {
675 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
676 print
'<div class="box-flex-container kanban">';
680 if ($massactionbutton || $massaction) {
682 if (in_array($object->id, $arrayofselected)) {
686 print $object->getKanbanView(
'', array(
'selected' => $selected));
687 if ($i == ($imaxinloop - 1)) {
694 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
698 print
'<td class="nowrap center">';
699 if ($massactionbutton || $massaction) {
701 if (in_array($object->id, $arrayofselected)) {
704 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
708 $totalarray[
'nbfield']++;
711 foreach ($object->fields as $key => $val) {
712 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
713 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
714 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
715 } elseif ($key ==
'status') {
716 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
719 if (in_array($val[
'type'], array(
'timestamp'))) {
720 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
721 } elseif ($key ==
'ref') {
722 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
725 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
726 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
730 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
731 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
732 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
733 print
' title="'.dol_escape_htmltag($object->$key).
'"';
736 if ($key ==
'status') {
737 print $object->getLibStatut(5);
738 } elseif ($key ==
'rowid') {
739 print $object->showOutputField($val, $key, $object->id,
'');
741 print $object->showOutputField($val, $key, $object->$key,
'');
745 $totalarray[
'nbfield']++;
747 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
749 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
751 if (!isset($totalarray[
'val'])) {
752 $totalarray[
'val'] = array();
754 if (!isset($totalarray[
'val'][
't.'.$key])) {
755 $totalarray[
'val'][
't.'.$key] = 0;
757 $totalarray[
'val'][
't.'.$key] += $object->$key;
762 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
764 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
765 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
766 print $hookmanager->resPrint;
772 print
'<td class="nowrap center">';
773 if ($massactionbutton || $massaction) {
775 if (in_array($object->id, $arrayofselected)) {
778 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
782 $totalarray[
'nbfield']++;
793include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
798 foreach ($arrayfields as $key => $val) {
799 if (!empty($val[
'checked'])) {
803 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
809$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
810$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
811print $hookmanager->resPrint;
813print
'</table>'.
"\n";
818if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
819 $hidegeneratedfilelistifempty = 1;
820 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
821 $hidegeneratedfilelistifempty = 0;
824 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
828 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
829 $urlsource .= str_replace(
'&',
'&', $param);
831 $filedir = $diroutputmassaction;
832 $genallowed = $permissiontoread;
833 $delallowed = $permissiontoadd;
835 print $formfile->showdocuments(
'massfilesarea_'.$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
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...
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.
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.
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_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.