add ajax tooltip on task
This commit is contained in:
parent
2fd6b9438f
commit
df411abe41
@ -130,8 +130,7 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
|
||||
$langs->load('projects');
|
||||
$classpath = 'projet/class';
|
||||
$module = 'projet';
|
||||
} elseif ($objecttype == 'task') {
|
||||
$langs->load('projects');
|
||||
} elseif ($objecttype == 'project_task') {
|
||||
$classpath = 'projet/class';
|
||||
$module = 'projet';
|
||||
$myobject = 'task';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
@ -696,6 +696,34 @@ class Task extends CommonObjectLine
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getTooltipContentArray
|
||||
*
|
||||
* @param array $params ex option, infologin
|
||||
* @since v18
|
||||
* @return array
|
||||
*/
|
||||
public function getTooltipContentArray($params)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$langs->load('projects');
|
||||
|
||||
$datas = [];
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans("Task").'</u>';
|
||||
if (!empty($this->ref)) {
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
}
|
||||
if (!empty($this->label)) {
|
||||
$datas['label'] = '<br><b>'.$langs->trans('LabelTask').':</b> '.$this->label;
|
||||
}
|
||||
if ($this->date_start || $this->date_end) {
|
||||
$datas['range'] = "<br>".get_date_range($this->date_start, $this->date_end, '', $langs, 0);
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@ -717,16 +745,18 @@ class Task extends CommonObjectLine
|
||||
}
|
||||
|
||||
$result = '';
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Task").'</u>';
|
||||
if (!empty($this->ref)) {
|
||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
}
|
||||
if (!empty($this->label)) {
|
||||
$label .= '<br><b>'.$langs->trans('LabelTask').':</b> '.$this->label;
|
||||
}
|
||||
if ($this->date_start || $this->date_end) {
|
||||
$label .= "<br>".get_date_range($this->date_start, $this->date_end, '', $langs, 0);
|
||||
$params = [
|
||||
'id' => $this->id,
|
||||
'objecttype' => $this->element,
|
||||
];
|
||||
$classfortooltip = 'classfortooltip';
|
||||
$dataparams = '';
|
||||
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||
$classfortooltip = 'classforajaxtooltip';
|
||||
$dataparams = ' data-params='.json_encode($params);
|
||||
// $label = $langs->trans('Loading');
|
||||
}
|
||||
$label = implode($this->getTooltipContentArray($params));
|
||||
|
||||
$url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option == 'withproject' ? '&withproject=1' : '');
|
||||
// Add param to save lastsearch_values or not
|
||||
@ -744,8 +774,8 @@ class Task extends CommonObjectLine
|
||||
$label = $langs->trans("ShowTask");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip nowraponall"';
|
||||
$linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="'.$classfortooltip.' nowraponall"';
|
||||
} else {
|
||||
$linkclose .= ' class="nowraponall"';
|
||||
}
|
||||
@ -758,7 +788,7 @@ class Task extends CommonObjectLine
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
$result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= $this->ref;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user