add ajax tooltip on project
This commit is contained in:
parent
eef350d1d3
commit
019802ec33
@ -1244,6 +1244,50 @@ class Project extends CommonObject
|
|||||||
return dolGetStatus($langs->transnoentitiesnoconv($this->statuts_long[$status]), $langs->transnoentitiesnoconv($this->statuts_short[$status]), '', $statusClass, $mode);
|
return dolGetStatus($langs->transnoentitiesnoconv($this->statuts_long[$status]), $langs->transnoentitiesnoconv($this->statuts_short[$status]), '', $statusClass, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getTooltipContentArray
|
||||||
|
*
|
||||||
|
* @param array $params ex option, infologin
|
||||||
|
* @since v18
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getTooltipContentArray($params)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$langs->load('projects');
|
||||||
|
$option = $params['option'] ?? '';
|
||||||
|
$moreinpopup = $params['morinpopup'] ?? '';
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
if ($option != 'nolink') {
|
||||||
|
$datas['picto'] = img_picto('', $this->picto, 'class="pictofixedwidth"').' <u class="paddingrightonly">'.$langs->trans("Project").'</u>';
|
||||||
|
}
|
||||||
|
if (isset($this->status)) {
|
||||||
|
$datas['picto'] .= ' '.$this->getLibStatut(5);
|
||||||
|
}
|
||||||
|
$datas['ref'] = (isset($datas['picto']) ? '<br>' : '').'<b>'.$langs->trans('Ref').': </b>'.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto
|
||||||
|
$datas['label'] = '<br><b>'.$langs->trans('Label').': </b>'.$this->title; // The space must be after the : to not being explode when showing the title in img_picto
|
||||||
|
if (isset($this->public)) {
|
||||||
|
$datas['visibility'] = '<br><b>'.$langs->trans("Visibility").":</b> ";
|
||||||
|
$datas['visibility'] .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject"));
|
||||||
|
}
|
||||||
|
if (!empty($this->thirdparty_name)) {
|
||||||
|
$datas['thirdparty'] = '<br><b>'.$langs->trans('ThirdParty').': </b>'.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto
|
||||||
|
}
|
||||||
|
if (!empty($this->date_start)) {
|
||||||
|
$datas['datestart'] = '<br><b>'.$langs->trans('DateStart').': </b>'.dol_print_date($this->date_start, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
|
||||||
|
}
|
||||||
|
if (!empty($this->date_end)) {
|
||||||
|
$datas['dateend'] = '<br><b>'.$langs->trans('DateEnd').': </b>'.dol_print_date($this->date_end, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
|
||||||
|
}
|
||||||
|
if ($moreinpopup) {
|
||||||
|
$datas['moreinpopup'] = '<br>'.$moreinpopup;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clickable name (with picto eventually)
|
* Return clickable name (with picto eventually)
|
||||||
*
|
*
|
||||||
@ -1269,32 +1313,20 @@ class Project extends CommonObject
|
|||||||
if (!empty($conf->global->PROJECT_OPEN_ALWAYS_ON_TAB)) {
|
if (!empty($conf->global->PROJECT_OPEN_ALWAYS_ON_TAB)) {
|
||||||
$option = $conf->global->PROJECT_OPEN_ALWAYS_ON_TAB;
|
$option = $conf->global->PROJECT_OPEN_ALWAYS_ON_TAB;
|
||||||
}
|
}
|
||||||
|
$params = [
|
||||||
$label = '';
|
'id' => $this->id,
|
||||||
if ($option != 'nolink') {
|
'objecttype' => $this->element,
|
||||||
$label = img_picto('', $this->picto, 'class="pictofixedwidth"').' <u class="paddingrightonly">'.$langs->trans("Project").'</u>';
|
'moreinpopup' => $moreinpopup,
|
||||||
}
|
'option' => $option,
|
||||||
if (isset($this->status)) {
|
];
|
||||||
$label .= ' '.$this->getLibStatut(5);
|
$classfortooltip = 'classfortooltip';
|
||||||
}
|
$dataparams = '';
|
||||||
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('Ref').': </b>'.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto
|
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||||
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('Label').': </b>'.$this->title; // The space must be after the : to not being explode when showing the title in img_picto
|
$classfortooltip = 'classforajaxtooltip';
|
||||||
if (isset($this->public)) {
|
$dataparams = ' data-params='.json_encode($params);
|
||||||
$label .= '<br><b>'.$langs->trans("Visibility").":</b> ";
|
// $label = $langs->trans('Loading');
|
||||||
$label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject"));
|
|
||||||
}
|
|
||||||
if (!empty($this->thirdparty_name)) {
|
|
||||||
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('ThirdParty').': </b>'.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto
|
|
||||||
}
|
|
||||||
if (!empty($this->date_start)) {
|
|
||||||
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('DateStart').': </b>'.dol_print_date($this->date_start, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
|
|
||||||
}
|
|
||||||
if (!empty($this->date_end)) {
|
|
||||||
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('DateEnd').': </b>'.dol_print_date($this->date_end, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
|
|
||||||
}
|
|
||||||
if ($moreinpopup) {
|
|
||||||
$label .= '<br>'.$moreinpopup;
|
|
||||||
}
|
}
|
||||||
|
$label = implode($this->getTooltipContentArray($params));
|
||||||
|
|
||||||
$url = '';
|
$url = '';
|
||||||
if ($option != 'nolink') {
|
if ($option != 'nolink') {
|
||||||
@ -1325,8 +1357,8 @@ class Project extends CommonObject
|
|||||||
$label = $langs->trans("ShowProject");
|
$label = $langs->trans("ShowProject");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
$linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
|
||||||
} else {
|
} else {
|
||||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||||
}
|
}
|
||||||
@ -1342,7 +1374,7 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) {
|
if ($withpicto) {
|
||||||
$result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1);
|
$result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').$classfortooltip.' pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1);
|
||||||
}
|
}
|
||||||
if ($withpicto != 2) {
|
if ($withpicto != 2) {
|
||||||
$result .= $this->ref;
|
$result .= $this->ref;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user