CMS  Version 3.9
my_bookmarks.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("bookmark");
3 $page->page_title = "My Bookmarks";
4 
5 $bookmarks = GroupedQuery::create(Bookmark, "WHERE user_id=:u ORDER BY category, title", "category")
6  ->bind(":u", $user->get($user->getPrimaryKey()))
7  ->execute();
8 
9 if (count($bookmarks) > 0)
10 {
11  foreach($bookmarks as $category => $links)
12  {
13  if (!$category) $category = "Unclassified";
14 
15  echo "<h3>$category</h3>";
16  echo "<ul>";
17 
18  foreach($links as $link)
19  {
20  echo $link->format("<li><a href='{url}'>{title}</a>&nbsp;<img src='/fakoli/images/icon_edit.png' alt='Edit' style='cursor: pointer' onclick='BookmarkManager.editBookmark({bookmark_id}); return false'/>");
21  }
22 
23  echo "</ul>";
24  }
25 }
26 else
27 {
28  echo "<em>You haven't recorded any bookmarks.</em>";
29 }
$page
Definition: help.inc:39
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
global $user
$bookmarks
Definition: my_bookmarks.inc:5