Scripting for module and blocks

Scripting for module and blocks

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

評比平均分數: -
In reply to chairu ferdiansyah

Re: Scripting for module and blocks

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

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

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

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.5微笑)
In reply to Michael Penney

Re: Scripting for module and blocks

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