Horde_Core_TagBrowser
in package
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.
Tags
Table of Contents
Properties
- $_app : string
- The application this browser is for.
- $_dirty : bool
- Dirty flag
- $_owner : string
- The user whose resources we are searching.
- $_results : array<string|int, mixed>
- Results cache. Holds the results of the current search.
- $_tagger : Horde_Core_Tagger
- The Tagger object.
- $_tags : array<string|int, mixed>
- Array of tag_name => tag_id hashes for the current search.
- $_totalCount : int
- Total count of matches.
Methods
- __construct() : mixed
- Const'r
- addTag() : mixed
- Add a tag to the cumulative tag search
- clearSearch() : mixed
- Clears the session cache of tags currently included in the search.
- count() : int
- Get the total number of resources that match.
- getRelatedTags() : array<string|int, mixed>
- Get a list of tags related to this search. Concrete tagger classes can override the _getRelatedTagsWith* methods if they can perform them more efficiently.
- getSlice() : array<string|int, mixed>
- Fetch the matching resources that should appear on the current page
- getTags() : array<string|int, mixed>
- Get the list of currently choosen tags
- getTagTrail() : Return
- Get breadcrumb style navigation html for choosen tags
- removeTag() : mixed
- Remove a tag from the cumulative search
- runSearch() : mixed
- Perform, and cache the search.
- save() : mixed
- Saves current state to the session.
- tagCount() : int
- Get the total number of tags included in this search.
- _getRelatedTagsWithNoResults() : array<string|int, mixed>
- 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().
- _getRelatedTagsWithResults() : array<string|int, mixed>
- Default implementation for getRelatedTags
- _runSearch() : array<string|int, mixed>
- Default implementation for runSearch.
- _sortTagInfo() : mixed
- Helper for uasort. Sorts the results by count.
Properties
$_app
The application this browser is for.
protected
string
$_app
$_dirty
Dirty flag
protected
bool
$_dirty
= \false
$_owner
The user whose resources we are searching.
protected
string
$_owner
= ''
$_results
Results cache. Holds the results of the current search.
protected
array<string|int, mixed>
$_results
= array()
$_tagger
The Tagger object.
protected
Horde_Core_Tagger
$_tagger
$_tags
Array of tag_name => tag_id hashes for the current search.
protected
array<string|int, mixed>
$_tags
= array()
Tags are always added to the search by name and stored by name=>id.
$_totalCount
Total count of matches.
protected
int
$_totalCount
= \null
Methods
__construct()
Const'r
public
__construct(Horde_Core_Tagger $tagger[, array<string|int, mixed> $tags = null ][, string $owner = null ]) : mixed
Parameters
- $tagger : Horde_Core_Tagger
-
The tagger object.
- $tags : array<string|int, mixed> = null
-
Tags to add to initially search on.
- $owner : string = null
-
Restrict to resources owned by owner.
addTag()
Add a tag to the cumulative tag search
public
addTag(string $tag) : mixed
Parameters
- $tag : string
-
The tag name to add.
clearSearch()
Clears the session cache of tags currently included in the search.
public
clearSearch() : mixed
count()
Get the total number of resources that match.
public
count() : int
Return values
int —The count of matching resources.
getRelatedTags()
Get a list of tags related to this search. Concrete tagger classes can override the _getRelatedTagsWith* methods if they can perform them more efficiently.
public
getRelatedTags([array<string|int, mixed> $default_results = null ]) : array<string|int, mixed>
Parameters
- $default_results : array<string|int, mixed> = null
-
A default list of object ids to use to fetch tags from. Used when the current search results are empty.
Tags
Return values
array<string|int, mixed> —An array tag_id => {tag_name, total}
getSlice()
Fetch the matching resources that should appear on the current page
public
abstract getSlice([int $page = 0 ][, int $perpage = null ]) : array<string|int, mixed>
Parameters
- $page : int = 0
-
The page to get slice for.
- $perpage : int = null
-
The number of objects per page.
Return values
array<string|int, mixed> —An array of result objects.
getTags()
Get the list of currently choosen tags
public
getTags() : array<string|int, mixed>
Return values
array<string|int, mixed> —A hash of the currently selected tag_name => tag_id.
getTagTrail()
Get breadcrumb style navigation html for choosen tags
public
abstract getTagTrail() : Return
Return values
Return —information useful for building a tag trail.
removeTag()
Remove a tag from the cumulative search
public
removeTag(string $tag) : mixed
Parameters
- $tag : string
-
The tag name to remove.
runSearch()
Perform, and cache the search.
public
runSearch() : mixed
save()
Saves current state to the session.
public
save() : mixed
tagCount()
Get the total number of tags included in this search.
public
tagCount() : int
Return values
int —The number of tags used in the current search.
_getRelatedTagsWithNoResults()
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().
protected
_getRelatedTagsWithNoResults() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of tag_id => [tag_name, total]
_getRelatedTagsWithResults()
Default implementation for getRelatedTags
protected
_getRelatedTagsWithResults([array<string|int, mixed> $default_results = null ]) : array<string|int, mixed>
Parameters
- $default_results : array<string|int, mixed> = null
-
A default list of object ids to use to fetch tags from. Used when the current search results are empty.
Return values
array<string|int, mixed> —An array of tag_id => [tag_name, total].
_runSearch()
Default implementation for runSearch.
protected
_runSearch() : array<string|int, mixed>
Return values
array<string|int, mixed> —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, ....
_sortTagInfo()
Helper for uasort. Sorts the results by count.
protected
_sortTagInfo(mixed $a, mixed $b) : mixed
Parameters
- $a : mixed
- $b : mixed