diff --git a/main/admin/settings.php b/main/admin/settings.php index e0be93b182..3455503bfd 100755 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -153,7 +153,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' } switch ($row['type']) { - case 'textfield': + case 'textfield': if ($row['variable'] == 'account_valid_duration') { $form->addElement('text', $row['variable'], get_lang($row['comment']), array('maxlength' => '5')); $form->applyFilter($row['variable'], 'html_filter'); @@ -192,9 +192,19 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' $default_values[$row['variable']] = $row['selected_value']; } break; - case 'textarea': - $form->addElement('textarea', $row['variable'], get_lang($row['comment']) , array('rows'=>'10','cols'=>'50'), $hideme); - $default_values[$row['variable']] = $row['selected_value']; + case 'textarea': + if ($row['variable'] == 'header_extra_content') { + $file = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content'; + $value = ''; + if (file_exists($file)) { + $value = file_get_contents($file); + } + $form->addElement('textarea', $row['variable'], get_lang($row['comment']) , array('rows'=>'10','cols'=>'50'), $hideme); + $default_values[$row['variable']] = $value; + } else { + $form->addElement('textarea', $row['variable'], get_lang($row['comment']) , array('rows'=>'10','cols'=>'50'), $hideme); + $default_values[$row['variable']] = $row['selected_value']; + } break; case 'radio': $values = get_settings_options($row['variable']); @@ -330,7 +340,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' if ($row['variable'] == 'pdf_export_watermark_enable') { - $url = PDF::get_watermark($course_code); + $url = PDF::get_watermark($course_code); $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark')); if ($url != false) { $delete_url = ''.Display::return_icon('delete.png',get_lang('DelImage')).''; @@ -342,6 +352,8 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' if ($row['variable'] == 'timezone_value') { $form->addElement('html', sprintf(get_lang('LocalTimeUsingPortalTimezoneXIsY'),$row['selected_value'],api_get_local_time())); } + + } $form->addElement('html', '
'); @@ -394,12 +406,13 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' // Treat gradebook values in separate function. //if (strpos($key, 'gradebook_score_display_custom_values') === false) { if (!is_array($value)) { - //$sql = "UPDATE $table_settings_current SET selected_value='".Database::escape_string($value)."' WHERE variable='$key'"; - //$result = Database::query($sql); - $old_value = api_get_setting($key); switch ($key) { + case 'header_extra_content': + file_put_contents(api_get_path(SYS_PATH).api_get_home_path().'/header_extra_content', $value); + $value = api_get_home_path().'/header_extra_content'; + break; // URL validation for some settings. case 'InstitutionUrl': @@ -431,7 +444,6 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', ' } if ($old_value != $value) $keys[] = $key; - $result = api_set_setting($key, $value, null, null, $_configuration['access_url']); } else { @@ -496,9 +508,11 @@ $action_images['search'] = 'search.png'; $action_images['editor'] = 'html_editor.png'; $action_images['timezones'] = 'timezone.png'; $action_images['extra'] = 'wizard.png'; +$action_images['tracking'] = 'statistics.png'; // Grabbing the categories. $resultcategories = api_get_settings_categories(array('stylesheets', 'Plugins', 'Templates', 'Search')); + echo "
"; foreach ($resultcategories as $row) { echo "".Display::return_icon($action_images[strtolower($row['category'])], api_ucfirst(get_lang($row['category'])),'','32').""; diff --git a/main/css/base_chamilo.css b/main/css/base_chamilo.css index 57468c514b..1dc581cb74 100644 --- a/main/css/base_chamilo.css +++ b/main/css/base_chamilo.css @@ -1053,7 +1053,7 @@ div.admin_section { div.admin_section h4 { margin: 5px 0px 5px 5px; - padding: 0px 0px 5px 0px; + /*padding: 0px 0px 5px 0px; */ border-bottom: 1px solid #E1E1E0; width: 100%; } diff --git a/main/inc/header.inc.php b/main/inc/header.inc.php index 5b957fbd26..19bad5513c 100755 --- a/main/inc/header.inc.php +++ b/main/inc/header.inc.php @@ -187,6 +187,12 @@ if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_ } } echo $favico; +if (!api_is_platform_admin()) { + $extra_header = trim(api_get_setting('header_extra_content')); + if (!empty($extra_header)) { + $this->assign('header_extra_content', $extra_header); + } +} ?> assign('style', $this->style); } + /** + * Sets the footer visibility + * @param bool true if we show the footer + */ function set_footer($status) { $this->assign('show_footer', $status); } - - function set_header($status) { + /** + * Sets the header visibility + * + */ + function set_header($status) { $this->assign('show_header', $status); } @@ -189,8 +196,8 @@ class Template extends Smarty { $this->assign('css_file_to_string', $css_file_to_string); $this->assign('js_file_to_string', $js_file_to_string); - $this->assign('text_direction', api_get_text_direction()); - $this->assign('style_print', $style_print); + $this->assign('text_direction', api_get_text_direction()); + $this->assign('style_print', $style_print); $extra_headers = ''; if (isset($htmlHeadXtra) && $htmlHeadXtra) { @@ -198,8 +205,7 @@ class Template extends Smarty { $extra_headers .= $this_html_head; } } - $this->assign('extra_headers', $extra_headers); - + $this->assign('extra_headers', $extra_headers); $favico = ''; if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) { @@ -249,11 +255,6 @@ class Template extends Smarty { if (isset($database_connection)) { // connect to the main database. - // if single database, don't pefix table names with the main database name in SQL queries - // (ex. SELECT * FROM table) - // if multiple database, prefix table names with the course database name in SQL queries (or no prefix if the table is in - // the main database) - // (ex. SELECT * FROM table_from_main_db - SELECT * FROM courseDB.table_from_course_db) Database::select_db($_configuration['main_database'], $database_connection); } @@ -279,6 +280,13 @@ class Template extends Smarty { $this->assign('header3', $header3); $this->assign('header4', $header4); + if (!api_is_platform_admin()) { + $extra_header = trim(api_get_setting('header_extra_content')); + if (!empty($extra_header)) { + $this->assign('header_extra_content', $extra_header); + } + } + header('Content-Type: text/html; charset='.api_get_system_encoding()); header('X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'],0,1)); } diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 83884f0316..53964d4a2d 100644 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -19,19 +19,8 @@ class IndexManager { $this->tpl = new Template($title); } - $home = 'home/'; - if (api_get_multiple_access_url()) { - $access_url_id = api_get_current_access_url_id(); - $url_info = api_get_access_url($access_url_id); - $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - $clean_url = replace_dangerous_char($url); - $clean_url = str_replace('/', '-', $clean_url); - $clean_url .= '/'; - // if $clean_url == "localhost/" means that the multiple URL was not well configured we don't rename the $home variable - if ($clean_url != 'localhost/') - $home = 'home/'.$clean_url; - } - $this->home = $home; + + $this->home = api_get_home_path(); $this->user_id = api_get_user_id(); $this->load_directories_preview = true; } diff --git a/main/inc/reduced_header.inc.php b/main/inc/reduced_header.inc.php index 3dd32d48f3..0ea3d6c872 100755 --- a/main/inc/reduced_header.inc.php +++ b/main/inc/reduced_header.inc.php @@ -150,5 +150,13 @@ if (isset($htmlHeadXtra) && $htmlHeadXtra) { echo $this_html_head; } } + +if (!api_is_platform_admin()) { + $extra_header = trim(api_get_setting('header_extra_content')); + if (!empty($extra_header)) { + $this->assign('header_extra_content', $extra_header); + } +} + ?> \ No newline at end of file diff --git a/main/template/default/layout/head.tpl b/main/template/default/layout/head.tpl index 839f2e48cc..320236a9d5 100644 --- a/main/template/default/layout/head.tpl +++ b/main/template/default/layout/head.tpl @@ -1,3 +1,4 @@ + @@ -13,7 +14,6 @@