+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/ajax/ajaxtooltip.php
+ * \ingroup tooltip
+ * \brief This script returns content of tooltip
+ */
+
+
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1); // Disables token renewal
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+if (!defined('NOREQUIREHTML')) {
+ define('NOREQUIREHTML', '1');
+}
+if (!defined('NOREQUIREAJAX')) {
+ define('NOREQUIREAJAX', '1');
+}
+include '../../main.inc.php';
+include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+
+top_httphead();
+
+$id = GETPOST('id', 'int');
+$objecttype = GETPOST('objecttype', 'aZ09');
+
+$html = '';
+$regs = array();
+$params = array();
+if (GETPOSTISSET('infologin')) {
+ $params['infologin'] = GETPOST('infologin', 'int');
+}
+if (GETPOSTISSET('option')) {
+ $params['option'] = GETPOST('option', 'restricthtml');
+}
+// If we ask a resource form external module (instead of default path)
+if (preg_match('/^([^@]+)@([^@]+)$/i', $objecttype, $regs)) {
+ $myobject = $regs[1];
+ $module = $regs[2];
+} else {
+ // Parse $objecttype (ex: project_task)
+ $module = $myobject = $objecttype;
+ if (preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
+ $module = $regs[1];
+ $myobject = $regs[2];
+ }
+}
+
+// Generic case for $classpath
+$classpath = $module.'/class';
+
+// Special cases, to work with non standard path
+if ($objecttype == 'facture' || $objecttype == 'invoice') {
+ $langs->load('bills');
+ $classpath = 'compta/facture/class';
+ $module = 'facture';
+ $myobject = 'facture';
+} elseif ($objecttype == 'commande' || $objecttype == 'order') {
+ $langs->load('orders');
+ $classpath = 'commande/class';
+ $module = 'commande';
+ $myobject = 'commande';
+} elseif ($objecttype == 'propal') {
+ $langs->load('propal');
+ $classpath = 'comm/propal/class';
+} elseif ($objecttype == 'supplier_proposal') {
+ $langs->load('supplier_proposal');
+ $classpath = 'supplier_proposal/class';
+} elseif ($objecttype == 'shipping') {
+ $langs->load('sendings');
+ $classpath = 'expedition/class';
+ $myobject = 'expedition';
+ $module = 'expedition_bon';
+} elseif ($objecttype == 'delivery') {
+ $langs->load('deliveries');
+ $classpath = 'delivery/class';
+ $myobject = 'delivery';
+ $module = 'delivery_note';
+} elseif ($objecttype == 'contract') {
+ $langs->load('contracts');
+ $classpath = 'contrat/class';
+ $module = 'contrat';
+ $myobject = 'contrat';
+} elseif ($objecttype == 'member') {
+ $langs->load('members');
+ $classpath = 'adherents/class';
+ $module = 'adherent';
+ $myobject = 'adherent';
+} elseif ($objecttype == 'cabinetmed_cons') {
+ $classpath = 'cabinetmed/class';
+ $module = 'cabinetmed';
+ $myobject = 'cabinetmedcons';
+} elseif ($objecttype == 'fichinter') {
+ $langs->load('interventions');
+ $classpath = 'fichinter/class';
+ $module = 'ficheinter';
+ $myobject = 'fichinter';
+} elseif ($objecttype == 'project') {
+ $langs->load('projects');
+ $classpath = 'projet/class';
+ $module = 'projet';
+} elseif ($objecttype == 'task') {
+ $langs->load('projects');
+ $classpath = 'projet/class';
+ $module = 'projet';
+ $myobject = 'task';
+} elseif ($objecttype == 'stock') {
+ $classpath = 'product/stock/class';
+ $module = 'stock';
+ $myobject = 'stock';
+} elseif ($objecttype == 'inventory') {
+ $classpath = 'product/inventory/class';
+ $module = 'stock';
+ $myobject = 'inventory';
+} elseif ($objecttype == 'mo') {
+ $classpath = 'mrp/class';
+ $module = 'mrp';
+ $myobject = 'mo';
+} elseif ($objecttype == 'productlot') {
+ $classpath = 'product/stock/class';
+ $module = 'stock';
+ $myobject = 'productlot';
+}
+
+// Generic case for $classfile and $classname
+$classfile = strtolower($myobject);
+$classname = ucfirst($myobject);
+//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath;
+
+if ($objecttype == 'invoice_supplier') {
+ $classfile = 'fournisseur.facture';
+ $classname = 'FactureFournisseur';
+ $classpath = 'fourn/class';
+ $module = 'fournisseur';
+} elseif ($objecttype == 'order_supplier') {
+ $classfile = 'fournisseur.commande';
+ $classname = 'CommandeFournisseur';
+ $classpath = 'fourn/class';
+ $module = 'fournisseur';
+} elseif ($objecttype == 'supplier_proposal') {
+ $classfile = 'supplier_proposal';
+ $classname = 'SupplierProposal';
+ $classpath = 'supplier_proposal/class';
+ $module = 'supplier_proposal';
+} elseif ($objecttype == 'stock') {
+ $classpath = 'product/stock/class';
+ $classfile = 'entrepot';
+ $classname = 'Entrepot';
+} elseif ($objecttype == 'facturerec') {
+ $classpath = 'compta/facture/class';
+ $classfile = 'facture-rec';
+ $classname = 'FactureRec';
+ $module = 'facture';
+} elseif ($objecttype == 'mailing') {
+ $classpath = 'comm/mailing/class';
+ $classfile = 'mailing';
+ $classname = 'Mailing';
+}
+
+if (isModEnabled($module)) {
+ $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
+ if ($res) {
+ if (class_exists($classname)) {
+ $object = new $classname($db);
+ $res = $object->fetch($id);
+ if ($res > 0) {
+ $html = $object->getTooltipContent($params);
+ } elseif ($res == 0) {
+ $html = $langs->trans('Deleted');
+ }
+ unset($object);
+ } else {
+ dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR);
+ }
+ }
+}
+
+print $html;
+
+$db->close();
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 25f16cbbdb4..416e1ca737b 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -664,6 +664,57 @@ abstract class CommonObject
}
return -1;
}
+ /**
+ * getTooltipContentArray
+ *
+ * @since v18
+ * @param array $params
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ return [];
+ }
+
+ /**
+ * getTooltipContent
+ *
+ * @param array $params
+ * @since v18
+ * @return string
+ */
+ public function getTooltipContent($params)
+ {
+ global $action, $extrafields, $langs, $hookmanager;
+
+ $datas = $this->getTooltipContentArray($params);
+
+ if (!empty($extrafields->attributes[$this->table_element]['label'])) {
+ foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
+ if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) {
+ $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
+ }
+ $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
+ if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
+ $datas[$key]= '
'. $labelextra . '';
+ } else {
+ $value = $this->array_options['options_' . $key];
+ $datas[$key]= '
'. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
+ }
+ }
+ }
+
+ $hookmanager->initHooks(array($this->element . 'dao'));
+ $parameters = array(
+ 'tooltipcontentarray' => &$datas
+ );
+ // Note that $action and $object may have been modified by some hooks
+ $hookmanager->executeHooks('getTooltipContent', $parameters, $this, $action);
+
+ $label = implode($datas);
+
+ return $label;
+ }
/**
diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php
index c037b86a7b9..7ec398f3368 100644
--- a/htdocs/core/js/lib_foot.js.php
+++ b/htdocs/core/js/lib_foot.js.php
@@ -65,38 +65,63 @@ if (empty($dolibarr_nocache)) {
// Wrapper to show tooltips (html or onclick popup)
-print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */\n";
-print "jQuery(document).ready(function () {\n";
+print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */
+jQuery(document).ready(function () {\n";
if (empty($conf->dol_no_mouse_hover)) {
- print 'jQuery(".classfortooltip").tooltip({
+ print '
+ jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
hide: { delay: 250, duration: 20 },
tooltipClass: "mytooltip",
content: function () {
- console.log("Return title for popup");
- return $(this).prop("title"); /* To force to get title as is */
- }
- });'."\n";
+ console.log("Return title for popup");
+ return $(this).prop("title"); /* To force to get title as is */
+ }
+ });
+ jQuery(".classforajaxtooltip").tooltip({
+ show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 },
+ hide: { delay: 250, duration: 20 },
+ tooltipClass: "mytooltip",
+ open: function (event, ui) {
+ var id = $(this).attr("id");
+ var params = $(this).attr("data-params");
+ $.ajax({
+ url:"' . dol_buildpath('/core/ajax/ajaxtooltip.php', 1) . '",
+ type: "post",
+ data: JSON.parse(params),
+ success: function(response){
+ // Setting content option
+ $("#"+id).tooltip("option","content",response);
+ }
+ });
+ console.log(event);
+ }
+ });
+ jQuery(".classforajaxtooltip").mouseout(function(){
+ console.log("hide ajax tooltip");
+ $(this).tooltip("close");
+ });
+ ';
}
print '
-jQuery(".classfortooltiponclicktext").dialog({
- closeOnEscape: true, classes: { "ui-dialog": "highlight" },
- maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).',
- modal: true,
- autoOpen: false
- }).css("z-index: 5000");
-jQuery(".classfortooltiponclick").click(function () {
- console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
- if ($(this).attr(\'dolid\')) {
- obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
- obj.dialog("open");
- return false;
- }
-});'."\n";
-
-print "});\n";
+ jQuery(".classfortooltiponclicktext").dialog({
+ closeOnEscape: true, classes: { "ui-dialog": "highlight" },
+ maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).',
+ modal: true,
+ autoOpen: false
+ }).css("z-index: 5000");
+ jQuery(".classfortooltiponclick").click(function () {
+ console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\'));
+ if ($(this).attr(\'dolid\')) {
+ obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
+ obj.dialog("open");
+ return false;
+ }
+ });
+});
+';
// Wrapper to manage dropdown
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 60de90d819d..e7160ef467a 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -4999,6 +4999,112 @@ class Product extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ * @param array $params
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs;
+
+ $datas = [];
+
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("ShowProduct")];
+ }
+
+ if (!empty($this->entity)) {
+ $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80);
+ if ($this->nbphoto > 0) {
+ $datas['photo'] = '' . $tmpphoto . '
';
+ //$label .= '';
+ }
+ }
+
+ if ($this->type == Product::TYPE_PRODUCT) {
+ $datas['picto'] = img_picto('', 'product').' '.$langs->trans("Product").'';
+ } elseif ($this->type == Product::TYPE_SERVICE) {
+ $datas['picto']= img_picto('', 'service').' '.$langs->trans("Service").'';
+ }
+ if (isset($this->status) && isset($this->status_buy)) {
+ $datas['status']= ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1);
+ }
+
+ if (!empty($this->ref)) {
+ $datas['ref']= '
'.$langs->trans('ProductRef').': '.$this->ref;
+ }
+ if (!empty($this->label)) {
+ $datas['label']= '
'.$langs->trans('ProductLabel').': '.$this->label;
+ }
+ if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
+ if (isModEnabled('productbatch')) {
+ $langs->load("productbatch");
+ $datas['batchstatus']= "
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2);
+ }
+ }
+ if (isModEnabled('barcode')) {
+ $datas['barcode']= '
'.$langs->trans('BarCode').': '.$this->barcode;
+ }
+
+ if ($this->type == Product::TYPE_PRODUCT) {
+ if ($this->weight) {
+ $datas['weight']= "
".$langs->trans("Weight").': '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units);
+ }
+ $labelsize = "";
+ if ($this->length) {
+ $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Length").': '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units);
+ }
+ if ($this->width) {
+ $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Width").': '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units);
+ }
+ if ($this->height) {
+ $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Height").': '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units);
+ }
+ if ($labelsize) {
+ $datas['size']= "
".$labelsize;
+ }
+
+ $labelsurfacevolume = "";
+ if ($this->surface) {
+ $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."".$langs->trans("Surface").': '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units);
+ }
+ if ($this->volume) {
+ $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."".$langs->trans("Volume").': '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
+ }
+ if ($labelsurfacevolume) {
+ $datas['surface']= "
" . $labelsurfacevolume;
+ }
+ }
+ if (!empty($this->pmp) && $this->pmp) {
+ $datas['pmp'] = "
".$langs->trans("PMPValue").': '.price($this->pmp, 0, '', 1, -1, -1, $conf->currency);
+ }
+
+ if (isModEnabled('accounting')) {
+ if ($this->status && isset($this->accountancy_code_sell)) {
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
+ $selllabel = '
';
+ $selllabel .= '
'.$langs->trans('ProductAccountancySellCode').': '.length_accountg($this->accountancy_code_sell);
+ $selllabel .= '
'.$langs->trans('ProductAccountancySellIntraCode').': '.length_accountg($this->accountancy_code_sell_intra);
+ $selllabel .= '
'.$langs->trans('ProductAccountancySellExportCode').': '.length_accountg($this->accountancy_code_sell_export);
+ $datas['accountancysell'] = $selllabel;
+ }
+ if ($this->status_buy && isset($this->accountancy_code_buy)) {
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
+ if (empty($this->status)) {
+ $buylabel = '
';
+ }
+ $buylabel .= '
'.$langs->trans('ProductAccountancyBuyCode').': '.length_accountg($this->accountancy_code_buy);
+ $buylabel .= '
'.$langs->trans('ProductAccountancyBuyIntraCode').': '.length_accountg($this->accountancy_code_buy_intra);
+ $buylabel .= '
'.$langs->trans('ProductAccountancyBuyExportCode').': '.length_accountg($this->accountancy_code_buy_export);
+ $datas['accountancybuy'] = $buylabel;
+ }
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable link of object (with eventually picto)
*
@@ -5119,8 +5225,18 @@ class Product extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
- $linkclose .= ' class="nowraponall classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $linkclose .= ' data-params='.json_encode($params).' id="product-' . uniqid() . '" title="' . $langs->trans('Loading') . '"';
+ $linkclose .= ' class="nowraponall classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"';
+ } else {
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
+ $linkclose .= ' class="nowraponall classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ }
} else {
$linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"';
}
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 2893378bdd9..0a963da1f5d 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -2744,6 +2744,99 @@ class User extends CommonObject
return $result;
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $menumanager;
+
+ $infologin = $params['infologin'] ?? 0;
+ $option = $params['option'] ?? '';
+
+ $datas = [];
+ if (!empty($this->photo)) {
+ $photo = '';
+ $photo .= Form::showphoto('userphoto', $this, 0, 60, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1); // Force height to 60 so we total height of tooltip can be calculated and collision can be managed
+ $photo .= '
';
+ $datas['photo'] = $photo;
+ //$label .= '';
+ }
+
+ // Info Login
+ $datas['opendiv'] = '';
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("User").' '.$this->getLibStatut(4);
+ $datas['name'] = '
'.$langs->trans('Name').': '.dol_string_nohtmltag($this->getFullName($langs, ''));
+ if (!empty($this->login)) {
+ $datas['login'] = '
'.$langs->trans('Login').': '.dol_string_nohtmltag($this->login);
+ }
+ if (!empty($this->job)) {
+ $datas['job'] = '
'.$langs->trans("Job").': '.dol_string_nohtmltag($this->job);
+ }
+ $datas['email'] = '
'.$langs->trans("Email").': '.dol_string_nohtmltag($this->email);
+ if (!empty($this->office_phone) || !empty($this->office_fax) || !empty($this->fax)) {
+ $phonelist = array();
+ if ($this->office_phone) {
+ $phonelist[] = dol_print_phone($this->office_phone, $this->country_code, $this->id, 0, '', ' ', 'phone');
+ }
+ if ($this->office_fax) {
+ $phonelist[] = dol_print_phone($this->office_fax, $this->country_code, $this->id, 0, '', ' ', 'fax');
+ }
+ if ($this->user_mobile) {
+ $phonelist[] = dol_print_phone($this->user_mobile, $this->country_code, $this->id, 0, '', ' ', 'mobile');
+ }
+ $datas['phones'] = '
'.$langs->trans('Phone').': '.implode(' ', $phonelist);
+ }
+ if (!empty($this->admin)) {
+ $datas['administrator'] = '
'.$langs->trans("Administrator").': '.yn($this->admin);
+ }
+ if (!empty($this->accountancy_code) || $option == 'accountancy') {
+ $datas['accountancycode'] = '
'.$langs->trans("AccountancyCode").': '.$this->accountancy_code;
+ }
+ $company = '';
+ if (!empty($this->socid)) { // Add thirdparty for external users
+ $thirdpartystatic = new Societe($this->db);
+ $thirdpartystatic->fetch($this->socid);
+ if (empty($hidethirdpartylogo)) {
+ $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company
+ }
+ $company = ' ('.$langs->trans("Company").': '.img_picto('', 'company').' '.dol_string_nohtmltag($thirdpartystatic->name).')';
+ }
+ $type = ($this->socid ? $langs->trans("ExternalUser").$company : $langs->trans("InternalUser"));
+ $datas['type'] = '
'.$langs->trans("Type").': '.$type;
+ $datas['closediv'] = '
';
+ if ($infologin > 0) {
+ $datas['newlinelogin'] = '
';
+ $datas['session'] = '
'.$langs->trans("Session").'';
+ $datas['ip'] = '
'.$langs->trans("IPAddress").': '.dol_string_nohtmltag(getUserRemoteIP());
+ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) {
+ $datas['multicompany'] = '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (User entity '.$this->entity.')';
+ }
+ $datas['authentication'] = '
'.$langs->trans("AuthenticationMode").': '.dol_string_nohtmltag($_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'));
+ $datas['connectedsince'] = '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
+ $datas['previousconnexion'] = '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
+ $datas['currenttheme'] = '
'.$langs->trans("CurrentTheme").': '.dol_string_nohtmltag($conf->theme);
+ $datas['currentmenumanager'] = '
'.$langs->trans("CurrentMenuManager").': '.dol_string_nohtmltag($menumanager->name);
+ $s = picto_from_langcode($langs->getDefaultLang());
+ $datas['currentuserlang'] = '
'.$langs->trans("CurrentUserLanguage").': '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang());
+ $datas['browser'] = '
'.$langs->trans("Browser").': '.dol_string_nohtmltag($conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')');
+ $datas['layout'] = '
'.$langs->trans("Layout").': '.dol_string_nohtmltag($conf->browser->layout);
+ $datas['screen'] = '
'.$langs->trans("Screen").': '.dol_string_nohtmltag($_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']);
+ if ($conf->browser->layout == 'phone') {
+ $datas['phone'] = '
'.$langs->trans("Phone").': '.$langs->trans("Yes");
+ }
+ if (!empty($_SESSION["disablemodules"])) {
+ $datas['disabledmodules'] = '
'.$langs->trans("DisabledModules").':
'.dol_string_nohtmltag(join(', ', explode(',', $_SESSION["disablemodules"])));
+ }
+ }
+
+ return $datas;
+ }
+
/**
* Return a HTML link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
@@ -2877,8 +2970,19 @@ class User extends CommonObject
$label = $langs->trans("ShowUser");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'infologin' => $infologin,
+ 'option' => $option,
+ ];
+ $linkclose .= ' data-params='.json_encode($params).' id="user-' . uniqid() . '" title="' . $langs->trans('Loading') . '"';
+ $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"';
+ } else {
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ }
}
$linkstart .= $linkclose.'>';