dirroot.'/course/moodleform_mod.php'); require_once($CFG->dirroot.'/mod/gradeimporter/lib.php'); class mod_gradeimporter_mod_form extends moodleform_mod { function definition() { global $CFG, $COURSE, $USER, $DB, $OUTPUT; $mform =& $this->_form; $course_modules_id = optional_param('update', 0, PARAM_INT); $mform->addElement('header', 'general', get_string('general', 'gradeimporter')); $mform->addElement('text', 'name', get_string('name', 'gradeimporter'), array('size'=>'64')); $mform->setType('name', PARAM_TEXT); $mform->addRule('name', get_string('error_nameField', 'gradeimporter'), 'required', null, 'client'); $this->standard_intro_elements(get_string('description', 'gradeimporter')); //$ynoptions = array(0 => get_string('visibilityOn', 'gradeimporter'), 1 => get_string('visibilityOff', 'gradeimporter')); //$mform->addElement('') $features = array('groups' => false, 'groupings' => false, 'groupmembersonly' => false, 'outcomes' => false,'gradecat' => false, 'idnumber' => false); $this->standard_coursemodule_elements($features); //hidden fields $mform->addElement('hidden', 'action'); $mform->setType('action', PARAM_TEXT); $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_TEXT); $mform->addElement('hidden', 'iassign_id'); $mform->setType('iassign_id', PARAM_TEXT); $mform->addElement('hidden', 'author_name'); $mform->setType('author_name', PARAM_TEXT); $mform->addElement('hidden', 'author_modified_name'); $mform->setType('author_modified_name', PARAM_TEXT); $mform->addElement('hidden', 'timecreated'); $mform->setType('timecreated', PARAM_TEXT); $mform->addElement('hidden', 'position'); $mform->setType('position', PARAM_TEXT); $this->add_action_buttons(); } //$DB->insert_record($table, $dataobject, $returnid, $bulk); insert records on db /*function data_preprocessing (&$default_values) { parent::data_preprocessing($default_values); $mform = & $this->_form; if (!$mform->isSubmitted() && array_key_exists('name', $default_values)) { //TODO Remove when updating all the iassign that are tag <ia_uc> //$ia_uc = explode('<ia_uc>', $default_values['name']); //$default_values['name'] = $ia_uc[0]; } }*/ /* function definition_after_data() { global $DB; $mform = & $this->_form; $data = $mform->exportValues(); if ($mform->isSubmitted()) { $iassign_statements = $data['iassign_statement']; foreach ($iassign_statements as $key => $value) { if ($value == 1) { $updateentry = new stdClass(); $updateentry->id = $key; $updateentry->timemodified = time(); if (isset($data['grade_enabled']) && $data['grade_enabled'] == 1) $updateentry->grade = $data['grade']; if (isset($data['timedue_enabled']) && $data['timedue_enabled'] == 1) $updateentry->timedue = $data['timedue']; if (isset($data['timeavailable_enabled']) && $data['timeavailable_enabled'] == 1) $updateentry->timeavailable = $data['timeavailable']; if (isset($data['preventlate_enabled']) && $data['preventlate_enabled'] == 1) $updateentry->preventlate = $data['preventlate']; if (isset($data['test_enabled']) && $data['test_enabled'] == 1) $updateentry->test = $data['test']; if (isset($data['max_experiment_enabled']) && $data['max_experiment_enabled'] == 1) $updateentry->max_experiment = $data['max_experiment']; if (!$DB->update_record("iassign_statement", $updateentry)) print_error('error_update', 'iassign'); } } } }*/ }