1: <?php
2: 3: 4: 5:
6: class Horde_Block_Cloud extends Horde_Core_Block
7: {
8: 9:
10: public function __construct($app, $params = array())
11: {
12: parent::__construct($app, $params);
13: $this->_name = _("Tag Cloud");
14: }
15:
16: 17:
18: protected function _content()
19: {
20: $cloud = new Horde_Core_Ui_TagCloud();
21: foreach ($this->_getTags() as $tag) {
22: $cloud->addElement(
23: $tag['tag_name'], '#', $tag['count'], null,
24: 'doSearch(\'' . $tag['tag_name'] . '\');');
25: }
26:
27: Horde::startBuffer();
28: include HORDE_TEMPLATES . '/block/cloud.inc';
29:
30: return Horde::endBuffer()
31: . '<div> '
32: . Horde::img('loading.gif', '', array('style' => 'display:none;', 'id' => 'cloudloadingimg'))
33: . '</div>' . $cloud->buildHTML()
34: . '<div id="cloudsearch"></div>';
35: }
36:
37: 38:
39: private function _getTags()
40: {
41: $results = array();
42: foreach ($GLOBALS['registry']->listAPIs() as $api) {
43: if ($GLOBALS['registry']->hasMethod($api . '/listTagInfo')) {
44: try {
45: $results = array_merge(
46: $results,
47: $GLOBALS['registry']->call($api . '/listTagInfo', array(null, $GLOBALS['registry']->getAuth())));
48: } catch (Horde_Exception $e) {}
49: }
50: }
51:
52: return $results;
53: }
54:
55: }
56: