navigation MDL-14632 Very significant navigation commit
[moodle.git] / course / format / topics / lib.php
CommitLineData
7d2a0492 1<?php
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/>.
16
17/**
18 * This file contains general functions for the course format Topic
19 *
20 * @since 2.0
21 * @package moodlecore
22 * @copyright 2009 Sam Hemelryk
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 */
25
26/**
27 * Used to display the course structure for a course where format=topic
28 *
29 * This is called automatically by {@link load_course()} if the current course
30 * format = weeks.
31 *
32 * @param array $path An array of keys to the course node in the navigation
33 * @param stdClass $modinfo The mod info object for the current course
34 * @return bool Returns true
35 */
36function callback_topics_load_content(&$navigation, $keys, $course) {
37 $navigation->add_course_section_generic($keys, $course, get_string('topic'), 'topic');
38}
39
40/**
41 * Used to display the course structure for a course where format=topic
42 *
43 * This is called automatically by {@link load_course()} if the current course
44 * format = weeks and the navigation was requested via AJAX
45 *
46 * @param array $path An array of keys to the course node in the navigation
47 * @param stdClass $modinfo The mod info object for the current course
48 * @return bool Returns true
49 */
50function callback_topics_load_limited_section(&$navigation, $keys, $course, $section) {
51 $navigation->limited_load_section_generic($keys, $course, $section, get_string('topic'), 'topic');
52}
53
54/**
55 * The string that is used to describe a section of the course
56 * e.g. Topic, Week...
57 *
58 * @return string
59 */
60function callback_topics_definition() {
61 return get_string('topic');
62}
63
64/**
65 * The GET argument variable that is used to identify the section being
66 * viewed by the user (if there is one)
67 *
68 * @return string
69 */
70function callback_topics_request_key() {
71 return 'topic';
72}
73?>