public function fetchCloud($sql) { $cloud = new Zend_Tag_Cloud(); if ($sql instanceof Zend_Db_Select) { $sql->order(new Zend_Db_Expr('RAND()')); } foreach ($this->fetchAll($sql) as $tag) { $cloud->appendTag($tag); } return $cloud; }
public function mostUsedTags() { $tags = $this->_getModel()->getMostUsedTags(); if (count($tags) < 1) { return false; } $cloud = new Zend_Tag_Cloud(array('cloudDecorator' => new PPN_View_Helper_DivCloud(), 'tagDecorator' => new PPN_View_Helper_SpanTag())); foreach ($tags as $tag) { $cloud->appendTag(array('title' => $tag->title, 'weight' => $tag->num, 'params' => array('url' => '/oznaka/' . $tag->slug . '/strana/1'))); } return $cloud; }
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; }
function format_surname_tagcloud($surnames, $script, $totals) { $cloud = new Zend_Tag_Cloud(array('tagDecorator' => array('decorator' => 'HtmlTag', 'options' => array('htmlTags' => array(), 'fontSizeUnit' => '%', 'minFontSize' => 80, 'maxFontSize' => 250)), 'cloudDecorator' => array('decorator' => 'HtmlCloud', 'options' => array('htmlTags' => array('div' => array('class' => 'tag_cloud')))))); foreach ($surnames as $surn => $surns) { foreach ($surns as $spfxsurn => $indis) { $cloud->appendTag(array('title' => $totals ? WT_I18N::translate('%1$s (%2$d)', '<span dir="auto">' . $spfxsurn . '</span>', count($indis)) : $spfxsurn, 'weight' => count($indis), 'params' => array('url' => $surn ? $script . '?surname=' . urlencode($surn) . '&ged=' . WT_GEDURL : $script . '?alpha=,&ged=' . WT_GEDURL))); } } return (string) $cloud; }
protected function _getCloud($options = null, $setPluginLoader = true) { $cloud = new Zend_Tag_Cloud($options); if ($setPluginLoader) { $cloud->getPluginLoader()->addPrefixPath('Zend_Tag_Cloud_Decorator_Dummy_', dirname(__FILE__) . '/_classes'); } return $cloud; }