root/devel/mod/search/lib/tags_display_personal.php

Revision 1552, 1.5 kB (checked in by misja, 1 year ago)

Misja Hoebe <misja@curverider.co.uk> Typo, fixes #306

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 <?php
2 global $CFG;
3 // Display a user's tags
4
5 global $page_owner; // logged in user
6 $parameter = (int) $parameter; // user whose tags we're looking at
7
8 $searchline = "(" . run("users:access_level_sql_where",$page_owner) . ")";
9 $searchline = str_replace("access","t.access", $searchline);
10 if ($tags = get_records_sql('SELECT tag, count(ident) AS number
11                              FROM '.$CFG->prefix.'tags t
12                              WHERE '.$searchline.' AND owner = '.$parameter.'
13                              GROUP BY tag ASC')) {
14     $max = 0;
15     foreach($tags as $tag) {
16         if ($tag->number > $max) {
17             $max = $tag->number;
18         }
19     }
20    
21     $tag_count = 0;
22     $run_result .= "<div id=\"tagcloud\"><p>";
23     foreach($tags as $tag) {
24        
25         if ($max > 1) {
26             $size = round((log($tag->number) / log($max)) * 200) + 100;
27         } else {
28             $size = 100;
29         }
30        
31         $tag->tag = stripslashes($tag->tag);
32         $run_result .= "<a href=\"".url."search/index.php?all=".urlencode(htmlspecialchars((($tag->tag)), ENT_COMPAT, 'utf-8'))."&amp;owner=$parameter\" style=\"font-size: $size%\" title=\"".htmlspecialchars($tag->tag, ENT_COMPAT, 'utf-8')." (" .$tag->number. ")\">";
33         $run_result .= $tag->tag . "</a>";
34         if ($tag_count < sizeof($tags) - 1) {
35             $run_result .= ", ";
36         }
37         $tag_count++;
38     }
39     $run_result .= "</p></div>";
40    
41 } else {
42     $run_result .= "<p>" . __gettext("No tags found for this user.") . "</p>";
43 }
44
45 ?>
Note: See TracBrowser for help on using the browser.