5
* @author Thomas Tanghus
6
* @copyright 2013 Thomas Tanghus <thomas@tanghus.net>
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
* License as published by the Free Software Foundation; either
11
* version 3 of the License, or any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18
* You should have received a copy of the GNU Affero General Public
19
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
24
* Public interface of ownCloud for apps to use.
29
// use OCP namespace for all classes that are considered public.
30
// This means that they should be used by apps instead of the internal ownCloud classes
33
// FIXME: Where should I put this? Or should it be implemented as a Listener?
34
\OC_Hook::connect('OC_User', 'post_deleteUser', 'OC\Tags', 'post_deleteUser');
37
* Class for easily tagging objects by their id
39
* A tag can be e.g. 'Family', 'Work', 'Chore', 'Special Occation' or
40
* anything else that is either parsed from a vobject or that the user chooses
42
* Tag names are not case-sensitive, but will be saved with the case they
43
* are entered in. If a user already has a tag 'family' for a type, and
44
* tries to add a tag named 'Family' it will be silently ignored.
50
* Check if any tags are saved for this type and user.
54
public function isEmpty();
57
* Get the tags for a specific user.
59
* This returns an array with id/name maps:
61
* ['id' => 0, 'name' = 'First tag'],
62
* ['id' => 1, 'name' = 'Second tag'],
67
public function getTags();
70
* Get the a list if items tagged with $tag.
72
* Throws an exception if the tag could not be found.
74
* @param string|integer $tag Tag id or name.
75
* @return array An array of object ids or false on error.
77
public function getIdsForTag($tag);
80
* Checks whether a tag is already saved.
82
* @param string $name The name to check for.
85
public function hasTag($name);
90
* @param string $name A string with a name of the tag
91
* @return int the id of the added tag or false if it already exists.
93
public function add($name);
98
* @param string $from The name of the existing tag
99
* @param string $to The new name of the tag.
102
public function rename($from, $to);
105
* Add a list of new tags.
107
* @param string[] $names A string with a name or an array of strings containing
108
* the name(s) of the to add.
109
* @param bool $sync When true, save the tags
110
* @param int|null $id int Optional object id to add to this|these tag(s)
111
* @return bool Returns false on error.
113
public function addMultiple($names, $sync=false, $id = null);
116
* Delete tag/object relations from the db
118
* @param array $ids The ids of the objects
119
* @return boolean Returns false on error.
121
public function purgeObjects(array $ids);
124
* Get favorites for an object type
126
* @return array An array of object ids.
128
public function getFavorites();
131
* Add an object to favorites
133
* @param int $objid The id of the object
136
public function addToFavorites($objid);
139
* Remove an object from favorites
141
* @param int $objid The id of the object
144
public function removeFromFavorites($objid);
147
* Creates a tag/object relation.
149
* @param int $objid The id of the object
150
* @param int|string $tag The id or name of the tag
151
* @return boolean Returns false on database error.
153
public function tagAs($objid, $tag);
156
* Delete single tag/object relation from the db
158
* @param int $objid The id of the object
159
* @param int|string $tag The id or name of the tag
162
public function unTag($objid, $tag);
165
* Delete tags from the
167
* @param string[] $names An array of tags to delete
168
* @return bool Returns false on error
170
public function delete($names);
b'\\ No newline at end of file'