PHP Class Horde_Core_TagBrowser, horde

Copyright 2011-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Author: Michael J Rubinsky ([email protected])
Datei anzeigen Open project: horde/horde

Protected Properties

Property Type Description
$_app string The application this browser is for.
$_dirty boolean Dirty flag
$_owner string The user whose resources we are searching.
$_results array Results cache. Holds the results of the current search.
$_tagger Horde_Core_Tagger The Tagger object.
$_tags array Tags are always added to the search by name and stored by name=>id.
$_totalCount integer Total count of matches.

Public Methods

Method Description
__construct ( Horde_Core_Tagger $tagger, array $tags = null, string $owner = null ) Const'r
addTag ( string $tag ) Add a tag to the cumulative tag search
clearSearch ( ) Clears the session cache of tags currently included in the search.
count ( ) : integer Get the total number of resources that match.
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.
getSlice ( integer $page, integer $perpage = null ) : array Fetch the matching resources that should appear on the current page
getTagTrail ( ) : Return Get breadcrumb style navigation html for choosen tags
getTags ( ) : array Get the list of currently choosen tags
removeTag ( string $tag ) Remove a tag from the cumulative search
runSearch ( ) Perform, and cache the search.
save ( ) Saves current state to the session.
tagCount ( ) : integer Get the total number of tags included in this search.

Protected Methods

Method Description
_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().
_getRelatedTagsWithResults ( array $default_results = null ) : array Default implementation for getRelatedTags
_runSearch ( ) : array Default implementation for runSearch.
_sortTagInfo ( $a, $b ) Helper for uasort. Sorts the results by count.

Method Details

__construct() public method

Const'r
public __construct ( Horde_Core_Tagger $tagger, array $tags = null, string $owner = null )
$tagger Horde_Core_Tagger The tagger object.
$tags array Tags to add to initially search on.
$owner string Restrict to resources owned by owner.

_getRelatedTagsWithNoResults() protected method

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
return array An array of tag_id => [tag_name, total]

_getRelatedTagsWithResults() protected method

Default implementation for getRelatedTags
protected _getRelatedTagsWithResults ( array $default_results = null ) : array
$default_results array A default list of object ids to use to fetch tags from. Used when the current search results are empty.
return array An array of tag_id => [tag_name, total].

_runSearch() protected method

Default implementation for runSearch.
protected _runSearch ( ) : array
return 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, ....

_sortTagInfo() protected method

Helper for uasort. Sorts the results by count.
protected _sortTagInfo ( $a, $b )

addTag() public method

Add a tag to the cumulative tag search
public addTag ( string $tag )
$tag string The tag name to add.

clearSearch() public method

Clears the session cache of tags currently included in the search.
public clearSearch ( )

count() public method

Get the total number of resources that match.
public count ( ) : integer
return integer The count of matching resources.

getRelatedTags() public method

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 $default_results = null ) : array
$default_results array A default list of object ids to use to fetch tags from. Used when the current search results are empty.
return array An array tag_id => {tag_name, total}

getSlice() abstract public method

Fetch the matching resources that should appear on the current page
abstract public getSlice ( integer $page, integer $perpage = null ) : array
$page integer The page to get slice for.
$perpage integer The number of objects per page.
return array An array of result objects.

getTagTrail() abstract public method

Get breadcrumb style navigation html for choosen tags
abstract public getTagTrail ( ) : Return
return Return information useful for building a tag trail.

getTags() public method

Get the list of currently choosen tags
public getTags ( ) : array
return array A hash of the currently selected tag_name => tag_id.

removeTag() public method

Remove a tag from the cumulative search
public removeTag ( string $tag )
$tag string The tag name to remove.

runSearch() public method

Perform, and cache the search.
public runSearch ( )

save() public method

Saves current state to the session.
public save ( )

tagCount() public method

Get the total number of tags included in this search.
public tagCount ( ) : integer
return integer The number of tags used in the current search.

Property Details

$_app protected_oe property

The application this browser is for.
protected string $_app
return string

$_dirty protected_oe property

Dirty flag
protected bool $_dirty
return boolean

$_owner protected_oe property

The user whose resources we are searching.
protected string $_owner
return string

$_results protected_oe property

Results cache. Holds the results of the current search.
protected array $_results
return array

$_tagger protected_oe property

The Tagger object.
protected Horde_Core_Tagger $_tagger
return Horde_Core_Tagger

$_tags protected_oe property

Tags are always added to the search by name and stored by name=>id.
protected array $_tags
return array

$_totalCount protected_oe property

Total count of matches.
protected int $_totalCount
return integer