Skip to content

Instantly share code, notes, and snippets.

@danpoltawski
Created May 5, 2012 15:22
Show Gist options
  • Save danpoltawski/2603267 to your computer and use it in GitHub Desktop.
Save danpoltawski/2603267 to your computer and use it in GitHub Desktop.
section admin
diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index f4b89df..2e30de9 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -3007,6 +3007,7 @@ class settings_navigation extends navigation_node {
break;
case CONTEXT_COURSE:
if ($this->page->course->id != SITEID) {
+ $this->load_section_settings();
$this->load_course_settings(($context->id == $this->context->id));
} else {
$this->load_front_page_settings(($context->id == $this->context->id));
@@ -3261,6 +3262,21 @@ class settings_navigation extends navigation_node {
return array($resources, $activities);
}
+ protected function load_section_settings() {
+ $course = $this->page->course;
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+
+ // hack hack hack
+
+ if (has_capability('moodle/course:update', $coursecontext)) {
+ $settingsnode = $this->add('Section Administration', null, self::TYPE_COURSE, null, 'settingadmin');
+ $settingsnode->force_open();
+ $url = new moodle_url('/course/editsection.php', array('id'=>10));
+ $settingsnode->add('Edit Topic', $url, self::TYPE_SETTING, null, null, new pix_icon('i/edit', ''));
+ $settingsnode->add('Hide Topic', $url, self::TYPE_SETTING, null, null, new pix_icon('i/hide', ''));
+ }
+ }
+
/**
* This function loads the course settings that are available for the user
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment