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');
|
$langs->load('projects');
|
||||||
$classpath = 'projet/class';
|
$classpath = 'projet/class';
|
||||||
$module = 'projet';
|
$module = 'projet';
|
||||||
} elseif ($objecttype == 'task') {
|
} elseif ($objecttype == 'project_task') {
|
||||||
$langs->load('projects');
|
|
||||||
$classpath = 'projet/class';
|
$classpath = 'projet/class';
|
||||||
$module = 'projet';
|
$module = 'projet';
|
||||||
$myobject = 'task';
|
$myobject = 'task';
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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) 2020 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
* 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)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
@ -717,16 +745,18 @@ class Task extends CommonObjectLine
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Task").'</u>';
|
$params = [
|
||||||
if (!empty($this->ref)) {
|
'id' => $this->id,
|
||||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
'objecttype' => $this->element,
|
||||||
}
|
];
|
||||||
if (!empty($this->label)) {
|
$classfortooltip = 'classfortooltip';
|
||||||
$label .= '<br><b>'.$langs->trans('LabelTask').':</b> '.$this->label;
|
$dataparams = '';
|
||||||
}
|
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||||
if ($this->date_start || $this->date_end) {
|
$classfortooltip = 'classforajaxtooltip';
|
||||||
$label .= "<br>".get_date_range($this->date_start, $this->date_end, '', $langs, 0);
|
$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' : '');
|
$url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option == 'withproject' ? '&withproject=1' : '');
|
||||||
// Add param to save lastsearch_values or not
|
// Add param to save lastsearch_values or not
|
||||||
@ -744,8 +774,8 @@ class Task extends CommonObjectLine
|
|||||||
$label = $langs->trans("ShowTask");
|
$label = $langs->trans("ShowTask");
|
||||||
$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 nowraponall"';
|
$linkclose .= ' class="'.$classfortooltip.' nowraponall"';
|
||||||
} else {
|
} else {
|
||||||
$linkclose .= ' class="nowraponall"';
|
$linkclose .= ' class="nowraponall"';
|
||||||
}
|
}
|
||||||
@ -758,7 +788,7 @@ class Task extends CommonObjectLine
|
|||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) {
|
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) {
|
if ($withpicto != 2) {
|
||||||
$result .= $this->ref;
|
$result .= $this->ref;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user