30require_once DOL_DOCUMENT_ROOT .
'/core/class/html.form.class.php';
70 public function inputDate($name, $value =
'', $placeholder =
'',
$id =
'', $morecss =
'', $moreparam =
'')
95 $out = $this->
selectDate($value ===
'' ? -1 : $value, $name, 0, 0, 0,
"", 1, 0, 0,
'',
'',
'',
'', 1,
'', $placeholder,
'auto', DOL_URL_ROOT .
"/theme/common/object_calendarday.png");
122 public static function selectarray($htmlname, $array,
$id =
'', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam =
'', $translate = 0, $maxlen = 0, $disabled = 0, $sort =
'', $morecss =
'minwidth75', $addjscombo = 1, $moreparamonempty =
'', $disablebademail = 0, $nohtmlescape = 0)
127 $array = array_combine($array, $array);
132 $idname = str_replace(array(
'[',
']'), array(
'',
''), $htmlname);
133 $out .=
'<select id="' . preg_replace(
'/^\./',
'', $idname) .
'"' . ($disabled ?
' disabled="disabled"' :
'') .
' class="' . ($morecss ?
' ' . $morecss :
'') .
'"';
134 $out .=
' name="' . preg_replace(
'/^\./',
'', $htmlname) .
'"' . ($moreparam ?
' ' . $moreparam :
'');
139 if (!is_numeric($show_empty)) {
140 $textforempty = $show_empty;
142 $out .=
'<option value="' . ($show_empty < 0 ? $show_empty : -1) .
'"' . (
$id == $show_empty ?
' selected' :
'') .
'>' . $textforempty .
'</option>' .
"\n";
145 if (is_array($array)) {
148 foreach ($array as $key => $value) {
149 if (!is_array($value)) {
150 $array[$key] = $langs->trans($value);
152 $array[$key][
'label'] = $langs->trans($value[
'label']);
158 if ($sort ==
'ASC') {
160 } elseif ($sort ==
'DESC') {
164 foreach ($array as $key => $tmpvalue) {
165 if (is_array($tmpvalue)) {
166 $value = $tmpvalue[
'label'];
167 $disabled = empty($tmpvalue[
'disabled']) ?
'' :
' disabled';
177 if ($value ==
'' || $value ==
'-') {
178 $selectOptionValue =
' ';
182 $out .=
'<option value="' . $key .
'"';
184 $out .= is_array($tmpvalue) && !empty($tmpvalue[
'parent']) ?
' parent="' . dolPrintHTMLForAttribute($tmpvalue[
'parent']) .
'"' :
'';
186 if (in_array($key,
$id) && !$disabled) {
191 if (
$id !=
'' && (
$id == $key || (
$id ==
'ifone' && count($array) == 1)) && !$disabled) {
195 if (is_array($tmpvalue)) {
196 foreach ($tmpvalue as $keyforvalue => $valueforvalue) {
197 if (preg_match(
'/^data-/', $keyforvalue)) {
203 $out .= $selectOptionValue;
204 $out .=
"</option>\n";
226 public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter =
'', $morecss =
'', $allfiles = 0)
228 include_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
237 $this->infofiles = array(
'nboffiles' => 0,
'extensions' => array(),
'files' => array());
244 preg_match(
'/\/([0-9]+)\/[^\/]+\/' . preg_quote($modulesubdir,
'/') .
'$/', $filedir, $regs);
245 $entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1);
250 $filterforfilesearch =
'^' . preg_quote(basename($modulesubdir),
'/');
252 $filterforfilesearch =
'^' . preg_quote(basename($modulesubdir),
'/') .
'\.';
254 $file_list =
dol_dir_list($filedir,
'files', 0, $filterforfilesearch,
'\.meta$|\.png$');
258 $out .=
'<!-- html.formwebportal::getDocumentsLink -->' .
"\n";
259 if (!empty($file_list)) {
265 foreach ($file_list as $file) {
267 if ($filter && !preg_match(
'/' . $filter .
'/i', $file[
"name"])) {
273 $relativepath = $file[
"name"];
275 $relativepath = $modulesubdir .
"/" . $file[
"name"];
278 if ($modulepart ==
'donation') {
279 $relativepath =
get_exdir($modulesubdir, 2, 0, 0,
null,
'donation') . $file[
"name"];
281 if ($modulepart ==
'export') {
282 $relativepath = $file[
"name"];
285 $this->infofiles[
'nboffiles']++;
286 $this->infofiles[
'files'][] = $file[
'fullname'];
287 $ext = pathinfo($file[
"name"], PATHINFO_EXTENSION);
288 if (empty($this->infofiles[
'extensions'][$ext])) {
289 $this->infofiles[
'extensions'][$ext] = 1;
292 $this->infofiles[
'extensions'][$ext]++;
296 $url =
$context->getControllerUrl(
'document') .
'&modulepart=' . $modulepart .
'&entity=' . $entity .
'&file=' . urlencode($relativepath) .
'&soc_id=' .
$context->logged_thirdparty->id;
298 $tmpout .=
'<a href="' . $url .
'" class="btn-download-link ' . $morecss .
'" role="downloadlink"';
300 if (preg_match(
'/text/', $mime)) {
301 $tmpout .=
' target="_blank" rel="noopener noreferrer"';
304 $tmpout .=
img_mime($relativepath, $file[
"name"]);
305 $tmpout .= strtoupper($ext);
330 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
331 $out =
'<!-- html.formwebportal::getSignatureLink -->' .
"\n";
332 $url = getOnlineSignatureUrl(0, $modulepart,
$object->ref, 1,
$object);
334 $out .=
'<a target="_blank" rel="noopener noreferrer" href="' . $url .
'"' . ($morecss ?
' class="' . $morecss .
'"' :
'') .
' role="signaturelink">';
335 $out .=
'<i class="fa fa-file-signature"></i>';
336 $out .= $langs->trans(
"Sign");
362 public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty =
'', $searchkey =
'', $placeholder =
'', $morecss =
'', $moreparams =
'', $forcecombo = 0, $disabled = 0, $selected_input_value =
'', $objectfield =
'')
372 $InfoFieldList = explode(
":", $objectdesc, 4);
373 $vartmp = (empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3]);
375 if (preg_match(
'/^.*:(\w*)$/', $vartmp, $reg)) {
376 $InfoFieldList[4] = $reg[1];
378 $InfoFieldList[3] = preg_replace(
'/:\w*$/',
'', $vartmp);
380 $classname = $InfoFieldList[0];
381 $classpath = $InfoFieldList[1];
382 $filter = empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3];
383 $sortfield = empty($InfoFieldList[4]) ?
'' : $InfoFieldList[4];
384 if (!empty($classpath)) {
387 if ($classname && class_exists($classname)) {
388 $objecttmp =
new $classname($this->db);
391 $sharedentities =
getEntity(strtolower($classname));
392 $filter = str_replace(
393 array(
'__ENTITY__',
'__SHARED_ENTITIES__'),
394 array(
$conf->entity, $sharedentities),
399 if (!is_object($objecttmp)) {
400 dol_syslog(
'Error bad setup of type for field ' . implode(
',', $InfoFieldList), LOG_WARNING);
401 return 'Error bad setup of type for field ' . implode(
',', $InfoFieldList);
404 dol_syslog(__METHOD__ .
' filter=' . $filter, LOG_DEBUG);
407 $out .= $this->
selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
431 global
$conf, $langs;
436 $size = !empty($val[
'size']) ? $val[
'size'] : 0;
438 if (preg_match(
'/^(integer|link):(.*):(.*):(.*):(.*)/i', $val[
'type'], $reg)) {
439 $param[
'options'] = array($reg[2] .
':' . $reg[3] .
':' . $reg[4] .
':' . $reg[5] =>
'N');
441 } elseif (preg_match(
'/^(integer|link):(.*):(.*):(.*)/i', $val[
'type'], $reg)) {
442 $param[
'options'] = array($reg[2] .
':' . $reg[3] .
':' . $reg[4] =>
'N');
444 } elseif (preg_match(
'/^(integer|link):(.*):(.*)/i', $val[
'type'], $reg)) {
445 $param[
'options'] = array($reg[2] .
':' . $reg[3] =>
'N');
447 } elseif (preg_match(
'/^(sellist):(.*):(.*):(.*):(.*)/i', $val[
'type'], $reg)) {
448 $param[
'options'] = array($reg[2] .
':' . $reg[3] .
':' . $reg[4] .
':' . $reg[5] =>
'N');
450 } elseif (preg_match(
'/^(sellist):(.*):(.*):(.*)/i', $val[
'type'], $reg)) {
451 $param[
'options'] = array($reg[2] .
':' . $reg[3] .
':' . $reg[4] =>
'N');
453 } elseif (preg_match(
'/^(sellist):(.*):(.*)/i', $val[
'type'], $reg)) {
454 $param[
'options'] = array($reg[2] .
':' . $reg[3] =>
'N');
456 } elseif (preg_match(
'/^varchar\((\d+)\)/', $val[
'type'], $reg)) {
457 $param[
'options'] = array();
460 } elseif (preg_match(
'/^varchar/', $val[
'type'])) {
461 $param[
'options'] = array();
463 } elseif (preg_match(
'/^double(\([0-9],[0-9]\)){0,1}/', $val[
'type'])) {
464 $param[
'options'] = array();
467 $param[
'options'] = array();
468 $type = $val[
'type'];
472 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
473 $param[
'options'] = $val[
'arrayofkeyval'];
474 $type = $val[
'type'] ==
'checkbox' ?
'checkbox' :
'select';
478 $default = (!empty($val[
'default']) ? $val[
'default'] :
'');
479 $computed = (!empty($val[
'computed']) ? $val[
'computed'] :
'');
481 $required = (!empty($val[
'required']) ? $val[
'required'] : 0);
482 $notNull = (!empty($val[
'notnull']) ? $val[
'notnull'] : 0);
486 $hidden = (in_array(abs($val[
'visible']), array(0, 2)) ? 1 : 0);
491 if (!preg_match(
'/^search_/', $keyprefix)) {
492 return '<span>' . $langs->trans(
"AutomaticallyCalculated") .
'</span>';
499 if (empty($morecss) && !empty($val[
'css'])) {
500 $morecss = $val[
'css'];
503 $htmlName = $keyprefix . $key . $keysuffix;
512 $dateArr = explode(
' ', $value);
513 if (count($dateArr) > 0) {
514 $valueDate = $dateArr[0];
515 if (isset($dateArr[1])) {
516 $valueTime = $dateArr[1];
519 $out = $this->
inputDate($htmlName, $valueDate,
'', $htmlId, $morecss, $moreparam);
521 if ($type ==
'datetime') {
523 $out .=
' ' . $this->
inputType(
'time', $htmlName.
'_time', $valueTime, $htmlId, $morecss, $moreparam);
533 $moreparam .= ($size > 0 ?
' maxlength="' . $size .
'"' :
'');
546 if (preg_match(
'/^search_/', $keyprefix)) {
558 if (!empty($value)) {
559 $value =
price($value);
561 $addInputLabel =
' ' . $langs->getCurrencySymbol();
562 $out = $this->
inputType(
'text', $htmlName, $value, $htmlId, $morecss, $moreparam,
'', $addInputLabel);
566 if (!empty($value)) {
567 $value =
price($value);
569 $out = $this->
inputType(
'text', $htmlName, $value, $htmlId, $morecss, $moreparam);
573 $out = $this->
inputType(
'password', $htmlName, $value, $htmlId, $morecss, $moreparam);
577 foreach ($param[
'options'] as $keyopt => $valopt) {
578 $htmlId = $htmlName .
'_' . $keyopt;
579 $htmlMoreParam = $moreparam . ($value == $keyopt ?
' checked' :
'');
580 $out .= $this->
inputType(
'radio', $htmlName, $keyopt, $htmlId, $morecss, $htmlMoreParam, $valopt) .
'<br>';
585 $out =
'<select class="' . $morecss .
'" name="' . $htmlName .
'" id="' . $htmlId .
'"' . ($moreparam ?
' ' . $moreparam :
'') .
' >';
586 if ($default ==
'' || $notNull != 1) {
587 $out .=
'<option value="0"> </option>';
589 foreach ($param[
'options'] as $keyb => $valb) {
593 if (strpos($valb,
"|") !==
false) {
594 list($valb, $parent) = explode(
'|', $valb);
596 $out .=
'<option value="' . $keyb .
'"';
597 $out .= (((string) $value == $keyb) ?
' selected' :
'');
598 $out .= (!empty($parent) ?
' parent="' . $parent .
'"' :
'');
599 $out .=
'>' . $valb .
'</option>';
604 $out =
'<select class="' . $morecss .
'" name="' . $htmlName .
'" id="' . $htmlId .
'"' . ($moreparam ?
' ' . $moreparam :
'') .
'>';
606 $param_list = array_keys($param[
'options']);
607 $InfoFieldList = explode(
":", $param_list[0]);
617 $keyList = (empty($InfoFieldList[2]) ?
'rowid' : $InfoFieldList[2] .
' as rowid');
619 if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
620 if (strpos($InfoFieldList[4],
'extra.') !==
false) {
621 $keyList =
'main.' . $InfoFieldList[2] .
' as rowid';
623 $keyList = $InfoFieldList[2] .
' as rowid';
626 if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) {
627 list($parentName, $parentField) = explode(
'|', $InfoFieldList[3]);
628 if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4],
'extra.') !==
false) {
629 $keyList .=
', main.'.$parentField;
631 $keyList .=
', '.$parentField;
635 $filter_categorie =
false;
636 if (count($InfoFieldList) > 5) {
637 if ($InfoFieldList[0] ==
'categorie') {
638 $filter_categorie =
true;
642 if (!$filter_categorie) {
643 $fields_label = isset($InfoFieldList[1]) ? explode(
'|', $InfoFieldList[1]) : array();
644 if (!empty($fields_label)) {
646 $keyList .= implode(
', ', $fields_label);
650 $sql =
"SELECT " . $this->db->sanitize($keyList, 0, 0, 1);
651 $sql .=
" FROM " . $this->db->prefix() . $this->db->sanitize($InfoFieldList[0]);
652 if (!empty($InfoFieldList[4])) {
654 if (strpos($InfoFieldList[4],
'$SEL$') !==
false) {
655 $InfoFieldList[4] = str_replace(
'$SEL$',
'SELECT', $InfoFieldList[4]);
659 $InfoFieldList[4] = str_replace(
'$ID$',
'0', $InfoFieldList[4]);
662 if (strpos($InfoFieldList[4],
'extra') !==
false) {
663 $sql .=
" as main, " . $this->db->prefix() . $this->db->sanitize($InfoFieldList[0]) .
"_extrafields as extra";
665 $sqlwhere .=
" WHERE extra.fk_object=main." . $this->db->sanitize($InfoFieldList[2]) .
" AND " . $InfoFieldList[4];
668 $sqlwhere .=
" WHERE " . $InfoFieldList[4];
671 $sqlwhere .=
' WHERE 1=1';
674 if (in_array($InfoFieldList[0], array(
'tablewithentity'))) {
675 $sqlwhere .=
" AND entity = " . ((int)
$conf->entity);
680 $sql .=
' ORDER BY ' . implode(
', ', $fields_label);
682 dol_syslog(get_class($this) .
'::showInputField type=sellist', LOG_DEBUG);
683 $resql = $this->db->query($sql);
685 $out .=
'<option value="0"> </option>';
686 $num = $this->db->num_rows($resql);
690 $obj = $this->db->fetch_object($resql);
694 $fields_label = explode(
'|', $InfoFieldList[1]);
695 if (count($fields_label) > 1) {
697 foreach ($fields_label as $field_toshow) {
698 $labeltoshow .= $obj->$field_toshow .
' ';
701 $labeltoshow = $obj->{$InfoFieldList[1]};
703 $labeltoshow =
dol_trunc($labeltoshow, 45);
705 if ($value == $obj->rowid) {
706 foreach ($fields_label as $field_toshow) {
707 $translabel = $langs->trans($obj->$field_toshow);
708 if ($translabel != $obj->$field_toshow) {
709 $labeltoshow =
dol_trunc($translabel) .
' ';
711 $labeltoshow =
dol_trunc($obj->$field_toshow) .
' ';
714 $out .=
'<option value="' . $obj->rowid .
'" selected>' . $labeltoshow .
'</option>';
717 $translabel = $langs->trans($obj->{$InfoFieldList[1]});
718 if ($translabel != $obj->{$InfoFieldList[1]}) {
719 $labeltoshow =
dol_trunc($translabel, 18);
721 $labeltoshow =
dol_trunc($obj->{$InfoFieldList[1]});
724 if (empty($labeltoshow)) {
725 $labeltoshow =
'(not defined)';
727 if ($value == $obj->rowid) {
728 $out .=
'<option value="' . $obj->rowid .
'" selected>' . $labeltoshow .
'</option>';
731 if (!empty($InfoFieldList[3]) && $parentField) {
732 $parent = $parentName .
':' . $obj->{$parentField};
736 $out .=
'<option value="' . $obj->rowid .
'"';
737 $out .= ($value == $obj->rowid ?
' selected' :
'');
738 $out .= (!empty($parent) ?
' parent="' . $parent .
'"' :
'');
739 $out .=
'>' . $labeltoshow .
'</option>';
744 $this->db->free($resql);
746 $out .=
'Error in request ' . $sql .
' ' . $this->db->lasterror() .
'. Check setup of extra parameters.<br>';
749 require_once DOL_DOCUMENT_ROOT .
'/categories/class/categorie.class.php';
750 $categorytype = $InfoFieldList[5];
751 if (is_numeric($categorytype)) {
753 $MAP_ID_TO_CODE = array_flip($tmpcategory->MAP_ID);
754 $categorytype = $MAP_ID_TO_CODE[(int) $categorytype];
757 $data = $this->select_all_categories($categorytype,
'',
'parent', 64, $InfoFieldList[6], 1, 1);
758 $out .=
'<option value="0"> </option>';
759 foreach ($data as $data_key => $data_value) {
760 $out .=
'<option value="' . $data_key .
'"';
761 $out .= ($value == $data_key ?
' selected' :
'');
762 $out .=
'>' . $data_value .
'</option>';
769 $param_list = array_keys($param[
'options']);
770 $showempty = (($required && $default !=
'') ?
'0' :
'1');
772 $out = $this->selectForForms($param_list[0], $htmlName, (
int) $value, $showempty,
'',
'', $morecss, $moreparam, 0, empty($val[
'disabled']) ? 0 : 1);
777 if (!empty($hidden)) {
778 $out = $this->inputType(
'hidden', $htmlName, $value, $htmlId);
799 public function showOutputFieldForObject(
$object, $val, $key, $value, $moreparam =
'', $keysuffix =
'', $keyprefix =
'', $morecss =
'')
805 global
$conf, $langs;
807 $label = empty($val[
'label']) ?
'' : $val[
'label'];
808 $type = empty($val[
'type']) ?
'' : $val[
'type'];
809 $css = empty($val[
'css']) ?
'' : $val[
'css'];
810 $picto = empty($val[
'picto']) ?
'' : $val[
'picto'];
814 if (preg_match(
'/varchar\((\d+)\)/', $type, $reg)) {
817 } elseif (preg_match(
'/varchar/', $type)) {
820 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
821 $type = $val[
'type'] ==
'checkbox' ?
'checkbox' :
'select';
823 if (preg_match(
'/^integer:(.*):(.*)/i', $val[
'type'], $reg)) {
827 $default = empty($val[
'default']) ?
'' : $val[
'default'];
828 $computed = empty($val[
'computed']) ?
'' : $val[
'computed'];
829 $unique = empty($val[
'unique']) ?
'' : $val[
'unique'];
830 $required = empty($val[
'required']) ?
'' : $val[
'required'];
832 $param[
'options'] = array();
834 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
835 $param[
'options'] = $val[
'arrayofkeyval'];
837 if (preg_match(
'/^integer:(.*):(.*)/i', $val[
'type'], $reg)) {
839 $stringforoptions = $reg[1] .
':' . $reg[2];
840 if ($reg[1] ==
'User') {
841 $stringforoptions .=
':-1';
843 $param[
'options'] = array($stringforoptions => $stringforoptions);
844 } elseif (preg_match(
'/^sellist:(.*):(.*):(.*):(.*)/i', $val[
'type'], $reg)) {
845 $param[
'options'] = array($reg[1] .
':' . $reg[2] .
':' . $reg[3] .
':' . $reg[4] =>
'N');
847 } elseif (preg_match(
'/^sellist:(.*):(.*):(.*)/i', $val[
'type'], $reg)) {
848 $param[
'options'] = array($reg[1] .
':' . $reg[2] .
':' . $reg[3] =>
'N');
850 } elseif (preg_match(
'/^sellist:(.*):(.*)/i', $val[
'type'], $reg)) {
851 $param[
'options'] = array($reg[1] .
':' . $reg[2] =>
'N');
853 } elseif (preg_match(
'/^chkbxlst:(.*)/i', $val[
'type'], $reg)) {
854 $param[
'options'] = array($reg[1] =>
'N');
858 $langfile = empty($val[
'langfile']) ?
'' : $val[
'langfile'];
859 $list = (empty($val[
'list']) ?
'' : $val[
'list']);
860 $help = (empty($val[
'help']) ?
'' : $val[
'help']);
861 $hidden = (($val[
'visible'] == 0) ? 1 : 0);
871 $value = (string)
dol_eval((
string) $computed, 1, 0,
'2');
878 if (in_array($key, array(
'rowid',
'ref'))) {
879 if (property_exists(
$object,
'ref')) {
880 $value = (string)
$object->ref;
881 } elseif (property_exists(
$object,
'id')) {
886 } elseif ($key ==
'status' && method_exists(
$object,
'getLibStatut')) {
887 $value =
$object->getLibStatut(3);
891 } elseif (is_array($value)) {
894 if ($type ==
'array') {
895 $value = implode(
'<br>', $value);
897 dol_syslog(__METHOD__.
"Unexpected type=".$type.
" for array value=".((
string) json_encode($value)), LOG_ERR);
902 } elseif ($type ==
'date') {
903 if (!empty($value)) {
908 } elseif ($type ==
'datetime' || $type ==
'timestamp') {
909 if (!empty($value)) {
914 } elseif ($type ==
'duration') {
915 include_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
916 if (!is_null($value) && $value !==
'') {
922 } elseif ($type ==
'double' || $type ==
'real') {
923 if (!is_null($value) && $value !==
'') {
924 $value =
price($value);
929 } elseif ($type ==
'boolean') {
931 if (!empty($value)) {
932 $checked =
' checked ';
934 $value =
'<input type="checkbox" ' . $checked .
' ' . ($moreparam ? $moreparam :
'') .
' readonly disabled>';
935 } elseif ($type ==
'mail' || $type ==
'email') {
937 } elseif ($type ==
'url') {
939 } elseif ($type ==
'phone') {
941 } elseif ($type ==
'ip') {
943 } elseif ($type ==
'price') {
944 if (!is_null($value) && $value !==
'') {
950 } elseif ($type ==
'select') {
951 $value = isset($param[
'options'][$value]) ? $param[
'options'][$value] :
'';
952 } elseif ($type ==
'sellist') {
953 $param_list = array_keys($param[
'options']);
954 $InfoFieldList = explode(
":", $param_list[0]);
956 $selectkey =
"rowid";
959 if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
960 $selectkey = $InfoFieldList[2];
961 $keyList = $InfoFieldList[2] .
' as rowid';
964 $fields_label = explode(
'|', $InfoFieldList[1]);
965 if (is_array($fields_label)) {
967 $keyList .= implode(
', ', $fields_label);
970 $filter_categorie =
false;
971 if (count($InfoFieldList) > 5) {
972 if ($InfoFieldList[0] ==
'categorie') {
973 $filter_categorie =
true;
977 $sql =
"SELECT " . $this->db->sanitize($keyList);
978 $sql .=
' FROM ' . $this->db->prefix() . $this->db->sanitize($InfoFieldList[0]);
979 if (strpos($InfoFieldList[4],
'extra') !==
false) {
982 if ($selectkey ==
'rowid' && empty($value)) {
983 $sql .=
" WHERE " . $this->db->sanitize($selectkey) .
" = 0";
984 } elseif ($selectkey ==
'rowid') {
985 $sql .=
" WHERE " . $this->db->sanitize($selectkey) .
" = " . ((int) $value);
987 $sql .=
" WHERE " . $this->db->sanitize($selectkey) .
" = '" . $this->db->escape($value) .
"'";
990 dol_syslog(__METHOD__ .
' type=sellist', LOG_DEBUG);
991 $resql = $this->db->query($sql);
993 if (!$filter_categorie) {
995 $numrows = $this->db->num_rows($resql);
997 $obj = $this->db->fetch_object($resql);
1000 $fields_label = explode(
'|', $InfoFieldList[1]);
1002 if (is_array($fields_label) && count($fields_label) > 1) {
1003 foreach ($fields_label as $field_toshow) {
1005 if (!empty($obj->$field_toshow)) {
1006 $translabel = $langs->trans($obj->$field_toshow);
1008 if ($translabel != $field_toshow) {
1009 $value .=
dol_trunc($translabel, 18) .
' ';
1011 $value .= $obj->$field_toshow .
' ';
1016 if (!empty($obj->{$InfoFieldList[1]})) {
1017 $translabel = $langs->trans($obj->{$InfoFieldList[1]});
1019 if ($translabel != $obj->{$InfoFieldList[1]}) {
1022 $value = $obj->{$InfoFieldList[1]};
1027 require_once DOL_DOCUMENT_ROOT .
'/categories/class/categorie.class.php';
1030 $obj = $this->db->fetch_object($resql);
1032 $c->fetch($obj->rowid);
1033 $ways =
$c->print_all_ways();
1034 foreach ($ways as $way) {
1035 $toprint[] =
'<li>' . img_object(
'',
'category') .
' ' . $way .
'</li>';
1037 $value =
'<div><ul>' . implode(
' ', $toprint) .
'</ul></div>';
1040 dol_syslog(__METHOD__ .
' error ' . $this->db->lasterror(), LOG_WARNING);
1042 } elseif ($type ==
'radio') {
1043 $value = (string) $param[
'options'][$value];
1044 } elseif ($type ==
'checkbox') {
1045 $value_arr = explode(
',', $value);
1047 if (is_array($value_arr) && count($value_arr) > 0) {
1049 foreach ($value_arr as $valueval) {
1050 if (!empty($valueval)) {
1051 $toprint[] =
'<li>' . $param[
'options'][$valueval] .
'</li>';
1054 if (!empty($toprint)) {
1055 $value =
'<div><ul>' . implode(
' ', $toprint) .
'</ul></div>';
1058 } elseif ($type ==
'chkbxlst') {
1059 $value_arr = explode(
',', $value);
1061 $param_list = array_keys($param[
'options']);
1062 $InfoFieldList = explode(
":", $param_list[0]);
1064 $selectkey =
"rowid";
1067 if (count($InfoFieldList) >= 3) {
1068 $selectkey = $InfoFieldList[2];
1069 $keyList = $InfoFieldList[2] .
' as rowid';
1072 $fields_label = explode(
'|', $InfoFieldList[1]);
1073 if (is_array($fields_label)) {
1075 $keyList .= implode(
', ', $fields_label);
1078 $filter_categorie =
false;
1079 if (count($InfoFieldList) > 5) {
1080 if ($InfoFieldList[0] ==
'categorie') {
1081 $filter_categorie =
true;
1085 $sql =
"SELECT " . $this->db->sanitize($keyList);
1086 $sql .=
' FROM ' . $this->db->prefix() . $this->db->sanitize($InfoFieldList[0]);
1087 if (strpos($InfoFieldList[4],
'extra') !==
false) {
1093 dol_syslog(__METHOD__ .
' type=chkbxlst', LOG_DEBUG);
1094 $resql = $this->db->query($sql);
1096 if (!$filter_categorie) {
1099 while ($obj = $this->db->fetch_object($resql)) {
1101 $fields_label = explode(
'|', $InfoFieldList[1]);
1102 if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
1103 if (is_array($fields_label) && count($fields_label) > 1) {
1104 foreach ($fields_label as $field_toshow) {
1106 if (!empty($obj->$field_toshow)) {
1107 $translabel = $langs->trans($obj->$field_toshow);
1109 if ($translabel != $field_toshow) {
1110 $toprint[] =
'<li>' .
dol_trunc($translabel, 18) .
'</li>';
1112 $toprint[] =
'<li>' . $obj->$field_toshow .
'</li>';
1117 if (!empty($obj->{$InfoFieldList[1]})) {
1118 $translabel = $langs->trans($obj->{$InfoFieldList[1]});
1120 if ($translabel != $obj->{$InfoFieldList[1]}) {
1121 $toprint[] =
'<li>' .
dol_trunc($translabel, 18) .
'</li>';
1123 $toprint[] =
'<li>' . $obj->{$InfoFieldList[1]} .
'</li>';
1129 require_once DOL_DOCUMENT_ROOT .
'/categories/class/categorie.class.php';
1132 while ($obj = $this->db->fetch_object($resql)) {
1133 if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
1135 $c->fetch($obj->rowid);
1136 $ways =
$c->print_all_ways();
1137 foreach ($ways as $way) {
1138 $toprint[] =
'<li>' . img_object(
'',
'category') .
' ' . $way .
'</li>';
1143 $value =
'<div><ul>' . implode(
' ', $toprint) .
'</ul></div>';
1145 dol_syslog(__METHOD__ .
' error ' . $this->db->lasterror(), LOG_WARNING);
1147 } elseif ($type ==
'link') {
1150 $param_list = array_keys($param[
'options']);
1152 $InfoFieldList = explode(
":", $param_list[0]);
1153 $classname = $InfoFieldList[0];
1154 $classpath = $InfoFieldList[1];
1155 if (!empty($classpath)) {
1157 if ($classname && class_exists($classname)) {
1158 $object =
new $classname($this->db);
1159 '@phan-var-force CommonObject $object';
1161 $result =
$object->fetch($value);
1164 if (property_exists(
$object,
'label')) {
1165 $value = (string)
$object->label;
1166 } elseif (property_exists(
$object,
'libelle')) {
1167 $value = (string)
$object->libelle;
1168 } elseif (property_exists(
$object,
'nom')) {
1169 $value = (string)
$object->nom;
1170 } elseif (property_exists(
$object,
'ref')) {
1171 $value = (string)
$object->ref;
1176 dol_syslog(__METHOD__ .
' Error bad setup of field', LOG_WARNING);
1177 return 'Error bad setup of field';
1182 } elseif ($type ==
'password') {
1183 $value = preg_replace(
'/./i',
'*', $value);
1206 public function inputType($type, $name, $value =
'',
$id =
'', $morecss =
'', $moreparam =
'', $label =
'', $addInputLabel =
'')
1210 $out .=
'<label for="' . dolPrintHTMLForAttribute(
$id) .
'">';
1212 $out .=
'<input type="' . dolPrintHTMLForAttribute($type) .
'"';
1213 $out .=
' class="flat valignmiddle maxwidthonsmartphone ' . dolPrintHTMLForAttribute($morecss) .
'"';
1215 $out .=
' id="' . dolPrintHTMLForAttribute(
$id) .
'"';
1217 $out .=
' name="' . dolPrintHTMLForAttribute($name) .
'"';
1218 $out .=
' value="' . dolPrintHTMLForAttribute($value) .
'" ';
1219 $out .= ($moreparam ?
' ' . $moreparam :
'');
1220 $out .=
' />' . $addInputLabel;
1222 $out .= $label .
'</label>';
1240 public function inputSelectAjax($htmlName, $array,
$id, $ajaxUrl, $ajaxData = [], $morecss =
'minwidth75', $moreparam =
'')
1244 $(document).ready(function () {
1249 delay: 250, // wait 250 milliseconds before triggering the request
1250 data: function (params) {
1252 search: params.term,
1253 page: params.page || 1";
1254 if (!empty($ajaxData) && is_array($ajaxData)) {
1255 foreach ($ajaxData as $key => $value) {
1256 $out .=
", " . preg_replace(
'/[^a-z0-9_]/i',
'', $key) .
": '" .
dol_escape_js($value) .
"'";
1268 $out .= $this->selectarray($htmlName, $array,
$id, 0, 0, 0, $moreparam, 0, 0, 0,
'', $morecss);
1282 public function inputHtml($htmlName, $value, $morecss =
'', $moreparam =
'')
1284 require_once DOL_DOCUMENT_ROOT .
'/core/class/doleditor.class.php';
1285 $doleditor =
new DolEditor($htmlName, $value,
'', 200,
'dolibarr_notes',
'In',
false,
false,
isModEnabled(
'fckeditor') &&
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_5,
'90%');
1287 return (
string) $doleditor->Create(1,
'',
true,
'',
'', $moreparam, $morecss);
1300 public function inputText($htmlName, $value, $morecss =
'', $moreparam =
'', $options = array())
1304 if (!empty($options)) {
1306 $out .=
'<div class="text-area-multi-input-add-group" >';
1307 $out .= $this->selectarray($htmlName .
"_multiinput", $options,
'', 1, 0, 0, $moreparam, 0, 0, 0,
'',
"flat maxwidthonphone" . $morecss);
1308 $out .=
'<input id="' . $htmlName .
'_multiinputadd" type="button" class="button" value="' . $langs->trans(
"Add") .
'">';
1312 function handlemultiinputdisabling(htmlname){
1313 console.log("We handle the disabling of used options for "+htmlname+"_multiinput");
1314 multiinput = $("#"+htmlname+"_multiinput");
1315 multiinput.find("option").each(function(){
1316 tmpval = $("#"+htmlname).val();
1317 tmpvalarray = tmpval.split("\n");
1318 valtotest = $(this).val();
1319 if(tmpvalarray.includes(valtotest)){
1320 $(this).prop("disabled",true);
1322 if($(this).prop("disabled") == true){
1323 console.log(valtotest)
1324 $(this).prop("disabled", false);
1330 $(document).ready(function () {
1331 $("#' . $htmlName .
'_multiinputadd").on("click",function() {
1332 tmpval = $("#' . $htmlName .
'").val();
1333 tmpvalarray = tmpval.split(",");
1334 valtotest = $("#' . $htmlName .
'_multiinput").val();
1335 if(valtotest != -1 && !tmpvalarray.includes(valtotest)){
1336 console.log("We add the selected value to the text area ' . $htmlName .
'");
1340 tmpval = tmpval + "\n" + valtotest;
1342 $("#' . $htmlName .
'").val(tmpval);
1343 handlemultiinputdisabling("' . $htmlName .
'");
1344 $("#' . $htmlName .
'_multiinput").val(-1);
1346 console.log("We add nothing the text area ' . $htmlName .
'");
1349 $("#' . $htmlName .
'").on("change",function(){
1350 handlemultiinputdisabling("' . $htmlName .
'");
1352 handlemultiinputdisabling("' . $htmlName .
'");
1354 $out .=
"</script>";
1355 $value = str_replace(
',',
"\n", $value);
1358 require_once DOL_DOCUMENT_ROOT .
'/core/class/doleditor.class.php';
1359 $doleditor =
new DolEditor($htmlName, (
string) $value,
'', 200,
'dolibarr_notes',
'In',
false,
false,
false, ROWS_5);
1360 $out .= (string) $doleditor->Create(1,
'',
true,
'',
'', $moreparam, $morecss);
1375 public function inputRadio($htmlName, $options, $selectedValue, $morecss =
'', $moreparam =
'')
1378 foreach ($options as $optionKey => $optionLabel) {
1379 $selected = ((string) $selectedValue) === ((string) $optionKey) ?
' checked="checked"' :
'';
1380 $optionId = $htmlName .
'_' . $optionKey;
1381 $out .=
'<input class="flat' . $morecss .
'" type="radio" name="' . $htmlName .
'" id="' . $optionId .
'" value="' . dolPrintHTMLForAttribute((
string) $optionKey) .
'"' . $selected . $moreparam .
'/><label for="' . $optionId .
'">' . $optionLabel .
'</label><br>';
1397 public function inputStars($htmlName, $size, $value, $morecss =
'', $moreparam =
'')
1399 $out =
'<input type="hidden" class="flat ' . $morecss .
'" name="' . $htmlName .
'" id="' . $htmlName .
'" value="' . dolPrintHTMLForAttribute((
string) $value) .
'"' . $moreparam .
'>';
1400 $out .=
'<div class="star-selection" id="' . $htmlName .
'_selection">';
1401 for ($i = 1; $i <= $size; $i++) {
1402 $out .=
'<span class="star" data-value="' . $i .
'">' . img_picto(
'',
'fontawesome_star_fas') .
'</span>';
1406 jQuery(function($) { /* commonobject.class.php 1 */
1407 let container = $("#' . $htmlName .
'_selection");
1408 let selectedStars = parseInt($("#' . $htmlName .
'").val()) || 0;
1409 container.find(".star").each(function() {
1410 $(this).toggleClass("active", $(this).data("value") <= selectedStars);
1412 container.find(".star").on("mouseover", function() {
1413 let selectedStar = $(this).data("value");
1414 container.find(".star").each(function() {
1415 $(this).toggleClass("active", $(this).data("value") <= selectedStar);
1418 container.on("mouseout", function() {
1419 container.find(".star").each(function() {
1420 $(this).toggleClass("active", $(this).data("value") <= selectedStars);
1423 container.find(".star").off("click").on("click", function() {
1424 selectedStars = $(this).data("value");
1425 if (selectedStars === 1 && $("#' . $htmlName .
'").val() == 1) {
1428 $("#' . $htmlName .
'").val(selectedStars);
1429 container.find(".star").each(function() {
1430 $(this).toggleClass("active", $(this).data("value") <= selectedStars);
1448 public function inputIcon($htmlName, $value, $morecss =
'', $moreparam =
'')
1457 $out =
'<input type="text" class="form-control icp icp-auto iconpicker-element iconpicker-input flat ' . $morecss .
' maxwidthonsmartphone"';
1458 $out .=
' name="' . $htmlName .
'" id="' . $htmlName .
'" value="' . dolPrintHTMLForAttribute((
string) $value) .
'" ' . ((string) $moreparam) .
'>';
1461 $options =
"{ title: '<b>" . $langs->trans(
"IconFieldSelector") .
"</b>', placement: 'right', showFooter: false, templates: {";
1462 $options .=
"iconpicker: '<div class=\"iconpicker\"><div style=\"background-color:#EFEFEF;\" class=\"iconpicker-items\"></div></div>',";
1463 $options .=
"iconpickerItem: '<a role=\"button\" href=\"#\" class=\"iconpicker-item\" style=\"background-color:#DDDDDD;\"><i></i></a>',";
1466 $options .=
"footer: '<div class=\"popover-footer\" style=\"background-color:#EFEFEF;\"></div>',";
1467 $options .=
"search: '<input type=\"search\" class\"form-control iconpicker-search\" placeholder=\"" . $langs->trans(
"TypeToFilter") .
"\" />',";
1468 $options .=
"popover: '<div class=\"iconpicker-popover popover\">";
1469 $options .=
" <div class=\"arrow\" ></div>";
1470 $options .=
" <div class=\"popover-title\" style=\"text-align:center;background-color:#EFEFEF;\"></div>";
1471 $options .=
" <div class=\"popover-content \" ></div>";
1472 $options .=
"</div>'}}";
1473 $out .=
"$('#" . $htmlName .
"').iconpicker(" . $options .
");";
1474 $out .=
'</script>';
1490 require_once DOL_DOCUMENT_ROOT .
'/core/class/dolgeophp.class.php';
1491 require_once DOL_DOCUMENT_ROOT .
'/core/class/geomapeditor.class.php';
1497 if (!empty($value)) {
1498 $tmparray = $dolgeophp->parseGeoString($value);
1499 $geojson = $tmparray[
'geojson'];
1500 $centroidjson = $tmparray[
'centroidjson'];
1503 return $geomapeditor->getHtml($htmlName, $geojson, $centroidjson, $type);
1516 $values = is_array($values) ? $values : array();
1518 foreach ($values as $value) {
1519 $toPrint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $value .
'</li>';
1521 if (!empty($toPrint)) {
1522 $out =
'<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(
' ', $toPrint) .
'</ul></div>';
1537 $out =
'<div class="star-selection" data-value="' . dolPrintHTMLForAttribute((
string) $value) .
'">';
1538 for ($i = 1; $i <= $size; $i++) {
1539 $out .=
'<span class="star' . ($i <= $value ?
' active' :
'') .
'" data-value="' . $i .
'">' . img_picto(
'',
'fontawesome_star_fas') .
'</span>';
1554 $out =
'<span class="' . dolPrintHTMLForAttribute((
string) $value) .
'"></span>';
1570 if (!empty($value)) {
1571 require_once DOL_DOCUMENT_ROOT .
'/core/class/dolgeophp.class.php';
1573 if ($type ==
'point') {
1574 $out = $dolgeophp->getXYString($value);
1576 $out = $dolgeophp->getPointString($value);
1597 public function getNomUrl(&
$object, $withpicto = 0, $option =
'', $maxlength = 0, $save_lastsearch_value = -1, $notooltip = 0, $morecss =
'', $add_label = 0, $sep =
' - ')
1600 $out =
$object->getNomUrl($withpicto, $option, $maxlength, $save_lastsearch_value, $notooltip, $morecss, $add_label, $sep);
1626 public static function showphoto($modulepart,
$object, $width = 100, $height = 0, $caneditfield = 0, $cssclass =
'photowithmargin', $imagesize =
'', $addlinktofullsize = 1, $cache = 0, $forcecapture =
'', $noexternsourceoverwrite = 0, $usesharelinkifavailable = 0)
1628 $out = parent::showphoto($modulepart,
$object, $width, $height, $caneditfield, $cssclass, $imagesize, $addlinktofullsize, $cache, $forcecapture, $noexternsourceoverwrite, $usesharelinkifavailable);
1629 $out = self::convertAllLink($out);
1652 $required = !empty($params[
'required']) ?
' required' :
'';
1653 $cell_class = !empty($params[
'cell_class']) ?
' ' . dolPrintHTMLForAttribute(trim($params[
'cell_class'])) :
'';
1654 $cell_attributes = !empty($params[
'cell_attributes']) ?
' ' . trim($params[
'cell_attributes']) :
'';
1655 $label_class = !empty($params[
'label_class']) ?
' ' . dolPrintHTMLForAttribute(trim($params[
'label_class'])) :
'';
1656 $label_attributes = !empty($params[
'label_attributes']) ?
' ' . trim($params[
'label_attributes']) :
'';
1657 $value_class = !empty($params[
'value_class']) ?
' ' . dolPrintHTMLForAttribute(trim($params[
'value_class'])) :
'';
1658 $value_attributes = !empty($params[
'value_attributes']) ?
' ' . trim($params[
'value_attributes']) :
'';
1660 $out =
'<div class="grid field_' . dolPrintHTMLForAttribute(strtolower($key)) . $cell_class .
'"' . $cell_attributes .
'>';
1661 $out .=
'<div class="' . $required . $label_class .
'"' . $label_attributes .
'>';
1664 $out .=
'<div class="' . $value_class .
'"' . $value_attributes .
'>';
1680 public static function convertAllLink($html, $additionalViewImageParams =
'', $additionalDocumentParams =
'')
1682 require_once DOL_DOCUMENT_ROOT .
'/webportal/class/context.class.php';
1685 $html = str_replace(DOL_URL_ROOT .
'/viewimage.php?',
$context->getControllerUrl(
'viewimage') . $additionalViewImageParams .
'&', $html);
1686 $html = str_replace(urlencode(DOL_URL_ROOT .
'/viewimage.php?'), urlencode(
$context->getControllerUrl(
'viewimage') . $additionalViewImageParams .
'&'), $html);
1687 $html = str_replace(DOL_URL_ROOT .
'/document.php?',
$context->getControllerUrl(
'document') . $additionalDocumentParams .
'&', $html);
1688 $html = str_replace(urlencode(DOL_URL_ROOT .
'/document.php?'), urlencode(
$context->getControllerUrl(
'document') . $additionalDocumentParams .
'&'), $html);
1702 public function selectCurrency($selected =
'', $htmlname =
'currency_id', $mode = 0, $useempty =
'')
1705 return '<span class="form-select-currency-container">'.parent::selectCurrency($selected, $htmlname, $mode, $useempty).
'</span>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
Class to manage categories.
static getInstance()
Singleton method to create one instance of this object.
Class to manage a WYSIWYG editor.
Class to manage Geo processing Usage: $dolgeophp=new DolGeoPHP($db);.
Class to manage a Leaflet map width geometrics objects.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=2, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
dol_print_ip($ip, $mode=0, $showname=0)
Return an IP formatted to be shown on screen.
dol_print_phone($phone, $countrycode='', $contactid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_print_url($url, $target='_blank', $max=32, $withpicto=0, $morecss='')
Show Url link.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
$context
@method int call_trigger(string $triggerName, ?User $user)