add bookmarks in selectable landing pages for users

This commit is contained in:
Noé Cendrier 2023-02-17 18:28:08 +01:00
parent 4404b36a55
commit 8d548d0489

View File

@ -214,6 +214,28 @@ if (isModEnabled('agenda')) {
if (isModEnabled('ticket')) {
$tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets';
}
// add bookmarks to available landing pages
if (!empty($conf->global->MAIN_USE_BOOKMARKS_FOR_LANDING_PAGES)) {
$sql = "SELECT b.rowid, b.fk_user, b.url, b.title,";
$sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b";
$sql .= " WHERE 1=1";
$sql .= " AND b.entity IN (".getEntity('bookmark').")";
$sql .= " AND b.url NOT LIKE 'http%'";
if (!$object->admin) {
$sql .= " AND (b.fk_user = ".((int) $object->id)." OR b.fk_user is NULL OR b.fk_user = 0)";
}
$resql = $object->db->query($sql);
if ($resql) {
$i = 0;
while ($i < $object->db->num_rows($resql)) {
$obj = $db->fetch_object($resql);
$landing_url = str_replace(DOL_URL_ROOT,'',$obj->url);
$tmparray[$landing_url] = $obj->title;
$i++;
}
}
}
// Hook for insertion new items in the List of possible landing pages
$reshook = $hookmanager->executeHooks('addToLandingPageList', $tmparray, $object);