| 1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* This file contains the forms to create and edit an instance of this module
|
|
|
19 |
*
|
|
|
20 |
* @package mod_assign
|
|
|
21 |
* @copyright 2012 NetSpot {@link http://www.netspot.com.au}
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
|
|
|
26 |
|
|
|
27 |
require_once($CFG->libdir.'/formslib.php');
|
|
|
28 |
require_once($CFG->dirroot . '/mod/assign/locallib.php');
|
|
|
29 |
|
|
|
30 |
/**
|
|
|
31 |
* Assignment grading options form
|
|
|
32 |
*
|
|
|
33 |
* @package mod_assign
|
|
|
34 |
* @copyright 2012 NetSpot {@link http://www.netspot.com.au}
|
|
|
35 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 1441 |
ariadna |
36 |
* @deprecated since 4.5
|
|
|
37 |
* @todo Final deprecation in Moodle 6.0. See MDL-82869.
|
| 1 |
efrain |
38 |
*/
|
| 1441 |
ariadna |
39 |
#[\core\attribute\deprecated(
|
|
|
40 |
replacement: null,
|
|
|
41 |
since: '4.5',
|
|
|
42 |
reason: 'It is no longer used.',
|
|
|
43 |
mdl: 'MDL-80750',
|
|
|
44 |
)]
|
| 1 |
efrain |
45 |
class mod_assign_grading_batch_operations_form extends moodleform {
|
|
|
46 |
/**
|
|
|
47 |
* Define this form - called by the parent constructor.
|
| 1441 |
ariadna |
48 |
*
|
|
|
49 |
* @deprecated since 4.5
|
| 1 |
efrain |
50 |
*/
|
| 1441 |
ariadna |
51 |
#[\core\attribute\deprecated(
|
|
|
52 |
replacement: null,
|
|
|
53 |
since: '4.5',
|
|
|
54 |
reason: 'It is no longer used.',
|
|
|
55 |
mdl: 'MDL-80750'
|
|
|
56 |
)]
|
| 1 |
efrain |
57 |
public function definition() {
|
| 1441 |
ariadna |
58 |
\core\deprecation::emit_deprecation([$this, __FUNCTION__]);
|
|
|
59 |
|
| 1 |
efrain |
60 |
global $CFG;
|
|
|
61 |
$mform = $this->_form;
|
|
|
62 |
$instance = $this->_customdata;
|
|
|
63 |
|
|
|
64 |
// Visible elements.
|
|
|
65 |
$options = array();
|
|
|
66 |
$options['lock'] = get_string('locksubmissions', 'assign');
|
|
|
67 |
$options['unlock'] = get_string('unlocksubmissions', 'assign');
|
|
|
68 |
if (!empty($CFG->messaging) &&
|
|
|
69 |
has_all_capabilities(['moodle/site:sendmessage', 'moodle/course:bulkmessaging'], $instance['context'])
|
|
|
70 |
) {
|
|
|
71 |
$options['message'] = get_string('messageselectadd');
|
|
|
72 |
}
|
|
|
73 |
$options['downloadselected'] = get_string('downloadselectedsubmissions', 'assign');
|
|
|
74 |
if ($instance['submissiondrafts']) {
|
|
|
75 |
$options['reverttodraft'] = get_string('reverttodraft', 'assign');
|
|
|
76 |
}
|
|
|
77 |
if (has_capability('mod/assign:editothersubmission', $instance['context'])) {
|
|
|
78 |
$options['removesubmission'] = get_string('removesubmission', 'assign');
|
|
|
79 |
}
|
|
|
80 |
if ($instance['duedate'] && has_capability('mod/assign:grantextension', $instance['context'])) {
|
|
|
81 |
$options['grantextension'] = get_string('grantextension', 'assign');
|
|
|
82 |
}
|
| 1441 |
ariadna |
83 |
$multipleattemptsallowed = $instance['maxattempts'] > 1 ||
|
|
|
84 |
$instance['maxattempts'] == ASSIGN_UNLIMITED_ATTEMPTS;
|
|
|
85 |
|
|
|
86 |
if ($multipleattemptsallowed && $instance['attemptreopenmethod'] == ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL) {
|
| 1 |
efrain |
87 |
$options['addattempt'] = get_string('addattempt', 'assign');
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
foreach ($instance['feedbackplugins'] as $plugin) {
|
|
|
91 |
if ($plugin->is_visible() && $plugin->is_enabled()) {
|
|
|
92 |
foreach ($plugin->get_grading_batch_operations() as $action => $description) {
|
|
|
93 |
$operationkey = 'plugingradingbatchoperation_' . $plugin->get_type() . '_' . $action;
|
|
|
94 |
$options[$operationkey] = $description;
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
}
|
|
|
98 |
if ($instance['markingworkflow']) {
|
|
|
99 |
$options['setmarkingworkflowstate'] = get_string('setmarkingworkflowstate', 'assign');
|
|
|
100 |
}
|
|
|
101 |
if ($instance['markingallocation']) {
|
|
|
102 |
$options['setmarkingallocation'] = get_string('setmarkingallocation', 'assign');
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
$mform->addElement('hidden', 'action', 'gradingbatchoperation');
|
|
|
106 |
$mform->setType('action', PARAM_ALPHA);
|
|
|
107 |
$mform->addElement('hidden', 'id', $instance['cm']);
|
|
|
108 |
$mform->setType('id', PARAM_INT);
|
|
|
109 |
$mform->addElement('hidden', 'selectedusers', '', array('class'=>'selectedusers'));
|
|
|
110 |
$mform->setType('selectedusers', PARAM_SEQUENCE);
|
|
|
111 |
$mform->addElement('hidden', 'returnaction', 'grading');
|
|
|
112 |
$mform->setType('returnaction', PARAM_ALPHA);
|
|
|
113 |
|
|
|
114 |
$objs = array();
|
|
|
115 |
$objs[] =& $mform->createElement('select', 'operation', get_string('chooseoperation', 'assign'), $options);
|
|
|
116 |
$objs[] =& $mform->createElement('submit', 'submit', get_string('go'));
|
|
|
117 |
$batchdescription = get_string('batchoperationsdescription', 'assign');
|
|
|
118 |
$mform->addElement('group', 'actionsgrp', $batchdescription, $objs, ' ', false);
|
|
|
119 |
}
|
|
|
120 |
}
|