Project

General

Profile

Feature #4450

Improving the Chamilo plugins

Added by Julio Montoya over 7 years ago. Updated over 7 years ago.

Status:
Feature implemented
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
02/03/2012
Due date:
% Done:

100%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

The plugin chamilo system is not easy to configure and use
Now that we use smarty is more easy to content
new blocks will be added

footer_left, footer_right, footer_center, content_top, content_bottom
header_center, header_left, header_right

Associated revisions

Revision 7743980b (diff)
Added by Julio Montoya over 7 years ago

Adding missing files in the show template plugins + adding the very first Chamilo template using smarty it shows a welcome message to the user ... see #4450

Revision 44c220b1 (diff)
Added by Julio Montoya over 7 years ago

Adding some commets + using get_lang and other examples in the show user info plugin see #4450

Revision 8996ea90 (diff)
Added by Julio Montoya over 7 years ago

Improving plugin system see #4450 adding new parameters in order to install a plugin

Revision 60e5b4f4 (diff)
Added by Julio Montoya over 7 years ago

Minor - removing autor/readme in the region list see #4450

History

#1

Updated by Julio Montoya over 7 years ago

  • Status changed from New to Needs more info
  • Target version set to 1.9 Stable
  • % Done changed from 0 to 50

the location is not longer necessary
I also added a new plugin called "hello world"

#3

Updated by Marko Kastelic over 7 years ago

nce. just check the comments from install.php & uninstall.php (help plugin). Install contains something like : ... script to uninstall plugin ..

#4

Updated by Julio Montoya over 7 years ago

oops, I fixed that, I also added smarty support for the plugins!

#5

Updated by Julio Montoya over 7 years ago

I added some instructions that could be added in the wiki:

    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

#6

Updated by Yannick Warnier over 7 years ago

  • Status changed from Needs more info to Assigned
  • Assignee set to Julio Montoya

In http://code.google.com/p/chamilo/source/detail?repo=classic&r=ddcb571e26c0698851d32a7427a8d1eb1b8c24a3, I note the following:

     <div class="well">
         {"Welcome"|get_lang} {$my_user_info.complete_name} ({$my_username})
         <br />
         The administrator - {"siteName"|api_get_setting}
     </div>

1) The salutation will no work in Japanese, where the salutation would be: {$my_user_info.complete_name} {"Welcome"|get_lang}, and not {"Welcome"|get_lang} {$my_user_info.complete_name}. To avoid this, I have added a specific section in Coding conventions, which says this:

a language term should always be as large as possible. Don't try to join several strings into one. Something like: get_lang('Dear ').$username.get_lang('WelcomeToPortal').get_lang('WeHopeYouHaveFun').get_lang('BestRegards').$teamname; will never work out in languages with different grammatical roots like Japanese, Arabic, Quechua and many more. Instead, use a context-full string like this "Dear %s, welcome to this portal. We hope you'll have fun learning through the courses made available to you. Best regards, %s". Then the %s will be replaced in the call to get_lang(): get_lang('GeneralWelcomeToPortal',$username, $teamname); This is because, in other languages, the order of the sentences may not be exactly the same. You might finish your introduction as "Yannick San E" (as compared with "Dear Mr Yannick"), instead of what could be possible with a single get_lang('Dear'), which would force you to use "E San Yannick", which doesn't mean anything in Japanese (it would be the equivalent of "Yannick Mr Dear" in English)

Instead, use a string with several params like: {"Welcome"|get_lang|$my_user_info.complete_name|($my_username)}
If this is not possibile, it will have to be fixed in the get_lang modifier, because it is absolutely essential in terms of internationalization (and we're not even talking Left-To-Right here)

2) "The Administrator" is still without translation...

#7

Updated by Yannick Warnier over 7 years ago

Please review the uninstall procedure. It currently generates warnings on chamilodev.beeznest.com and it very much looks like uninstalling would not work (maybe add an "enable" checkbox, like in Drupal):

Warning: in_array() expects parameter 2 to be array, null given in /var/www/chamilodev.beeznest.com/www/main/admin/settings.lib.php on line 389 Call Stack: 0.0022 884128 1. {main}() /var/www/chamilodev.beeznest.com/www/main/admin/settings.php:0 0.5049 55043824 2. handle_plugins() /var/www/chamilodev.beeznest.com/www/main/admin/settings.php:402 0.5049 55044312 3. store_plugins() /var/www/chamilodev.beeznest.com/www/main/admin/settings.lib.php:27 0.7297 55135984 4. in_array() /var/www/chamilodev.beeznest.com/www/main/admin/settings.lib.php:389 
#8

Updated by Yannick Warnier over 7 years ago

In particular, if I want to disable the "Show templates blocks" plugin, I can't. Also, in order to facilitate the job for people coming from Drupal, please call this plugin the "Show template regions" so we use the term "region" instead of "block".

#9

Updated by Julio Montoya over 7 years ago

Yannick Warnier wrote:

In particular, if I want to disable the "Show templates blocks" plugin, I can't. Also, in order to facilitate the job for people coming from Drupal, please call this plugin the "Show template regions" so we use the term "region" instead of "block".

I added a new way to installed a plugin and add in in regions see

http://code.google.com/p/chamilo/source/detail?r=46b8aa5803cfb8a01a6c23ae174863638d481fb1&repo=classic

#10

Updated by Julio Montoya over 7 years ago

  • Status changed from Assigned to Needs more info
  • Assignee deleted (Julio Montoya)

I agree with your comments/suggestions about the Japanese language and etc, but I think we should leave it like that because we don't have a lot of Japanese Chamilo Plugin developers as far as I know. When we have a "community" of developers then we should developed that feature otherwise we will work for nothing ... BUT If you really want that feature I can implemented, it will take some hours to do it. The idea is to develop a smarty plugin like somebody already did for gettext:

http://smarty.incutio.com/?page=SmartyGettext

{t 1='one' 2='two' 3='three'}The 1st parameter is %1, the 2nd is %2 and the 3nd %3.{/t}

{t name="sagi"}my name is %1{/t} 

One other thing: there's a task #4467 (Add gettext support) that if is implemented this "Japanese" issue will be fixed.

#11

Updated by Julio Montoya over 7 years ago

I just replaced very easily smarty with Twig.

Twig has a gettext extension that seems more mature:
http://twig.sensiolabs.org/doc/extensions/i18n.html

#12

Updated by Julio Bonifacio Aliaga over 7 years ago

  • Status changed from Needs more info to Feature implemented
  • Assignee set to Julio Montoya
  • % Done changed from 50 to 100

OK for me (Yannick, showing the idea to Julio B.). The gettext task will fix it, indeed.

#13

Updated by Julio Montoya over 7 years ago

  • Assignee deleted (Julio Montoya)

I finally fixed that "Japanese" problem that Yannick mention using the twig "format" filter.
Just use this:

{{ "WelcomToChamiloUserX" | get_lang | format(show_user_info.user_info.complete_name) }}            

code extracted from the show_user_info plugin now it supports languages related to #4557

Also available in: Atom PDF