diff options
author | Christian Weiske <cweiske@cweiske.de> | 2010-10-01 18:21:16 +0200 |
---|---|---|
committer | Christian Weiske <cweiske@cweiske.de> | 2010-10-01 18:21:16 +0200 |
commit | 04d360dadbdcd492d3a1e5b7b6105007ad841987 (patch) | |
tree | 82b85f1df2988e9578cd53a5fe617066aa31058f | |
parent | b53b77d0dcf2ea89087d23ad037063dd8f620331 (diff) | |
download | semanticscuttle-04d360dadbdcd492d3a1e5b7b6105007ad841987.tar.gz semanticscuttle-04d360dadbdcd492d3a1e5b7b6105007ad841987.tar.bz2 |
CS, docblocks
-rw-r--r-- | src/SemanticScuttle/Service/Tag2Tag.php | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/src/SemanticScuttle/Service/Tag2Tag.php b/src/SemanticScuttle/Service/Tag2Tag.php index 8666209..33d211b 100644 --- a/src/SemanticScuttle/Service/Tag2Tag.php +++ b/src/SemanticScuttle/Service/Tag2Tag.php @@ -14,7 +14,7 @@ */ /** - * SemanticScuttle tag-to-tag service. + * SemanticScuttle tag-to-tag service which works with tag relations. * * @category Bookmarking * @package SemanticScuttle @@ -102,18 +102,49 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService return true; } - // Return linked tags just for admin users - function getAdminLinkedTags($tag, $relationType, $inverseRelation = false, $stopList = array()) { + + + /** + * Same as getLinkedTags(), but only tags that have been created + * by admin users are returned. + * + * @param string $tag Tag to get related tags for + * @param string $relationType Type of tag-to-tag relation: >, < or = + * @param boolean $inverseRelation Reverse relation (parent -> child) + * @param array $stopList Array of tags that shall not be returned + * + * @return array Array of tag names + * + * @see getLinkedTags() + */ + public function getAdminLinkedTags( + $tag, $relationType, $inverseRelation = false, $stopList = array() + ) { // look for admin ids $userservice = SemanticScuttle_Service_Factory :: get('User'); - $adminIds = $userservice->getAdminIds(); + $adminIds = $userservice->getAdminIds(); //ask for their linked tags - return $this->getLinkedTags($tag, $relationType, $adminIds, $inverseRelation, $stopList); + return $this->getLinkedTags( + $tag, $relationType, $adminIds, $inverseRelation, $stopList + ); } - // Return the target linked tags. If inverseRelation is true, return the source linked tags. - function getLinkedTags($tag, $relationType, $uId = null, $inverseRelation = false, $stopList = array()) { + + + /** + * Returns an array of tags that are in relation to the given $tag. + * + * @param string $tag Tag to get related tags for + * @param string $relationType Type of tag-to-tag relation: >, < or = + * @param boolean $inverseRelation Reverse relation (parent -> child) + * @param array $stopList Array of tags that shall not be returned + * + * @return array Array of tag names + */ + public function getLinkedTags( + $tag, $relationType, $uId = null, $inverseRelation = false, $stopList = array() + ) { // Set up the SQL query. if($inverseRelation) { $queriedTag = "tag1"; |