/** * Saves a new instance of the jclic into the database * * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will create a new instance and return the id number * of the new instance. * * @todo: create event (when timedue added) * * @param object $jclic An object from the form in mod_form.php * @param mod_jclic_mod_form $mform * @return int The id of the newly inserted jclic record */ function jclic_add_instance(stdClass $data, mod_jclic_mod_form $mform = null) { global $CFG; require_once $CFG->dirroot . '/mod/jclic/locallib.php'; $jclic = new jclic(context_module::instance($data->coursemodule), null, null); return $jclic->add_instance($data, true); }