2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * This file contains main class for the course format Social
21 * @package format_social
22 * @copyright 2009 Sam Hemelryk
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 * Main class for the Social course format
29 * @package format_social
30 * @copyright 2012 Marina Glancy
31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33 class format_social extends format_base {
36 * The URL to use for the specified course
38 * @param int|stdClass $section Section object from database or just field course_sections.section
39 * if null the course view page is returned
40 * @param array $options options for view URL. At the moment core uses:
41 * 'navigation' (bool) if true and section has no separate page, the function returns null
42 * 'sr' (int) used by multipage formats to specify to which section to return
43 * @return null|moodle_url
45 public function get_view_url($section, $options = array()) {
46 if (!empty($options['navigation']) && $section !== null) {
49 return new moodle_url('/course/view.php', array('id' => $this->courseid));
53 * Loads all of the course sections into the navigation
55 * @param global_navigation $navigation
56 * @param navigation_node $node The course node within the navigation
58 public function extend_course_navigation($navigation, navigation_node $node) {
59 // Social course format does not extend navigation, it uses social_activities block instead
63 * Returns the list of blocks to be automatically added for the newly created course
65 * @return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT
66 * each of values is an array of block names (for left and right side columns)
68 public function get_default_blocks() {
70 BLOCK_POS_LEFT => array(),
71 BLOCK_POS_RIGHT => array('search_forums', 'calendar_upcoming', 'social_activities',
72 'recent_activity', 'course_list')