Adding some commets + using get_lang and other examples in the show user info plugin see #4450
parent
7743980b2f
commit
44c220b1a6
@ -1,22 +1,18 @@ |
||||
<?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); |
||||
|
||||
//Showing the complete name (that means the firstname and lastname depending of the language) |
||||
echo 'This is a simple echo'; |
||||
|
||||
//If you want to see more data you can do a var_dump($user_info); |
||||
|
||||
//You can also change the style |
||||
echo '<h4>This is an echo with style :)</h4>'; |
||||
|
||||
//You can also use smarty setting variables in the special variable called template |
||||
$_template['user_info'] = $user_info; |
||||
$_template['user_email'] = $user_info['mail']; |
||||
$_template['my_user_info'] = $user_info; |
||||
$_template['my_username'] = $user_info['username']; |
||||
} |
||||
@ -1,4 +1,33 @@ |
||||
This is a chamilo plugin using smarty |
||||
{* |
||||
This is a Chamilo plugin using Smarty you can use 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 |
||||
|
||||
4. Read more |
||||
You can also see more examples in the the main/template/default/layout files |
||||
*} |
||||
{if $show_message} |
||||
<div class="well"> |
||||
Welcome, {$user_info.complete_name} |
||||
{"Welcome"|get_lang} {$my_user_info.complete_name} ({$my_username}) |
||||
<br /> |
||||
The administrator - {"siteName"|api_get_setting} |
||||
</div> |
||||
{/if} |
||||
Loading…
Reference in new issue