add ajax tooltip on ticket
This commit is contained in:
parent
31d5547e33
commit
2fd6b9438f
@ -1400,6 +1400,34 @@ class Ticket extends CommonObject
|
|||||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
|
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getTooltipContentArray
|
||||||
|
*
|
||||||
|
* @param array $params ex option, infologin
|
||||||
|
* @since v18
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getTooltipContentArray($params)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$langs->load('ticket');
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Ticket").'</u>';
|
||||||
|
$datas['picto'] .= ' '.$this->getLibStatut(4);
|
||||||
|
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||||
|
$datas['track_id'] = '<br><b>'.$langs->trans('TicketTrackId').':</b> '.$this->track_id;
|
||||||
|
$datas['subject'] = '<br><b>'.$langs->trans('Subject').':</b> '.$this->subject;
|
||||||
|
if ($this->date_creation) {
|
||||||
|
$datas['date_creation'] = '<br><b>'.$langs->trans('DateCreation').':</b> '.$this->date_creation;
|
||||||
|
}
|
||||||
|
if ($this->date_modification) {
|
||||||
|
$datas['date_modification'] = '<br><b>'.$langs->trans('DateModification').':</b> '.$this->date_modification;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a link to the object card (with optionaly the picto)
|
* Return a link to the object card (with optionaly the picto)
|
||||||
@ -1423,18 +1451,19 @@ class Ticket extends CommonObject
|
|||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Ticket").'</u>';
|
$params = [
|
||||||
$label .= ' '.$this->getLibStatut(4);
|
'id' => $this->id,
|
||||||
$label .= '<br>';
|
'objecttype' => $this->element,
|
||||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
|
];
|
||||||
$label .= '<b>'.$langs->trans('TicketTrackId').':</b> '.$this->track_id.'<br>';
|
$classfortooltip = 'classfortooltip';
|
||||||
$label .= '<b>'.$langs->trans('Subject').':</b> '.$this->subject;
|
$dataparams = '';
|
||||||
if ($this->date_creation) {
|
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||||
$label .= '<br><b>'.$langs->trans('DateCreation').':</b> '.$this->date_creation;
|
$classfortooltip = 'classforajaxtooltip';
|
||||||
}
|
$dataparams = ' data-params='.json_encode($params);
|
||||||
if ($this->date_modification) {
|
// $label = $langs->trans('Loading');
|
||||||
$label .= '<br><b>'.$langs->trans('DateModification').':</b> '.$this->date_modification;
|
|
||||||
}
|
}
|
||||||
|
$label = implode($this->getTooltipContentArray($params));
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/ticket/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/ticket/card.php?id='.$this->id;
|
||||||
|
|
||||||
if ($option != 'nolink') {
|
if ($option != 'nolink') {
|
||||||
@ -1454,8 +1483,8 @@ class Ticket extends CommonObject
|
|||||||
$label = $langs->trans("ShowTicket");
|
$label = $langs->trans("ShowTicket");
|
||||||
$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.'"' : '');
|
||||||
}
|
}
|
||||||
@ -1466,7 +1495,7 @@ class Ticket extends CommonObject
|
|||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) {
|
if ($withpicto) {
|
||||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 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