function countGroups($type = 0)
{
if ($type > 0) {
if (isset($this->groups[$type])) {
return count($this->groups[$type]);
}
} else {
if (count($this->groups)) {
$count = 0;
foreach ($this->groups as $u) {
$count += count($u);
}
return $count;
}
}
return 0;
}