$permission->Redirect(FALSE);
    //Redirect
}
//Debug::setVerbosity(11);
$smarty->assign('title', TTi18n::gettext($title = 'Edit Employee Group'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'id', 'previous_parent_id', 'data')));
$ugf = new UserGroupFactory();
$action = Misc::findSubmitButton();
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $ugf->setId($data['id']);
        $ugf->setCompany($current_company->getId());
        $ugf->setPreviousParent($previous_parent_id);
        $ugf->setParent($data['parent_id']);
        $ugf->setName($data['name']);
        if ($ugf->isValid()) {
            $ugf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'UserGroupList.php'));
            break;
        }
    default:
        $uglf = new UserGroupListFactory();
        $nodes = FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE);
        foreach ($nodes as $node) {
            $parent_list_options[$node['id']] = $node['text'];
        }