Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions course_menu/block_course_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class block_course_menu extends block_base
function init()
{
$this->blockname = get_class($this);
$this->title = get_string('pluginname', $this->blockname);
$this->title = get_string('pluginname', $this->blockname);
}

function instance_allow_multiple()
Expand Down Expand Up @@ -156,7 +156,7 @@ function get_content()
}
}
}

$module = array('name' => 'block_course_menu', 'fullpath' => '/blocks/course_menu/course_menu.js', 'requires' => array('core_dock', 'io', 'node', 'dom', 'event-custom', 'json-parse'), 'strings' => array(array('viewallcourses', 'moodle')));
$limit = 20;

Expand Down Expand Up @@ -214,10 +214,10 @@ function get_content()
//check capabilities
// user/index.php expect course context, so get one if page has module context.
$currentcontext = $this->page->context->get_course_context(false);
if (! (empty($currentcontext) ||
if (! (empty($currentcontext) ||
($this->page->course->id == SITEID && !has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) ||
!has_capability('moodle/course:viewparticipants', $currentcontext))) {

$element['url'] = $CFG->wwwroot . '/user/index.php?contextid=' . $currentcontext->id;
$child_node = new navigation_node(array(
'text' => get_string('participantlist', $this->blockname),
Expand Down Expand Up @@ -584,22 +584,22 @@ function get_sections()
if (!empty($this->instance) && $this->page->course->id != SITEID) {

require_once($CFG->dirroot . "/course/lib.php");

$context = get_context_instance(CONTEXT_COURSE, $this->course->id);
$canviewhidden = has_capability('moodle/course:viewhiddensections', $context);

$genericName = get_string("sectionname", 'format_' . $this->course->format);

$modinfo = get_fast_modinfo($this->page->course);
$mods = $modinfo->get_cms();

$allSections = $modinfo->get_section_info_all();

$sections = array();
if ($this->course->format != 'social' && $this->course->format != 'scorm') {
foreach ($allSections as $k => $section) {

if ($k <= $this->course->numsections) { // get_all_sections() may return sections that are in the db but not displayed because the number of the sections for this course was lowered - bug [CM-B10]
if ($k <= $allSections) {
if (!empty($section)) {
$newSec = array();
$newSec['visible'] = $section->visible;
Expand All @@ -614,7 +614,7 @@ function get_sections()
$strsummary = ucwords($genericName) . " " . $k; // just a default name
}

$strsummary = $this->trim($strsummary);
$strsummary = $this->trim($strsummary);
$newSec['name'] = $strsummary;
$newSec['url'] = course_get_url($this->course, $k);

Expand Down Expand Up @@ -1034,4 +1034,3 @@ function remove_deprecated()

}

?>
41 changes: 41 additions & 0 deletions course_menu/db/access.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Capability definitions for the course_menu block
*
* @package block
* @subpackage course_menu
* @copyright 2013 onwards Paul Vaughan
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$capabilities = array(

// New standard capability 'addinstance'.
'block/course_menu:addinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),

);
4 changes: 2 additions & 2 deletions course_menu/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
* ---------------------------------------------------------------------------------------------------------------------
*/

$plugin->version = 2012110500;
$plugin->version = 2013013100;

$plugin->component = 'block_course_menu';
$plugin->release = '2.3.0';
$plugin->requires = 2012062500; // Moodle 2.3
$plugin->maturity = MATURITY_STABLE;
$plugin->maturity = MATURITY_STABLE;