add function

This commit is contained in:
Frédéric FRANCE 2019-09-12 20:44:24 +02:00
parent fa44af1df8
commit cd109d04cd
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
3 changed files with 27 additions and 26 deletions

View File

@ -70,19 +70,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$sql = "SELECT rowid, code, label, url, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$socialnetworks = array();
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
$socialnetworks[$obj->code] = array(
'rowid' => $obj->rowid,
'label' => $obj->label,
'url' => $obj->url,
'active' => $obj->active,
);
}
}
$socialnetworks = getArrayOfSocialNetworks();
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($id);

View File

@ -2186,6 +2186,31 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
return $rep;
}
/**
* Get array of social network dictionary
*
* @return array Array of Social Networks Dictionary
*/
function getArrayOfSocialNetworks()
{
global $conf, $db;
$sql = "SELECT rowid, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$socialnetworks = array();
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
$socialnetworks[$obj->code] = array(
'rowid' => $obj->rowid,
'label' => $obj->label,
'url' => $obj->url,
'icon' => $obj->icon,
'active' => $obj->active,
);
}
}
return $socialnetworks;
}
/**
* Show social network link
*

View File

@ -100,19 +100,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$sql = "SELECT rowid, code, label, url, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$socialnetworks = array();
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
$socialnetworks[$obj->code] = array(
'rowid' => $obj->rowid,
'label' => $obj->label,
'url' => $obj->url,
'active' => $obj->active,
);
}
}
$socialnetworks = getArrayOfSocialNetworks();
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('usercard','globalcard'));