Commit 57c9e0e4 authored by Astor Bizard's avatar Astor Bizard
Browse files

Merge branch 'dev' into 'test'

Added settings overrides, work state summary, temporary token to be sent to execution server.

See merge request !12
parents 7f1ef28f aa797e33
define(["jquery"],function(a){return{makeSortable:function(b,c=[],d,e=0){var f;null===d&&(d=void 0);var g=a("#"+b+" tbody"),h=a("#"+b+" thead th"),i=h.length;h.each(function(){var b=h.index(this);-1==c.indexOf(b)&&-1==c.indexOf(b-i)&&a(this).append('<i class="icon fa fa-fw sortarrow"></i>')}),a("#"+b+" thead .sortarrow").each(function(){var b=a(this),c=b.closest("th"),d=h.index(c);c.css("cursor","pointer").css("user-select","none").click(function(){b.hasClass("sortarrow-active")?1==(f=-f)?b.removeClass("fa-caret-up").addClass("fa-caret-down"):b.removeClass("fa-caret-down").addClass("fa-caret-up"):(a("i.sortarrow-active").removeClass("sortarrow-active fa-caret-down fa-caret-up"),b.addClass("sortarrow-active fa-caret-down"),f=1);var c=1,h=Array.from(g.children("tr")),i=h.splice(-e,e);h.sort(function(b,c){var e=function(b){return a(b).find(".cell.c"+d+" [value]").attr("value")||a(b).find(".cell.c"+d).text()},g=e(b),h=e(c);return f*(""===g||""===h||isNaN(g)||isNaN(h)?g.toString().localeCompare(h):g-h)}).forEach(function(b){a(b).children("td").first().find(":not(:empty)").addBack(":not(:empty)").each(function(){/^[0-9]+$/.test(a(this).html())&&a(this).html(c)}),c++,g.append(b)}),i.forEach(function(a){g.append(a)})}),c.find("a").click(function(a){a.stopPropagation()})}).eq(d).click()}}});
\ No newline at end of file
define(["jquery"],function(a){return{makeSortable:function(b,c=[],d,e=0){var f;null===d&&(d=void 0);var g=a("#"+b+" tbody"),h=a("#"+b+" thead th"),i=h.length;h.each(function(){var b=h.index(this);-1==c.indexOf(b)&&-1==c.indexOf(b-i)&&a(this).append('<i class="icon fa fa-fw sortarrow"></i>')}),a("#"+b+" thead .sortarrow").each(function(){var b=a(this),c=b.closest("th"),d=h.index(c);c.css("cursor","pointer").css("user-select","none").click(function(){b.hasClass("sortarrow-active")?(f=-f,b.toggleClass("fa-caret-up",1!=f).toggleClass("fa-caret-down",1==f)):(a("i.sortarrow-active").removeClass("sortarrow-active fa-caret-down fa-caret-up"),b.addClass("sortarrow-active fa-caret-down"),f=1);var c=1,h=Array.from(g.children("tr")),i=h.splice(-e,e);h.sort(function(b,c){var e=function(b){return a(b).find(".cell.c"+d+" [value]").attr("value")||a(b).find(".cell.c"+d).text()},g=e(b),h=e(c);return f*(""===g||""===h||isNaN(g)||isNaN(h)?g.toString().localeCompare(h):g-h)}).forEach(function(b){a(b).children("td").first().find(":not(:empty)").addBack(":not(:empty)").each(function(){/^[0-9]+$/.test(a(this).html())&&a(this).html(c)}),c++,g.append(b)}),i.forEach(function(a){g.append(a)})}),c.find("a").click(function(a){a.stopPropagation()})}).eq(d).click()}}});
\ No newline at end of file
define(["jquery"],function(a){function b(b){"archive"==b?(a("#id_headersubmitarchive").show().removeClass("collapsed"),a("#id_headersubmitfiles").hide()):(a("#id_headersubmitarchive").hide(),a("#id_headersubmitfiles").show().removeClass("collapsed"))}return{setup:function(){var c=a('select[name="submitmethod"]');c.change(function(){b(c.val())}),b(c.val())}}});
\ No newline at end of file
define(["jquery"],function(a){return{setup:function(){a('select[name="submitmethod"]').change(function(){a("#id_headersubmitarchive").toggle("archive"==a(this).val()).removeClass("collapsed"),a("#id_headersubmitfiles").toggle("archive"!=a(this).val()).removeClass("collapsed")}).change()}}});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -39,12 +39,7 @@ define(['jquery'], function($){
else {
// Change sorting direction and arrow display.
sortdirection = -sortdirection;
if (sortdirection == 1) {
$arrow.removeClass('fa-caret-up').addClass('fa-caret-down');
}
else {
$arrow.removeClass('fa-caret-down').addClass('fa-caret-up');
}
$arrow.toggleClass('fa-caret-up', sortdirection != 1).toggleClass('fa-caret-down', sortdirection == 1);
}
// Sort rows.
var num = 1;
......
define(['jquery'], function($) {
function updateHeaders(submitType) {
if (submitType == 'archive') {
$('#id_headersubmitarchive').show().removeClass('collapsed');
$('#id_headersubmitfiles').hide();
} else {
$('#id_headersubmitarchive').hide();
$('#id_headersubmitfiles').show().removeClass('collapsed');
}
}
return {
setup: function() {
var $select = $('select[name="submitmethod"]');
$select.change(function() {
updateHeaders($select.val());
});
updateHeaders($select.val());
$('select[name="submitmethod"]').change(function() {
$('#id_headersubmitarchive').toggle($(this).val() == 'archive').removeClass('collapsed');
$('#id_headersubmitfiles').toggle($(this).val() != 'archive').removeClass('collapsed');
}).change();
}
};
});
\ No newline at end of file
......@@ -1737,6 +1737,44 @@ define(
}
});
var reloadFilesAfterExecution = function() {
$.ajax({
type: "POST",
url: options.loadajaxurl + 'getlastversion',
'data': JSON.stringify(options),
contentType: "application/json; charset=utf-8",
dataType: "json"
}).done(function(outcome) {
if (outcome.success && fileManager.getVersion() < outcome.response.version) {
// A more recent version exists, prompt user to load it.
showMessage(str('morerecentversionloadprompt'), {
title: str('morerecentversionsaved'),
yes: function() {
VPLUtil.requestAction('load', 'loading', options, options.loadajaxurl)
.done(function(response) {
var files = response.files;
for (var i = 0; i < files.length; i++) {
fileManager.addFile(files[i], true, VPLUtil.doNothing, showErrorMessage);
}
fileManager.fileListVisibleIfNeeded();
fileManager.resetModified();
fileManager.setVersion(response.version);
fileManager.fileListVisible(files.length > 5);
tabs.tabs('option', 'active', 0);
VPLUtil.afterAll('AfterLoadFiles', function() {
fileManager.resetModified();
updateMenu();
autoResizeTab();
adjustTabsTitles(false);
});
})
.fail(showErrorMessage);
}
});
}
});
};
var executionActions = {
'getConsole': function() {
return lastConsole;
......@@ -1747,19 +1785,20 @@ define(
if (lastConsole && lastConsole.isOpen()) {
lastConsole.close();
}
var afterExecution = function() {
if (ws.readyState != ws.OPEN) {
reloadFilesAfterExecution();
}
ws.close();
focusCurrentFile();
};
if (type == 'terminal') {
lastConsole = terminal;
terminal.connect(coninfo.executionURL, function() {
ws.close();
focusCurrentFile();
});
terminal.connect(coninfo.executionURL, afterExecution);
} else {
lastConsole = VNCClient;
VNCClient.connect(coninfo.secure, coninfo.server, coninfo.portToUse, coninfo.VNCpassword,
coninfo.executionPath, function() {
ws.close();
focusCurrentFile();
});
coninfo.executionPath, afterExecution);
}
},
'lastAction': false,
......
......@@ -423,6 +423,7 @@ define(
'kt': 'kotlin', 'kts': 'kotlin',
'm': 'matlab',
'md': 'markdown',
'ml': 'ocaml',
'less': 'less',
'lisp': 'lisp', 'lsp': 'lisp',
'lua': 'lua',
......
......@@ -214,6 +214,27 @@ class backup_vpl_activity_structure_step extends backup_activity_structure_step
'variation'
);
/**
* @var array Overrides table fields list
*/
protected $overridefields = array (
'vpl',
'startdate',
'duedate',
'freeevaluations',
'reductionbyevaluation'
);
/**
* @var array Assigned Overrides table fields list
*/
protected $assioverridefields = array (
'vpl',
'userid',
'groupid',
'override'
);
/**
* Define the full structure of a VPL instance with user data
* {@inheritDoc}
......@@ -241,6 +262,12 @@ class backup_vpl_activity_structure_step extends backup_activity_structure_step
$asignedvariation = new backup_nested_element( 'asigned_variation',
$idfield,
$this->asivariationfields );
$overrides = new backup_nested_element( 'overrides' );
$override = new backup_nested_element( 'override', $idfield, $this->overridefields );
$assignedoverrides = new backup_nested_element( 'assigned_overrides' );
$assignedoverride = new backup_nested_element( 'assigned_override',
$idfield,
$this->assioverridefields );
$submissions = new backup_nested_element( 'submissions' );
$submission = new backup_nested_element( 'submission', $idfield, $this->submissionfields );
$submissionfiles = new backup_nested_element( 'submission_files' );
......@@ -250,6 +277,8 @@ class backup_vpl_activity_structure_step extends backup_activity_structure_step
$vpl->add_child( $corrected_files );
$vpl->add_child( $executionfiles );
$vpl->add_child( $variations );
$vpl->add_child( $overrides );
$vpl->add_child( $assignedoverrides );
$vpl->add_child( $submissions );
$requiredfiles->add_child( $requiredfile );
$corrected_files->add_child( $corrected_file );
......@@ -257,6 +286,8 @@ class backup_vpl_activity_structure_step extends backup_activity_structure_step
$variations->add_child( $variation );
$variation->add_child( $asignedvariations );
$asignedvariations->add_child( $asignedvariation );
$overrides->add_child( $override );
$assignedoverrides->add_child( $assignedoverride );
$submissions->add_child( $submission );
$submission->add_child( $submissionfiles );
$submissionfiles->add_child( $submissionfile );
......@@ -269,8 +300,10 @@ class backup_vpl_activity_structure_step extends backup_activity_structure_step
$query .= ' WHERE s.id = ?';
$vpl->set_source_sql( $query, array ( backup::VAR_ACTIVITYID ) );
$variation->set_source_table( 'vpl_variations', $parmvplid );
$override->set_source_table( 'vpl_overrides', $parmvplid );
if ($userinfo) {
$asignedvariation->set_source_table( 'vpl_assigned_variations', $parmvplid );
$assignedoverride->set_source_table( 'vpl_assigned_overrides', $parmvplid );
/*
* Uncomment next line and comment nexts to backup all student's submissions, not only last one.
* $submission->set_source_table('vpl_submissions', $parmvplid);
......@@ -287,6 +320,8 @@ class backup_vpl_activity_structure_step extends backup_activity_structure_step
$vpl->annotate_ids( 'scale', 'grade' );
$vpl->annotate_ids( 'vpl', 'basedon' );
$asignedvariation->annotate_ids( 'user', 'userid' );
$assignedoverride->annotate_ids( 'user', 'userid' );
$assignedoverride->annotate_ids( 'group', 'groupid' );
$submission->annotate_ids( 'user', 'userid' );
$submission->annotate_ids( 'user', 'grader' );
$submission->annotate_ids( 'group', 'groupid' );
......
......@@ -80,8 +80,10 @@ class restore_vpl_activity_structure_step extends restore_activity_structure_ste
$paths [] = new restore_path_element ( 'corrected_file', '/activity/vpl/corrected_files/corrected_file' );
$paths [] = new restore_path_element ( 'execution_file', '/activity/vpl/execution_files/execution_file' );
$paths [] = new restore_path_element ( 'variation', '/activity/vpl/variations/variation' );
$paths [] = new restore_path_element ( 'override', '/activity/vpl/overrides/override' );
if ($userinfo) {
$paths [] = new restore_path_element ( 'assigned_variation', '/activity/vpl/assigned_variations/assigned_variation' );
$paths [] = new restore_path_element ( 'assigned_override', '/activity/vpl/assigned_overrides/assigned_override' );
$paths [] = new restore_path_element ( 'submission', '/activity/vpl/submissions/submission' );
$paths [] = new restore_path_element (
'submission_file',
......@@ -192,6 +194,37 @@ class restore_vpl_activity_structure_step extends restore_activity_structure_ste
$DB->insert_record ( 'vpl_assigned_variations', $data );
}
/**
* Restore an override
* @param array $data override instance
*/
protected function process_override($data) {
global $DB;
$data = ( object ) $data;
$data->vpl = $this->get_new_parentid ( 'vpl' );
$data->startdate = $this->apply_date_offset ( $data->startdate );
$data->duedate = $this->apply_date_offset ( $data->duedate );
$newid = $DB->insert_record ( 'vpl_overrides', $data );
$this->set_mapping('override', $data->id, $newid); // Map new id to be used by process_assigned_override().
}
/**
* Restore an override assignation
* @param array $data assigned override instance
*/
protected function process_assigned_override($data) {
global $DB;
$data = ( object ) $data;
$newid = $this->get_mappingid('override', $data->override, null); // Fetch new override id.
if ($newid !== null) {
$data->vpl = $this->get_new_parentid ( 'vpl' );
$data->override = $newid;
$data->userid = $this->get_mappingid ( 'user', $data->userid, null );
$data->groupid = $this->get_mappingid ( 'group', $data->groupid, null );
$DB->insert_record ( 'vpl_assigned_overrides', $data );
}
}
/**
* Restore a submission
* @param array $data submission instance
......
<?php
// This file is part of VPL for Moodle - http://vpl.dis.ulpgc.es/
//
// VPL for Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VPL for Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VPL for Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for logging of override updated events
*
* @package mod_vpl
* @copyright 2014 onwards Juan Carlos Rodríguez-del-Pino, 2021 Astor Bizard
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_vpl\event;
defined( 'MOODLE_INTERNAL' ) || die();
require_once(dirname( __FILE__ ) . '/../../locallib.php');
class override_base extends base {
public static function get_objectid_mapping() {
return array('db' => VPL_OVERRIDES, 'restore' => VPL_OVERRIDES);
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
protected function init() {
$this->data ['crud'] = 'u';
$this->data ['edulevel'] = self::LEVEL_TEACHING;
$this->data ['objecttable'] = VPL_OVERRIDES;
}
public static function log($vpl, $overrideid = null) {
if (is_array($vpl)) {
$info = $vpl;
} else {
$vplinstance = $vpl->get_instance();
$info = array (
'objectid' => $overrideid,
'contextid' => $vpl->get_context()->id,
'courseid' => $vplinstance->course,
'other' => array('vplid' => $vplinstance->id),
);
}
parent::log( $info );
}
public function get_url() {
return $this->get_url_base( 'view.php' );
}
public function get_description_mod($mod) {
$desc = 'The user with id ' . $this->userid . ' ' . $mod;
$desc .= ' override with id ' . $this->objectid . ' of VPL activity with id ' . $this->other['vplid'];
if ($this->relateduserid) {
$desc .= ' for user with id ' . $this->relateduserid;
}
return $desc;
}
}
<?php
// This file is part of VPL for Moodle - http://vpl.dis.ulpgc.es/
//
// VPL for Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VPL for Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VPL for Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for logging of override created events
*
* @package mod_vpl
* @copyright 2014 onwards Juan Carlos Rodríguez-del-Pino, 2021 Astor Bizard
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_vpl\event;
defined( 'MOODLE_INTERNAL' ) || die();
require_once(dirname( __FILE__ ) . '/../../locallib.php');
class override_created extends override_base {
protected function init() {
parent::init();
$this->data ['crud'] = 'c';
$this->legacyaction = 'created override';
}
public function get_description() {
return $this->get_description_mod( 'created' );
}
}
<?php
// This file is part of VPL for Moodle - http://vpl.dis.ulpgc.es/
//
// VPL for Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VPL for Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VPL for Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for logging of override deleted events
*
* @package mod_vpl
* @copyright 2014 onwards Juan Carlos Rodríguez-del-Pino, 2021 Astor Bizard
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_vpl\event;
defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__).'/../../locallib.php');
class override_deleted extends override_base {
protected function init() {
parent::init();
$this->data['crud'] = 'd';
$this->legacyaction = 'deleted override';
}
public function get_description() {
return $this->get_description_mod( 'deleted' );
}
}
<?php
// This file is part of VPL for Moodle - http://vpl.dis.ulpgc.es/
//
// VPL for Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VPL for Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VPL for Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for logging of override updated events
*
* @package mod_vpl
* @copyright 2014 onwards Juan Carlos Rodríguez-del-Pino, 2021 Astor Bizard
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_vpl\event;
defined( 'MOODLE_INTERNAL' ) || die();
require_once(dirname( __FILE__ ) . '/../../locallib.php');
class override_updated extends override_base {
protected function init() {
parent::init();
$this->data ['crud'] = 'u';
$this->legacyaction = 'updated override';
}
public function get_description() {
return $this->get_description_mod( 'updated' );
}
}
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/vpl/db" VERSION="20171119" COMMENT="XMLDB file for Moodle mod/vpl"
<XMLDB PATH="mod/vpl/db" VERSION="20210616" COMMENT="XMLDB file for Moodle mod/vpl"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
......@@ -22,7 +22,7 @@
<FIELD NAME="visiblegrade" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="0 visible grade no, 1 yes"/>
<FIELD NAME="usevariations" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Boolean to set if use variations or not in this vpl"/>
<FIELD NAME="variationtitle" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Variation tittle, is show with the variation description"/>
<FIELD NAME="usableasbase" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" />
<FIELD NAME="usableasbase" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="basedon" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Optionally, set the VPL id from this will be based on"/>
<FIELD NAME="run" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Let the student Run the program intertive (0=no, 1=yes)"/>
<FIELD NAME="debug" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Let to the student debug the program"/>
......@@ -132,5 +132,37 @@
<INDEX NAME="userid_id" UNIQUE="true" FIELDS="userid, id" COMMENT="Index for userid id"/>
</INDEXES>
</TABLE>
<TABLE NAME="vpl_overrides" COMMENT="Overrides to VPL settings">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="vpl" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="VPL id"/>
<FIELD NAME="startdate" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If set, date the vpl will be available"/>
<FIELD NAME="duedate" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If set, after this date this vpl instance will not be available"/>
<FIELD NAME="freeevaluations" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If set, number of automatic evaluations that do not reduce final score"/>
<FIELD NAME="reductionbyevaluation" TYPE="char" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If set, reduce final score by a value or percentage for each automatic evaluation"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="vpl" UNIQUE="false" FIELDS="vpl"/>
</INDEXES>
</TABLE>
<TABLE NAME="vpl_assigned_overrides" COMMENT="Overrides assignations to users and groups">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="vpl" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="VPL id"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="User this override applies to"/>
<FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Group this override applies to"/>
<FIELD NAME="override" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Override id"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="vpl" UNIQUE="false" FIELDS="vpl"/>
<INDEX NAME="override" UNIQUE="false" FIELDS="override"/>
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
\ No newline at end of file
......@@ -323,5 +323,54 @@ function xmldb_vpl_upgrade($oldversion = 0) {
// VPL savepoint reached.
upgrade_mod_savepoint( true, 2018011314, 'vpl' );
}
if ($oldversion < 2021061600) {
// Define table vpl_overrides to be created.
$table = new xmldb_table('vpl_overrides');
// Adding fields to table vpl_overrides.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('vpl', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('startdate', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('duedate', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('freeevaluations', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('reductionbyevaluation', XMLDB_TYPE_CHAR, '10', null, null, null, null);
// Adding keys to table vpl_overrides.
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
// Adding indexes to table vpl_assigned_overrides.
$table->add_index('vpl', XMLDB_INDEX_NOTUNIQUE, ['vpl']);
// Conditionally launch create table for vpl_overrides.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Define table vpl_assigned_overrides to be created.
$table = new xmldb_table('vpl_assigned_overrides');
// Adding fields to table vpl_assigned_overrides.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('vpl', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('groupid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('override', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
// Adding keys to table vpl_assigned_overrides.
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
// Adding indexes to table vpl_assigned_overrides.
$table->add_index('vpl', XMLDB_INDEX_NOTUNIQUE, ['vpl']);
$table->add_index('override', XMLDB_INDEX_NOTUNIQUE, ['override']);
// Conditionally launch create table for vpl_assigned_overrides.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Vpl savepoint reached.
upgrade_mod_savepoint(true, 2021061600, 'vpl');
}
return true;
}
......@@ -121,6 +121,8 @@ class vpl_editor_util {
'interfacetheme',
'keyboard',
'maxfilesexceeded',
'morerecentversionloadprompt',
'morerecentversionsaved',
'new',
'next',
'load',
......
......@@ -180,9 +180,8 @@ class mod_vpl_edit{
$files = self::get_requested_files( $vpl );
$compilationexecution = new stdClass();
$compilationexecution->nevaluations = 0;
$vplinstance = $vpl->get_instance();
$compilationexecution->freeevaluations = $vplinstance->freeevaluations;
$compilationexecution->reductionbyevaluation = $vplinstance->reductionbyevaluation;
$compilationexecution->freeevaluations = $vpl->get_effective_setting('freeevaluations', $userid);
$compilationexecution->reductionbyevaluation = $vpl->get_effective_setting('reductionbyevaluation', $userid);
}
return $files;
......@@ -227,8 +226,8 @@ class mod_vpl_edit{
$compilationexecution = new stdClass();
$compilationexecution->grade = '';
$compilationexecution->nevaluations = 0;