1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
- }
- require_once($CFG->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, $DB;
- $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('instanceName', 'gradeimporter'), array('size'=>'64'));
- $mform->setType('name', PARAM_TEXT);
- $mform->addRule('name', get_string('error_instanceNameField', '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);
-
-
- $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');
- }
- }
- }
- }*/
- }
|