function myWordsBlockTags($options) { $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mod_mywords_tags") . " ORDER BY RAND() LIMIT 0,{$options['0']}"; $result = $db->query($sql); $block = array(); $max = 0; $min = 0; while ($row = $db->fetchArray($result)) { $tag = new MWTag(); $tag->assignVars($row); $block['tags'][] = array('id' => $tag->id(), 'posts' => $tag->getVar('posts'), 'link' => $tag->permalink(), 'name' => $tag->getVar('tag'), 'size' => $options[1] * $tag->getVar('posts') + 0.9); } RMTemplate::get()->add_style('mwblocks.css', 'mywords'); return $block; }
/** * Get all tags according to given options * return array * @todo Enable objects return */ public function tags($objects = false) { if (empty($this->tags)) { $this->get_tags(); } if (!$objects) { return $this->tags; } $tags = array(); foreach ($this->tags as $data) { $tag = new MWTag(); $tag->assignVars($data); $tags[] = $tag; } return $tags; }