MDL-54613 unit tests: Add iteminstance to test grade_item
[moodle.git] / lib / grade / constants.php
CommitLineData
b79fe189 1<?php
b79fe189 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/>.
a153c9f2 16
cd9e4ec4 17/**
18 * Definitions of constants for gradebook
19 *
a153c9f2
AD
20 * @package core_grades
21 * @category grade
22 * @copyright 2007 Nicolas Connault
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
cd9e4ec4 24 */
7ad5a627
PS
25
26defined('MOODLE_INTERNAL') || die();
27
a153c9f2
AD
28// Category aggregation types
29
30/**
31 * GRADE_AGGREGATE_MEAN - Use the category mean for grade aggregation.
32 */
cd9e4ec4 33define('GRADE_AGGREGATE_MEAN', 0);
a153c9f2
AD
34
35/**
36 * GRADE_AGGREGATE_MEDIAN - Use the category median for grade aggregation.
37 */
cd9e4ec4 38define('GRADE_AGGREGATE_MEDIAN', 2);
a153c9f2
AD
39
40/**
41 * GRADE_AGGREGATE_MIN - Use the category minimum grade for grade aggregation.
42 */
cd9e4ec4 43define('GRADE_AGGREGATE_MIN', 4);
a153c9f2
AD
44
45/**
46 * GRADE_AGGREGATE_MAX - Use the category maximum grade for grade aggregation.
47 */
cd9e4ec4 48define('GRADE_AGGREGATE_MAX', 6);
a153c9f2
AD
49
50/**
51 * GRADE_AGGREGATE_MEDIAN - Use the category mode for grade aggregation.
52 */
cd9e4ec4 53define('GRADE_AGGREGATE_MODE', 8);
a153c9f2
AD
54
55/**
56 * GRADE_AGGREGATE_WEIGHTED_MEAN - Use a weighted mean of grades in the category for grade aggregation. Weights can be manually set.
57 */
cd9e4ec4 58define('GRADE_AGGREGATE_WEIGHTED_MEAN', 10);
a153c9f2
AD
59
60/**
61 * GRADE_AGGREGATE_WEIGHTED_MEAN2 - Use a simple weighted mean of grades in the category for grade aggregation.
62 */
1426edac 63define('GRADE_AGGREGATE_WEIGHTED_MEAN2', 11);
a153c9f2
AD
64
65/**
66 * GRADE_AGGREGATE_EXTRACREDIT_MEAN - Use the category mean for grade aggregation and include support for extra credit.
67 */
cd9e4ec4 68define('GRADE_AGGREGATE_EXTRACREDIT_MEAN', 12);
a153c9f2
AD
69
70/**
b5e00814 71 * GRADE_AGGREGATE_WEIGHTED_MEAN2 - Use Natural in the category for grade aggregation.
a153c9f2 72 */
0758a08e 73define('GRADE_AGGREGATE_SUM', 13);
cd9e4ec4 74
a153c9f2
AD
75// Grade types
76
77/**
78 * GRADE_TYPE_NONE - Ungraded.
79 */
cd9e4ec4 80define('GRADE_TYPE_NONE', 0);
a153c9f2
AD
81
82/**
83 * GRADE_TYPE_NONE - The grade is a numeric value
84 */
cd9e4ec4 85define('GRADE_TYPE_VALUE', 1);
a153c9f2
AD
86
87/**
88 * GRADE_TYPE_NONE - The grade is a value from the set of values available in a grade scale.
89 */
cd9e4ec4 90define('GRADE_TYPE_SCALE', 2);
a153c9f2
AD
91
92/**
93 * GRADE_TYPE_NONE - Feedback only.
94 */
cd9e4ec4 95define('GRADE_TYPE_TEXT', 3);
96
a153c9f2 97
cd9e4ec4 98// grade_update() return status
a153c9f2
AD
99
100/**
101 * GRADE_UPDATE_OK - Grade updated completed successfully.
102 */
cd9e4ec4 103define('GRADE_UPDATE_OK', 0);
a153c9f2
AD
104
105/**
106 * GRADE_UPDATE_FAILED - Grade updated failed.
107 */
cd9e4ec4 108define('GRADE_UPDATE_FAILED', 1);
a153c9f2
AD
109
110/**
111 * GRADE_UPDATE_MULTIPLE - Grade update failed because there are multiple grade items with the same itemnumber for this activity.
112 */
cd9e4ec4 113define('GRADE_UPDATE_MULTIPLE', 2);
a153c9f2 114
a153c9f2
AD
115/**
116 * GRADE_UPDATE_DELETED - Grade item cannot be updated as it is locked
117 */
cd9e4ec4 118define('GRADE_UPDATE_ITEM_LOCKED', 4);
119
a153c9f2 120
f7d515b6 121// Grade tables history tracking actions
a153c9f2
AD
122
123/**
124 * GRADE_HISTORY_INSERT - A grade item was inserted
125 */
cd9e4ec4 126define('GRADE_HISTORY_INSERT', 1);
a153c9f2
AD
127
128/**
129 * GRADE_HISTORY_UPDATE - A grade item was updated
130 */
cd9e4ec4 131define('GRADE_HISTORY_UPDATE', 2);
a153c9f2
AD
132
133/**
134 * GRADE_HISTORY_INSERT - A grade item was deleted
135 */
cd9e4ec4 136define('GRADE_HISTORY_DELETE', 3);
137
e9096dc2 138// Display style constants
a153c9f2
AD
139
140/**
141 * GRADE_DISPLAY_TYPE_DEFAULT - Grade display type can be set at 3 levels: grade_item, course setting and site. Use the display type from the higher level.
142 */
1796708d 143define('GRADE_DISPLAY_TYPE_DEFAULT', 0);
a153c9f2
AD
144
145/**
146 * GRADE_DISPLAY_TYPE_REAL - Display the grade as a decimal number.
147 */
1796708d 148define('GRADE_DISPLAY_TYPE_REAL', 1);
a153c9f2
AD
149
150/**
151 * GRADE_DISPLAY_TYPE_PERCENTAGE - Display the grade as a percentage.
152 */
1796708d 153define('GRADE_DISPLAY_TYPE_PERCENTAGE', 2);
a153c9f2
AD
154
155/**
156 * GRADE_DISPLAY_TYPE_LETTER - Display the grade as a letter grade. For example, A, B, C, D or F.
157 */
1796708d 158define('GRADE_DISPLAY_TYPE_LETTER', 3);
a153c9f2
AD
159
160/**
161 * GRADE_DISPLAY_TYPE_REAL_PERCENTAGE - Display the grade as a decimal number and a percentage.
162 */
7d10995c 163define('GRADE_DISPLAY_TYPE_REAL_PERCENTAGE', 12);
a153c9f2
AD
164
165/**
166 * GRADE_DISPLAY_TYPE_REAL_LETTER - Display the grade as a decimal number and a letter grade.
167 */
7d10995c 168define('GRADE_DISPLAY_TYPE_REAL_LETTER', 13);
a153c9f2
AD
169
170/**
171 * GRADE_DISPLAY_TYPE_LETTER_REAL - Display the grade as a letter grade and a decimal number.
172 */
7d10995c 173define('GRADE_DISPLAY_TYPE_LETTER_REAL', 31);
a153c9f2
AD
174
175/**
176 * GRADE_DISPLAY_TYPE_LETTER_PERCENTAGE - Display the grade as a letter grade and a percentage.
177 */
7d10995c 178define('GRADE_DISPLAY_TYPE_LETTER_PERCENTAGE', 32);
a153c9f2
AD
179
180/**
181 * GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER - Display the grade as a percentage and a letter grade.
182 */
7d10995c 183define('GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER', 23);
a153c9f2
AD
184
185/**
186 * GRADE_DISPLAY_TYPE_PERCENTAGE_REAL - Display the grade as a percentage and a decimal number.
187 */
7d10995c 188define('GRADE_DISPLAY_TYPE_PERCENTAGE_REAL', 21);
e9096dc2 189
a153c9f2
AD
190/**
191 * GRADE_REPORT_AGGREGATION_POSITION_FIRST - Display the course totals before the individual activity grades
192 */
e0724506 193define('GRADE_REPORT_AGGREGATION_POSITION_FIRST', 0);
a153c9f2
AD
194
195/**
196 * GRADE_REPORT_AGGREGATION_POSITION_LAST - Display the course totals after the individual activity grades
197 */
e0724506 198define('GRADE_REPORT_AGGREGATION_POSITION_LAST', 1);
a153c9f2 199
a153c9f2
AD
200// What to do if category or course total contains a hidden item
201
202/**
203 * GRADE_REPORT_HIDE_TOTAL_IF_CONTAINS_HIDDEN - If the category or course total contains a hidden item hide the total from students.
204 */
205define('GRADE_REPORT_HIDE_TOTAL_IF_CONTAINS_HIDDEN', 0);
206
207/**
208 * GRADE_REPORT_SHOW_TOTAL_IF_CONTAINS_HIDDEN - If the category or course total contains a hidden item show the total to students minus grades from the hidden items.
209 */
210define('GRADE_REPORT_SHOW_TOTAL_IF_CONTAINS_HIDDEN', 1);
61541a5a 211
a153c9f2
AD
212/**
213 * GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN - If the category or course total contains a hidden item show students the real total including marks from hidden items.
214 */
215define('GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN', 2);
216
217/**
218 * GRADE_REPORT_PREFERENCE_DEFAULT - Use the setting from site preferences.
219 */
220define('GRADE_REPORT_PREFERENCE_DEFAULT', 'default');
221
222/**
223 * GRADE_REPORT_PREFERENCE_INHERIT - Inherit the setting value from the parent.
224 */
e0724506 225define('GRADE_REPORT_PREFERENCE_INHERIT', 'inherit'); // means inherit from parent
a153c9f2
AD
226
227/**
228 * GRADE_REPORT_PREFERENCE_UNUSED - Unused constant.
229 */
cd9e4ec4 230define('GRADE_REPORT_PREFERENCE_UNUSED', -1);
e0724506 231
a153c9f2
AD
232/**
233 * GRADE_REPORT_MEAN_ALL - Include all grade items including those where the student hasn't received a grade when calculating the mean.
234 */
cd9e4ec4 235define('GRADE_REPORT_MEAN_ALL', 0);
a153c9f2
AD
236
237/**
238 * GRADE_REPORT_MEAN_GRADED - Only include grade items where the student has a grade when calculating the mean.
239 */
cd9e4ec4 240define('GRADE_REPORT_MEAN_GRADED', 1);
70aaa10f 241
a153c9f2
AD
242/**
243 * GRADE_NAVMETHOD_DROPDOWN - Display a drop down box to allow navigation within the gradebook
244 */
70aaa10f 245define('GRADE_NAVMETHOD_DROPDOWN', 0);
a153c9f2
AD
246
247/**
248 * GRADE_NAVMETHOD_TABS - Display tabs to allow navigation within the gradebook
249 */
70aaa10f 250define('GRADE_NAVMETHOD_TABS', 1);
a153c9f2
AD
251
252/**
253 * GRADE_NAVMETHOD_TABS - Display both a drop down and tabs to allow navigation within the gradebook
254 */
70aaa10f 255define('GRADE_NAVMETHOD_COMBO', 2);
ebea19cb
FM
256
257/**
258 * GRADE_MIN_MAX_FROM_GRADE_ITEM - Get the grade min/max from the grade item.
259 */
260define('GRADE_MIN_MAX_FROM_GRADE_ITEM', 1);
261
262/**
263 * GRADE_MIN_MAX_FROM_GRADE_GRADE - Get the grade min/max from the grade grade.
264 */
265define('GRADE_MIN_MAX_FROM_GRADE_GRADE', 2);