Back to PhocaGalleryTag class

Method getTags

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

Method getTags - Source code

public static function getTags($imgId, $select = 0)
{
    $db = Factory::getDBO();
    if ($select == 1) {
        $query = 'SELECT r.tagid';
    } else {
        $query = 'SELECT a.*';
    }
    $query .= ' FROM #__phocagallery_tags AS a' . ' LEFT JOIN #__phocagallery_tags_ref AS r ON a.id = r.tagid' . ' WHERE r.imgid = ' . (int) $imgId . ' ORDER BY a.id';
    $db->setQuery($query);
    if ($select == 1) {
        $tags = $db->loadColumn();
    } else {
        $tags = $db->loadObjectList();
    }
    return $tags;
}