|
|
|
@ -32,7 +32,7 @@ api_protect_admin_script(); |
|
|
|
|
//Ajax request |
|
|
|
|
if (isset($_POST['sent_http_request'])) { |
|
|
|
|
if (isset($_POST['visibility']) && $_POST['visibility'] == strval(intval($_POST['visibility'])) && $_POST['visibility'] == 0) { |
|
|
|
|
if (isset($_POST['id']) && $_POST['id'] == strval(intval($_POST['id']))) { |
|
|
|
|
if (isset($_POST['id']) && $_POST['id'] == strval(intval($_POST['id']))) { |
|
|
|
|
if (SubLanguageManager::check_if_language_is_used($_POST['id']) == false) { |
|
|
|
|
SubLanguageManager::make_unavailable_language($_POST['id']); |
|
|
|
|
echo 'set_hidden'; |
|
|
|
@ -88,9 +88,9 @@ $htmlHeadXtra[] = '<script> |
|
|
|
|
url: "../admin/languages.php", |
|
|
|
|
data: "id="+link_id+"&visibility="+my_visibility+"&sent_http_request=1", |
|
|
|
|
success: function(datos) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (datos=="set_visible" || datos=="set_hidden") { |
|
|
|
|
$("#"+id_img_link_tool).attr("src",path_name_of_imglinktool); |
|
|
|
|
$("#"+id_img_link_tool).attr("src",path_name_of_imglinktool); |
|
|
|
|
|
|
|
|
|
if (my_image_tool=="visible.png") { |
|
|
|
|
$("#"+id_img_link_tool).attr("alt","' . get_lang('MakeAvailable', '') . '"); |
|
|
|
@ -108,8 +108,8 @@ $htmlHeadXtra[] = '<script> |
|
|
|
|
$("#id_content_message").html("<div class=\"confirmation-message\">' . get_lang('LanguageIsNowHidden', '') . '</div>"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var action = datos.split(":")[0]; |
|
|
|
|
|
|
|
|
|
var action = datos.split(":")[0]; |
|
|
|
|
if (action && action == "confirm") { |
|
|
|
|
var id = datos.split(":")[1]; |
|
|
|
|
var sure = "<div class=\"warning-message\">'.get_lang('ThereAreUsersUsingThisLanguageYouWantToDisableThisLanguageAndSetUsersWithTheDefaultPortalLanguage').'</div><a href=\"languages.php?action=make_unavailable_confirmed&id="+id+"\" class=\"btn\">' . get_lang('MakeUnavailable') . '</a>"; |
|
|
|
@ -129,28 +129,31 @@ $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
|
|
|
|
STORING THE CHANGES |
|
|
|
|
============================================================================== |
|
|
|
|
*/ |
|
|
|
|
$action = isset($_GET['action']) ? $_GET['action'] : null; |
|
|
|
|
|
|
|
|
|
// we change the availability |
|
|
|
|
if ($_GET['action'] == 'makeunavailable') { |
|
|
|
|
if ($action == 'makeunavailable') { |
|
|
|
|
if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) { |
|
|
|
|
SubLanguageManager::make_unavailable_language($_GET['id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($_GET['action'] == 'makeavailable') { |
|
|
|
|
|
|
|
|
|
if ($action == 'makeavailable') { |
|
|
|
|
if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) { |
|
|
|
|
SubLanguageManager::make_available_language($_GET['id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($_GET['action'] == 'setplatformlanguage') { |
|
|
|
|
|
|
|
|
|
if ($action == 'setplatformlanguage') { |
|
|
|
|
if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) { |
|
|
|
|
SubLanguageManager::set_platform_language($_GET['id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($_POST['Submit']) { |
|
|
|
|
if (isset($_POST['Submit']) && $_POST['Submit']) { |
|
|
|
|
// changing the name |
|
|
|
|
$sql_update = "UPDATE $tbl_admin_languages SET original_name='{$_POST['txt_name']}' WHERE id='{$_POST['edit_id']}'"; |
|
|
|
|
$sql_update = "UPDATE $tbl_admin_languages SET original_name='{$_POST['txt_name']}' |
|
|
|
|
WHERE id='{$_POST['edit_id']}'"; |
|
|
|
|
$result = Database::query($sql_update); |
|
|
|
|
// changing the Platform language |
|
|
|
|
if ($_POST['platformlanguage'] && $_POST['platformlanguage'] <> '') { |
|
|
|
@ -183,7 +186,6 @@ if ($_POST['Submit']) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
============================================================================== |
|
|
|
|
MAIN CODE |
|
|
|
@ -197,11 +199,11 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdm |
|
|
|
|
|
|
|
|
|
// including the header file (which includes the banner itself) |
|
|
|
|
Display :: display_header($tool_name); |
|
|
|
|
|
|
|
|
|
if (isset($_GET['action']) && $_GET['action'] == 'make_unavailable_confirmed') { |
|
|
|
|
|
|
|
|
|
if (isset($_GET['action']) && $_GET['action'] == 'make_unavailable_confirmed') { |
|
|
|
|
$language_info = SubLanguageManager::get_all_information_of_language($_GET['id']); |
|
|
|
|
if ($language_info['available'] == 1) { |
|
|
|
|
SubLanguageManager::make_unavailable_language($_GET['id']); |
|
|
|
|
SubLanguageManager::make_unavailable_language($_GET['id']); |
|
|
|
|
$platform_language = api_get_setting('platformLanguage'); |
|
|
|
|
UserManager::update_all_user_languages($language_info['english_name'], $platform_language); |
|
|
|
|
Display::display_confirmation_message(get_lang('LanguageIsNowHidden')); |
|
|
|
@ -223,16 +225,15 @@ $row_lang = Database::fetch_array($result_select_lang); |
|
|
|
|
-------------------------------------- |
|
|
|
|
DISPLAY THE TABLE |
|
|
|
|
-------------------------------------- |
|
|
|
|
*/ |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
// the table data |
|
|
|
|
$language_data = array(); |
|
|
|
|
while ($row = Database::fetch_array($result_select)) { |
|
|
|
|
|
|
|
|
|
$row_td = array(); |
|
|
|
|
$row_td[] = $row['id']; |
|
|
|
|
// the first column is the original name of the language OR a form containing the original name |
|
|
|
|
if ($_GET['action'] == 'edit' and $row['id'] == $_GET['id']) { |
|
|
|
|
if ($action == 'edit' and $row['id'] == $_GET['id']) { |
|
|
|
|
if ($row['english_name'] == api_get_setting('platformLanguage')) { |
|
|
|
|
$checked = ' checked="checked" '; |
|
|
|
|
} |
|
|
|
@ -242,19 +243,22 @@ while ($row = Database::fetch_array($result_select)) { |
|
|
|
|
} else { |
|
|
|
|
$row_td[] = $row['original_name']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// the second column |
|
|
|
|
$row_td[] = $row['english_name']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// the third column |
|
|
|
|
$row_td[] = $row['dokeos_folder']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($row['english_name'] == $row_lang['selected_value']) { |
|
|
|
|
$setplatformlanguage = Display::return_icon('languages.png', get_lang('CurrentLanguagesPortal'), '', ICON_SIZE_SMALL); |
|
|
|
|
} else { |
|
|
|
|
$setplatformlanguage = "<a href=\"javascript:if (confirm('" . addslashes(get_lang('AreYouSureYouWantToSetThisLanguageAsThePortalDefault')) . "')) { location.href='" . api_get_self() . "?action=setplatformlanguage&id=" . $row['id'] . "'; }\">" . Display::return_icon('languages_na.png', get_lang('SetLanguageAsDefault'), '', ICON_SIZE_SMALL) . "</a>"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$allow_delete_sub_language = null; |
|
|
|
|
$allow_add_term_sub_language = null; |
|
|
|
|
|
|
|
|
|
if (api_get_setting('allow_use_sub_language') == 'true') { |
|
|
|
|
|
|
|
|
|
$verified_if_is_sub_language = SubLanguageManager::check_if_language_is_sub_language($row['id']); |
|
|
|
@ -274,14 +278,11 @@ while ($row = Database::fetch_array($result_select)) { |
|
|
|
|
$allow_add_term_sub_language = " <a href='sub_language.php?action=registersublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('2rightarrow.gif', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>"; |
|
|
|
|
$allow_delete_sub_language = " <a href='sub_language_add.php?action=deletesublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>"; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$allow_use_sub_language = ''; |
|
|
|
|
$allow_add_term_sub_language = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($row['english_name'] == $row_lang['selected_value']) { |
|
|
|
|
$row_td[] = Display::return_icon('visible.png', get_lang('Visible'))."<a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a> |
|
|
|
|
" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language; |
|
|
|
|
" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language; |
|
|
|
|
} else { |
|
|
|
|
if ($row['available'] == 1) { |
|
|
|
|
$row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_" . $row['id'] . "\" href='" . api_get_self() . "?action=makeunavailable&id=" . $row['id'] . "'>" . Display::return_icon('visible.png', get_lang('MakeUnavailable'), array('id' => 'imglinktool_' . $row['id']), ICON_SIZE_SMALL) . "</a> <a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a> " . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language; |
|
|
|
|