Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 19... Línea 19...
19
 * @module    gradereport_grader/user
19
 * @module    gradereport_grader/user
20
 * @copyright 2023 Mathew May <mathew.solutions>
20
 * @copyright 2023 Mathew May <mathew.solutions>
21
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 */
22
 */
23
import UserSearch from 'core_user/comboboxsearch/user';
23
import UserSearch from 'core_user/comboboxsearch/user';
24
import Url from 'core/url';
-
 
25
import * as Repository from 'gradereport_grader/local/user/repository';
24
import * as Repository from 'gradereport_grader/local/user/repository';
Línea 26... Línea 25...
26
 
25
 
27
// Define our standard lookups.
26
// Define our standard lookups.
28
const selectors = {
27
const selectors = {
Línea 32... Línea 31...
32
const component = document.querySelector(selectors.component);
31
const component = document.querySelector(selectors.component);
33
const courseID = component.querySelector(selectors.courseid).dataset.courseid;
32
const courseID = component.querySelector(selectors.courseid).dataset.courseid;
Línea 34... Línea 33...
34
 
33
 
Línea -... Línea 34...
-
 
34
export default class User extends UserSearch {
-
 
35
 
-
 
36
    /**
-
 
37
     * Construct the class.
35
export default class User extends UserSearch {
38
     * @param {string} baseUrl The base URL for the page.
36
 
39
     */
-
 
40
    constructor(baseUrl) {
37
    constructor() {
41
        super();
Línea 38... Línea 42...
38
        super();
42
        this.baseUrl = baseUrl;
39
    }
43
    }
40
 
44
 
Línea 41... Línea 45...
41
    static init() {
45
    static init(baseUrl) {
42
        return new User();
46
        return new User(baseUrl);
43
    }
47
    }
Línea 55... Línea 59...
55
     * Build up the view all link.
59
     * Build up the view all link.
56
     *
60
     *
57
     * @returns {string|*}
61
     * @returns {string|*}
58
     */
62
     */
59
    selectAllResultsLink() {
63
    selectAllResultsLink() {
60
        return Url.relativeUrl('/grade/report/grader/index.php', {
-
 
61
            id: courseID,
64
        const url = new URL(this.baseUrl);
62
            gpr_search: this.getSearchTerm()
65
        url.searchParams.set('gpr_search', this.getSearchTerm());
63
        }, false);
66
        return url.toString();
64
    }
67
    }
Línea 65... Línea 68...
65
 
68
 
66
    /**
69
    /**
67
     * Build up the link that is dedicated to a particular result.
70
     * Build up the link that is dedicated to a particular result.
68
     *
71
     *
69
     * @param {Number} userID The ID of the user selected.
72
     * @param {Number} userID The ID of the user selected.
70
     * @returns {string|*}
73
     * @returns {string|*}
71
     */
74
     */
72
    selectOneLink(userID) {
-
 
73
        return Url.relativeUrl('/grade/report/grader/index.php', {
75
    selectOneLink(userID) {
74
            id: courseID,
76
        const url = new URL(this.baseUrl);
75
            gpr_search: this.getSearchTerm(),
77
        url.searchParams.set('gpr_search', this.getSearchTerm());
76
            gpr_userid: userID,
78
        url.searchParams.set('gpr_userid', userID);
77
        }, false);
79
        return url.toString();
78
    }
80
    }