source: extensions/typetags/typetags.php @ 9752

Last change on this file since 9752 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

File size: 1.8 KB
Line 
1<?php
2
3global $page, $template;
4
5$query = '
6SELECT  t.id , tt.color
7FROM ' . typetags_TABLE . ' AS tt
8INNER JOIN ' . TAGS_TABLE . ' AS t
9ON  t.id_typetags = tt.id
10WHERE  t.id_typetags IS NOT NULL ;';
11
12$result = pwg_query($query);
13$tagsColor = array();
14while ($row = mysql_fetch_assoc($result))
15{
16  $tagsColor[$row['id']] = $row['color'];
17}
18$display = $template->get_template_vars('display_mode');
19
20if ($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}
38elseif ($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}
53elseif ($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?>
Note: See TracBrowser for help on using the repository browser.