\Horde_Core_TagBrowser

Horde_Core_TagBrowser:: class provides logic for dealing with tag browsing.

Copyright 2011-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.

Summary

Methods
Properties
Constants
__construct()
save()
addTag()
removeTag()
getTags()
tagCount()
count()
getRelatedTags()
runSearch()
clearSearch()
getSlice()
getTagTrail()
No public properties found
No constants found
_getRelatedTagsWithResults()
_getRelatedTagsWithNoResults()
_sortTagInfo()
_runSearch()
$_app
$_tags
$_totalCount
$_owner
$_dirty
$_results
$_tagger
N/A
No private methods found
No private properties found
N/A

Properties

$_app

$_app : string

The application this browser is for.

Type

string

$_tags

$_tags : array

Array of tag_name => tag_id hashes for the current search.

Tags are always added to the search by name and stored by name=>id.

Type

array

$_totalCount

$_totalCount : integer

Total count of matches.

Type

integer

$_owner

$_owner : string

The user whose resources we are searching.

Type

string

$_dirty

$_dirty : boolean

Dirty flag

Type

boolean

$_results

$_results : array

Results cache. Holds the results of the current search.

Type

array

Methods

__construct()

__construct(\Horde_Core_Tagger  $tagger, array  $tags = null, string  $owner = null) 

Const'r

Parameters

\Horde_Core_Tagger $tagger

The tagger object.

array $tags

Tags to add to initially search on.

string $owner

Restrict to resources owned by owner.

save()

save() 

Saves current state to the session.

addTag()

addTag(string  $tag) 

Add a tag to the cumulative tag search

Parameters

string $tag

The tag name to add.

removeTag()

removeTag(string  $tag) 

Remove a tag from the cumulative search

Parameters

string $tag

The tag name to remove.

getTags()

getTags() : array

Get the list of currently choosen tags

Returns

array —

A hash of the currently selected tag_name => tag_id.

tagCount()

tagCount() : integer

Get the total number of tags included in this search.

Returns

integer —

The number of tags used in the current search.

count()

count() : integer

Get the total number of resources that match.

Returns

integer —

The count of matching resources.

getRelatedTags()

getRelatedTags(array  $default_results = null) : array

Get a list of tags related to this search. Concrete tagger classes can override the _getRelatedTagsWith* methods if they can perform them more efficiently.

Parameters

array $default_results

A default list of object ids to use to fetch tags from. Used when the current search results are empty.

Returns

array —

An array tag_id => {tag_name, total}

runSearch()

runSearch() 

Perform, and cache the search.

clearSearch()

clearSearch() 

Clears the session cache of tags currently included in the search.

getSlice()

getSlice(integer  $page, integer  $perpage = null) : array

Fetch the matching resources that should appear on the current page

Parameters

integer $page

The page to get slice for.

integer $perpage

The number of objects per page.

Returns

array —

An array of result objects.

getTagTrail()

getTagTrail() : \Return

Get breadcrumb style navigation html for choosen tags

Returns

\Return —

information useful for building a tag trail.

_getRelatedTagsWithResults()

_getRelatedTagsWithResults(array  $default_results = null) : array

Default implementation for getRelatedTags

Parameters

array $default_results

A default list of object ids to use to fetch tags from. Used when the current search results are empty.

Returns

array —

An array of tag_id => [tag_name, total].

_getRelatedTagsWithNoResults()

_getRelatedTagsWithNoResults() : array

Default implementation for getting related tags when we don't have any current search in effect. This is very inefficent and should only be used as a very last resort. Better to have concrete classes provide the full result set. See _getRelatedTagsWithResults().

Returns

array —

An array of tag_id => [tag_name, total]

_sortTagInfo()

_sortTagInfo(  $a,   $b) 

Helper for uasort. Sorts the results by count.

Parameters

$a
$b

_runSearch()

_runSearch() : array

Default implementation for runSearch.

Returns

array —

An array of search results. Either a one dimensional array containing local object uids, or a multi dimensional array of object_type => array_of_uids, ....