Actualización

This commit is contained in:
Xes
2025-04-10 12:36:07 +02:00
parent 1da7c3f3b9
commit 4aff98e77b
3147 changed files with 320647 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
External Authentication Logout button behaviour plugin
===
If you use some other authentication than local Chamilo authentication, you may want to disable the Chamilo logout button and display information about your SSO logout.
With this plugin, you can:
* change the logout URL of the button
* disable the logout button
* display it in grey style
* change the button tooltip on mouseover
* add an alert message if user click on the button
Related plugins
---
Add a button to login using CAS<br/>
Add a button to logout from CAS<br/>
Add a button to login using FACEBOOK account<br/>
Add a button to login using Shibboleth<br/>

View File

@@ -0,0 +1,42 @@
<?php
// personalize the logout button behaviour
global $_user;
$_template['show_message'] = false;
if (!api_is_anonymous() &&
api_get_setting('cas_activate') == 'true' &&
$_user['auth_source'] == CAS_AUTH_SOURCE
) {
$_template['show_message'] = true;
// the link URL
$link_url = "#";
if (!empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url'])) {
$link_url = api_htmlentities($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url']);
}
// the infobulle
$link_infobulle = "Vous devez fermer votre navigateur pour clore votre session de travail.";
if (!empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle'])) {
$link_infobulle = api_htmlentities($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle']);
}
// $link_image=1 if we replace the logout button by a grey one 'exit_na'
$link_image = "1";
if (empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image'])) {
$link_image = "";
}
// checkbox to disaply an alert box when clicnkig on the logout button
$alert_onoff = "1";
if (empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff'])) {
$alert_onoff = "";
}
// alert text to display if check is on
$alert_text = "\\\\nVous êtes connectés avec votre compte universitaire.\\\\n\\\\nVous devez *** fermer votre navigateur *** pour clore votre session de travail.";
if (!empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text'])) {
$alert_text = $plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text'];
}
$_template['link_url'] = $link_url;
$_template['link_infobulle'] = $link_infobulle;
$_template['link_image'] = $link_image;
$_template['alert_onoff'] = $alert_onoff;
$_template['alert_text'] = $alert_text;
}

View File

@@ -0,0 +1,61 @@
<?php
/**
* This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins).
*
* @package chamilo.plugin
*
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Plugin details (must be present).
*/
//the plugin title
$plugin_info['title'] = 'Enable or disable logout button';
//the comments that go with the plugin
$plugin_info['comment'] = "If you use some other authentication than local Chamilo authentication, you may have to disable the Chamilo logout button and give users information about your SSO logout.";
//the plugin version
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration
$form = new FormValidator('eaclbb_form');
$form->addElement("html", "<div class='normal-message'>Fill the text boxes below to overwrite the default values used in this plugin</div>");
$form->addElement('text', 'eaclbb_form_link_url', 'Page to load when clicking on the logout button');
$form->addElement('text', 'eaclbb_form_link_infobulle', 'Tooltip text for the logout button (displayed on mouseover)');
$form->addElement('checkbox', 'eaclbb_form_link_image', "Display the logout button disabled (black and white)", "", ['checked' => true]);
$form->addElement('checkbox', 'eaclbb_form_alert_onoff', "Display an alert when clicking on the logout button", "", ['checked' => true]);
$form->addElement('text', 'eaclbb_form_alert_text', "Text displayed in the alert box when clickng on the logout button (if checkbox above has been checked).");
$form->addButtonSave(get_lang('Save'), 'submit_button');
//get default value for form
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff');
$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text');
if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url) {
$defaults['eaclbb_form_link_url'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url['eaclbb_form_link_url'];
}
if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle) {
$defaults['eaclbb_form_link_infobulle'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle['eaclbb_form_link_infobulle'];
}
if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image) {
$defaults['eaclbb_form_link_image'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image['eaclbb_form_link_image'];
}
if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff) {
$defaults['eaclbb_form_alert_onoff'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff['eaclbb_form_alert_onoff'];
}
if ($tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text) {
$defaults['eaclbb_form_alert_text'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text['eaclbb_form_alert_text'];
}
$form->setDefaults($defaults);
//display form
$plugin_info['settings_form'] = $form;
// Set the templates that are going to be used
$plugin_info['templates'] = ['template.tpl'];

View File

@@ -0,0 +1,12 @@
{% if ext_auth_chamilo_logout_button_behaviour.show_message %}
<script type="text/javascript">
$("#logout_button").attr('href', '{{ ext_auth_chamilo_logout_button_behaviour.link_url }}' );
$("#logout_button").attr('title', '{{ ext_auth_chamilo_logout_button_behaviour.link_infobulle }}' );
{% if ext_auth_chamilo_logout_button_behaviour.alert_onoff %}
$("#logout_button").attr('onclick', 'alert("{{ ext_auth_chamilo_logout_button_behaviour.alert_text }}")' );
{% endif %}
{% if ext_auth_chamilo_logout_button_behaviour.link_image %}
$("#logout_button img").attr('src', '{{ "exit_na.png"|icon(22) }}');
{% endif %}
</script>
{% endif %}