}
 if (file_exists("{$CFG->dirroot}/local/contextadmin/mod/{$currentmodule->name}/cat_settings.php") && $haseditsettingscapability) {
     $settingstd = "<a href=\"cat_settings.php?section=modsetting{$currentmodule->name}&name={$currentmodule->name}&contextid={$contextid}\">\n            {$strsettings}</a>";
 } else {
     $settingstd = "";
 }
 $class = '';
 // If we can hide/show then create the icons/links.
 // Do not show these for forum, changing visibility breaks announcement tool.
 if (($haseditvisibilitycapability or $haseditsettingscapability) and $currentmodule->name != "forum") {
     $selfpath = "activities.php?contextid={$contextid}&catid={$catid}";
     $islocked = is_module_locked($catid, $currentmodule->name);
     $isoverridden = is_module_overridden($catid, $currentmodule->name);
     $lockedimagetag = create_image_tag($OUTPUT->pix_url('i/hierarchylock'), 'locked in parent category');
     // Representation of the module if we were to climb the tree.
     $modulerepresentation = get_context_module_settings($catid, $currentmodule->name);
     // For each section provide a form if it is not locked. If it is locked only show icons.
     // If the module is overridden then show the overridden value in front of the category's value.
     if ($isoverridden) {
         if ($modulerepresentation->visible) {
             $overridevaluetd .= create_image_tag($OUTPUT->pix_url('i/hide'), get_string('visible_alt', 'local_contextadmin'), 'overridden');
         } else {
             $overridevaluetd .= create_image_tag($OUTPUT->pix_url('i/show'), get_string('not_visible_alt', 'local_contextadmin'), 'overridden');
         }
     }
     // Test for existence of this category's module.
     if ($categorymodule) {
         if ($categorymodule->visible) {
             if ($islocked) {
                 $visibletd .= create_image_tag($OUTPUT->pix_url('i/hide'), 'hidden');
                 $visibletd .= $lockedimagetag;
 public function test_remove_module_setting()
 {
     global $COURSE;
     // Setup.
     // Test Set.
     $COURSE->category = 2;
     set_context_module_settings($COURSE->category, 'assignment', array('visible' => 0));
     $COURSE->category = 3;
     set_context_module_settings($COURSE->category, 'assignment', array('visible' => 0));
     $COURSE->category = 2;
     remove_category_module_values($COURSE->category, 'assignment');
     $result = get_context_module_settings($COURSE->category, 'assignment');
     $this->assertEquals($result->name, 'assignment');
     $this->assertEquals($result->visible, 1);
     $COURSE->category = 3;
     $result = get_context_module_settings($COURSE->category, 'assignment');
     $this->assertEquals($result->name, 'assignment');
     $this->assertEquals($result->visible, 0);
     $COURSE->category = 3;
     remove_category_module_values($COURSE->category, 'assignment');
     $result = get_context_module_settings($COURSE->category, 'assignment');
     $this->assertEquals($result->name, 'assignment');
     $this->assertEquals($result->visible, 1);
     // Teardown.
 }