MDL-82681 mod_assign: Remove temporary class grading_options_temp_form

The grading_options_temp_form class and
process_save_grading_options_temp() method were temporarily introduced
to migrate form elements across the submission page while preserving
the original class and method, as they are part of the public API and
may be used by external code. Now that the migration is complete, both
the temporary class and method can be removed.
This commit is contained in:
Mihail Geshoski 2024-09-16 18:17:36 +08:00
parent 15fc229e77
commit f86a9fd520
2 changed files with 0 additions and 120 deletions

View file

@ -1,69 +0,0 @@
<?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/>.
/**
* This file contains the temporary form used on the submissions page to apply assignment grading options.
*
* @package mod_assign
* @copyright 2024 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_assign\form;
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
require_once($CFG->libdir.'/formslib.php');
require_once($CFG->dirroot . '/mod/assign/locallib.php');
/**
* Assignment grading options temporary form.
*
* This form class is a copy of mod_assign_grading_options_form. The only purpose of this form is to be temporarily used
* on the submission page until the gradual removal of the current form elements is completed. After that, this form
* class will be removed.
*
* @package mod_assign
* @copyright 2024 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grading_options_temp_form extends \moodleform {
/**
* Define this form - called from the parent constructor.
*/
public function definition() {
$mform = $this->_form;
$instance = $this->_customdata;
$mform->disable_form_change_checker();
$mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
// Hidden params.
$mform->addElement('hidden', 'contextid', $instance['contextid']);
$mform->setType('contextid', PARAM_INT);
$mform->addElement('hidden', 'id', $instance['cm']);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'userid', $instance['userid']);
$mform->setType('userid', PARAM_INT);
$mform->addElement('hidden', 'action', 'saveoptionstemp');
$mform->setType('action', PARAM_ALPHA);
// Buttons.
$this->add_action_buttons(false, get_string('updatetable', 'assign'));
}
}

View file

@ -638,10 +638,6 @@ class assign {
$this->process_save_grading_options();
$action = 'redirect';
$nextpageparams['action'] = 'grading';
} else if ($action == 'saveoptionstemp') {
$this->process_save_grading_options_temp();
$action = 'redirect';
$nextpageparams['action'] = 'grading';
} else if ($action == 'saveextension') {
$action = 'grantextension';
if ($this->process_save_extension($mform)) {
@ -4555,23 +4551,6 @@ class assign {
$markingworkflow = $this->get_instance()->markingworkflow;
// Print options for changing the filter and changing the number of results per page.
$gradingoptionsformparams = [
'cm' => $cmid,
'contextid' => $this->context->id,
'userid' => $USER->id,
];
$classoptions = array('class'=>'gradingoptionsform');
$gradingoptionsform = new \mod_assign\form\grading_options_temp_form(null,
$gradingoptionsformparams,
'post',
'',
$classoptions);
$gradingoptionsdata = new stdClass();
$gradingoptionsform->set_data($gradingoptionsdata);
$buttons = new \mod_assign\output\grading_actionmenu(cmid: $this->get_course_module()->id, assign: $this);
$actionformtext = $this->get_renderer()->render($buttons);
$currenturl = new moodle_url('/mod/assign/view.php', ['id' => $this->get_course_module()->id, 'action' => 'grading']);
@ -4638,11 +4617,6 @@ class assign {
$SESSION->mod_assign_useridlist[$this->get_useridlist_key()] = $useridlist;
}
$assignform = new assign_form('gradingoptionsform',
$gradingoptionsform,
'M.mod_assign.init_grading_options');
$o .= $this->get_renderer()->render($assignform);
$currentgroup = groups_get_activity_group($this->get_course_module(), true);
$users = array_keys($this->list_participants($currentgroup, true));
if (count($users) != 0 && $this->can_grade()) {
@ -7456,31 +7430,6 @@ class assign {
}
}
/**
* Save grading options.
*
* @return void
*/
protected function process_save_grading_options_temp() {
global $USER, $CFG;
// Include grading options form.
require_once($CFG->dirroot . '/mod/assign/gradingoptionsform.php');
// Need submit permission to submit an assignment.
$this->require_view_grades();
require_sesskey();
$gradingoptionsparams = [
'cm' => $this->get_course_module()->id,
'contextid' => $this->context->id,
'userid' => $USER->id,
];
$mform = new mod_assign\form\grading_options_temp_form(null, $gradingoptionsparams);
if ($formdata = $mform->get_data()) {
}
}
/**
* @deprecated since 2.7
*/