/** * Takes in the request params from a save request and processes * them for the save. * * @param REQUEST params $params */ function saveTabGroups($params) { $tabGroups = array(); $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language']; for ($count = 0; isset($params['slot_' . $count]); $count++) { if ($params['delete_' . $count] == 1) { continue; } $index = $params['slot_' . $count]; $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time(); $labelValue = $params['tablabel_' . $index]; if (empty($GLOBALS['app_strings'][$labelID]) || $GLOBALS['app_strings'][$labelID] != $labelValue) { $contents = return_custom_app_list_strings_file_contents($selected_lang); $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents); save_custom_app_list_strings_contents($new_contents, $selected_lang); $app_strings[$labelID] = $labelValue; } $tabGroups[$labelID] = array('label' => $labelID); $tabGroups[$labelID]['modules'] = array(); for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) { $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount]; } } sugar_cache_put('app_strings', $GLOBALS['app_strings']); $newFile = create_custom_directory('include/tabConfig.php'); write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile); $GLOBALS['tabStructure'] = $tabGroups; }
/** * Takes in the request params from a save request and processes * them for the save. * * @param REQUEST params $params */ function saveTabGroups($params) { //#30205 global $sugar_config; //Get the selected tab group language $grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language']; $tabGroups = array(); $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language']; $slot_count = $params['slot_count']; $completedIndexes = array(); for ($count = 0; $count < $slot_count; $count++) { if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) { continue; } $index = $params['slot_' . $count]; if (isset($completedIndexes[$index])) { continue; } $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time(); $labelValue = $params['tablabel_' . $index]; $app_strings = return_application_language($grouptab_lang); if (empty($app_strings[$labelID]) || $app_strings[$labelID] != $labelValue) { $contents = return_custom_app_list_strings_file_contents($grouptab_lang); $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents); save_custom_app_list_strings_contents($new_contents, $grouptab_lang); $languages = get_languages(); foreach ($languages as $language => $langlabel) { if ($grouptab_lang == $language) { continue; } $app_strings = return_application_language($language); if (!isset($app_strings[$labelID])) { $contents = return_custom_app_list_strings_file_contents($language); $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents); save_custom_app_list_strings_contents($new_contents, $language); } } $app_strings[$labelID] = $labelValue; } $tabGroups[$labelID] = array('label' => $labelID); $tabGroups[$labelID]['modules'] = array(); for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) { $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount]; } $completedIndexes[$index] = true; } // Force a rebuild of the app language sugar_cache_clear('app_strings.' . $grouptab_lang); $newFile = create_custom_directory('include/tabConfig.php'); write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile); $GLOBALS['tabStructure'] = $tabGroups; }
/** * Takes in the request params from a save request and processes * them for the save. * * @param REQUEST params $params */ function saveTabGroups($params) { //#30205 global $sugar_config; if (strcmp($params['other_group_tab_displayed'], '1') == 0) { $value = true; } else { $value = false; } if (!isset($sugar_config['other_group_tab_displayed']) || $sugar_config['other_group_tab_displayed'] != $value) { require_once 'modules/Configurator/Configurator.php'; $cfg = new Configurator(); $cfg->config['other_group_tab_displayed'] = $value; $cfg->handleOverride(); } //Get the selected tab group language $grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language']; $tabGroups = array(); $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language']; $slot_count = $params['slot_count']; $completedIndexes = array(); for ($count = 0; $count < $slot_count; $count++) { if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) { continue; } $index = $params['slot_' . $count]; if (isset($completedIndexes[$index])) { continue; } $labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time(); $labelValue = $params['tablabel_' . $index]; $appStirngs = return_application_language($grouptab_lang); if (empty($appStirngs[$labelID]) || $appStirngs[$labelID] != $labelValue) { $contents = return_custom_app_list_strings_file_contents($grouptab_lang); $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents); save_custom_app_list_strings_contents($new_contents, $grouptab_lang); $languages = get_languages(); foreach ($languages as $language => $langlabel) { if ($grouptab_lang == $language) { continue; } $appStirngs = return_application_language($language); if (!isset($appStirngs[$labelID])) { $contents = return_custom_app_list_strings_file_contents($language); $new_contents = replace_or_add_app_string($labelID, $labelValue, $contents); save_custom_app_list_strings_contents($new_contents, $language); } } $app_strings[$labelID] = $labelValue; } $tabGroups[$labelID] = array('label' => $labelID); $tabGroups[$labelID]['modules'] = array(); for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) { $tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount]; } $completedIndexes[$index] = true; } sugar_cache_put('app_strings', $GLOBALS['app_strings']); $newFile = create_custom_directory('include/tabConfig.php'); write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile); $GLOBALS['tabStructure'] = $tabGroups; }