1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: class Jonah_Block_Cloud extends Horde_Core_Block
13: {
14: 15:
16: public function __construct($app, $params = array())
17: {
18: parent::__construct($app, $params);
19:
20: $this->_name = _("Tag Cloud");
21: }
22:
23: 24:
25: protected function _params()
26: {
27: return array(
28: 'results_url' => array(
29: 'name' => _("Results URL"),
30: 'type' => 'text',
31: 'default' => Horde::url('stories/results.php?tag_id=@id@'),
32: ),
33: );
34: }
35:
36: protected function _content()
37: {
38:
39: $tags = $GLOBALS['injector']->getInstance('Jonah_Driver')->listTagInfo();
40: if (count($tags)) {
41: $cloud = new Horde_Core_Ui_TagCloud();
42: foreach ($tags as $id => $tag) {
43: $cloud->addElement($tag['tag_name'], str_replace(array('@id@', '@tag@'), array($id, $tag['tag_name']), $this->_params['results_url']), $tag['total']);
44: }
45: $html = $cloud->buildHTML();
46: } else {
47: $html = '';
48: }
49:
50: return $html;
51: }
52: }
53: