public function tagCloud($tag = null) { if ($tag) { $tags = Stoa_Model_Tag::getRelatedTags($tag); } else { $tags = Stoa_Model_Tag::getPopularTags(); } if (empty($tags)) { return; } $minWeight = min($tags); $maxWeight = max($tags); $cloud = new Zend_Tag_Cloud(); foreach ($tags as $tagName => $tagWeight) { $cloud->appendTag(array('title' => $tagName, 'weight' => $tagWeight, 'params' => array('url' => $this->view->baseUrl . '/tag/' . urlencode($tagName)))); } $cloud->getCloudDecorator()->setHtmlTags(array('ul' => array('class' => 'tag-cloud'))); $cloud->getTagDecorator()->setOptions(array('fontSizeUnit' => '%', 'maxFontSize' => 200, 'minFontSize' => 100)); return (string) $cloud; }
protected function _editBefore($scope) { $data = $this->getModel()->getOne($this->_getParam('id', 0)); if (is_null($data)) { $this->notFoundException(); } $this->getForm()->isValid($data->toArray()); $this->view->item = $data; $tags = array(); for ($i = 1; $i < 10; $i++) { $tags[] = array('title' => 'WeightTitle ' . $i, 'weight' => $i); } $cloud = new Zend_Tag_Cloud(); $cloud->setTags($tags); /* ($cloud->getCloudDecorator()->setHtmlTags(array( 'div' => array('class' => 'Zend_Tag_Cloud') )));*/ $cloud->setTagDecorator(new Tag_Cloud_Decorator_HtmlTagWithoutLinks()); $cloud->getCloudDecorator()->setHtmlTags(array('ul' => array('id' => 'tagsSource', 'class' => 'tagCloud'))); $this->view->tags = $cloud; }