An error occurred while loading the file. Please try again.
locallib.php 13.30 KiB
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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.
//
// 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 Moodle.  If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
// Import various entity and application logic files.
require_once($CFG->dirroot . '/mod/assign/submission/dta/models/DtaResult.php');
require_once($CFG->dirroot . '/mod/assign/submission/dta/classes/database.php');
require_once($CFG->dirroot . '/mod/assign/submission/dta/classes/backend.php');
require_once($CFG->dirroot . '/mod/assign/submission/dta/classes/view.php');
use assignsubmission_dta\util\DtaBackendUtils;
use assignsubmission_dta\util\DbUtils;
use assignsubmission_dta\util\view_submission_utils;
/**
 * library class for DTA submission plugin extending assign submission plugin base class
 * @package assignsubmission_dta
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
class assign_submission_dta extends assign_submission_plugin {
    /**
     * Broadly used in logic, parametrized for easier change.
    const COMPONENT_NAME = "assignsubmission_dta";
    /**
     * Draft file area for dta tests to be uploaded by the teacher.
    const ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST = "tests_draft_dta";
    /**
     * File area for dta tests to be uploaded by the teacher.
    const ASSIGNSUBMISSION_DTA_FILEAREA_TEST = "tests_dta";
    /**
     * File area for dta submission assignment.
    const ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION = "submissions_dta";
    /**
     * get plugin name
     * @return string
    public function get_name(): string {
        return get_string("pluginname", self::COMPONENT_NAME);
    /**
     * Get default settings for assignment submission settings
     * @param MoodleQuickForm $mform form to add elements to
     * @return void
    public function get_settings(MoodleQuickForm $mform): void {
        // Add draft filemanager to form.
        $mform->addElement(