public function getData()
{
$TagQuery = Gdn::sql();
$this->autoContext();
$TagCacheKey = "TagModule-{$this->ParentType}-{$this->ParentID}";
switch ($this->ParentType) {
case 'Discussion':
$Tags = TagModel::instance()->getDiscussionTags($this->ParentID, false);
break;
case 'Category':
$TagQuery->join('TagDiscussion td', 't.TagID = td.TagID')->select('COUNT(DISTINCT td.TagID)', '', 'NumTags')->where('td.CategoryID', $this->ParentID)->groupBy('td.TagID')->cache($TagCacheKey, 'get', array(Gdn_Cache::FEATURE_EXPIRY => 120));
break;
case 'Global':
$TagCacheKey = 'TagModule-Global';
$TagQuery->where('t.CountDiscussions >', 0, false)->cache($TagCacheKey, 'get', array(Gdn_Cache::FEATURE_EXPIRY => 120));
if ($this->CategorySearch) {
$TagQuery->where('t.CategoryID', '-1');
}
break;
}
if (isset($Tags)) {
$this->_TagData = new Gdn_DataSet($Tags, DATASET_TYPE_ARRAY);
} else {
$this->_TagData = $TagQuery->select('t.*')->from('Tag t')->orderBy('t.CountDiscussions', 'desc')->limit(25)->get();
}
$this->_TagData->datasetType(DATASET_TYPE_ARRAY);
}