Developer FAQ

Z MoodleDocs
Wersja z dnia 11:03, 5 kwi 2006 autorstwa Dan Stowell (dyskusja | edycje)
(różn.) ← poprzednia wersja | przejdź do aktualnej wersji (różn.) | następna wersja → (różn.)
Skocz do:nawigacja, szukaj

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.