/** * Removes all users from a group after asking for confirmation * * @access private * @return string A template for the confirmation formular */ function _RemoveAllUsers() { // Get external parameters $GroupID = GetPostOrGet('group_id'); $Confirmation = GetPostOrGet('confirmation'); if ($GroupID != 0 && $Confirmation == 1) { // we got a group... check wether it got any users and if remove all of them $sql = 'SELECT * FROM ' . DB_PREFIX . "group_users\n\t\t\t\t\t\tWHERE group_id='{$GroupID}'"; $result = $this->_SqlConnection->SqlQuery($sql); if (mysql_fetch_object($result)) { // The group got some users... remove them! mysql_free_result($result); $sql = 'DELETE FROM ' . DB_PREFIX . "group_users\n\t\t\t\t\t\t\tWHERE group_id='{$GroupID}'"; $this->_SqlConnection->SqlQuery($sql); $template = "\r\n\t\t\t\t" . $this->_ViewGroup($GroupID); return $template; } else { // Nothing to do... there are no users in the group... $template = "\r\n\t\t\t\t" . $this->_ViewGroup($GroupID); return $template; } } elseif ($GroupID != 0) { // Get some information about the group $sql = 'SELECT group_name FROM ' . DB_PREFIX . "groups\n\t\t\t\t\t\tWHERE group_id={$GroupID}"; $result = $this->_SqlConnection->SqlQuery($sql); $group = mysql_fetch_object($result); $group = $group->group_name; mysql_free_result($result); // Generate a formular to find a new user for the group $formMaker = new FormMaker($this->_Translation->GetTranslation('todo'), $this->_SqlConnection); $formMaker->AddForm('remove_all_users', 'admin.php', $this->_Translation->GetTranslation('remove'), $this->_Translation->GetTranslation('remove_all_users'), 'post'); $formMaker->AddHiddenInput('remove_all_users', 'page', 'groups'); $formMaker->AddHiddenInput('remove_all_users', 'action', 'remove_all_users'); $formMaker->AddHiddenInput('remove_all_users', 'group_id', $GroupID); $formMaker->AddInput('remove_all_users', 'confirmation', 'select', $this->_Translation->GetTranslation('remove_users'), sprintf($this->_Translation->GetTranslation('do_you_really_want_to_remove_all_users_from_the_group_%group%?'), $group)); $formMaker->AddSelectEntry('remove_all_users', 'confirmation', true, 0, $this->_Translation->GetTranslation('no')); $formMaker->AddSelectEntry('remove_all_users', 'confirmation', false, 1, $this->_Translation->GetTranslation('yes')); // Generate the template to correct the inputs $template = "\r\n\t\t\t\t" . $formMaker->GenerateSingleFormTemplate($this->_ComaLate, false); return $template; } else { // Set the user back to the homepage $template = "\r\n\t\t\t\t" . $this->_HomePage(); return $template; } }