ITags¶
-
interface
OCP\
ITags
¶ - Class for easily tagging objects by their idA tag can be e.g. ‘Family’, ‘Work’, ‘Chore’, ‘Special Occation’ oranything else that is either parsed from a vobject or that the user choosesto add.Tag names are not case-sensitive, but will be saved with the case theyare entered in. If a user already has a tag ‘family’ for a type, andtries to add a tag named ‘Family’ it will be silently ignored.
Implemented by: OC\Tags
Source: lib/public/ITags.php#57
Constants¶
-
TAG_FAVORITE = _$!<Favorite>!$_
Source: lib/public/ITags.php#61 Since: 19.0.0
Methods¶
-
public
OCP\ITags::
isEmpty
()¶ - Check if any tags are saved for this type and user.
Source: lib/public/ITags.php#69 Returns: bool Since: 6.0.0
-
public
OCP\ITags::
getTag
($id)¶ - Returns an array mapping a given tag’s properties to its values:[‘id’ => 0, ‘name’ = ‘Tag’, ‘owner’ = ‘User’, ‘type’ => ‘tagtype’]
Source: Parameters: - $id (string) The ID of the tag that is going to be mapped
Returns: array | bool
Since: 8.0.0
-
public
OCP\ITags::
getTags
()¶ - Get the tags for a specific user.This returns an array with id/name maps:[[‘id’ => 0, ‘name’ = ‘First tag’],[‘id’ => 1, ‘name’ = ‘Second tag’],]
Source: lib/public/ITags.php#93 Returns: array Since: 6.0.0
-
public
OCP\ITags::
getTagsForObjects
($objIds)¶ - Get a list of tags for the given item ids.This returns an array with object id / tag names:[1 => array(‘First tag’, ‘Second tag’),2 => array(‘Second tag’),3 => array(‘Second tag’, ‘Third tag’),]
Source: Parameters: - $objIds (array) item ids
Returns: array | bool with object id as key and an array of tag names as value or false if an error occurred
Since: 8.0.0
-
public
OCP\ITags::
getIdsForTag
($tag)¶ - Get a list of items tagged with $tag.Throws an exception if the tag could not be found.
Source: Parameters: - $tag (string | int) Tag id or name.
Returns: array | bool An array of object ids or false on error.
Since: 6.0.0
-
public
OCP\ITags::
hasTag
($name)¶ - Checks whether a tag is already saved.
Source: Parameters: - $name (string) The name to check for.
Returns: bool
Since: 6.0.0
-
public
OCP\ITags::
userHasTag
($name, $user)¶ - Checks whether a tag is saved for the given user,disregarding the ones shared with him or her.
Source: Parameters: - $name (string) The tag name to check for.
- $user (string) The user whose tags are to be checked.
Returns: bool
Since: 8.0.0
-
public
OCP\ITags::
add
($name)¶ - Add a new tag.
Source: Parameters: - $name (string) A string with a name of the tag
Returns: int | bool the id of the added tag or false if it already exists.
Since: 6.0.0
-
public
OCP\ITags::
rename
($from, $to)¶ - Rename tag.
Source: Parameters: - $from (string | int) The name or ID of the existing tag
- $to (string) The new name of the tag.
Returns: bool
Since: 6.0.0
-
public
OCP\ITags::
addMultiple
($names, $sync=false, $id=null)¶ - Add a list of new tags.
Source: Parameters: - $names (string[]) A string with a name or an array of strings containing
the name(s) of the to add. * $sync (bool) When true, save the tags * $id (int | null) int Optional object id to add to this|these tag(s)
Returns: bool Returns false on error.
Since: 6.0.0
-
public
OCP\ITags::
purgeObjects
($ids)¶ - Delete tag/object relations from the db
Source: Parameters: - $ids (array) The ids of the objects
Returns: bool Returns false on error.
Since: 6.0.0
-
public
OCP\ITags::
getFavorites
()¶ - Get favorites for an object type
Source: lib/public/ITags.php#189 Returns: array | bool An array of object ids. Since: 6.0.0
-
public
OCP\ITags::
addToFavorites
($objid)¶ - Add an object to favorites
Source: Parameters: - $objid (int) The id of the object
Returns: bool
Since: 6.0.0
-
public
OCP\ITags::
removeFromFavorites
($objid)¶ - Remove an object from favorites
Source: Parameters: - $objid (int) The id of the object
Returns: bool
Since: 6.0.0
-
public
OCP\ITags::
tagAs
($objid, $tag)¶ - Creates a tag/object relation.
Source: Parameters: - $objid (int) The id of the object
- $tag (string) The id or name of the tag
Returns: bool Returns false on database error.
Since: 6.0.0
-
public
OCP\ITags::
unTag
($objid, $tag)¶ - Delete single tag/object relation from the db
Source: Parameters: - $objid (int) The id of the object
- $tag (string) The id or name of the tag
Returns: bool
Since: 6.0.0
-
public
OCP\ITags::
delete
($names)¶ - Delete tags from the database
Source: Parameters: - $names (string[] | int[]) An array of tags (names or IDs) to delete
Returns: bool Returns false on error
Since: 6.0.0