Exemplo n.º 1
0
 } else {
     // Took out hspace="\10\", because it does not validate. don't know what to replace with.
     $icon = "<img src=\"" . $OUTPUT->pix_url('icon', $currentmodule->name) . "\" class=\"icon\" alt=\"\" />";
     $strmodulename = $icon . ' ' . get_string('modulename', $currentmodule->name);
 }
 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) {
 public function test_cascade_locked_set_module_settings()
 {
     global $COURSE;
     // Setup.
     // Test Set.
     $COURSE->category = 2;
     set_context_module_settings($COURSE->category, 'assignment', array('visible' => 1));
     $COURSE->category = 3;
     set_context_module_settings($COURSE->category, 'assignment', array('visible' => 0, 'locked' => 1));
     $COURSE->category = 2;
     $this->assertFalse((bool) is_plugin_locked($COURSE->category, 'assignment', 'modules'));
     $COURSE->category = 3;
     $this->assertFalse((bool) is_plugin_locked($COURSE->category, 'assignment', 'modules'));
     $COURSE->category = 4;
     $this->assertTrue((bool) is_plugin_locked($COURSE->category, 'assignment', 'modules'));
     $COURSE->category = 5;
     $this->assertTrue((bool) is_module_locked($COURSE->category, 'assignment'));
     // Teardown.
 }