1 | <?php |
---|
2 | |
---|
3 | global $page, $template; |
---|
4 | |
---|
5 | $query = ' |
---|
6 | SELECT t.id , tt.color |
---|
7 | FROM ' . typetags_TABLE . ' AS tt |
---|
8 | INNER JOIN ' . TAGS_TABLE . ' AS t |
---|
9 | ON t.id_typetags = tt.id |
---|
10 | WHERE t.id_typetags IS NOT NULL ;'; |
---|
11 | |
---|
12 | $result = pwg_query($query); |
---|
13 | $tagsColor = array(); |
---|
14 | while ($row = mysql_fetch_assoc($result)) |
---|
15 | { |
---|
16 | $tagsColor[$row['id']] = $row['color']; |
---|
17 | } |
---|
18 | $display = $template->get_template_vars('display_mode'); |
---|
19 | |
---|
20 | if ($display == 'letters') |
---|
21 | { |
---|
22 | $letters = $template->get_template_vars('letters'); |
---|
23 | if (empty($letters)) return; |
---|
24 | $template->clear_assign('letters'); |
---|
25 | |
---|
26 | foreach ($letters as $k1 => $letter) |
---|
27 | { |
---|
28 | foreach ($letter['tags'] as $k2 => $tag) |
---|
29 | { |
---|
30 | if (isset($tagsColor[$tag['id']])) |
---|
31 | { |
---|
32 | $letters[$k1]['tags'][$k2]['URL'] .= '" style="color:' . $tagsColor[$tag['id']]; |
---|
33 | } |
---|
34 | } |
---|
35 | } |
---|
36 | $template->assign('letters', $letters); |
---|
37 | } |
---|
38 | elseif ($display == 'cloud') |
---|
39 | { |
---|
40 | $tags = $template->get_template_vars('tags'); |
---|
41 | if (empty($tags)) return; |
---|
42 | $template->clear_assign('tags'); |
---|
43 | |
---|
44 | foreach ($tags as $key => $tag) |
---|
45 | { |
---|
46 | if (isset($tagsColor[$tag['id']])) |
---|
47 | { |
---|
48 | $tags[$key]['URL'] .= '" style="color:' . $tagsColor[$tag['id']]; |
---|
49 | } |
---|
50 | } |
---|
51 | $template->assign('tags', $tags); |
---|
52 | } |
---|
53 | elseif ($display == 'cumulus') |
---|
54 | { |
---|
55 | $tags = $template->get_template_vars('tags'); |
---|
56 | if (empty($tags)) return; |
---|
57 | $template->clear_assign('tags'); |
---|
58 | |
---|
59 | foreach ($tags as $key => $tag) |
---|
60 | { |
---|
61 | if (isset($tagsColor[$tag['id']])) |
---|
62 | { |
---|
63 | $tagsColor[$tag['id']] = str_replace('#', '0x', $tagsColor[$tag['id']]); |
---|
64 | $tags[$key]['URL'] .= '\' color=\'' . $tagsColor[$tag['id']] . '\' hicolor=\'' . $tagsColor[$tag['id']]; |
---|
65 | } |
---|
66 | } |
---|
67 | $template->assign('tags', $tags); |
---|
68 | } |
---|
69 | |
---|
70 | // Suppression des liens soulignés |
---|
71 | $template->block_html_head('', '<style type="text/css">#fullTagCloud a, .tagLetter a { border: none; }</style>', $smarty, $repeat); |
---|
72 | |
---|
73 | ?> |
---|