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 javascript module to handle calendar ajax actions.
|
|
|
18 |
*
|
|
|
19 |
* @module core_table/local/dynamic/repository
|
|
|
20 |
* @copyright 2017 Simey Lameze <lameze@moodle.com>
|
|
|
21 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
22 |
*/
|
|
|
23 |
import {call as fetchMany} from 'core/ajax';
|
|
|
24 |
|
|
|
25 |
/**
|
|
|
26 |
* Fetch table view.
|
|
|
27 |
*
|
|
|
28 |
* @method fetch
|
|
|
29 |
* @param {String} component The component
|
|
|
30 |
* @param {String} handler The name of the handler
|
|
|
31 |
* @param {String} uniqueid The unique id of the table
|
|
|
32 |
* @param {Object} options The options to use when updating the table
|
|
|
33 |
* @param {Array} options.sortData The list of columns to sort by
|
|
|
34 |
* @param {Number} options.joinType The filterset join type
|
|
|
35 |
* @param {Object} options.filters The filters to apply when searching
|
|
|
36 |
* @param {String} options.firstinitial The first name initial to filter on
|
|
|
37 |
* @param {String} options.lastinitial The last name initial to filter on
|
|
|
38 |
* @param {String} options.pageNumber The page number
|
|
|
39 |
* @param {Number} options.pageSize The page size
|
|
|
40 |
* @param {Object} options.hiddenColumns The columns to hide
|
|
|
41 |
* @param {Bool} resetPreferences
|
|
|
42 |
* @return {Promise} Resolved with requested table view
|
|
|
43 |
*/
|
|
|
44 |
export const fetch = (component, handler, uniqueid, {
|
|
|
45 |
sortData = [],
|
|
|
46 |
joinType = null,
|
|
|
47 |
filters = {},
|
|
|
48 |
firstinitial = null,
|
|
|
49 |
lastinitial = null,
|
|
|
50 |
pageNumber = null,
|
|
|
51 |
pageSize = null,
|
|
|
52 |
hiddenColumns = {}
|
|
|
53 |
} = {}, resetPreferences = false) => fetchMany([{
|
|
|
54 |
methodname: `core_table_get_dynamic_table_content`,
|
|
|
55 |
args: {
|
|
|
56 |
component,
|
|
|
57 |
handler,
|
|
|
58 |
uniqueid,
|
|
|
59 |
sortdata: sortData,
|
|
|
60 |
jointype: joinType,
|
|
|
61 |
filters,
|
|
|
62 |
firstinitial,
|
|
|
63 |
lastinitial,
|
|
|
64 |
pagenumber: pageNumber,
|
|
|
65 |
pagesize: pageSize,
|
|
|
66 |
hiddencolumns: hiddenColumns,
|
|
|
67 |
resetpreferences: resetPreferences
|
|
|
68 |
},
|
|
|
69 |
}])[0];
|