add ajax tooltip on dolresource
This commit is contained in:
parent
df411abe41
commit
eef350d1d3
@ -698,8 +698,9 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$datas = [];
|
||||
$langs->load('members');
|
||||
|
||||
$datas = [];
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("MemberType").'</u> '.$this->getLibStatut(4);
|
||||
$datas['label'] = '<br>'.$langs->trans("Label").': '.$this->label;
|
||||
if (isset($this->subscription)) {
|
||||
|
||||
@ -154,6 +154,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
|
||||
$classpath = 'user/class';
|
||||
$module = 'user';
|
||||
$myobject = 'usergroup';
|
||||
} elseif ($objecttype == 'dolresource') {
|
||||
$classpath = 'resource/class';
|
||||
$module = 'resource';
|
||||
$myobject = 'dolresource';
|
||||
}
|
||||
|
||||
// Generic case for $classfile and $classname
|
||||
@ -189,7 +193,6 @@ if ($objecttype == 'invoice_supplier') {
|
||||
$classfile = 'mailing';
|
||||
$classname = 'Mailing';
|
||||
} elseif ($objecttype == 'adherent_type') {
|
||||
$langs->load('members');
|
||||
$classpath = 'adherents/class';
|
||||
$classfile = 'adherent_type';
|
||||
$module = 'adherent';
|
||||
|
||||
@ -382,11 +382,10 @@ class EmailCollector extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
$object->label = $langs->trans("CopyOf")." ".$object->label;
|
||||
if (empty($object->host)) {
|
||||
$object->host = 'imap.example.com';
|
||||
}
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||
$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
|
||||
@ -247,6 +247,7 @@ CountryJE=Jersey
|
||||
CountryME=Montenegro
|
||||
CountryBL=Saint Barthelemy
|
||||
CountryMF=Saint Martin
|
||||
CountryXK=Kosovo
|
||||
|
||||
##### Civilities #####
|
||||
CivilityMME=Mrs.
|
||||
|
||||
@ -52,6 +52,9 @@ class Dolresource extends CommonObject
|
||||
|
||||
public $type_label;
|
||||
|
||||
/**
|
||||
* @var string description
|
||||
*/
|
||||
public $description;
|
||||
|
||||
public $fk_country;
|
||||
@ -761,6 +764,33 @@ class Dolresource extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getTooltipContentArray
|
||||
*
|
||||
* @param array $params ex option, infologin
|
||||
* @since v18
|
||||
* @return array
|
||||
*/
|
||||
public function getTooltipContentArray($params)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load('resource');
|
||||
|
||||
$datas = [];
|
||||
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans("Resource").'</u>';
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
/*if (isset($this->status)) {
|
||||
$datas['status'] = '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}*/
|
||||
if (isset($this->type_label)) {
|
||||
$datas['label'] = '<br><b>'.$langs->trans("ResourceType").":</b> ".$this->type_label;
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
@ -777,15 +807,18 @@ class Dolresource extends CommonObject
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$result = '';
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Resource").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
/*if (isset($this->status)) {
|
||||
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}*/
|
||||
if (isset($this->type_label)) {
|
||||
$label .= '<br><b>'.$langs->trans("ResourceType").":</b> ".$this->type_label;
|
||||
$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.'/resource/card.php?id='.$this->id;
|
||||
|
||||
@ -806,8 +839,8 @@ class Dolresource 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.'"' : '');
|
||||
}
|
||||
@ -820,7 +853,7 @@ class Dolresource extends CommonObject
|
||||
|
||||
$result .= $linkstart;
|
||||
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) {
|
||||
$result .= $this->ref;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user