Merge branch 'wip-MDL-37572-m25' of git://github.com/samhemelryk/moodle

This commit is contained in:
Dan Poltawski
2013-02-05 15:25:08 +08:00
13 changed files with 888 additions and 684 deletions
+5 -10
View File
@@ -4024,20 +4024,15 @@ class settings_navigation extends navigation_node {
$categorynode = $this->add(print_context_name($this->context), null, null, null, 'categorysettings');
$categorynode->force_open();
$onmanagepage = $this->page->url->compare(new moodle_url('/course/manage.php'), URL_MATCH_BASE);
if (has_any_capability(array('moodle/category:manage', 'moodle/course:create'), $this->context)) {
$url = new moodle_url('/course/category.php', array('id'=>$this->context->instanceid, 'sesskey'=>sesskey()));
if ($this->page->user_is_editing()) {
$url->param('categoryedit', '0');
$editstring = get_string('turneditingoff');
} else {
$url->param('categoryedit', '1');
$editstring = get_string('turneditingon');
}
if (can_edit_in_category($this->context->instanceid) && !$onmanagepage) {
$url = new moodle_url('/course/manage.php', array('id' => $this->context->instanceid));
$editstring = get_string('managecategorythis');
$categorynode->add($editstring, $url, self::TYPE_SETTING, null, null, new pix_icon('i/edit', ''));
}
if ($this->page->user_is_editing() && has_capability('moodle/category:manage', $this->context)) {
if ($onmanagepage && has_capability('moodle/category:manage', $this->context)) {
$editurl = new moodle_url('/course/editcategory.php', array('id' => $this->context->instanceid));
$categorynode->add(get_string('editcategorythis'), $editurl, self::TYPE_SETTING, null, 'edit', new pix_icon('i/edit', ''));