Fix wrong URL in tab when using plugin in multiple url BT#13711

pull/2487/head
Julio 8 years ago
parent 4eb63faad7
commit 14b78a3dec
  1. 15
      main/inc/lib/banner.lib.php

@ -49,8 +49,7 @@ function get_tabs($courseId = null)
$navigation['mycourses']['icon'] = 'my-course.png'; $navigation['mycourses']['icon'] = 'my-course.png';
// My Profile // My Profile
$navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH) $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'
.'auth/profile.php'
.(!empty($courseInfo['path']) ? '?coursePath='.$courseInfo['path'].'&courseCode='.$courseInfo['official_code'] : ''); .(!empty($courseInfo['path']) ? '?coursePath='.$courseInfo['path'].'&courseCode='.$courseInfo['official_code'] : '');
$navigation['myprofile']['title'] = get_lang('ModifyProfile'); $navigation['myprofile']['title'] = get_lang('ModifyProfile');
$navigation['myprofile']['key'] = 'profile'; $navigation['myprofile']['key'] = 'profile';
@ -152,16 +151,16 @@ function get_tabs($courseId = null)
*/ */
function getCustomTabs() function getCustomTabs()
{ {
$urlId = api_get_current_access_url_id();
$tableSettingsCurrent = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); $tableSettingsCurrent = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$sql = "SELECT * FROM $tableSettingsCurrent $sql = "SELECT * FROM $tableSettingsCurrent
WHERE WHERE
variable = 'show_tabs' AND variable = 'show_tabs' AND
subkey like 'custom_tab_%'"; subkey LIKE 'custom_tab_%' AND access_url = $urlId ";
$result = Database::query($sql); $result = Database::query($sql);
$customTabs = array(); $customTabs = array();
while ($row = Database::fetch_assoc($result)) { while ($row = Database::fetch_assoc($result)) {
$shouldAdd = true; $shouldAdd = true;
if (strpos($row['subkey'], Plugin::TAB_FILTER_NO_STUDENT) !== false && api_is_student()) { if (strpos($row['subkey'], Plugin::TAB_FILTER_NO_STUDENT) !== false && api_is_student()) {
$shouldAdd = false; $shouldAdd = false;
} elseif (strpos($row['subkey'], Plugin::TAB_FILTER_ONLY_STUDENT) !== false && !api_is_student()) { } elseif (strpos($row['subkey'], Plugin::TAB_FILTER_ONLY_STUDENT) !== false && !api_is_student()) {
@ -350,7 +349,6 @@ function return_navigation_array()
if (!empty($result) && $result['selected_value'] === 'installed') { if (!empty($result) && $result['selected_value'] === 'installed') {
// Students // Students
$url = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php'; $url = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php';
if (api_is_platform_admin() || api_is_drh() || api_is_teacher()) { if (api_is_platform_admin() || api_is_drh() || api_is_teacher()) {
$url = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/my_students.php'; $url = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/my_students.php';
} }
@ -372,19 +370,16 @@ function return_navigation_array()
// Custom tabs // Custom tabs
$customTabs = getCustomTabs(); $customTabs = getCustomTabs();
if (!empty($customTabs)) { if (!empty($customTabs)) {
foreach ($customTabs as $tab) { foreach ($customTabs as $tab) {
if (api_get_setting($tab['variable'], $tab['subkey']) == 'true' && if (api_get_setting($tab['variable'], $tab['subkey']) == 'true' &&
isset($possible_tabs[$tab['subkey']]) isset($possible_tabs[$tab['subkey']])
) { ) {
$possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH) $possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH).$possible_tabs[$tab['subkey']]['url'];
.$possible_tabs[$tab['subkey']]['url'];
$navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']]; $navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']];
} else { } else {
if (isset($possible_tabs[$tab['subkey']])) { if (isset($possible_tabs[$tab['subkey']])) {
$possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH) $possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH).$possible_tabs[$tab['subkey']]['url'];
.$possible_tabs[$tab['subkey']]['url'];
$menu_navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']]; $menu_navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']];
} }
} }

Loading…
Cancel
Save