/** * @return CloudGlueTag[] */ function getTags() { $result = DAO_CloudGlue::getTagsOnContents(array($this->id), CerberusApplication::INDEX_TICKETS); $tags = array_shift($result); return $tags; }
/** * @param array $content_ids * @param string $index_name * @return CloudGlueTag[] */ static function getTagsOnContents($content_ids, $index_name) { if (!is_array($content_ids)) { $content_ids = array($content_ids); } $db = DevblocksPlatform::getDatabaseService(); $ids = array(); $index_id = DAO_CloudGlue::lookupIndex($index_name); if (empty($index_id)) { return array(); } $sql = sprintf("SELECT tc.tag_id, tc.content_id " . "FROM tag_to_content tc " . "WHERE tc.content_id IN (%s) " . "AND tc.index_id = %d ", implode(',', $content_ids), $index_id); $rs = $db->Execute($sql) or die(__CLASS__ . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ while (!$rs->EOF) { $content_id = intval($rs->fields['content_id']); $tag_id = intval($rs->fields['tag_id']); if (!isset($ids[$content_id])) { $ids[$content_id] = array(); } $ids[$content_id][] = $tag_id; $rs->MoveNext(); } if (empty($ids)) { return array(); } $content_tags = array(); foreach ($ids as $content_id => $tags) { $content_tags[$content_id] = DAO_CloudGlue::getTags($tags); } return $content_tags; }
function getPathTagInfo() { $tags = DAO_CloudGlue::getCloudTags($this->cfg->indexName, $this->getPath()); return array('tags' => $tags[0], 'weights' => $tags[1], 'font_weights' => $this->scaleWeights($tags[1])); }