mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 06:21:28 +01:00
add ajax tooltip for cronjobs
This commit is contained in:
@@ -11288,6 +11288,9 @@ function getElementProperties($element_type)
|
|||||||
$classpath = 'comm/action/class';
|
$classpath = 'comm/action/class';
|
||||||
$subelement = 'Actioncomm';
|
$subelement = 'Actioncomm';
|
||||||
$module = 'agenda';
|
$module = 'agenda';
|
||||||
|
} elseif ($element_type == 'cronjob') {
|
||||||
|
$classpath = 'cron/class';
|
||||||
|
$module = 'cron';
|
||||||
} elseif ($element_type == 'adherent_type') {
|
} elseif ($element_type == 'adherent_type') {
|
||||||
$classpath = 'adherents/class';
|
$classpath = 'adherents/class';
|
||||||
$classfile = 'adherent_type';
|
$classfile = 'adherent_type';
|
||||||
|
|||||||
@@ -969,6 +969,49 @@ class Cronjob extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getTooltipContentArray
|
||||||
|
* @param array $params params to construct tooltip data
|
||||||
|
* @since v18
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getTooltipContentArray($params)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$langs->load('cron');
|
||||||
|
$datas = [];
|
||||||
|
|
||||||
|
$datas['picto'] = img_picto('', 'object_'.$this->picto).' <u>'.$langs->trans("CronTask").'</u>';
|
||||||
|
if (isset($this->status)) {
|
||||||
|
$datas['picto'] .= ' '.$this->getLibStatut(5);
|
||||||
|
}
|
||||||
|
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.dol_escape_htmltag($this->ref);
|
||||||
|
$datas['label'] = '<br><b>'.$langs->trans('Title').':</b> '.$langs->trans($this->label);
|
||||||
|
if ($this->label != $langs->trans($this->label)) {
|
||||||
|
$datas['label'] .= ' <span class="opacitymedium">('.$this->label.')</span>';
|
||||||
|
}
|
||||||
|
if (!empty($this->params)) {
|
||||||
|
$datas['params'] = '<br><b>'.$langs->trans('Parameters').':</b> '.dol_escape_htmltag($this->params);
|
||||||
|
}
|
||||||
|
$datas['space'] = '<br>';
|
||||||
|
|
||||||
|
if (!empty($this->datestart)) {
|
||||||
|
$datas['crondtstart'] = '<br><b>'.$langs->trans('CronDtStart').':</b> '.dol_print_date($this->datestart, 'dayhour', 'tzuserrel');
|
||||||
|
}
|
||||||
|
if (!empty($this->dateend)) {
|
||||||
|
$datas['crondtend'] = '<br><b>'.$langs->trans('CronDtEnd').':</b> '.dol_print_date($this->dateend, 'dayhour', 'tzuserrel');
|
||||||
|
}
|
||||||
|
if (!empty($this->datelastrun)) {
|
||||||
|
$datas['cronlastlaunch'] = '<br><b>'.$langs->trans('CronDtLastLaunch').':</b> '.dol_print_date($this->datelastrun, 'dayhour', 'tzuserrel');
|
||||||
|
}
|
||||||
|
if (!empty($this->datenextrun)) {
|
||||||
|
$datas['crondtnextlaunch'] = '<br><b>'.$langs->trans('CronDtNextLaunch').':</b> '.dol_print_date($this->datenextrun, 'dayhour', 'tzuserrel');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a link to the object card (with optionaly the picto)
|
* Return a link to the object card (with optionaly the picto)
|
||||||
*
|
*
|
||||||
@@ -991,31 +1034,18 @@ class Cronjob extends CommonObject
|
|||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
$label = img_picto('', 'object_'.$this->picto).' <u>'.$langs->trans("CronTask").'</u>';
|
$params = [
|
||||||
if (isset($this->status)) {
|
'id' => $this->id,
|
||||||
$label .= ' '.$this->getLibStatut(5);
|
'objecttype' => $this->element,
|
||||||
}
|
];
|
||||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.dol_escape_htmltag($this->ref);
|
$classfortooltip = 'classfortooltip';
|
||||||
$label .= '<br><b>'.$langs->trans('Title').':</b> '.$langs->trans($this->label);
|
$dataparams = '';
|
||||||
if ($this->label != $langs->trans($this->label)) {
|
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||||
$label .= ' <span class="opacitymedium">('.$this->label.')</span>';
|
$classfortooltip = 'classforajaxtooltip';
|
||||||
}
|
$dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
|
||||||
if (!empty($this->params)) {
|
$label = '';
|
||||||
$label .= '<br><b>'.$langs->trans('Parameters').':</b> '.dol_escape_htmltag($this->params);
|
} else {
|
||||||
}
|
$label = implode($this->getTooltipContentArray($params));
|
||||||
$label .= '<br>';
|
|
||||||
|
|
||||||
if (!empty($this->datestart)) {
|
|
||||||
$label .= '<br><b>'.$langs->trans('CronDtStart').':</b> '.dol_print_date($this->datestart, 'dayhour', 'tzuserrel');
|
|
||||||
}
|
|
||||||
if (!empty($this->dateend)) {
|
|
||||||
$label .= '<br><b>'.$langs->trans('CronDtEnd').':</b> '.dol_print_date($this->dateend, 'dayhour', 'tzuserrel');
|
|
||||||
}
|
|
||||||
if (!empty($this->datelastrun)) {
|
|
||||||
$label .= '<br><b>'.$langs->trans('CronDtLastLaunch').':</b> '.dol_print_date($this->datelastrun, 'dayhour', 'tzuserrel');
|
|
||||||
}
|
|
||||||
if (!empty($this->datenextrun)) {
|
|
||||||
$label .= '<br><b>'.$langs->trans('CronDtNextLaunch').':</b> '.dol_print_date($this->datenextrun, 'dayhour', 'tzuserrel');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id;
|
||||||
@@ -1038,7 +1068,7 @@ class Cronjob extends CommonObject
|
|||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
|
||||||
} else {
|
} else {
|
||||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||||
}
|
}
|
||||||
@@ -1049,7 +1079,7 @@ class Cronjob 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user