/**
     * Returns an overview over the current users of the group
     * 
     * @access private
     * @param integer $GroupID This is the id of the group that should be shown
     * @return string A template for the groupoverview
     */
    function _ViewGroup($GroupID = '')
    {
        // Get external inputs
        if ($GroupID == '') {
            $GroupID = GetPostOrGet('group_id');
        }
        if (!is_numeric($GroupID)) {
            return $this->_HomePage();
        }
        // We are looking for an existing group now so get the groupdata from the database
        $sql = "SELECT *\n\t\t\t\t\tFROM " . DB_PREFIX . "groups\n\t\t\t\t\tWHERE group_id='{$GroupID}'";
        $result = $this->_SqlConnection->SqlQuery($sql);
        $group = mysql_fetch_object($result);
        mysql_free_result($result);
        $this->_ComaLate->SetReplacement('GROUP_NAME', $group->group_name);
        $this->_ComaLate->SetReplacement('GROUP_DESCRIPTION', $group->group_description);
        // Get the current users of the group from the database
        $sql = "SELECT users.user_showname, group_users.user_id\n\t\t\t\t\tFROM " . DB_PREFIX . "group_users group_users\n\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "users users\n\t\t\t\t\tON (group_users.user_id = users.user_id)\n\t\t\t\t\tWHERE group_users.group_id='{$GroupID}'\n\t\t\t\t\tORDER BY users.user_showname ASC";
        $result = $this->_SqlConnection->SqlQuery($sql);
        $users = array();
        while ($user = mysql_fetch_object($result)) {
            // Add users to the array to display
            $users[substr($user->user_showname, 0, 1)]['SUBTITLE'] = substr($user->user_showname, 0, 1);
            $users[substr($user->user_showname, 0, 1)]['USERS'][] = array('USER_ID' => $user->user_id, 'GROUP_ID' => $GroupID, 'USER_NAME' => $user->user_showname, 'USER_REMOVE' => sprintf($this->_Translation->GetTranslation('remove_%user%_from_the_group'), $user->user_showname), 'USER_EDIT' => sprintf($this->_Translation->GetTranslation('edit_%user%'), $user->user_showname));
        }
        // Order the items for two column output
        if (count(array_keys($users)) == 0) {
            // Set groupcontend to empty
            $this->_ComaLate->SetReplacement('GROUP_CONTENT', '<span class="full-size-error">' . $this->_Translation->GetTranslation('no_users') . '</span>');
        } else {
            $users = TwoColumns($users, 'USERS');
            // Check wether we got any entries in column b and build the right template
            if (count(array_keys($users[2])) == 0) {
                $template = '<LISTS:loop>
						<ul style="list-style: none">
							<li>
								<h4>{SUBTITLE}</h4>
								<ul>
									<USERS:loop><li class="group_user_item"><span class="structure_row"><span class="group_actions"><a href="admin.php?page=users&amp;action=edit_user&amp;user_id={USER_ID}"><img src="./img/edit.png" class="icon" height="16" width="16" alt="{USER_EDIT}" title="{USER_EDIT}" /></a><a href="admin.php?page=groups&amp;action=remove_user&amp;user_id={USER_ID}&amp;group_id={GROUP_ID}"><img src="./img/del.png" class="icon" height="16" width="16" alt="{USER_REMOVE}" title="{USER_REMOVE}"/></a></span><strong>{USER_NAME}</strong></span></li></USERS>
								</ul>
							</li>
						</ul>
						</LISTS>';
                $this->_ComaLate->SetReplacement('LISTS', $users[1]);
            } else {
                // Generate a template
                $template = '<div class="column ctwo">
						<LISTS_A:loop>
							<ul style="list-style: none">
								<li>
									<h4>{SUBTITLE}</h4>
									<ul>
										<USERS:loop><li class="group_user_item"><span class="structure_row"><span class="group_actions"><a href="admin.php?page=users&amp;action=edit_user&amp;user_id={USER_ID}"><img src="./img/edit.png" class="icon" height="16" width="16" alt="{USER_EDIT}" title="{USER_EDIT}" /></a><a href="admin.php?page=groups&amp;action=remove_user&amp;user_id={USER_ID}&amp;group_id={GROUP_ID}"><img src="./img/del.png" class="icon" height="16" width="16" alt="{USER_REMOVE}" title="{USER_REMOVE}"/></a></span><strong>{USER_NAME}</strong></span></li></USERS>
									</ul>
								</li>
							</ul>
						</LISTS_A>
						</div>
						<div class="column ctwo">
						<LISTS_B:loop>
							<ul style="list-style: none">
								<li>
									<h4>{SUBTITLE}</h4>
									<ul>
										<USERS:loop><li class="group_user_item"><span class="structure_row"><span class="group_actions"><a href="admin.php?page=users&amp;action=edit_user&amp;user_id={USER_ID}"><img src="./img/edit.png" class="icon" height="16" width="16" alt="{USER_EDIT}" title="{USER_EDIT}" /></a><a href="admin.php?page=groups&amp;action=remove_user&amp;user_id={USER_ID}&amp;group_id={GROUP_ID}"><img src="./img/del.png" class="icon" height="16" width="16" alt="{USER_REMOVE}" title="{USER_REMOVE}" /></a></span><strong>{USER_NAME}</strong></span></li></USERS>
									</ul>
								</li>
							</ul>
						</LISTS_B>
						</div>
						<p class="after_column" />';
                $this->_ComaLate->SetReplacement('LISTS_A', $users[1]);
                $this->_ComaLate->SetReplacement('LISTS_B', $users[2]);
            }
            $this->_ComaLate->SetReplacement('GROUP_CONTENT', $template);
        }
        // Language replacements
        $this->_ComaLate->SetReplacement('LANG_GROUP_NAME', $this->_Translation->GetTranslation('group_name'));
        $this->_ComaLate->SetReplacement('LANG_ADD_USER', $this->_Translation->GetTranslation('add_user'));
        $this->_ComaLate->SetReplacement('LANG_EDIT_GROUP', $this->_Translation->GetTranslation('edit_group'));
        $this->_ComaLate->SetReplacement('LANG_REMOVE_ALL_USERS', $this->_Translation->GetTranslation('remove_all_users'));
        $this->_ComaLate->SetReplacement('GROUP_ID', $GroupID);
        // Generate the template for the page
        $template = '
						<a href="admin.php?page=groups&amp;action=add_user&amp;group_id={GROUP_ID}" class="button">{LANG_ADD_USER}</a>
						<a href="admin.php?page=groups&amp;action=edit_group&amp;group_id={GROUP_ID}" class="button">{LANG_EDIT_GROUP}</a>
						<a href="admin.php?page=groups&amp;action=remove_all_users&amp;group_id={GROUP_ID}" class="button">{LANG_REMOVE_ALL_USERS}</a>
						<h3>{LANG_GROUP_NAME}: {GROUP_NAME}</h3>
						<span class="full-size-info">
							{GROUP_DESCRIPTION}
						</span>
						<br />
						{GROUP_CONTENT}';
        return $template;
    }
    /**
     * Generates the template for the homepage of the usermanagement
     * @access private
     * @return string The template for the home page
     */
    function _HomePage()
    {
        // Get the existing users
        $sql = "SELECT *\n\t\t\t\t\tFROM " . DB_PREFIX . "users";
        $usersResult = $this->_SqlConnection->SqlQuery($sql);
        // Initialize users array
        $users = array();
        while ($user = mysql_fetch_object($usersResult)) {
            $users[substr($user->user_showname, 0, 1)]['SUBTITLE'] = substr($user->user_showname, 0, 1);
            $users[substr($user->user_showname, 0, 1)]['USERS'] = array('USER_ID' => $user->user_id, 'USER_SHOWNAME' => $user->user_showname, 'USER_ADMIN' => $user->user_admin == 1 ? '(' . $this->_Translation->GetTranslation('administrator') . ')' : '', 'USER_COLOR' => $user->user_activated == 1 ? 'green' : 'red', 'USER_EDIT' => sprintf($this->_Translation->GetTranslation('edit_%user%'), $user->user_showname), 'USER_DELETE' => sprintf($this->_Translation->GetTranslation('delete_%user%'), $user->user_showname));
        }
        if (count(array_keys($users)) == 0) {
            // Set empty usercontent
            $this->_ComaLate->SetReplacement('USER_CONTENT', '<span class="full-size-error">' . $this->_Translation->GetTranslation('no_users') . '</span>');
        } else {
            $users = TwoColumns($users, 'USERS');
            // Check wether we got any entries in column b and build the right template
            if (count(array_keys($users[2])) == 0) {
                $template = '<LISTS:loop>
						<ul style="list-style: none">
							<li>
								<h4>{SUBTITLE}</h4>
								<ul>
									<USERS:loop><li class="group_user_item"><span class="structure_row"><span class="group_actions"><a href="admin.php?page=users&amp;action=edit_user&amp;user_id={USER_ID}"><img src="./img/edit.png" class="icon" height="16" width="16" alt="{USER_EDIT}" title="{USER_EDIT}" /></a><a href="admin.php?page=groups&amp;action=remove_user&amp;user_id={USER_ID}&amp;group_id={GROUP_ID}"><img src="./img/del.png" class="icon" height="16" width="16" alt="{USER_REMOVE}" title="{USER_REMOVE}"/></a></span><strong>{USER_NAME}</strong></span></li></USERS>
								</ul>
							</li>
						</ul>
						</LISTS>';
                $this->_ComaLate->SetReplacement('LISTS', $users[1]);
            } else {
                // Generate a template
                $template = '<div class="column ctwo">
						<LISTS_A:loop>
							<ul style="list-style: none">
								<li>
									<h4>{SUBTITLE}</h4>
									<ul>
										<USERS:loop><li class="group_user_item"><span class="structure_row"><span class="group_actions"><a href="admin.php?page=users&amp;action=edit_user&amp;user_id={USER_ID}"><img src="./img/edit.png" class="icon" height="16" width="16" alt="{USER_EDIT}" title="{USER_EDIT}" /></a><a href="admin.php?page=groups&amp;action=remove_user&amp;user_id={USER_ID}&amp;group_id={GROUP_ID}"><img src="./img/del.png" class="icon" height="16" width="16" alt="{USER_REMOVE}" title="{USER_REMOVE}"/></a></span><strong>{USER_NAME}</strong></span></li></USERS>
									</ul>
								</li>
							</ul>
						</LISTS_A>
						</div>
						<div class="column ctwo">
						<LISTS_B:loop>
							<ul style="list-style: none">
								<li>
									<h4>{SUBTITLE}</h4>
									<ul>
										<USERS:loop><li class="group_user_item"><span class="structure_row"><span class="group_actions"><a href="admin.php?page=users&amp;action=edit_user&amp;user_id={USER_ID}"><img src="./img/edit.png" class="icon" height="16" width="16" alt="{USER_EDIT}" title="{USER_EDIT}" /></a><a href="admin.php?page=groups&amp;action=remove_user&amp;user_id={USER_ID}&amp;group_id={GROUP_ID}"><img src="./img/del.png" class="icon" height="16" width="16" alt="{USER_REMOVE}" title="{USER_REMOVE}" /></a></span><strong>{USER_NAME}</strong></span></li></USERS>
									</ul>
								</li>
							</ul>
						</LISTS_B>
						</div>
						<p class="after_column" />';
                $this->_ComaLate->SetReplacement('LISTS_A', $users[1]);
                $this->_ComaLate->SetReplacement('LISTS_B', $users[2]);
            }
            $this->_ComaLate->SetReplacement('USER_CONTENT', $template);
        }
        $template = '';
        return $template;
    }