\Trean_Bookmarks

Trean_Bookmarks handles basic management of bookmark storage.

Summary

Methods
Properties
Constants
__construct()
newBookmark()
listBookmarks()
searchBookmarks()
countBookmarks()
groupBookmarks()
getBookmark()
getBookmarks()
removeBookmark()
No public properties found
No constants found
_resultSet()
$_userManager
$_userId
N/A
No private methods found
No private properties found
N/A

Properties

$_userManager

$_userManager : \Content_Users_Manager

Type

\Content_Users_Manager

$_userId

$_userId : integer

Type

integer

Methods

__construct()

__construct(\Content_Users_Manager  $userManager) 

Constructor.

Parameters

\Content_Users_Manager $userManager

newBookmark()

newBookmark(array  $properties, boolean  $crawl = true) : \Trean_Bookmark

Create a new bookmark for the current user.

Parameters

array $properties

The bookmark property array.

boolean $crawl

If true (default) attempt to crawl the URL.

Returns

\Trean_Bookmark

listBookmarks()

listBookmarks(  $sortby = 'title', integer  $sortdir, integer  $from,   $count, string  $userId = null) : array

List bookmarks, sorted and paged as specified.

Parameters

$sortby
integer $sortdir

Direction of sort.

integer $from

Starting bookmark.

$count
string $userId

List bookmarks for this userId. Defaults to $this->_userId.

Returns

array —

An array of Trean_Bookmark objects.

searchBookmarks()

searchBookmarks(string  $q) : array

Search bookmarks.

Parameters

string $q

The search text.

Throws

\Trean_Exception

Returns

array —

An array of Trean_Bookmark objects that match the search.

countBookmarks()

countBookmarks() : integer

Returns the number of bookmarks.

Throws

\Trean_Exception

Returns

integer —

The number of all bookmarks.

groupBookmarks()

groupBookmarks(string  $groupby) : array

Return counts on grouping bookmarks by a specific property.

Parameters

string $groupby

The field to group on. (i.e., 'status').

Throws

\Trean_Exception

Returns

array —

A hash of results.

getBookmark()

getBookmark(integer  $id) : \Trean_Bookmark

Returns the bookmark corresponding to the given id.

Parameters

integer $id

The ID of the bookmark to retrieve.

Throws

\Horde_Exception_NotFound,

Trean_Exception

Returns

\Trean_Bookmark

The bookmark object corresponding to the given name.

getBookmarks()

getBookmarks(array  $ids, array  $options = array()) : array

Returns the bookmarks corresponding to the given ids.

Parameters

array $ids
array $options

An array of options:

  • sortby: (string) The field to sort by. DEFAULT: No sorting is done.
  • sortdir: (integer) The direction to sort, if sorting.

Throws

\Trean_Exception

Returns

array —

An array of Trean_Bookmark objects.

removeBookmark()

removeBookmark(\Trean_Bookmark  $bookmark) 

Removes a Trean_Bookmark from the backend.

Parameters

\Trean_Bookmark $bookmark

The bookmark to remove.

Throws

\Horde_Exception_PermissionDenied,

Trean_Exception

_resultSet()

_resultSet(array  $bookmarks) : array

Creates Trean_Bookmark objects for each row in a SQL result.

Parameters

array $bookmarks

An array of query results.

Returns

array —

An array of Trean_Bookmark objects.