function savePreferences(&$source_array, $base_path, $adminidst, $all_admin_permission) { require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php'; $aclManager =& Docebo::user()->getAclManager(); $admin_manager = new AdminManager(); // Retriving main menu $main_area = $this->getLevelOne(); $re = true; while (list($id_page, $area_info) = each($main_area)) { // retriving modules of the main menu $query_menu = "\r\n\t\t\tSELECT idUnder, module_name, default_name, default_op, associated_token, class_file, class_name\r\n\t\t\tFROM " . $this->table_level_two . "\r\n\t\t\tWHERE idMenu = '" . $id_page . "'\r\n\t\t\tORDER BY sequence"; $re_menu = sql_query($query_menu); while (list($id, $modname, $name, $op, $token, $class_file, $class_name) = sql_fetch_row($re_menu)) { if ($class_file != '' || $class_name != '') { require_once $GLOBALS['where_lms'] . '/admin/class.module/' . $class_file; $module = eval("return new {$class_name}();"); // Retriving all token for this module $all_module_token =& $module->getAllToken($op); // Retriving appropiated idst $all_module_idst =& $admin_manager->fromRolePathToIdst($base_path . '/' . $modname, $all_module_token); // Match with the real user permission $module_perm =& $admin_manager->modulePermissionAsToken($all_admin_permission, $all_module_idst); // Retrive new permission $selected_token = $module->getSelectedPermission($source_array, $modname, $op); // Convert selected token to idst $selected_idst =& $admin_manager->convertTokenToIdst($selected_token, $all_module_idst); // Add and remove permission if necessary $token_to_add = array_diff($selected_idst, $module_perm); $token_to_remove = array_diff($module_perm, $selected_idst); $re &= $admin_manager->addRoleToAdmin($token_to_add, $adminidst); $re &= $admin_manager->delRoleToAdmin($token_to_remove, $adminidst); } //end if } //end inner while } //end while return $re; }