70 global $user, $langs, $conf;
71 $langs->load(
"boxes");
75 $this->info_box_head = array(
76 'text' => $langs->trans(
"BoxMyLastBookmarks", $max),
77 'sublink' => DOL_URL_ROOT.
'/bookmarks/list.php',
79 if ($user->hasRight(
"bookmark",
"creer")) {
80 $this->info_box_head[
'subpicto'] =
'bookmark';
81 $this->info_box_head[
'subtext'] = $langs->trans(
"BookmarksManagement");
83 $this->info_box_head[
'subpicto'] =
'bookmark';
84 $this->info_box_head[
'subtext'] = $langs->trans(
"ListOfBookmark");
87 if ($user->hasRight(
'bookmark',
'lire')) {
88 $sql =
"SELECT b.title, b.url, b.target, b.favicon";
89 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookmark as b";
90 $sql .=
" WHERE fk_user = ".((int) $user->id);
91 $sql .=
" AND b.entity = ".$conf->entity;
92 $sql .= $this->db->order(
"position",
"ASC");
93 $sql .= $this->db->plimit($max, 0);
95 $result = $this->db->query($sql);
97 $num = $this->db->num_rows($result);
101 while ($line < $num) {
102 $objp = $this->db->fetch_object($result);
104 $this->info_box_contents[$line][0] = array(
105 'td' =>
'class="left" width="16"',
106 'logo' => $this->boximg,
108 'tooltip' => $objp->title,
109 'target' => $objp->target ?
'newtab' :
'',
111 $this->info_box_contents[$line][1] = array(
113 'text' => $objp->title,
115 'tooltip' => $objp->title,
116 'target' => $objp->target ?
'newtab' :
'',
123 $mytxt = $langs->trans(
"NoRecordedBookmarks");
124 if ($user->hasRight(
"bookmark",
"creer")) {
125 $mytxt .=
' '.$langs->trans(
"ClickToAdd");
127 $this->info_box_contents[$line][0] = array(
128 'td' =>
'class="center" colspan="2"',
130 'url'=> DOL_URL_ROOT.
'/bookmarks/list.php',
'text'=>$mytxt,
134 $this->db->free($result);
136 $this->info_box_contents[0][0] = array(
139 'text' => ($this->db->error().
' sql='.$sql),
143 $this->info_box_contents[0][0] = array(
144 'td' =>
'class="nohover left"',
145 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'