add ajax tooltip on opensurvey
This commit is contained in:
parent
3e7b74557a
commit
eee645bb06
@ -41,7 +41,8 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
|||||||
|
|
||||||
top_httphead();
|
top_httphead();
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
// opensurvey as aZ09 id
|
||||||
|
$id = GETPOST('id', 'aZ09');
|
||||||
$objecttype = GETPOST('objecttype', 'aZ09');
|
$objecttype = GETPOST('objecttype', 'aZ09');
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
@ -158,6 +159,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
|
|||||||
$classpath = 'resource/class';
|
$classpath = 'resource/class';
|
||||||
$module = 'resource';
|
$module = 'resource';
|
||||||
$myobject = 'dolresource';
|
$myobject = 'dolresource';
|
||||||
|
} elseif ($objecttype == 'opensurvey_sondage') {
|
||||||
|
$classpath = 'opensurvey/class';
|
||||||
|
$module = 'opensurvey';
|
||||||
|
$myobject = 'opensurveysondage';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic case for $classfile and $classname
|
// Generic case for $classfile and $classname
|
||||||
|
|||||||
@ -420,6 +420,27 @@ class Opensurveysondage extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getTooltipContentArray
|
||||||
|
*
|
||||||
|
* @param array $params ex option, infologin
|
||||||
|
* @since v18
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getTooltipContentArray($params)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$langs->load('opensurvey');
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans("ShowSurvey").'</u>';
|
||||||
|
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||||
|
$datas['title'] = '<br><b>'.$langs->trans('Title').':</b> '.$this->title;
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a link to the object card (with optionaly the picto)
|
* Return a link to the object card (with optionaly the picto)
|
||||||
*
|
*
|
||||||
@ -440,11 +461,18 @@ class Opensurveysondage extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
$params = [
|
||||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("ShowSurvey").'</u>';
|
'id' => $this->id,
|
||||||
$label .= '<br>';
|
'objecttype' => $this->element,
|
||||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
|
];
|
||||||
$label .= '<b>'.$langs->trans('Title').':</b> '.$this->title.'<br>';
|
$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.'/opensurvey/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/opensurvey/card.php?id='.$this->id;
|
||||||
|
|
||||||
@ -463,8 +491,8 @@ class Opensurveysondage extends CommonObject
|
|||||||
$label = $langs->trans("ShowMyObject");
|
$label = $langs->trans("ShowMyObject");
|
||||||
$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.'"' : '');
|
||||||
}
|
}
|
||||||
@ -475,7 +503,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) {
|
if ($withpicto) {
|
||||||
$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
$result .= img_object(($notooltip ? '' : $label), $this->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