|
@@ -50,333 +50,6 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
|
|
|
$dbman = $DB->get_manager();
|
|
|
|
|
|
- if ($oldversion < 2014012100) {
|
|
|
- // Define field and index in iLM table to be added
|
|
|
- $table = new xmldb_table('iassign_ilm');
|
|
|
- $index_name = new xmldb_index('name');
|
|
|
- $index_name->set_attributes(XMLDB_INDEX_UNIQUE, array('name'));
|
|
|
- if ($dbman->index_exists($table, $index_name)) {
|
|
|
- $dbman->drop_index($table, $index_name, $continue = true, $feedback = true);
|
|
|
- }
|
|
|
- $index_name_version = new xmldb_index('name_version');
|
|
|
- $index_name_version->set_attributes(XMLDB_INDEX_UNIQUE, array('name', 'version'));
|
|
|
- if (!$dbman->index_exists($table, $index_name_version)) {
|
|
|
- $dbman->add_index($table, $index_name_version, $continue = true, $feedback = true);
|
|
|
- }
|
|
|
-
|
|
|
- // Fix field name in ilm table to be added.
|
|
|
- $table = new xmldb_table('iassign_ilm');
|
|
|
- $field_height = new xmldb_field('heigth', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '600', 'width');
|
|
|
- if ($dbman->field_exists($table, $field_height))
|
|
|
- $dbman->rename_field($table, $field_height, 'height');
|
|
|
-
|
|
|
- // Define fields in iassign table to be added.
|
|
|
- $table = new xmldb_table('iassign');
|
|
|
- $field_intro = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'name');
|
|
|
- if (!$dbman->field_exists($table, $field_intro))
|
|
|
- $dbman->add_field($table, $field_intro);
|
|
|
- $field_introformat = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'intro');
|
|
|
- if (!$dbman->field_exists($table, $field_introformat))
|
|
|
- $dbman->add_field($table, $field_introformat);
|
|
|
- $field_grade = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '0', 'activity_group');
|
|
|
- if (!$dbman->field_exists($table, $field_grade))
|
|
|
- $dbman->add_field($table, $field_grade);
|
|
|
- $field_timeavailable = new xmldb_field('timeavailable', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'grade');
|
|
|
- if (!$dbman->field_exists($table, $field_timeavailable))
|
|
|
- $dbman->add_field($table, $field_timeavailable);
|
|
|
- $field_timedue = new xmldb_field('timedue', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'timeavailable');
|
|
|
- if (!$dbman->field_exists($table, $field_timedue))
|
|
|
- $dbman->add_field($table, $field_timedue);
|
|
|
- $field_preventlate = new xmldb_field('preventlate', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, '1', 'timedue');
|
|
|
- if (!$dbman->field_exists($table, $field_preventlate))
|
|
|
- $dbman->add_field($table, $field_preventlate);
|
|
|
- $field_test = new xmldb_field('test', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, '0', 'preventlate');
|
|
|
- if (!$dbman->field_exists($table, $field_test))
|
|
|
- $dbman->add_field($table, $field_test);
|
|
|
- $field_max_experiment = new xmldb_field('max_experiment', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'test');
|
|
|
- if (!$dbman->field_exists($table, $field_max_experiment))
|
|
|
- $dbman->add_field($table, $field_max_experiment);
|
|
|
-
|
|
|
- if (!$dbman->table_exists($table)) {
|
|
|
- $field_id = new xmldb_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE);
|
|
|
- $field_time = new xmldb_field('time', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'id');
|
|
|
- $field_userid = new xmldb_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'time');
|
|
|
- $field_ip = new xmldb_field('ip', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'userid');
|
|
|
- $field_course = new xmldb_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'ip');
|
|
|
- $field_cmid = new xmldb_field('cmid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'course');
|
|
|
- $field_ilmid = new xmldb_field('ilmid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'cmid');
|
|
|
- $field_action = new xmldb_field('action', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'ilmid');
|
|
|
- $field_info = new xmldb_field('info', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'action');
|
|
|
- $field_language = new xmldb_field('language', XMLDB_TYPE_CHAR, '10', null, null, null, null, 'info');
|
|
|
- $field_user_agent = new xmldb_field('user_agent', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'language');
|
|
|
- $field_javascript = new xmldb_field('javascript', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'user_agent');
|
|
|
- $field_java = new xmldb_field('java', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'javascript');
|
|
|
-
|
|
|
- $key = new xmldb_key('primary');
|
|
|
- $key->set_attributes(XMLDB_KEY_PRIMARY, array('id'), null, null);
|
|
|
-
|
|
|
- $index = new xmldb_index('course');
|
|
|
- $index->set_attributes(XMLDB_INDEX_NOTUNIQUE, array('course'));
|
|
|
-
|
|
|
- $table->addField($field_id);
|
|
|
- $table->addField($field_time);
|
|
|
- $table->addField($field_userid);
|
|
|
- $table->addField($field_ip);
|
|
|
- $table->addField($field_course);
|
|
|
- $table->addField($field_cmid);
|
|
|
- $table->addField($field_ilmid);
|
|
|
- $table->addField($field_action);
|
|
|
- $table->addField($field_info);
|
|
|
- $table->addField($field_language);
|
|
|
- $table->addField($field_user_agent);
|
|
|
- $table->addField($field_javascript);
|
|
|
- $table->addField($field_java);
|
|
|
-
|
|
|
- $table->addKey($key);
|
|
|
-
|
|
|
- $table->addIndex($index);
|
|
|
-
|
|
|
- $status = $dbman->create_table($table);
|
|
|
- } // if (!$dbman->table_exists($table))
|
|
|
-
|
|
|
- // Now update Moodle table '*_files' related to the iAssign: insert new field 'filearea'
|
|
|
- $fs = get_file_storage();
|
|
|
- $is_delete = true;
|
|
|
- $ilm_path = $CFG->dirroot . "/mod/iassign/ilm/";
|
|
|
-
|
|
|
- // All iAssign 'exercises' must get the label 'exercise'
|
|
|
- $exercise_files = $DB->get_records('files', array("component" => "mod_iassign", "filearea" => "activity"));
|
|
|
- foreach ($exercise_files as $exercise_file) {
|
|
|
- $exercise_file->filearea = "exercise";
|
|
|
- $DB->update_record('files', $exercise_file);
|
|
|
- }
|
|
|
-
|
|
|
- // All iAssign iLM (usually 'JAR package') must get the label 'activity'
|
|
|
- $activity_files = $DB->get_records('files', array("component" => "mod_iassign", "filearea" => "ilm"));
|
|
|
- foreach ($activity_files as $activity_file) {
|
|
|
- $activity_file->filearea = "activity";
|
|
|
- $DB->update_record('files', $activity_file);
|
|
|
- }
|
|
|
-
|
|
|
- // iAssign savepoint reached
|
|
|
- upgrade_mod_savepoint(true, 2014012100, 'iassign');
|
|
|
- } // if ($oldversion < 2014012100)
|
|
|
-
|
|
|
- if ($oldversion < 2017021900) { // update to migrate from 2016021300 to 2017021900 (2.2.00)
|
|
|
- // iassign_ilm : id; name; version; description; url; extension; parent; file_jar; file_class; width; height; enable; timemodified; author; timecreated; evaluate
|
|
|
- $count_iassign_ilm = $DB->count_records_sql('SELECT COUNT(id) FROM {iassign_ilm}'); // count the number of existing iLM in table '*_iassign_ilm'
|
|
|
- if ($count_iassign_ilm>0) { // Insert new iLM: iVProgH5 (package in HTML5 technology)
|
|
|
-
|
|
|
- // Insert an entry in the Moodle table '*_files'
|
|
|
- $context = context_system::instance();
|
|
|
- $file_ilm = array(
|
|
|
- 'userid' => $USER->id, // ID of context
|
|
|
- 'contextid' => $context->id, // ID of context
|
|
|
- 'component' => 'mod_iassign', // usually = table name
|
|
|
- 'filearea' => 'ilm', // in table '*_files' all iAssign exercises will have 'filearea="exercise"' and all iLM must be 'ilm'
|
|
|
- 'itemid' => 0,
|
|
|
- 'filepath' => '/iassign/ilm/', // any path beginning and ending in /
|
|
|
- 'filename' => "iVProg/1.0.20200221/ivprog/index.html"); // any filename: use the starting point of iVProgH5
|
|
|
-
|
|
|
- // Now update Moodle table '*_files' related to the iAssign: insert new field 'filearea'
|
|
|
- $fs = get_file_storage();
|
|
|
- $is_delete = true;
|
|
|
- $ilm_path = $CFG->dirroot . "/mod/iassign/ilm/";
|
|
|
-
|
|
|
- //TODO iLM_HTML5 : What model to implement to HTML5?
|
|
|
- //TODO 1. The first version of iLM HTML5 in '/var/www/html/moodle/mod/iassign/ilm/ilm-nome' and others in '/var/moodledata/filedir/'?
|
|
|
- //TODO 2. Inserting new iLM HTML5 by ZIP file => explode it and register in '/var/moodledata/filedir/'?
|
|
|
-
|
|
|
- // Create file using the content: the file information is inserted in the Moodle table '*_files'
|
|
|
- // The real file will be registered in Moodle data (default '/var/moodledata/filedir/xx/yy' - 'xxyy' is the first 4 char in '*_files.contenthash')
|
|
|
- //TODO Keep this even change the model to not insert iLM HTML5 (need this object to connect with '*_iassign_ilm' bellow)
|
|
|
- $file_ilm = $fs->create_file_from_string($file_ilm, file_get_contents($ilm_path . "ivprog-html/main.html"));
|
|
|
-
|
|
|
- if ($file_ilm)
|
|
|
- $is_delete &= @unlink($ilm_path . "ivprog-html");
|
|
|
-
|
|
|
- // Insert an entry in iAssign table '*_iassign_ilm'
|
|
|
- $newentry = new stdClass();
|
|
|
- $newentry->name = 'iVProg';
|
|
|
- $newentry->url = 'http://www.matematica.br/ivprog';
|
|
|
- $newentry->version = '1.0.20200221';
|
|
|
- $newentry->description = '{"en":"Visual Interactive Programming on the Internet HTML5","pt_br":"Programação visual interativa na Internet"}';
|
|
|
- $newentry->extension = 'ivph';
|
|
|
- $newentry->file_jar = 'iVProg/1.0.20200221/ivprog/'; // to JAR this is the '*_files.id' correponding to the iLM storaged in '/var/moodledata/filedir/'
|
|
|
- $newentry->file_class = 'index.html';
|
|
|
- $newentry->width = 800;
|
|
|
- $newentry->height = 700;
|
|
|
- $newentry->enable = 1;
|
|
|
- $newentry->timemodified = time();
|
|
|
- $newentry->author = $USER->id;
|
|
|
- $newentry->timecreated = time();
|
|
|
- $newentry->evaluate = 1;
|
|
|
- // $DB->insert_records('iassign_ilm', $newentry);
|
|
|
- $newentry->id = $DB->insert_record("iassign_ilm", $newentry);
|
|
|
-
|
|
|
- // iAssign savepoint reached
|
|
|
- upgrade_mod_savepoint(true, 2017021900, 'iassign');
|
|
|
- } // if ($count_iassign_ilm>0)
|
|
|
-
|
|
|
- } // if ($oldversion < 2017021900)
|
|
|
-
|
|
|
- if ($oldversion < 2017120100) { // last one: 2017042800 from 2017/02/19
|
|
|
- // Create new field 'type', putting 'Java' if JAR and 'HTML5' if HTML5
|
|
|
- // Update fields 'file_jar, file_class' of iLM iVProgH5 (from 'iVProgH5, ivprog-html/main.html' to 'ilm/ivprog-html/, main.html'
|
|
|
-
|
|
|
- //---
|
|
|
- // Define new field in iassign table to be added: type varchar(20) in { 'Java' 'HTML5' }
|
|
|
- $table = new xmldb_table('iassign_ilm');
|
|
|
- $new_field_type = new xmldb_field('type', XMLDB_TYPE_CHAR, '20', null, null, null, null, 'version'); // after field 'version'
|
|
|
- if (!$dbman->field_exists($table, $new_field_type))
|
|
|
- $dbman->add_field($table, $new_field_type);
|
|
|
-
|
|
|
- //---
|
|
|
- // All iAssign iLM (usually 'JAR package') must get the type 'Java'
|
|
|
- $list_of_ilm_installed = $DB->get_records('iassign_ilm');
|
|
|
- foreach ($list_of_ilm_installed as $ilm_installed) {
|
|
|
- $ilm_name = strtolower($ilm_installed->name);
|
|
|
-
|
|
|
- if ($ilm_name=="ivprogh5" || $ilm_name=="ifractions" || $ilm_name=="fractions") { // if it is 'iVProgH5' (perhaps 'iFractions' already installed?)
|
|
|
- $ilm_installed->type = "HTML5"; // it is HTML5
|
|
|
- $file_jar = strtolower($ilm_installed->file_jar);
|
|
|
- if ($ilm_name=="ivprogh5" && $file_jar=="ivprogh5") { // fields 'file_jar' and 'file_class' must have: 'ilm/ivprog-html/' and 'main.html'
|
|
|
- $ilm_installed->file_jar = "ilm/ivprog-html/"; // iVProgH5 ivprog-html/main.html
|
|
|
- $ilm_installed->file_class = "main.html";
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- $ilm_installed->type = "Java"; // otherwise it is Java
|
|
|
-
|
|
|
- $DB->update_record('iassign_ilm', $ilm_installed);
|
|
|
- } // foreach
|
|
|
-
|
|
|
- //---
|
|
|
- // Insert in table '{iassign_ilm}' the new iLM iFractions version 0.1.2017.11.22
|
|
|
- // Table 'iassign_ilm' : id name version type description url extension parent file_jar file_class width height enable timemodified author timecreated evaluate
|
|
|
-
|
|
|
- } // if ($oldversion < 2017120101)
|
|
|
-
|
|
|
- if ($oldversion < 2018031000) {
|
|
|
- // Verify if exist iLM with the same name
|
|
|
- // then, update the version and file_jar
|
|
|
-
|
|
|
- $records = array(
|
|
|
- array_combine( // iGeom 5.9.22
|
|
|
- array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'),
|
|
|
- array('iGeom', 'http://www.matematica.br/igeom', '5.9.22', 'Java', '{"en":"Interactive Geometry on the Internet","pt_br":"Geometria Interativa na Internet"}', 'geo', 'ilm/iGeom/5.9.22/iGeom.jar', 'IGeomApplet.class', 800, 600, 1, time(), $USER->id, time(), 1)),
|
|
|
- array_combine( // iGraf 4.4.0.10
|
|
|
- array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'),
|
|
|
- array('iGraf', 'http://www.matematica.br/igraf', '4.4.0.10', 'Java', '{"en":"Interactive Graphic on the Internet","pt_br":"Gráficos Interativos na Internet"}', 'grf', 'ilm/iGraf/4.4.0.10/iGraf.jar', 'igraf.IGraf.class', 840, 600, 1, time(), $USER->id, time(), 1)),
|
|
|
- );
|
|
|
-
|
|
|
- foreach ($records as $record) {
|
|
|
- if ($record['type'] == 'HTML5') {
|
|
|
-
|
|
|
- // Verify if there is a HTML5 iLM register => update it
|
|
|
- $iassign_ilm = $DB->get_records('iassign_ilm', array('name' => $record['name']));
|
|
|
-
|
|
|
- if ($iassign_ilm) {
|
|
|
- // Update file_jar and file_class
|
|
|
-
|
|
|
- foreach ($iassign_ilm as $iassign) {
|
|
|
- $iassign->name = trim($iassign->name);
|
|
|
- $iassign->version = trim($iassign->version);
|
|
|
- // If HTML5 iLM is the same version, only update the path
|
|
|
- if ($iassign->version == $record['version']) {
|
|
|
- $newentry = new stdClass();
|
|
|
- $newentry->id = $iassign->id;
|
|
|
- $newentry->file_jar = $record['file_jar'];
|
|
|
- $newentry->file_class = $record['file_class'];
|
|
|
-
|
|
|
- $DB->update_record("iassign_ilm", $newentry);
|
|
|
- }
|
|
|
- else { // If HTML5 iLM is NOT the same version, make a copy of the iLM
|
|
|
- $dest = $CFG->dirroot . '/mod/iassign/ilm/' . $iassign->name . '/' . $iassign->version . '/';
|
|
|
- mkdir($dest, 0755); // permissions "drwxr-xr-x"
|
|
|
-
|
|
|
- $source = $CFG->dirroot . '/mod/iassign/ilm/' . $iassign->name . '/' . $record['version'] . '/';
|
|
|
-
|
|
|
- foreach (
|
|
|
- $iterator = new \RecursiveIteratorIterator(
|
|
|
- new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS),
|
|
|
- \RecursiveIteratorIterator::SELF_FIRST) as $item) {
|
|
|
- if ($item->isDir()) {
|
|
|
- mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
|
|
|
- }
|
|
|
- else { // copy or move?
|
|
|
- copy($item, $dest . $iterator->getSubPathName());
|
|
|
- // copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
|
|
|
- // rename($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $newentry = new stdClass();
|
|
|
- $newentry->id = $iassign->id;
|
|
|
- $newentry->file_jar = 'ilm/' . $iassign->name . '/' . $iassign->version . '/' . basename($record['file_jar']) . '/';
|
|
|
- $newentry->file_class = $record['file_class'];
|
|
|
-
|
|
|
- $DB->update_record("iassign_ilm", $newentry);
|
|
|
- }
|
|
|
- } // foreach ($iassign_ilm as $iassign)
|
|
|
-
|
|
|
- }
|
|
|
- else { // if ($iassign_ilm)
|
|
|
- // If not found a iLM with the same name
|
|
|
- $DB->insert_record('iassign_ilm', $record, false); // insert new iLM in the table '*_iassign_ilm'
|
|
|
- }
|
|
|
-
|
|
|
- } // if ($record['type'] == 'HTML5')
|
|
|
- else {
|
|
|
-
|
|
|
- // Verify if there is a Java iLM register to update it
|
|
|
- $iassign_ilm = $DB->get_record('iassign_ilm', array('name' => $record['name'], 'version' => $record['version']));
|
|
|
-
|
|
|
- if ($iassign_ilm) {
|
|
|
- // Update file_jar and file_class
|
|
|
- $newentry = new stdClass();
|
|
|
- $newentry->id = $iassign_ilm->id;
|
|
|
- $newentry->file_jar = $record['file_jar'];
|
|
|
- $newentry->file_class = $record['file_class'];
|
|
|
-
|
|
|
- $DB->update_record("iassign_ilm", $newentry);
|
|
|
- }
|
|
|
- else { // if ($iassign_ilm) - I couldn't find an iLM with this name ($record['name']) and under this version ($record['version'])
|
|
|
- // If not found a Java iLM with the same name and version, search a
|
|
|
- // different version, to use as parent of new version
|
|
|
-
|
|
|
- $iassign_ilm_parent = $DB->get_record('iassign_ilm', array('name' => $record['name'], 'parent' => 0));
|
|
|
-
|
|
|
- if ($iassign_ilm_parent) {
|
|
|
- $record['parent'] = $iassign_ilm_parent->id;
|
|
|
- $DB->insert_record('iassign_ilm', $record, false); // insert with parent
|
|
|
-
|
|
|
- // Download the JAR file of parent from MoodleData and put it in iassign/ilm/
|
|
|
- $dest = $CFG->dirroot . '/mod/iassign/ilm/' . $iassign_ilm_parent->name . '/' . $iassign_ilm_parent->version . '/';
|
|
|
- mkdir($dest, 0777);
|
|
|
-
|
|
|
- $fs = get_file_storage();
|
|
|
- $file = $fs->get_file_by_id($iassign_ilm_parent->file_jar);
|
|
|
- $file->copy_content_to($dest . $file->get_filename());
|
|
|
-
|
|
|
- // Update file_jar of iLM parent
|
|
|
- $update_parent = new stdClass();
|
|
|
- $update_parent->id = $iassign_ilm_parent->id;
|
|
|
- $update_parent->file_jar = 'ilm/' . $iassign_ilm_parent->name . '/' . $iassign_ilm_parent->version . '/' . $file->get_filename();
|
|
|
-
|
|
|
- $DB->update_record("iassign_ilm", $update_parent);
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
- $DB->insert_record('iassign_ilm', $record, false); // insert new iLM in the table '*_iassign_ilm' without a parent
|
|
|
- }
|
|
|
- } // else if ($iassign_ilm)
|
|
|
- } // else if ($record['type'] == 'HTML5')
|
|
|
-
|
|
|
- } // foreach ($records as $record)
|
|
|
-
|
|
|
- } // if ($oldversion < 2018031000)
|
|
|
-
|
|
|
//L if ($oldversion < 2019112219) {
|
|
|
if ($oldversion < 2020070613) {
|
|
|
$table = new xmldb_table('iassign_submission');
|
|
@@ -665,6 +338,29 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
}
|
|
|
} // if ($oldversion < 2020102800)
|
|
|
|
|
|
+ /// @Igor - adicionar a tabela iassign_allsubmissions
|
|
|
+ if ($oldversion < 2020112000) {
|
|
|
+
|
|
|
+ // Define table iassign_allsubmissions to be created.
|
|
|
+ $table = new xmldb_table('iassign_allsubmissions');
|
|
|
+
|
|
|
+ // Adding fields to table iassign_allsubmissions.
|
|
|
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
|
|
+ $table->add_field('iassign_statementid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
|
|
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
|
|
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '16', null, XMLDB_NOTNULL, null, null);
|
|
|
+ $table->add_field('grade', XMLDB_TYPE_FLOAT, null, null, null, null, null, null);
|
|
|
+ $table->add_field('answer', XMLDB_TYPE_TEXT, 'long', null, null, null, null, null);
|
|
|
+
|
|
|
+ // Adding keys to table iassign_allsubmissions.
|
|
|
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
|
|
+
|
|
|
+ // Conditionally launch create table for iassign_allsubmissions.
|
|
|
+ if (!$dbman->table_exists($table)) {
|
|
|
+ $dbman->create_table($table);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
// log event -----------------------------------------------------
|
|
|
if (class_exists('plugin_manager'))
|