aboutsummaryrefslogtreecommitdiff
path: root/templates/dynamictags.inc.php
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-12-01 17:10:36 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-12-01 17:10:36 +0000
commitef4fd0ad2715026bf12fd41e9c1c888e5a278687 (patch)
tree64127d82effcbfb6c6270f8cc77d89912cabfe8e /templates/dynamictags.inc.php
parent013ba82313adbdbdfc4cf59db1ec620c64cd39ac (diff)
downloadsemanticscuttle-ef4fd0ad2715026bf12fd41e9c1c888e5a278687.tar.gz
semanticscuttle-ef4fd0ad2715026bf12fd41e9c1c888e5a278687.tar.bz2
Interface fix: add tags cloud from all users into add bookmark window
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@182 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'templates/dynamictags.inc.php')
-rw-r--r--templates/dynamictags.inc.php81
1 files changed, 51 insertions, 30 deletions
diff --git a/templates/dynamictags.inc.php b/templates/dynamictags.inc.php
index 4bc0421..b317e9f 100644
--- a/templates/dynamictags.inc.php
+++ b/templates/dynamictags.inc.php
@@ -1,35 +1,61 @@
<?php
/***************************************************************************
-Copyright (C) 2005 - 2006 Scuttle project
-http://sourceforge.net/projects/scuttle/
-http://scuttle.org/
+ Copyright (C) 2005 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-***************************************************************************/
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
$userservice = & ServiceFactory :: getServiceInstance('UserService');
$logged_on_userid = $userservice->getCurrentUserId();
+//tags from current user
$userPopularTags =& $b2tservice->getPopularTags($logged_on_userid, 25, $logged_on_userid);
-$userPopularTagsCloud =& $b2tservice->tagCloud($userPopularTags, 5, 90, 175);
+$userPopularTagsCloud =& $b2tservice->tagCloud($userPopularTags, 5, 90, 175);
$userPopularTagsCount = count($userPopularTags);
-if ($userPopularTagsCount > 0) {
-?>
+//tags from all users
+$allPopularTags =& $b2tservice->getPopularTags(null, 5, $logged_on_userid);
+$allPopularTagsCloud =& $b2tservice->tagCloud($allPopularTags, 5, 90, 175);
+$allPopularTagsCount = count($allPopularTags);
+
+
+// function printing the cloud
+function writeTagsProposition($tagsCloud, $title) {
+ echo 'document.write(\'<div class="collapsible">\');';
+ echo 'document.write(\'<h3>'. $title .'<\/h3>\');';
+ echo 'document.write(\'<p id="popularTags" class="tags">\');';
+
+ $taglist = '';
+ foreach(array_keys($tagsCloud) as $key) {
+ $row =& $tagsCloud[$key];
+ $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']);
+ $taglist .= '<span title="'. $row['bCount'] .' '. $entries .'" style="font-size:'. $row['size'] .'" onclick="addTag(this)">'. filter($row['tag']) .'<\/span> ';
+ }
+
+ echo 'document.write(\''. $taglist .'\');';
+ echo 'document.write(\'<\/p>\');';
+ echo 'document.write(\'<\/div>\');';
+
+}
+
+
+if ($allPopularTagsCount > 0 || $userPopularTagsCount > 0 ) { ?>
<script type="text/javascript">
Array.prototype.contains = function (ele) {
@@ -97,22 +123,17 @@ function addTag(ele) {
document.getElementById('tags').focus();
}
-document.write('<div class="collapsible">');
-document.write('<h3><?php echo T_('Popular Tags'); ?><\/h3>');
-document.write('<p id="popularTags" class="tags">');
-
<?php
-$taglist = '';
-foreach(array_keys($userPopularTagsCloud) as $key) {
- $row =& $userPopularTagsCloud[$key];
- $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']);
- $taglist .= '<span title="'. $row['bCount'] .' '. $entries .'" style="font-size:'. $row['size'] .'" onclick="addTag(this)">'. filter($row['tag']) .'<\/span> ';
+if( $userPopularTagsCount > 0) {
+ writeTagsProposition($userPopularTagsCloud, T_('Popular Tags'));
+}
+if( $allPopularTagsCount > 0) {
+ writeTagsProposition($allPopularTagsCloud, T_('Popular Tags From All Users'));
}
+
+
?>
-document.write('<?php echo $taglist ?>');
-document.write('<\/p>');
-document.write('<\/div>');
</script>
<?php