Actualización
This commit is contained in:
5
plugin/show_user_info/README.md
Normal file
5
plugin/show_user_info/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Show User Info plugin
|
||||
===
|
||||
|
||||
This plugin shows the current user information in a selected region.
|
||||
Make sure you select a region in which you want to show this information.
|
||||
17
plugin/show_user_info/index.php
Normal file
17
plugin/show_user_info/index.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
// A user must be logged in.
|
||||
$_template['show_message'] = false;
|
||||
|
||||
if (!api_is_anonymous()) {
|
||||
$_template['show_message'] = true;
|
||||
|
||||
// Getting the current user id.
|
||||
$user_id = api_get_user_id();
|
||||
|
||||
//Getting the current user info.
|
||||
$user_info = api_get_user_info($user_id);
|
||||
|
||||
// You can also use template setting variables in the special variable called template.
|
||||
$_template['user_info'] = $user_info;
|
||||
$_template['username'] = $user_info['username'];
|
||||
}
|
||||
3
plugin/show_user_info/lang/english.php
Normal file
3
plugin/show_user_info/lang/english.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$strings['WelcomeToChamiloUserX'] = "Welcome to Chamilo %s!";
|
||||
3
plugin/show_user_info/lang/spanish.php
Normal file
3
plugin/show_user_info/lang/spanish.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$strings['WelcomeToChamiloUserX'] = "Bienvenido a Chamilo %s!";
|
||||
23
plugin/show_user_info/plugin.php
Normal file
23
plugin/show_user_info/plugin.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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'] = 'Show user information';
|
||||
// The comments that go with the plugin
|
||||
$plugin_info['comment'] = "Shows a welcome message, (this is an example to uses the template system: Twig)";
|
||||
// The plugin version
|
||||
$plugin_info['version'] = '1.0';
|
||||
// The plugin author
|
||||
$plugin_info['author'] = 'Julio Montoya';
|
||||
// Set the templates that are going to be used
|
||||
$plugin_info['templates'] = ['template.tpl'];
|
||||
30
plugin/show_user_info/template.tpl
Normal file
30
plugin/show_user_info/template.tpl
Normal file
@@ -0,0 +1,30 @@
|
||||
{#
|
||||
This is a Chamilo plugin using Twig you can use these handy shorcuts like:
|
||||
|
||||
1. Shortcuts
|
||||
|
||||
_p = url chamilo paths
|
||||
_u = user information of the current user
|
||||
|
||||
2. i18n
|
||||
|
||||
You can use i18n variables just use this syntax:
|
||||
|
||||
{{ "HelloWorld"|get_lang }}
|
||||
|
||||
Now you can add your variables in the main/lang/english/ or main/lang/spanish/ for example in spanish:
|
||||
$HelloWorld = "Hola Mundo";
|
||||
|
||||
3. Portal settings
|
||||
You can access the portal settings using:
|
||||
{{ "siteName"|api_get_setting }}
|
||||
For more settings check the settings_current database table
|
||||
4. Read more
|
||||
You can also see more examples in main/template/default/layout
|
||||
#}
|
||||
|
||||
{% if show_user_info.show_message is not null and _u.logged == 1 %}
|
||||
<div class="well">
|
||||
{{ "WelcomeToChamiloUserX" | get_lang | format(show_user_info.user_info.complete_name) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user