Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// This file is part of Moodle - http://moodle.org/
2
//
3
// Moodle is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
7
//
8
// Moodle is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
/**
17
 * A repo for the search widget.
18
 *
19
 * @module    core_grades/searchwidget/repository
20
 * @copyright 2022 Mathew May <mathew.solutions>
21
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 */
23
 
24
import ajax from 'core/ajax';
25
 
26
/**
27
 * Given a course ID, we want to fetch the gradable items, so we may fetch reports based on activity items.
28
 * Note: This will be worked upon in the single view issue.
29
 *
30
 * @method gradeitemFetch
31
 * @param {int} courseid ID of the course to fetch the users of.
32
 * @return {object} jQuery promise
33
 */
34
export const gradeitemFetch = (courseid) => {
35
    const request = {
36
        methodname: 'gradereport_singleview_get_grade_items_for_search_widget',
37
        args: {
38
            courseid: courseid,
39
        },
40
    };
41
    return ajax.call([request])[0];
42
};
43
 
44
/**
45
 * Given a course ID, we want to fetch the enrolled learners, so we may fetch their reports.
46
 *
47
 * @method userFetch
48
 * @param {int} courseid ID of the course to fetch the users of.
49
 * @param {int} groupId ID of the group to fetch the users of.
50
 * @return {object} jQuery promise
51
 */
52
export const userFetch = (courseid, groupId) => {
53
    const request = {
54
        methodname: 'core_grades_get_enrolled_users_for_selector',
55
        args: {
56
            courseid: courseid,
57
            groupid: groupId,
58
        },
59
    };
60
    return ajax.call([request])[0];
61
};