$g = (int) substr($g, 2); sotf_Group::setGroup($uid, $g, 1); debug("TYPE", gettype($g)); debug("ADD {$g}", $uGroups[$g]); unset($uGroups[$g]); debug("after REMOVING {$g}", $uGroups); } } // remove unchecked items debug("U2", $uGroups); foreach ($uGroups as $gid => $rid) { sotf_Group::setGroup($uid, $gid, 0, $rid); } $page->redirect("closeAndRefresh.php"); exit; } // close $close = sotf_Utils::getParameter('close'); if ($close) { $page->redirect("closeAndRefresh.php"); exit; } // generate output $uGroups = sotf_Group::listGroupsOfUser($uid); $groups = sotf_Group::listAll(0); foreach ($groups as $g) { $g['rid'] = $uGroups[$g['id']]; $glist[] = $g; } $smarty->assign('GROUPS', $glist); $page->sendPopup();