General developer forum

Activity module "edit settings" store information

Picture of Juraj Obonya
Activity module "edit settings" store information


I try to develop an activity module for moodle.  I already checked the newmodule documentation.

In the file mod_form.php I wrote this code.....

public function definition()

global $CFG,$DB;
$mform =$this->_form;
$mform->addElement('header', 'treport', get_string('modulename', 'treport'));

$select = $mform->addElement('select', 'selecting', get_string('selecting','treport'),get_all_courses_from_moodle($DB),array('class' => 'js-example-basic-multiple'));


//.... and so on....
Please can anyone help me? Where can I find and how can I further work with the submitted data, which was sent through this moodle form. For example I would like to save it into the database. And customize this concrete modul through the sended settings. 

Thanks for the help.

Average of ratings: -
Re: Activity module "edit settings" store information
Core developersParticularly helpful MoodlersPlugin developers

Have a look at the edit.php and edit_form.php in the mod/book directory.

There you find 3 important lines:

$mform = new book_chapter_edit_form(null, array('chapter'=>$chapter, 'options'=>$options));
if ($mform->is_cancelled()) {
} else if ($data = $mform->get_data()) {
Average of ratings: -