diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-01-28 14:55:07 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-01-28 14:55:07 +0000 |
commit | 3ef7b27643328861ab47bc1cfd8596bc747b5a09 (patch) | |
tree | 22ad2cd5d4742e9472ef3ea0d56af733a6bddf5b /services/tagservice.php | |
parent | e740849d4c37dca5634e0ac39ffb6dfdb2aedf1e (diff) | |
download | semanticscuttle-3ef7b27643328861ab47bc1cfd8596bc747b5a09.tar.gz semanticscuttle-3ef7b27643328861ab47bc1cfd8596bc747b5a09.tar.bz2 |
new feature: structured tags, add synonym link
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@29 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services/tagservice.php')
-rw-r--r-- | services/tagservice.php | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/services/tagservice.php b/services/tagservice.php index 509e575..bbf3574 100644 --- a/services/tagservice.php +++ b/services/tagservice.php @@ -86,22 +86,37 @@ class TagService { } } + $bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + // Create links between tags foreach($tags as $key => $tag) { - // case ">" - $pieces = explode('>', $tag); - $nbPieces = count($pieces); - if($nbPieces > 1) { - for($i = 0; $i < $nbPieces-1; $i++) { - $bs =& ServiceFactory::getServiceInstance('BookmarkService'); - $tts =& ServiceFactory::getServiceInstance('Tag2TagService'); - - $bookmark = $bs->getBookmark($bookmarkid); - $uId = $bookmark['uId']; - $tts->addLinkedTags($pieces[$i], $pieces[$i+1], '>', $uId); - } - $tags[$key] = $pieces[$nbPieces-1]; // Attach just the last tag to the bookmark - } + if(strpos($tag, '=')) { + // case "=" + $pieces = explode('=', $tag); + $nbPieces = count($pieces); + if($nbPieces > 1) { + for($i = 0; $i < $nbPieces-1; $i++) { + $bookmark = $bs->getBookmark($bookmarkid); + $uId = $bookmark['uId']; + $tts->addLinkedTags($pieces[$i], $pieces[$i+1], '=', $uId); + } + $tags[$key] = $pieces[0]; // Attach just the last tag to the bookmark + } + } else { + // case ">" + $pieces = explode('>', $tag); + $nbPieces = count($pieces); + if($nbPieces > 1) { + for($i = 0; $i < $nbPieces-1; $i++) { + $bookmark = $bs->getBookmark($bookmarkid); + $uId = $bookmark['uId']; + $tts->addLinkedTags($pieces[$i], $pieces[$i+1], '>', $uId); + } + $tags[$key] = $pieces[$nbPieces-1]; // Attach just the last tag to the bookmark + } + } + } |