Scripting for module and blocks

Scripting for module and blocks

by chairu ferdiansyah -
Number of replies: 5

Hi...

I want to make a new module and blocks in moodle, but I was confused about how moodle connect to the database, retrieve the data, and display it on the browser...I've tried to read the sourcecode but still I don't understand with the script.

can you tell me how moodle works with database?

I would be very happy if someone could send me a module and block toturial for moodle 1.4.3 to my email at pinoqyo2@yahoo.com.... so I can learn from it.

thanks

Average of ratings: -
In reply to chairu ferdiansyah

Re: Scripting for module and blocks

by Jan Dierckx -
No need emailing the blocks tutorial to you. If you have Moodle, you already have an excellent tutorial on blocks. Just visit the page /moodle/blocks/HOWTO.html in your own Moodle installation.
Not too sure about the module tutorial. It really depends on what you want the module to do. Some modules (Quiz / Assignment / Glossary) can be easily modified by adding new plugins. Read the comments in the sourcecode and use the cross reference code / Moodle API to find out what functions do / what variables are used /etc...
There is a newmodule template in CVS.
Good luck.
 
In reply to chairu ferdiansyah

Re: Scripting for module and blocks

by Skip Marshall -
I am working on a block that would be directed at the current user. I have been successful in building an array of all users. What would I need to do to populate the block with only information about the current user (such as name, location, email, etc.)? Is there a global variable or function available?  The idea being that it would be similar to their user profile page, only in block format.

Thanks,
In reply to Skip Marshall

Re: Scripting for module and blocks

by Jan Dierckx -
If it would be similar to the user profile page, then you could try looking at the code which builds the user profile page.
It is in user/view.php

And in this discussion you will find a block which displays (only) the user's picture. Maybe you can use that as a starter.

In reply to Skip Marshall

Re: Scripting for module and blocks

by Michael Penney -
Hi Skip, all the info. you want is in the global variable $USER, I think.

Try print_r($USER); and see if you get what you want.

There is a good general guide to block development here: http://moodle.org/blocks/HOWTO.html (its also there in your local install of 1.5smile)
In reply to Michael Penney

Re: Scripting for module and blocks

by Skip Marshall -
Thanks for the tips, Michael and Jan. I also found the moodle function documentation which is very helpful.....