The Ansel_Tagger:: class wraps Ansel's interaction with the Content/Tagger
system.
Copyright 2010-2012 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.
Methods summary
public
Ansel_Tagger
|
|
public
|
#
tag( string $localId, string|array $tags, string $owner, string $content_type = 'image' )
Tags an ansel object with any number of tags.
Tags an ansel object with any number of tags.
Parameters
- $localId
- The identifier of the ansel object.
- $tags
- <p>Either a single tag string or an array of
tags.</p>
- $owner
- <p>The tag owner (should normally be the owner
of the resource).</p>
- $content_type
- <p>The type of object we are tagging
(gallery/image).</p>
Throws
|
public
array
|
#
getTags( mixed $localId, string $type = 'image' )
Retrieves the tags on given object(s).
Retrieves the tags on given object(s).
Parameters
- $localId
- <p>Either the identifier of the ansel object or
an array of identifiers.</p>
- $type
- The type of object $localId represents.
Returns
array A tag_id => tag_name hash, possibly wrapped in a localid hash.
Throws
|
public
array
|
#
browseTags( array $tags, string $user )
Retrieve a set of tags that are related to the specifed set. A tag is
related if resources tagged with the specified set are also tagged with
the tag being considered. Used to "browse" tagged resources.
Retrieve a set of tags that are related to the specifed set. A tag is
related if resources tagged with the specified set are also tagged with
the tag being considered. Used to "browse" tagged resources.
Parameters
- $tags
- <p>An array of tags to check. This would represent the
current "directory" of tags while browsing.</p>
- $user
- The resource must be owned by this user.
Returns
array An tag_id => tag_name hash
|
public
array
|
#
getTagIds( string|array $tags )
Get tag ids for the specified tag names.
Get tag ids for the specified tag names.
Parameters
- $tags
- Either a tag_name or array of tag_names.
Returns
array A tag_id => tag_name hash.
Throws
|
public
|
#
untag( string $localId, mixed $tags, string $content_type = 'image' )
Untag a resource.
Removes the tag regardless of the user that added the tag.
Parameters
- $localId
- The ansel object identifier.
- $tags
- Either a tag_id, tag_name or an array.
- $content_type
- The type of object that $localId represents.
|
public
|
#
replaceTags( string $localId, mixed $tags, string $owner, mixed $content_type = 'image' )
Tags the given resource with only the tags provided, removing any
tags that are already present but not in the list.
Tags the given resource with only the tags provided, removing any
tags that are already present but not in the list.
Parameters
- $localId
- The identifier for the ansel object.
- $tags
- Either a tag_id, tag_name, or array of tag_ids.
- $owner
- <p>The tag owner - should normally be the resource
owner.</p>
- $content_type
- type of object that $localId represents.
|
public
array
|
#
listTags( string $token )
Returns tags belonging to the current user beginning with $token.
Returns tags belonging to the current user beginning with $token.
Used for autocomplete code.
Parameters
- $token
- The token to match the start of the tag with.
Returns
array A tag_id => tag_name hash
Throws
|
public
Array
|
#
getCloud( string $user, integer $limit = 5 )
Returns the data needed to build a tag cloud based on the specified
user's tag dataset.
Returns the data needed to build a tag cloud based on the specified
user's tag dataset.
Parameters
- $user
- <p>The user whose tags should be included.
If null, all users' tags are returned.</p>
- $limit
- The maximum number of tags to include.
Returns
Array An array of hashes, each containing tag_id, tag_name, and count.
Throws
|
public
array
|
#
getTagInfo( array $tags = null, integer $limit = 500, mixed $type = null, mixed $user = null )
Returns cloud-like information, but only for a specified set of tags.
Useful for displaying the counts of other images tagged with the same
tag as the currently displayed image.
Returns cloud-like information, but only for a specified set of tags.
Useful for displaying the counts of other images tagged with the same
tag as the currently displayed image.
Parameters
- $tags
- An array of either tag names or ids.
- $limit
- Limit results to this many.
- $type
-
- $user
-
Returns
array An array of hashes, tag_id, tag_name, and count.
Throws
|
public
A
|
#
search( array $tags, array $filter = array() )
Searches for resources that are tagged with all of the requested tags.
Searches for resources that are tagged with all of the requested tags.
Parameters
- $tags
- Either a tag_id, tag_name or an array.
- $filter
- <p>Array of filter parameters.
- type (string) - 'gallery' or 'image'
- user (array) - only include objects owned by
these users.</p>
Returns
A hash of 'gallery' and 'image' ids.
Throws
|
public
array
|
#
listRelatedImages( Ansel_Image $image, bolean $ownerOnly = true )
List image ids of images related (via similar tags) to the specified
image
List image ids of images related (via similar tags) to the specified
image
Parameters
- $image
- The image to get related images for.
- $ownerOnly
- <p>Only return images owned by the specified
image's owner.</p>
Returns
array An array of 'image' and 'rank' keys..
|