Back to PhocaGalleryCommentImage class

Method displayComment

public static
displayComment
(mixed $imgid)

Method displayComment - Source code

public static function displayComment($imgid)
{
    $db = Factory::getDBO();
    $query = 'SELECT co.id AS id, co.title AS title, co.comment AS comment, co.date AS date, u.name AS name, u.username AS username, uc.avatar AS avatar' . ' FROM #__phocagallery_img_comments AS co' . ' LEFT JOIN #__users AS u ON u.id = co.userid' . ' LEFT JOIN #__phocagallery_user AS uc ON uc.userid = u.id' . ' WHERE ' . ' CASE WHEN avatar IS NOT NULL THEN' . ' co.imgid = ' . (int) $imgid . ' AND co.published = 1' . ' AND uc.published = 1' . ' AND uc.approved = 1' . ' ELSE' . ' co.imgid = ' . (int) $imgid . ' AND co.published = 1' . ' END' . ' ORDER by co.ordering';
    $db->setQuery($query);
    $commentItem = $db->loadObjectList();
    return $commentItem;
}