Back to PhocaDownloadTag class

Method getTags

public static
getTags
(mixed $fileId, mixed $select = 0)

Method getTags - Source code

public static function getTags($fileId, $select = 0)
{
    $db = Factory::getDBO();
    if ($select == 1) {
        $query = 'SELECT r.tagid';
    } else {
        $query = 'SELECT a.*';
    }
    $query .= ' FROM #__phocadownload_tags AS a' . ' LEFT JOIN #__phocadownload_tags_ref AS r ON a.id = r.tagid' . ' WHERE r.fileid = ' . (int) $fileId . ' ORDER BY a.id';
    $db->setQuery($query);
    /*if (!$db->query()) {
    			echo PhocaDownloadException::renderErrorInfo('Database Error - Getting Selected Tags');
    			return false;
    		}*/
    if ($select == 1) {
        $tags = $db->loadColumn();
    } else {
        $tags = $db->loadObjectList();
    }
    return $tags;
}