mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 19:41:26 +01:00
socialnetworks links
This commit is contained in:
@@ -967,7 +967,7 @@ while ($i < min($num, $limit))
|
|||||||
if (!empty($conf->socialnetworks->enabled)) {
|
if (!empty($conf->socialnetworks->enabled)) {
|
||||||
foreach ($socialnetworks as $key => $value) {
|
foreach ($socialnetworks as $key => $value) {
|
||||||
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
|
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
|
||||||
print '<td>'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key).'</td>';
|
print '<td>'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).'</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -816,9 +816,10 @@ abstract class CommonObject
|
|||||||
$outsocialnetwork = '';
|
$outsocialnetwork = '';
|
||||||
|
|
||||||
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
||||||
|
$socialnetworksdict = getArrayOfSocialNetworks();
|
||||||
foreach ($this->socialnetworks as $key => $value) {
|
foreach ($this->socialnetworks as $key => $value) {
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key);
|
$outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
|
||||||
}
|
}
|
||||||
$outdone++;
|
$outdone++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2440,13 +2440,14 @@ function getArrayOfSocialNetworks()
|
|||||||
/**
|
/**
|
||||||
* Show social network link
|
* Show social network link
|
||||||
*
|
*
|
||||||
* @param string $value Skype to show (only skype, without 'Name of recipient' before)
|
* @param string $value Skype to show (only skype, without 'Name of recipient' before)
|
||||||
* @param int $cid Id of contact if known
|
* @param int $cid Id of contact if known
|
||||||
* @param int $socid Id of third party if known
|
* @param int $socid Id of third party if known
|
||||||
* @param string $type 'skype','facebook',...
|
* @param string $type 'skype','facebook',...
|
||||||
* @return string HTML Link
|
* @param array $dictsocialnetworks socialnetworks availables
|
||||||
|
* @return string HTML Link
|
||||||
*/
|
*/
|
||||||
function dol_print_socialnetworks($value, $cid, $socid, $type)
|
function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetworks = array())
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
@@ -2454,13 +2455,11 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
|
|||||||
|
|
||||||
if (empty($value)) return ' ';
|
if (empty($value)) return ' ';
|
||||||
|
|
||||||
if (!empty($type))
|
if (!empty($type)) {
|
||||||
{
|
|
||||||
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
|
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
|
||||||
$htmllink .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
$htmllink .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
||||||
$htmllink .= $value;
|
if ($type == 'skype') {
|
||||||
if ($type == 'skype')
|
$htmllink .= $value;
|
||||||
{
|
|
||||||
$htmllink .= ' ';
|
$htmllink .= ' ';
|
||||||
$htmllink .= '<a href="skype:';
|
$htmllink .= '<a href="skype:';
|
||||||
$htmllink .= $value;
|
$htmllink .= $value;
|
||||||
@@ -2471,13 +2470,19 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
|
|||||||
$htmllink .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">';
|
$htmllink .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">';
|
||||||
$htmllink .= '<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
$htmllink .= '<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
||||||
$htmllink .= '</a>';
|
$htmllink .= '</a>';
|
||||||
}
|
if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
|
||||||
if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type == 'skype')
|
$addlink = 'AC_SKYPE';
|
||||||
{
|
$link = '';
|
||||||
$addlink = 'AC_SKYPE';
|
if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$addlink.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
|
||||||
$link = '';
|
$htmllink .= ($link ? ' '.$link : '');
|
||||||
if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$addlink.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
|
}
|
||||||
$htmllink .= ($link ? ' '.$link : '');
|
} else {
|
||||||
|
if (!empty($dictsocialnetworks[$type]['url'])) {
|
||||||
|
$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
|
||||||
|
$htmllink .= ' <a href="'.$link.'">'.$value.'</a>';
|
||||||
|
} else {
|
||||||
|
$htmllink .= $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$htmllink .= '</div>';
|
$htmllink .= '</div>';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user