$disableFieldsDesc = '';
        if ($disableFields) {
            $disableFieldsDesc = "{\n\t\t\t\tcls:\t'atm-text-alert',\n\t\t\t\thtml:\t'{$cms_language->getJSMessage(MESSAGE_PAGE_NO_RIGHTS_MODIFY)}'\n\t\t\t},";
        }
    }
} else {
    $disableFields = false;
    $disableFieldsDesc = '';
    if ($profile->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
        $disableFields = true;
        $moduleClearance = CLEARANCE_MODULE_EDIT;
        $disableFieldsDesc = "{\n\t\t\tcls:\t'atm-text-alert',\n\t\t\thtml:\t'{$cms_language->getJSMessage(MESSAGE_PAGE_GROUP_ADMINISTRATOR_MODULE)}'\n\t\t},";
    }
}
//Module clearances
$allclearances = CMS_profile::getAllModuleClearances();
$moduleAccess = '';
foreach ($allclearances as $clearance => $messages) {
    $standardDisableNone = false;
    if ($moduleCodename == MOD_STANDARD_CODENAME && $clearance == CLEARANCE_PAGE_NONE) {
        $standardDisableNone = true;
    }
    $moduleAccess .= "{\n\t\tboxLabel:\t\t'<span ext:qtip=\"" . $cms_language->getJSMessage($messages['description']) . "\" class=\"atm-help\">" . $cms_language->getJSMessage($messages['label']) . "</span>',\n\t\tname:\t\t\t'{$moduleCodename}-access-{$profileId}',\n\t\t" . ($clearance == CLEARANCE_MODULE_NONE ? "id:'{$moduleCodename}-access-{$profileId}'," : '') . "\n\t\tinputValue:\t\t" . $clearance . ",\n\t\tchecked:\t\t" . ($moduleClearance == $clearance ? 'true' : 'false') . ",\n\t\tdisabled:\t\t" . ($standardDisableNone || $disableFields || !$cms_user->hasModuleClearance($moduleCodename, $clearance) ? 'true' : 'false') . "\n\t},";
}
//validations clearance
$moduleAccess .= "{\n\tboxLabel:\t\t'<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_AUTH_VALIDATION_USER_ADMINISTRATOR) . "\" class=\"atm-help\">" . $cms_language->getJSMessage(MESSAGE_PAGE_VALIDATION_RIGHTS) . "</span>',\n\tid:\t\t\t\t'{$moduleCodename}-validate-{$profileId}',\n\tinputValue:\t\t'1',\n\txtype:\t\t\t'checkbox',\n\tchecked:\t\t" . ($profile->hasValidationClearance($moduleCodename) ? 'true' : 'false') . ",\n\tdisabled:\t\t" . ($disableFields || !$cms_user->hasValidationClearance($moduleCodename) ? 'true' : 'false') . "\n}";
$moduleAccessSubmit = '';
if (!$disableFields) {
    $moduleAccessSubmit = ",buttons:[{\n\t\ttext:\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_SAVE) . "',\n\t\ticonCls:\t\t'atm-pic-validate',\n\t\txtype:\t\t\t'button',\n\t\tanchor:\t\t\t'',\n\t\thandler:\t\tfunction() {\n\t\t\tvar access = Ext.getCmp('{$moduleCodename}-access-{$profileId}');\n\t\t\tvar validation = Ext.getCmp('{$moduleCodename}-validate-{$profileId}');\n\t\t\tAutomne.server.call('{$controler}', Ext.emptyFn, {\n\t\t\t\tuserId:\t\t\t'{$userId}',\n\t\t\t\tgroupId:\t\t'{$groupId}',\n\t\t\t\taction:\t\t\t'module-rights',\n\t\t\t\taccess:\t\t\taccess.getGroupValue(),\n\t\t\t\tvalidation:\t\t(validation.getValue() ? 1 : 0),\n\t\t\t\tmodule:\t\t\t'{$moduleCodename}'\n\t\t\t});\n\t\t}\n\t}]";
}
$maxDepth = sensitiveIO::isPositiveInteger(CMS_session::getSessionVar("modules_clearances_max_depth")) ? CMS_session::getSessionVar("modules_clearances_max_depth") : 3;