Skip to content

Commit

Permalink
MDL-57961 course: change wording of module availability
Browse files Browse the repository at this point in the history
renamed Visible to Availability and added help strings

AMOS BEGIN
 CPY [availability,core_moodle],[modvisible,core_moodle]
 CPY [availability,core_moodle],[modvisiblewithstealth,core_moodle]
 CPY [availability,core_moodle],[modvisiblehiddensection,core_moodle]
 CPY [show,core_moodle],[modshow,core_moodle]
 CPY [hide,core_moodle],[modhide,core_moodle]
AMOS END
  • Loading branch information
marinaglancy authored and junpataleta committed Apr 4, 2017
1 parent 5eff549 commit 125c4c4
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 66 deletions.
Expand Up @@ -61,7 +61,7 @@ Feature: View structural changes in recent activity block
And I add a "Forum" to section "1" and I fill the form with:
| name | ForumHidden |
| Description | No description |
| Visible | 0 |
| Availability | 0 |
And I add a "Forum" to section "1" and I fill the form with:
| name | ForumNoGroups |
| Description | No description |
Expand Down
9 changes: 4 additions & 5 deletions blocks/site_main_menu/tests/behat/edit_activities.feature
Expand Up @@ -51,14 +51,13 @@ Feature: Edit activities in main menu block
And "My forum name" activity in site main menu block should have "Show" editing icon
And "My forum name" activity in site main menu block should not have "Make available" editing icon
And "My forum name" activity in site main menu block should have "Make unavailable" editing icon
# Make sure that "Visible" dropdown in the edit menu has three options.
# Make sure that "Availability" dropdown in the edit menu has three options.
And I open "My forum name" actions menu in site main menu block
And I click on "Edit settings" "link" in the "My forum name" activity in site main menu block
And I expand all fieldsets
And the "Visible" select box should contain "Show"
And the "Visible" select box should contain "Hidden from students"
And the "Visible" select box should not contain "Hide"
And the field "Visible" matches value "Available but not displayed on course page"
And the "Availability" select box should contain "Show on course page"
And the "Availability" select box should contain "Hide from students"
And the field "Availability" matches value "Make available but not shown on course page"
And I press "Save and return to course"
And "My forum name" activity in site main menu block should be available but hidden from course page
And I navigate to "Turn editing off" node in "Front page settings"
Expand Down
9 changes: 4 additions & 5 deletions blocks/social_activities/tests/behat/edit_activities.feature
Expand Up @@ -66,14 +66,13 @@ Feature: Edit activities in social activities block
And "My forum name" activity in social activities block should have "Show" editing icon
And "My forum name" activity in social activities block should not have "Make available" editing icon
And "My forum name" activity in social activities block should have "Make unavailable" editing icon
# Make sure that "Visible" dropdown in the edit menu has three options.
# Make sure that "Availability" dropdown in the edit menu has three options.
And I open "My forum name" actions menu in social activities block
And I click on "Edit settings" "link" in the "My forum name" activity in social activities block
And I expand all fieldsets
And the "Visible" select box should contain "Show"
And the "Visible" select box should contain "Hidden from students"
And the "Visible" select box should not contain "Hide"
And the field "Visible" matches value "Available but not displayed on course page"
And the "Availability" select box should contain "Show on course page"
And the "Availability" select box should contain "Hide from students"
And the field "Availability" matches value "Make available but not shown on course page"
And I press "Save and return to course"
And "My forum name" activity in social activities block should be available but hidden from course page
And I turn editing mode off
Expand Down
10 changes: 5 additions & 5 deletions course/lib.php
Expand Up @@ -1800,7 +1800,7 @@ function course_get_cm_edit_actions(cm_info $mod, $indent = -1, $sr = null) {

if (!isset($str)) {
$str = get_strings(array('delete', 'move', 'moveright', 'moveleft',
'editsettings', 'duplicate', 'hide', 'makeavailable', 'makeunavailable', 'show'), 'moodle');
'editsettings', 'duplicate', 'modhide', 'makeavailable', 'makeunavailable', 'modshow'), 'moodle');
$str->assign = get_string('assignroles', 'role');
$str->groupsnone = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsnone"));
$str->groupsseparate = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsseparate"));
Expand Down Expand Up @@ -1880,16 +1880,16 @@ function course_get_cm_edit_actions(cm_info $mod, $indent = -1, $sr = null) {
if ($displayedoncoursepage) {
$actions['hide'] = new action_menu_link_secondary(
new moodle_url($baseurl, array('hide' => $mod->id)),
new pix_icon('t/hide', $str->hide, 'moodle', array('class' => 'iconsmall', 'title' => '')),
$str->hide,
new pix_icon('t/hide', $str->modhide, 'moodle', array('class' => 'iconsmall', 'title' => '')),
$str->modhide,
array('class' => 'editing_hide', 'data-action' => 'hide')
);
} else if (!$displayedoncoursepage && $sectionvisible) {
// Offer to "show" only if the section is visible.
$actions['show'] = new action_menu_link_secondary(
new moodle_url($baseurl, array('show' => $mod->id)),
new pix_icon('t/show', $str->show, 'moodle', array('class' => 'iconsmall', 'title' => '')),
$str->show,
new pix_icon('t/show', $str->modshow, 'moodle', array('class' => 'iconsmall', 'title' => '')),
$str->modshow,
array('class' => 'editing_show', 'data-action' => 'show')
);
}
Expand Down
10 changes: 9 additions & 1 deletion course/moodleform_mod.php
Expand Up @@ -557,8 +557,16 @@ function standard_coursemodule_elements(){

$section = get_fast_modinfo($COURSE)->get_section_info($this->_section);
$allowstealth = !empty($CFG->allowstealth) && $this->courseformat->allow_stealth_module_visibility($this->_cm, $section);
$mform->addElement('modvisible', 'visible', get_string('visible'), null,
if ($allowstealth && $section->visible) {
$modvisiblelabel = 'modvisiblewithstealth';
} else if ($section->visible) {
$modvisiblelabel = 'modvisible';
} else {
$modvisiblelabel = 'modvisiblehiddensection';
}
$mform->addElement('modvisible', 'visible', get_string($modvisiblelabel), null,
array('allowstealth' => $allowstealth, 'sectionvisible' => $section->visible, 'cm' => $this->_cm));
$mform->addHelpButton('visible', $modvisiblelabel);
if (!empty($this->_cm)) {
$context = context_module::instance($this->_cm->id);
if (!has_capability('moodle/course:activityvisibility', $context)) {
Expand Down
37 changes: 17 additions & 20 deletions course/tests/behat/activities_visibility_icons.feature
Expand Up @@ -23,7 +23,7 @@ Feature: Toggle activities visibility from the course page
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Visible | Show |
| Availability | Show on course page |
When I open "Test forum name" actions menu
Then "Test forum name" actions menu should not have "Show" item
And "Test forum name" actions menu should not have "Make available" item
Expand All @@ -45,14 +45,13 @@ Feature: Toggle activities visibility from the course page
And "Test forum name" activity should be hidden
And I reload the page
And "Test forum name" activity should be hidden
# Make sure that "Visible" dropdown in the edit menu has two options: Show/Hide.
# Make sure that "Availability" dropdown in the edit menu has two options: Show/Hide.
And I open "Test forum name" actions menu
And I click on "Edit settings" "link" in the "Test forum name" activity
And I expand all fieldsets
And the "Visible" select box should not contain "Hidden from students"
And the "Visible" select box should not contain "Available but not displayed on course page"
And the "Visible" select box should contain "Show"
And the field "Visible" matches value "Hide"
And the "Availability" select box should contain "Show on course page"
And the "Availability" select box should not contain "Make available but not shown on course page"
And the field "Availability" matches value "Hide from students"
And I press "Save and return to course"
And "Test forum name" activity should be hidden
And I turn editing mode off
Expand Down Expand Up @@ -84,7 +83,7 @@ Feature: Toggle activities visibility from the course page
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Visible | Show |
| Availability | Show on course page |
When I hide section "2"
Then "Test forum name" activity should be hidden
And I open "Test forum name" actions menu
Expand All @@ -99,15 +98,14 @@ Feature: Toggle activities visibility from the course page
And "Test forum name" actions menu should not have "Make available" item
And I click on "Make unavailable" "link" in the "Test forum name" activity
And "Test forum name" activity should be hidden
# Make sure that "Visible" dropdown in the edit menu has three options.
# Make sure that "Availability" dropdown in the edit menu has three options.
And I open "Test forum name" actions menu
And I click on "Edit settings" "link" in the "Test forum name" activity
And I expand all fieldsets
And the "Visible" select box should contain "Hidden from students"
And the "Visible" select box should contain "Available but not displayed on course page"
And the "Visible" select box should not contain "Hide"
And the "Visible" select box should not contain "Show"
And I set the field "Visible" to "Available but not displayed on course page"
And the "Availability" select box should contain "Hide from students"
And the "Availability" select box should contain "Make available but not shown on course page"
And the "Availability" select box should not contain "Show on course page"
And I set the field "Availability" to "Make available but not shown on course page"
And I press "Save and return to course"
And "Test forum name" activity should be available but hidden from course page
And I turn editing mode off
Expand Down Expand Up @@ -139,7 +137,7 @@ Feature: Toggle activities visibility from the course page
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Visible | Show |
| Availability | Show on course page |
When I click on ".reduce-sections" "css_element"
Then "Test forum name" activity should be visible
And I open "Test forum name" actions menu
Expand Down Expand Up @@ -179,7 +177,7 @@ Feature: Toggle activities visibility from the course page
And I add a "Assignment" to section "2" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
| Visible | Show |
| Availability | Show on course page |
When I open "Test assignment name" actions menu
Then "Test assignment name" actions menu should not have "Show" item
And "Test assignment name" actions menu should have "Hide" item
Expand All @@ -193,14 +191,13 @@ Feature: Toggle activities visibility from the course page
And "Test assignment name" actions menu should not have "Make unavailable" item
And I click on "Make available" "link" in the "Test assignment name" activity
And "Test assignment name" activity should be available but hidden from course page
# Make sure that "Visible" dropdown in the edit menu has three options.
# Make sure that "Availability" dropdown in the edit menu has three options.
And I open "Test assignment name" actions menu
And I click on "Edit settings" "link" in the "Test assignment name" activity
And I expand all fieldsets
And the "Visible" select box should contain "Show"
And the "Visible" select box should contain "Hidden from students"
And the "Visible" select box should not contain "Hide"
And the field "Visible" matches value "Available but not displayed on course page"
And the "Availability" select box should contain "Show on course page"
And the "Availability" select box should contain "Hide from students"
And the field "Availability" matches value "Make available but not shown on course page"
And I press "Save and return to course"
And "Test assignment name" activity should be available but hidden from course page
And I turn editing mode off
Expand Down
12 changes: 6 additions & 6 deletions course/tests/behat/section_visibility.feature
Expand Up @@ -23,27 +23,27 @@ Feature: Show/hide course sections
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test hidden forum 11 name |
| Description | Test hidden forum 11 description |
| Visible | Hide |
| Availability | Hide from students |
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test hidden forum 12 name |
| Description | Test hidden forum 12 description |
| Visible | Show |
| Availability | Show on course page |
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test hidden forum 21 name |
| Description | Test hidden forum 21 description |
| Visible | Hide |
| Availability | Hide from students |
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test hidden forum 22 name |
| Description | Test hidden forum 22 description |
| Visible | Show |
| Availability | Show on course page |
And I add a "Forum" to section "3" and I fill the form with:
| Forum name | Test hidden forum 31 name |
| Description | Test hidden forum 31 description |
| Visible | Hide |
| Availability | Hide from students |
And I add a "Forum" to section "3" and I fill the form with:
| Forum name | Test hidden forum 32 name |
| Description | Test hidden forum 32 description |
| Visible | Show |
| Availability | Show on course page |
And I follow "Course 1"
When I hide section "1"
Then section "1" should be hidden
Expand Down
20 changes: 17 additions & 3 deletions lang/en/moodle.php
Expand Up @@ -133,8 +133,8 @@
$string['allmods'] = 'All {$a}';
$string['allow'] = 'Allow';
$string['allowinternal'] = 'Allow internal methods as well';
$string['allowstealthmodules'] = 'Allow hidden but available activities';
$string['allowstealthmodules_help'] = 'If enabled, activities can be marked as hidden on the course page but available by following a link from elsewhere. These activities are listed in the gradebook and other reports';
$string['allowstealthmodules'] = 'Allow activities to be available but not shown in visible sections of course page';
$string['allowstealthmodules_help'] = 'If enabled, the Availability setting in Common module settings may have three options, rather than two - \'Show on course page\', \'Hide from students\' and \'Make available but not shown on course page\'. If an activity or resource is made available but not shown on the course page, a link to it must be provided from elsewhere, such as from a page resource. The activity would still be listed in the gradebook and other reports.';
$string['allownone'] = 'Allow none';
$string['allownot'] = 'Do not allow';
$string['allparticipants'] = 'All participants';
Expand Down Expand Up @@ -930,7 +930,8 @@
$string['hide'] = 'Hide';
$string['hideadvancedsettings'] = 'Hide advanced settings';
$string['hidechartdata'] = 'Hide chart data';
$string['hideonfrontpage'] = 'Hide from front page';
$string['hidefromstudents'] = 'Hide from students';
$string['hideoncoursepage'] = 'Make available but not shown on course page';
$string['hidepicture'] = 'Hide picture';
$string['hidesection'] = 'Hide section {$a}';
$string['hidesettings'] = 'Hide settings';
Expand Down Expand Up @@ -1176,6 +1177,18 @@
$string['missingurl'] = 'Missing URL';
$string['missingusername'] = 'Missing username';
$string['moddoesnotsupporttype'] = 'Module {$a->modname} does not support uploads of type {$a->type}';
$string['modhide'] = 'Hide';
$string['modshow'] = 'Show';
$string['modvisible'] = 'Availability';
$string['modvisible_help'] = 'If the availability is set to \'Show on course page\', the activity or resource is available to students (subject to any access restrictions which may be set).<br><br>
If the availability is set to \'Hide from students\', the activity or resource is only available to users with permission to view hidden activities (by default, users with the role of teacher or non-editing teacher).';
$string['modvisiblewithstealth'] = 'Availability';
$string['modvisiblewithstealth_help'] = 'If the availability is set to \'Show on course page\', the activity or resource is available to students (subject to any access restrictions which may be set).<br><br>
If the availability is set to \'Hide from students\', the activity or resource is only available to users with permission to view hidden activities (by default, users with the role of teacher or non-editing teacher).<br><br>
If the course contains many activities or resources, the course page may be simplified by setting the availability to \'Make available but not shown on course page\'. In this case, a link to the activity or resource must be provided from elsewhere, such as from a page resource. The activity would still be listed in the gradebook and other reports.';
$string['modvisiblehiddensection'] = 'Availability';
$string['modvisiblehiddensection_help'] = 'If the availability is set to \'Hide from students\', the activity or resource is only available to users with permission to view hidden activities (by default, users with the role of teacher or non-editing teacher).<br><br>
If the course contains many activities or resources, the course page may be simplified by setting the availability to \'Make available but not shown on course page\'. In this case, a link to the activity or resource must be provided from elsewhere, such as from a page resource. The activity would still be listed in the gradebook and other reports.';
$string['moodlelogo'] = 'Moodle logo';
$string['month'] = 'Month';
$string['months'] = 'Months';
Expand Down Expand Up @@ -1715,6 +1728,7 @@
$string['showingxofycourses'] = 'Showing courses {$a->start} to {$a->end} of {$a->total} courses';
$string['showlistofcourses'] = 'Show list of courses';
$string['showmodulecourse'] = 'Show list of courses containing activity';
$string['showoncoursepage'] = 'Show on course page';
$string['showonly'] = 'Show only';
$string['showperpage'] = 'Show {$a} per page';
$string['showpopoverwindow'] = 'Show popover window';
Expand Down
20 changes: 9 additions & 11 deletions lib/form/modvisible.php
Expand Up @@ -89,20 +89,18 @@ public function onQuickFormEvent($event, $arg, &$caller) {
$choices = array();
if (!$sectionvisible) {
// If section is not visible the activity is hidden by default but it can also be made available.
$choices[self::HIDE] = get_string('hiddenfromstudents');
$choices[self::HIDE] = get_string('hidefromstudents');
if (!$cm || $cm->has_view()) {
$choices[self::SHOW] = get_string('hiddenoncoursepage');
$choices[self::SHOW] = get_string('hideoncoursepage');
}
} else if (!empty($options['allowstealth']) && (!$cm || $cm->has_view())) {
// If allowed in this course/section, add a third visibility option
// "Available but not displayed on course page".
$choices[self::SHOW] = get_string('show');
$choices[self::HIDE] = get_string('hiddenfromstudents');
$choices[self::STEALTH] = get_string('hiddenoncoursepage');
} else {
// In the visible section without "stealth" activities allowed it's just "Show" or "Hide".
$choices[self::SHOW] = get_string('show');
$choices[self::HIDE] = get_string('hide');
$choices[self::SHOW] = get_string('showoncoursepage');
$choices[self::HIDE] = get_string('hidefromstudents');
if (!empty($options['allowstealth']) && (!$cm || $cm->has_view())) {
// If allowed in this course/section, add a third visibility option
// "Available but not displayed on course page".
$choices[self::STEALTH] = get_string('hideoncoursepage');
}
}
$this->load($choices);
break;
Expand Down

0 comments on commit 125c4c4

Please sign in to comment.