upgrade
This commit is contained in:
12
plugin/add_cas_logout_button/README.md
Normal file
12
plugin/add_cas_logout_button/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
Add CAS logout button plugin
|
||||
===
|
||||
|
||||
This plugin adds a button to allow users to logout from their CAS session.
|
||||
|
||||
In order for the plugin to work, you'll have to:
|
||||
|
||||
* enable your CAS connection to display this button.
|
||||
* configure your CAS connection to have the button works.
|
||||
* go to Administration > Configuration settings > CAS and follow the instructions.
|
||||
|
||||
This plugin has been made to be added in the login_top region, but you can put it wherever you want.
|
||||
12
plugin/add_cas_logout_button/css.css
Normal file
12
plugin/add_cas_logout_button/css.css
Normal file
@@ -0,0 +1,12 @@
|
||||
.cas_plugin_image {
|
||||
float:left;
|
||||
height:50px;
|
||||
margin: 0px 5px 5px 0px;
|
||||
}
|
||||
.cas_plugin_comm {
|
||||
font-style:italic;
|
||||
}
|
||||
.cas_plugin_clear {
|
||||
clear:both;
|
||||
height:1px;
|
||||
}
|
||||
26
plugin/add_cas_logout_button/index.php
Normal file
26
plugin/add_cas_logout_button/index.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Show the CAS button to logout to your CAS session
|
||||
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 default title
|
||||
$logout_label = "Deconnexion de CAS";
|
||||
if (!empty($plugin_info['settings']['add_cas_logout_button_cas_logout_label'])) {
|
||||
$logout_label = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_label']);
|
||||
}
|
||||
// the comm
|
||||
$logout_comment = api_htmlentities($plugin_info['settings']['add_cas_logout_button_cas_logout_comment']);
|
||||
|
||||
// URL of the image
|
||||
$logout_image_url = $plugin_info['settings']['add_cas_logout_button_cas_logout_image_url'];
|
||||
|
||||
$_template['logout_label'] = $logout_label;
|
||||
$_template['form'] = Template::displayCASLogoutButton(get_lang('Logout'));
|
||||
$_template['logout_comment'] = $logout_comment;
|
||||
$_template['logout_image_url'] = $logout_image_url;
|
||||
}
|
||||
50
plugin/add_cas_logout_button/plugin.php
Normal file
50
plugin/add_cas_logout_button/plugin.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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'] = 'Add a button to logout from CAS';
|
||||
|
||||
//the comments that go with the plugin
|
||||
$plugin_info['comment'] = "If CAS is activated, this plugin add a text and a button on the user page to logout from a CAS session. Configure plugin to add title, comment and logo.";
|
||||
//the plugin version
|
||||
$plugin_info['version'] = '1.0';
|
||||
//the plugin author
|
||||
$plugin_info['author'] = 'Hubert Borderiou';
|
||||
//the plugin configuration
|
||||
$form = new FormValidator('add_cas_button_form');
|
||||
$form->addElement('text', 'cas_logout_label', 'CAS logout title', '');
|
||||
$form->addElement('text', 'cas_logout_comment', 'CAS logout description', '');
|
||||
$form->addElement('text', 'cas_logout_image_url', 'Logo URL if any (image, 50px height)');
|
||||
$form->addButtonSave(get_lang('Save'), 'submit_button');
|
||||
//get default value for form
|
||||
$defaults = [];
|
||||
$tab_default_add_cas_logout_button_cas_logout_label = api_get_setting('add_cas_logout_button_cas_logout_label');
|
||||
$tab_default_add_cas_logout_button_cas_logout_comment = api_get_setting('add_cas_logout_button_cas_logout_comment');
|
||||
$tab_default_add_cas_logout_button_cas_logout_image_url = api_get_setting('add_cas_logout_button_cas_logout_image_url');
|
||||
if ($tab_default_add_cas_logout_button_cas_logout_label) {
|
||||
$defaults['cas_logout_label'] = $tab_default_add_cas_logout_button_cas_logout_label['add_cas_logout_button'];
|
||||
}
|
||||
if ($tab_default_add_cas_logout_button_cas_logout_comment) {
|
||||
$defaults['cas_logout_comment'] = $tab_default_add_cas_logout_button_cas_logout_comment['add_cas_logout_button'];
|
||||
}
|
||||
|
||||
if ($tab_default_add_cas_logout_button_cas_logout_image_url) {
|
||||
$defaults['cas_logout_image_url'] = $tab_default_add_cas_logout_button_cas_logout_image_url['add_cas_logout_button'];
|
||||
}
|
||||
|
||||
$form->setDefaults($defaults);
|
||||
//display form
|
||||
$plugin_info['settings_form'] = $form;
|
||||
|
||||
// Set the templates that are going to be used
|
||||
$plugin_info['templates'] = ['template.tpl'];
|
||||
15
plugin/add_cas_logout_button/template.tpl
Normal file
15
plugin/add_cas_logout_button/template.tpl
Normal file
@@ -0,0 +1,15 @@
|
||||
{% if add_cas_logout_button.show_message %}
|
||||
<link href="{{ _p.web_plugin }}add_cas_logout_button/css.css" rel="stylesheet" type="text/css">
|
||||
<div class="well">
|
||||
{% if add_cas_logout_button.logout_image_url %}
|
||||
<img src="{{add_cas_logout_button.logout_image_url}}" class='cas_plugin_image'/>
|
||||
{% endif %}
|
||||
<h4>{{add_cas_logout_button.logout_label}}</h4>
|
||||
{% if add_cas_logout_button.logout_image_url %}
|
||||
<div class='cas_plugin_clear'> </div>
|
||||
{% endif %}
|
||||
<div class='cas_plugin_comm'>{{add_cas_logout_button.logout_comment}}</div>
|
||||
{{ add_cas_logout_button.form }}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user