|
@@ -14,6 +14,8 @@
|
|
|
* The commands in here will all be database-neutral,
|
|
|
* using the functions defined in lib/ddllib.php
|
|
|
*
|
|
|
+ * - v 1.5.4 2021/12/23
|
|
|
+ * + Added new version of iVProg 2021_11_30_22_06
|
|
|
* - v 1.5.2 2020/08/03
|
|
|
* + Fixed 'ALTER TABLE' of 'iassign_submission.grade' from BIGINT(11) to REAL
|
|
|
* + New version of iHanoi 1.0.20200803
|
|
@@ -50,8 +52,15 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
|
|
|
$dbman = $DB->get_manager();
|
|
|
|
|
|
- //L if ($oldversion < 2019112219) {
|
|
|
- if ($oldversion < 2020070613) {
|
|
|
+ // Sequence of updates:
|
|
|
+ // - 2020070613: structure
|
|
|
+ // - 2020080300
|
|
|
+ // - 2020120500
|
|
|
+ // - 2020122900
|
|
|
+ // - 2021020700
|
|
|
+ // - 2021122300: new version iVProg "1.0.20211130"
|
|
|
+
|
|
|
+ if ($oldversion < 2020070613) { // < 2020070613
|
|
|
$table = new xmldb_table('iassign_submission');
|
|
|
$field = new xmldb_field('previous_grade', XMLDB_TYPE_FLOAT, null, null, null, null, null);
|
|
|
if (!$dbman->field_exists($table, $field)) {
|
|
@@ -68,9 +77,9 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
array_combine( // iHanoi 1.0.20200803
|
|
|
array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate', 'reevaluate'),
|
|
|
array('iHanoi', 'http://www.matematica.br/ihanoi', '1.0.20200803', 'HTML5', '{"en":"interactive Tower os Hanoi (by LInE)", "pt_br":"Torres de Hanói (do LInE)"}', 'ihn', 'ilm/iHanoi/1.0.20200803/ihanoi/', 'index.html', 1100, 500, 1, time(), $USER->id, time(), 1, 0)),
|
|
|
- array_combine( // iVProg 1.0.20200221/ - HTML5 - 2020
|
|
|
+ array_combine( // iVProg 1.0.20211130/ - HTML5 - 2020
|
|
|
array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate', 'reevaluate'),
|
|
|
- array('iVProg', 'http://www.usp.br/line/ivprog/', '1.0.20200221', 'HTML5', '{"en":"Visual Interactive Programming on the Internet (HTML)","pt_br":"Programação visual interativa na Internet"}', 'ivph', 'ilm/iVProg/1.0.20200221/ivprog/', 'index.html', 800, 600, 1, time(), $USER->id, time(), 1, 1)),
|
|
|
+ array('iVProg', 'http://www.usp.br/line/ivprog/', '1.0.20211130', 'HTML5', '{"en":"Visual Interactive Programming on the Internet (HTML)","pt_br":"Programação visual interativa na Internet"}', 'ivph', 'ilm/iVProg/1.0.20211130/ivprog/', 'index.html', 800, 600, 1, time(), $USER->id, time(), 1, 1)),
|
|
|
array_combine( // iFractions 0.1.20200221 - HTML5
|
|
|
array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate', 'reevaluate'),
|
|
|
array('iFractions', 'http://www.matematica.br/ifractions', '0.1.20200221', 'HTML5', '{"en":"Interactive Fractions game","pt_br":"Jogo interativa de frações"}', 'frc', 'ilm/iFractions/0.1.20200221/ifractions/', 'index.html', 1000, 600, 1, time(), $USER->id, time(), 1, 0))
|
|
@@ -202,7 +211,7 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
$DB->execute($sql);
|
|
|
}
|
|
|
|
|
|
- // Update iHanoi, iVProg, iFractions and iGeom
|
|
|
+ // Update iHanoi
|
|
|
$records = array(
|
|
|
array_combine( // iHanoi 1.0.20200803
|
|
|
array('name', 'url', 'version', 'type', 'description',
|
|
@@ -215,10 +224,11 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
$iassign_ilm = $DB->get_records('iassign_ilm');
|
|
|
foreach ($records as $record) { // For each iLM in the current version of iAssign
|
|
|
$newentry = new stdClass();
|
|
|
+
|
|
|
$newentry->name = $record['name'];
|
|
|
+ $newentry->url = $record['url'];
|
|
|
$newentry->version = $record['version'];
|
|
|
$newentry->type = $record['type'];
|
|
|
- $newentry->url = $record['url'];
|
|
|
$newentry->description = $record['description'];
|
|
|
$newentry->extension = $record['extension'];
|
|
|
$newentry->file_jar = $record['file_jar'];
|
|
@@ -231,7 +241,6 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
$newentry->reevaluate = $record['reevaluate'];
|
|
|
$newentry->author = $USER->id;
|
|
|
$newentry->timecreated = time();
|
|
|
- $newentry->evaluate = $record['evaluate'];
|
|
|
|
|
|
$exists = 0;
|
|
|
$last_id = -1;
|
|
@@ -298,7 +307,6 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
// Updating all registers from iassing_statement.filesid
|
|
|
$DB->execute("UPDATE {iassign_statement} SET filesid = file");
|
|
|
|
|
|
-
|
|
|
// 1. encontrar os contextos dos arquivos do itarefa:
|
|
|
$iassign_contexts_list = $DB->get_records_sql("SELECT DISTINCT contextid FROM {files} f WHERE component='mod_iassign'");
|
|
|
// 2. compor um array com todos os contextos encontrados:
|
|
@@ -348,9 +356,9 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
} // foreach ($iassign_statement_list as $iassign_statement_activity_item)
|
|
|
} // if ($oldversion < 2020120500)
|
|
|
|
|
|
- /// @Igor - adicionar a tabela iassign_allsubmissions
|
|
|
- if ($oldversion < 2020122900) {
|
|
|
|
|
|
+ /// @Igor - adicionar a tabela iassign_allsubmissions
|
|
|
+ if ($oldversion < 2020122900) { // < 2020122900
|
|
|
// Define table iassign_allsubmissions to be created.
|
|
|
$table = new xmldb_table('iassign_allsubmissions');
|
|
|
|
|
@@ -476,16 +484,99 @@ function xmldb_iassign_upgrade ($oldversion) {
|
|
|
|
|
|
} // if ($oldversion < 2020122900)
|
|
|
|
|
|
- if ($oldversion < 2021020700) {
|
|
|
-
|
|
|
- // Update SAW iVProg to inform reevalute is enabled:
|
|
|
- $updateentry = new stdClass();
|
|
|
- $updateentry->id = 57;
|
|
|
- $updateentry->reevaluate = 1;
|
|
|
- $updateentry->timemodified = time();
|
|
|
- $DB->update_record("iassign_ilm", $updateentry); // insert new iLM
|
|
|
+ if ($oldversion < 2021020700) {
|
|
|
+ // Update SAW iVProg to inform reevalute is enabled:
|
|
|
+ $updateentry = new stdClass();
|
|
|
+ $updateentry->id = 57;
|
|
|
+ $updateentry->reevaluate = 1;
|
|
|
+ $updateentry->timemodified = time();
|
|
|
+ $DB->update_record("iassign_ilm", $updateentry); // insert new iLM
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ if ($oldversion < 2021122300) {
|
|
|
+
|
|
|
+ // Update iHanoi
|
|
|
+ $records = array(
|
|
|
+ array_combine( // iVProg 1.0.20211130/ - HTML5 - 2021/12/30
|
|
|
+ array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate', 'reevaluate'),
|
|
|
+ array('iVProg', 'http://www.usp.br/line/ivprog/', '1.0.20211130', 'HTML5', '{"en":"Visual Interactive Programming on the Internet (HTML)","pt_br":"Programação visual interativa na Internet"}',
|
|
|
+ 'ivph', 'ilm/iVProg/1.0.20211123/ivprog/', 'index.html', 800, 600, 1, time(), $USER->id, time(), 1, 1))
|
|
|
+ );
|
|
|
+ $iassign_ilm = $DB->get_records('iassign_ilm');
|
|
|
+ foreach ($records as $record) { // For each iLM in the current version of iAssign
|
|
|
+ $newentry = new stdClass();
|
|
|
+ $newentry->name = $record['name'];
|
|
|
+ $newentry->url = $record['url'];
|
|
|
+ $newentry->version = $record['version'];
|
|
|
+ $newentry->type = $record['type'];
|
|
|
+ $newentry->description = $record['description'];
|
|
|
+ $newentry->extension = $record['extension'];
|
|
|
+ $newentry->file_jar = $record['file_jar'];
|
|
|
+ $newentry->file_class = $record['file_class'];
|
|
|
+ $newentry->width = $record['width'];
|
|
|
+ $newentry->height = $record['height'];
|
|
|
+ $newentry->enable = $record['enable'];
|
|
|
+ $newentry->timemodified = time();
|
|
|
+ $newentry->author = $USER->id;
|
|
|
+ $newentry->timecreated = time();
|
|
|
+ $newentry->evaluate = $record['evaluate'];
|
|
|
+ $newentry->reevaluate = $record['reevaluate'];
|
|
|
+
|
|
|
+//parent
|
|
|
+//16 => NULL,
|
|
|
+ $exists = 0;
|
|
|
+ $last_id = -1;
|
|
|
+ if ($iassign_ilm) { // Search if there is any previous installed iLM that is also in the current version of iAssign
|
|
|
+ $record_type = strtolower($record['type']);
|
|
|
+ foreach ($iassign_ilm as $iassign) {
|
|
|
+ if ($iassign->name == $record['name'] && strtolower($iassign->type) == $record_type) {
|
|
|
+ if ($iassign->id > $last_id)
|
|
|
+ $last_id = $iassign->id; // last ID => last version (hopefully)
|
|
|
+ if ($iassign->version == $record['version']) { // or with the one with the same version
|
|
|
+ $exists = 1; // iLM found - exit with the last one, same version
|
|
|
+ $strNot_installed += "\n" + ' <li>' + $record['name'] + ';' + $record['type'] + ';' + $record['version'] + ' </li>' + "\n";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $newentry->parent = $last_id; // parent is the last iLM found (corresponde to the smallest ID)
|
|
|
+ }
|
|
|
+ else
|
|
|
+ $newentry->parent = -1; // first iLM of this one
|
|
|
+ if ($exists == 0) { // iLM does not exists or it has old version
|
|
|
+ // $newentry->parent = $record['parent'];
|
|
|
+ $DB->insert_record("iassign_ilm", $newentry, false);
|
|
|
+ }
|
|
|
+ } // foreach ($records as $record)
|
|
|
+
|
|
|
+ if ($strNot_installed != '') {
|
|
|
+ print '<div class="alert alert-warning alert-block fade in " role="alert" data-aria-autofocus="true" tabindex="0" >' + "\n";
|
|
|
+ print get_string('upgrade_alert_exists', 'iassign'); // iLM previouly existent
|
|
|
+ print ' <ul style="margin-top: 1rem;">' + "\n";
|
|
|
+ print $strNot_installed;
|
|
|
+ print ' </ul>' + "\n";
|
|
|
+ print '</div>' + "\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ // iassign_ilm: atualizou iHanoi existente, mas nao era isso! Deveria ter inserido novo!
|
|
|
+ // id name version type ... parent file_jar file_class width height ... evaluate reevaluate
|
|
|
+ // 53 iHanoi 2 HTML5 ... 0 ilm/iHanoi/2/ihanoi/ index.html 1100 700 ... 1 0
|
|
|
+ $iassign_ilm = $DB->get_records('iassign_ilm');
|
|
|
+ foreach ($iassign_ilm as $iassign) { // for iLM iHanoi update the new field 'reevaluate' as 1
|
|
|
+ if ($iassign->name == 'iHanoi' && $iassign->type == 'HTML5' && $iassign->reevaluate!=1) {
|
|
|
+ $updateentry = new stdClass();
|
|
|
+ $updateentry->id = $iassign->id;
|
|
|
+ $updateentry->reevaluate = 1;
|
|
|
+ $updateentry->timemodified = time();
|
|
|
+ $DB->update_record("iassign_ilm", $updateentry);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // iAssign savepoint reached.
|
|
|
+ upgrade_mod_savepoint(true, 2021122300, 'iassign');
|
|
|
+ } // if ($oldversion < 2021122300)
|
|
|
+
|
|
|
|
|
|
// log event -----------------------------------------------------
|
|
|
if (class_exists('plugin_manager'))
|