When is question added in DB?

When is question added in DB?

by Marigianna Skouradaki -
Number of replies: 4

Hello,

I am trying to find the piece of code, where a new question is inserted in the database. (When the teacher actually creates the question, and presses the submit button).

However i find it a bit difficult. Could you please help in which file/function to look?

thank you in advance,

 

Marigianna

Average of ratings: -
In reply to Marigianna Skouradaki

Re: When is question added in DB?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

See http://docs.moodle.org/dev/Finding_your_way_into_the_Moodle_code. What is the URL when you are editing a question?

In reply to Tim Hunt

Απάντηση: Re: When is question added in DB?

by Marigianna Skouradaki -

thank you for your answer i will study that.

this is a url example for editing essay question

http://tsl7.csd.uoc.gr/moodle/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcourseid%3D1&courseid=1&id=105

In reply to Marigianna Skouradaki

Re: Απάντηση: Re: When is question added in DB?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Right, so the script you need to look at is question/question.php. If you trace through that, the key bit is the

} else if ($fromform = $mform->get_data()) {

section, which you can see ends up calling the ->save_question method on the appropriate question type class.