Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Developer FAQ: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 1: Line 1:
==Moodle's database==
===Where can I see a schema for the structure of the Moodle database?===
When installing Moodle, the database tables are generated and updated by various db-handling scripts located in various places. There is no canonical schema representation, although the [[Coding#Database_structures coding guidelines for database structure]] give an outline of the general approach.
==How to get/set information when writing new Moodle code==
==How to get/set information when writing new Moodle code==



Revision as of 11:06, 5 April 2006

Moodle's database

Where can I see a schema for the structure of the Moodle database?

When installing Moodle, the database tables are generated and updated by various db-handling scripts located in various places. There is no canonical schema representation, although the Coding#Database_structures coding guidelines for database structure give an outline of the general approach.


How to get/set information when writing new Moodle code

How do I find out the currently-logged-on user?

The global object $USER, which contains the numeric $USER->id among other things.

How do I find out the current course?

...

How do I insert/retrieve records in the database, without creating my own database connections?

Always use the "datalib" functions, such as insert_record() or get_record(). Look at the documentation for datalib.php for more functions and details of use.

How do I get/set configuration settings?

...