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