59 global $user, $langs, $conf;
60 $langs->load(
"boxes");
64 $this->info_box_head = array(
65 'text' => $langs->trans(
"BoxMyLastBookmarks", $max),
66 'sublink' => DOL_URL_ROOT.
'/bookmarks/list.php',
68 if ($user->hasRight(
"bookmark",
"creer")) {
69 $this->info_box_head[
'subpicto'] =
'bookmark';
70 $this->info_box_head[
'subtext'] = $langs->trans(
"BookmarksManagement");
72 $this->info_box_head[
'subpicto'] =
'bookmark';
73 $this->info_box_head[
'subtext'] = $langs->trans(
"ListOfBookmark");
76 if ($user->hasRight(
'bookmark',
'lire')) {
77 $sql =
"SELECT b.title, b.url, b.target, b.favicon";
78 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookmark as b";
79 $sql .=
" WHERE fk_user = ".((int) $user->id);
80 $sql .=
" AND b.entity = ".$conf->entity;
81 $sql .= $this->db->order(
"position",
"ASC");
82 $sql .= $this->db->plimit($max, 0);
84 $result = $this->db->query($sql);
86 $num = $this->db->num_rows($result);
90 while ($line < $num) {
91 $objp = $this->db->fetch_object($result);
93 $this->info_box_contents[$line][0] = array(
94 'td' =>
'class="left" width="16"',
95 'logo' => $this->boximg,
97 'tooltip' => $objp->title,
98 'target' => $objp->target ?
'newtab' :
'',
100 $this->info_box_contents[$line][1] = array(
102 'text' => $objp->title,
104 'tooltip' => $objp->title,
105 'target' => $objp->target ?
'newtab' :
'',
112 $mytxt = $langs->trans(
"NoRecordedBookmarks");
113 if ($user->hasRight(
"bookmark",
"creer")) {
114 $mytxt .=
' '.$langs->trans(
"ClickToAdd");
116 $this->info_box_contents[$line][0] = array(
117 'td' =>
'class="center" colspan="2"',
119 'url'=> DOL_URL_ROOT.
'/bookmarks/list.php',
'text'=>$mytxt,
123 $this->db->free($result);
125 $this->info_box_contents[0][0] = array(
128 'text' => ($this->db->error().
' sql='.$sql),
132 $this->info_box_contents[0][0] = array(
133 'td' =>
'class="nohover left"',
134 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'