Back to PhocaGalleryAccess class

Method usersListOwner

public static
usersListOwner
(mixed $name, mixed $id, mixed $active, mixed $nouser = 0, mixed $javascript = NULL, mixed $order = 'name', mixed $reg = 1, mixed $returnArray = 0)

Method usersListOwner - Source code

/*
 * Get list of users to select Owner of the category
 */
public static function usersListOwner($name, $id, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1, $returnArray = 0)
{
    $db = Factory::getDBO();
    $and = '';
    if ($reg) {
        // does not include registered users in the list
        $and = ' AND m.group_id != 2';
    }
    $query = 'SELECT u.id AS value, u.name AS text' . ' FROM #__users AS u' . ' JOIN #__user_usergroup_map AS m ON m.user_id = u.id' . ' WHERE u.block = 0' . $and . ' GROUP BY u.id, u.name' . ' ORDER BY ' . $order;
    $db->setQuery($query);
    if ($nouser) {
        $idInput1 = -1;
        $idText1 = Text::_('COM_PHOCAGALLERY_NOBODY');
        $users[] = HTMLHelper::_('select.option', -1, '- ' . $idText1 . ' -');
        $users = array_merge($users, $db->loadObjectList());
    } else {
        $users = $db->loadObjectList();
    }
    if ($returnArray == 1) {
        return $users;
    }
    $users = HTMLHelper::_('select.genericlist', $users, $name, 'class="form-control" size="4" ' . $javascript, 'value', 'text', $active, $id);
    return $users;
}