Overview

Packages

  • Jonah
  • None

Classes

  • Jonah_Application
  • Jonah_Block_Cloud
  • Jonah_Block_Delivery
  • Jonah_Block_News
  • Jonah_Block_NewsPopular
  • Jonah_Block_Story
  • Jonah_View_Base
  • Jonah_View_DeliveryHtml
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Display Tag Cloud
 4:  *
 5:  * Copyright 2007-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file COPYING for license information (GPL). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/gpl.
 9:  *
10:  * @author  Michael Rubinsky <mrubinsk@horde.org>
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:         /* Get the tags */
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: 
API documentation generated by ApiGen