* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/bookmarks/bookmarks.lib.php * \ingroup bookmarks * \brief File with library for bookmark module */ /** * Add area with bookmarks in menu * * @param DoliDb $aDb Database handler * @param Translate $aLangs Object lang * @return string */ function printBookmarksList($aDb, $aLangs) { global $conf, $user; $db = $aDb; $langs = $aLangs; require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; $langs->load("bookmarks"); $url= $_SERVER["PHP_SELF"].(! empty($_SERVER["QUERY_STRING"])?'?'.$_SERVER["QUERY_STRING"]:''); $ret = ''; // Menu bookmark $ret.= ''; $ret.= ''."\n"; // Menu with all bookmarks if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) { $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; $sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)"; $sql.= " AND entity = ".$conf->entity; $sql.= " ORDER BY position"; if ($resql = $db->query($sql) ) { $i=0; while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql)) { $ret.=''; $i++; } } else { dol_print_error($db); } } $ret .= ''; return $ret; }