mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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();
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
// opensurvey as aZ09 id
|
||||
$id = GETPOST('id', 'aZ09');
|
||||
$objecttype = GETPOST('objecttype', 'aZ09');
|
||||
|
||||
$html = '';
|
||||
|
|
@ -158,6 +159,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
|
|||
$classpath = 'resource/class';
|
||||
$module = 'resource';
|
||||
$myobject = 'dolresource';
|
||||
} elseif ($objecttype == 'opensurvey_sondage') {
|
||||
$classpath = 'opensurvey/class';
|
||||
$module = 'opensurvey';
|
||||
$myobject = 'opensurveysondage';
|
||||
}
|
||||
|
||||
// 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)
|
||||
*
|
||||
|
|
@ -440,11 +461,18 @@ class Opensurveysondage extends CommonObject
|
|||
}
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("ShowSurvey").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
|
||||
$label .= '<b>'.$langs->trans('Title').':</b> '.$this->title.'<br>';
|
||||
$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.'/opensurvey/card.php?id='.$this->id;
|
||||
|
||||
|
|
@ -463,8 +491,8 @@ class Opensurveysondage extends CommonObject
|
|||
$label = $langs->trans("ShowMyObject");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
$linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
|
||||
} else {
|
||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
}
|
||||
|
|
@ -475,7 +503,7 @@ class Opensurveysondage extends CommonObject
|
|||
|
||||
$result .= $linkstart;
|
||||
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) {
|
||||
$result .= $this->ref;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user