public function getUserCount($RoleID, $UsersOnlyWithThisRole = false)
{
if ($UsersOnlyWithThisRole) {
$Data = $this->SQL->select('ur.UserID', 'count', 'UserCount')->from('UserRole ur')->join('UserRole urs', 'ur.UserID = urs.UserID')->groupBy('urs.UserID')->having('count(urs.RoleID) =', '1', true, false)->where('ur.RoleID', $RoleID)->get()->firstRow();
return $Data ? $Data->UserCount : 0;
} else {
return $this->SQL->getCount('UserRole', array('RoleID' => $RoleID));
}
}