$role_actions = array(); $role = new role(); $role->id_role = $id; if ($id > 0) { if (!$role->Load()) { $role->id_role = 0; } else { $role_actions = $role->GetRoleActionsId(); $role_actions = array_flip($role_actions); $role_variables = $role->GetRoleVariablesId(); $role_variables = array_flip($role_variables); } } // Получаем все типы дополнительных полей и сами поля $variable = new variable(); $variable_modules = $variable->GetModules(); reset($variable_modules); $variables = array(); while (list($variable_module, $variable_module_name) = each($variable_modules)) { $variable_modules[$variable_module] = array(); $variable_modules[$variable_module]['name'] = $variable_module_name; $variable_modules[$variable_module]['vars'] = array(); $variables = new collection(); $variables->Load(TABLE_VARIABLE, false, '"module"=\'' . db_class::str2base($variable_module) . '\'', '"name" ASC'); $variable_modules[$variable_module]['vars'] = $variables->_collection; } // Получаем все модули и все операции, связанные с ними $modules = new collection(); $modules->Load(TABLE_MODULE, false, '', '"name" ASC'); $modules = $modules->_collection; $module_actions = array();