Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 11... Línea 11...
11
// GNU General Public License for more details.
11
// GNU General Public License for more details.
12
//
12
//
13
// You should have received a copy of the GNU General Public License
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/>.
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea -... Línea 15...
-
 
15
 
15
 
16
import Config from 'core/config';
16
import {getString} from 'core/str';
17
import {getString} from 'core/str';
17
import {Reactive} from 'core/reactive';
18
import {Reactive} from 'core/reactive';
18
import notification from 'core/notification';
19
import notification from 'core/notification';
19
import Exporter from 'core_courseformat/local/courseeditor/exporter';
20
import Exporter from 'core_courseformat/local/courseeditor/exporter';
Línea 47... Línea 48...
47
     * @package
48
     * @package
48
     */
49
     */
49
    stateKey = 1;
50
    stateKey = 1;
Línea 50... Línea 51...
50
 
51
 
51
    /**
52
    /**
52
     * The current page section return
53
     * The section number of the current page
53
     * @attribute sectionReturn
54
     * @attribute sectionReturn
54
     * @type number
55
     * @type number
55
     * @default null
56
     * @default null
56
     */
57
     */
Línea 57... Línea 58...
57
    sectionReturn = null;
58
    sectionReturn = null;
-
 
59
 
-
 
60
    /**
-
 
61
     * The section ID of the current page
-
 
62
     * @attribute pageSectionId
-
 
63
     * @type number
-
 
64
     * @default null
-
 
65
     */
-
 
66
    pageSectionId = null;
58
 
67
 
59
    /**
68
    /**
60
     * Set up the course editor when the page is ready.
69
     * Set up the course editor when the page is ready.
61
     *
70
     *
62
     * The course can only be loaded once per instance. Otherwise an error is thrown.
71
     * The course can only be loaded once per instance. Otherwise an error is thrown.
Línea 216... Línea 225...
216
     * Load the current course state from the server.
225
     * Load the current course state from the server.
217
     *
226
     *
218
     * @returns {Object} the current course state
227
     * @returns {Object} the current course state
219
     */
228
     */
220
    async getServerCourseState() {
229
    async getServerCourseState() {
-
 
230
        // Only logged users can get the course state. Filtering here will prevent unnecessary
-
 
231
        // calls to the server and login page redirects. Especially for home activities with
-
 
232
        // guest access.
-
 
233
        if (Config.userId == 0) {
-
 
234
            return {
-
 
235
                course: {},
-
 
236
                section: [],
-
 
237
                cm: [],
-
 
238
            };
-
 
239
        }
221
        const courseState = await ajax.call([{
240
        const courseState = await ajax.call([{
222
            methodname: 'core_courseformat_get_state',
241
            methodname: 'core_courseformat_get_state',
223
            args: {
242
            args: {
224
                courseid: this.courseId,
243
                courseid: this.courseId,
225
            }
244
            }