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
This commit is contained in:
parent
013ba82313
commit
ef4fd0ad27
1 changed files with 51 additions and 30 deletions
|
@ -24,12 +24,38 @@ $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);
|
||||
$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
|
||||
|
|
Loading…
Reference in a new issue