Fixing missing configuration settings.

skala
Julio Montoya 12 years ago
parent baf1e53f1f
commit cdb2c013c1
  1. 24
      main/admin/settings.lib.php
  2. 15
      main/admin/settings.php

@ -1042,7 +1042,13 @@ function update_gradebook_score_display_custom_values($values) {
$scoredisplay->update_custom_score_display_settings($final);
}*/
function generate_settings_form($settings, $settings_by_access_list) {
/**
* @param array $settings
* @param array $settings_by_access_list
* @return FormValidator
*/
function generate_settings_form($settings, $settings_by_access_list)
{
global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list;
$table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
@ -1052,7 +1058,7 @@ function generate_settings_form($settings, $settings_by_access_list) {
$url_id = api_get_current_access_url_id();
if (!empty($_configuration['multiple_access_urls']) && api_is_global_platform_admin() && $url_id == 1) {
if (api_is_multiple_url_enabled() && api_is_global_platform_admin() && $url_id == 1) {
$group = array();
$group[] = $form->createElement('button', 'mark_all', get_lang('MarkAll'));
$group[] = $form->createElement('button', 'unmark_all', get_lang('UnmarkAll'));
@ -1061,13 +1067,14 @@ function generate_settings_form($settings, $settings_by_access_list) {
$default_values = array();
$url_info = api_get_access_url($url_id);
$settingsToAvoidKeys = array_filter(array_keys($settings_to_avoid));
foreach ($settings as $row) {
if (in_array($row['variable'], array_keys($settings_to_avoid))) {
if (in_array($row['variable'], $settingsToAvoidKeys)) {
continue;
}
if (!empty($_configuration['multiple_access_urls'])) {
if (api_is_multiple_url_enabled()) {
if (api_is_global_platform_admin()) {
if ($row['access_url_locked'] == 0) {
if ($url_id == 1) {
@ -1108,10 +1115,11 @@ function generate_settings_form($settings, $settings_by_access_list) {
if (empty($row['category']))
$row['category'] = 0;
if (is_array($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ])) {
if (is_array($settings_by_access_list[$row['variable']][ $row['subkey']][ $row['category']])) {
// We are sure that the other site have a selected value.
if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '')
$row['selected_value'] =$settings_by_access_list[$row['variable']] [$row['subkey']] [ $row['category'] ]['selected_value'];
if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '') {
$row['selected_value'] = $settings_by_access_list[$row['variable']][$row['subkey']][ $row['category']]['selected_value'];
}
}
// There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site.
}

@ -41,7 +41,7 @@ api_protect_admin_script();
// Settings to avoid
$settings_to_avoid = array(
'stylesheets' => '', // handled by the handle_stylesheet() function
'server_type',
'server_type' => '',
'use_session_mode' => 'true',
'gradebook_enable' => 'false',
'example_material_course_creation' => 'true' // ON by default - now we have this option when we create a course
@ -93,10 +93,14 @@ $form_search_html = $form_search->return_form();
$url_id = api_get_current_access_url_id();
$settings = null;
/**
* @param string $category
* @return array
*/
function get_settings($category = null)
{
$url_id = api_get_current_access_url_id();
$settings_by_access_list = array();
if ($url_id == 1) {
@ -129,19 +133,24 @@ function get_settings($category = null)
}
}
}
if (isset($category) && $category == 'search_setting') {
if (!empty($_REQUEST['search_field'])) {
$settings = search_setting($_REQUEST['search_field']);
}
}
return array('settings' => $settings, 'settings_by_access_list' => $settings_by_access_list);
return array(
'settings' => $settings,
'settings_by_access_list' => $settings_by_access_list
);
}
// Build the form.
if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))) {
$my_category = isset($_GET['category']) ? $_GET['category'] : null;
$settings_array = get_settings($my_category);
$settings = $settings_array['settings'];
$settings_by_access_list = $settings_array['settings_by_access_list'];
$form = generate_settings_form($settings, $settings_by_access_list);

Loading…
Cancel
Save