function _comments($id, $ref, $element)
{
    $element_tag = TTwiiit::getTag($element, $ref);
    $PDOdb = new TPDOdb();
    $r = '';
    $Tab = $PDOdb->ExecuteAsArray("SELECT DISTINCT t.rowid\n\tFROM " . MAIN_DB_PREFIX . "twiiit t  \n\t WHERE (t.fk_object=" . (int) $id . " AND t.type_object='" . $element . "') OR (t.comment LIKE '%" . $element_tag . "%')\n\t ORDER BY t.date_cre DESC");
    foreach ($Tab as &$row) {
        $twiiit = new TTwiiit();
        $twiiit->load($PDOdb, $row->rowid);
        $r .= '<div class="comm">';
        if ($id != $twiiit->fk_object || $element != $twiiit->type_object) {
            $origin_element = $twiiit->getNomUrl();
            if (!empty($origin_element)) {
                $r .= '<div class="object">' . $origin_element . '</div> ';
            }
        }
        $r .= $twiiit->getComment();
        $r .= '<div class="date">' . dol_print_date($twiiit->date_cre, 'dayhourtextshort') . '</div>';
        $r .= '</div>';
    }
    return $r;
}
    }
    list($code, $nom) = explode('_', $tag);
    $res = $db->query("SELECT p.rowid \n\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "socpeople p LEFT JOIN " . MAIN_DB_PREFIX . "societe s ON (p.fk_soc=s.rowid)\n\t\t\t\t\tWHERE (s.code_client = '" . $db->escape($code) . "' OR s.nom='" . $db->escape($code) . "' ) AND p.lastname='" . $db->escape($nom) . "'");
    while ($obj = $db->fetch_object($res)) {
        $o = new Contact($db);
        $o->fetch($obj->rowid);
        $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'contact');
    }
} else {
    if ($type_tag == 'rel') {
        $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "twiiit WHERE comment LIKE '%:" . $db->escape($tag) . "%'");
        $PDOdb = new TPDOdb();
        while ($obj = $db->fetch_object($res)) {
            $twiiit = new TTwiiit();
            $twiiit->load($PDOdb, $obj->rowid);
            $Tab[] = array('link' => $twiiit->getNomUrl(), 'text' => $twiiit->getComment());
        }
    } else {
        if ($type_tag == 'hashtag') {
            $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "propal WHERE ref = '" . $db->escape($tag) . "'");
            while ($obj = $db->fetch_object($res)) {
                $o = new Propal($db);
                $o->fetch($obj->rowid);
                $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'user');
            }
            $res = $db->query("SELECT rowid  FROM " . MAIN_DB_PREFIX . "facture WHERE facnumber = '" . $db->escape($tag) . "'");
            while ($obj = $db->fetch_object($res)) {
                $o = new Facture($db);
                $o->fetch($obj->rowid);
                $Tab[] = array('link' => $o->getNomUrl(1), 'link0' => $o->getNomUrl(0), 'type' => 'societe');
            }