Skip to content

Commit

Permalink
Version 3.2.1 for Moodle 3.3 and 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed May 5, 2017
1 parent fc5f30f commit 8b689c7
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 23 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
moodle-format_flexsections
==========================

Version 3.2.1
-------------

- Release for Moodle 3.3 and 3.2

Version 3.2.0
-------------

Expand Down
33 changes: 25 additions & 8 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ public function get_view_url($section, $options = array()) {
if ($sectionno) {
$url->set_anchor('section-'.$sectionno);
}
} else if (!empty($options['navigation'])) {
// this is called from navigation, create link only if this
// section has separate page
if ($section->collapsed == FORMAT_FLEXSECTIONS_COLLAPSED) {
$url->param('sectionid', $section->id);
} else {
return null;
}
} else if ($sectionno) {
// check if this section has separate page
if ($section->collapsed == FORMAT_FLEXSECTIONS_COLLAPSED) {
Expand Down Expand Up @@ -297,6 +289,9 @@ protected function navigation_add_activity(navigation_node $node, $cm) {
} else {
$activitynode->nodetype = navigation_node::NODETYPE_LEAF;
}
if (method_exists($cm, 'is_visible_on_course_page')) {
$activitynode->display = $cm->is_visible_on_course_page();
}
return $activitynode;
}

Expand Down Expand Up @@ -1240,6 +1235,19 @@ public function inplace_editable_render_section_name($section, $linkifneeded = t
}
return parent::inplace_editable_render_section_name($section, $linkifneeded, $editable, $edithint, $editlabel);
}

/**
* Returns whether this course format allows the activity to
* have "triple visibility state" - visible always, hidden on course page but available, hidden.
*
* @param stdClass|cm_info $cm course module (may be null if we are displaying a form for adding a module)
* @param stdClass|section_info $section section where this module is located or will be added to
* @return bool
*/
public function allow_stealth_module_visibility($cm, $section) {
// Allow the third visibility state inside visible sections or in section 0.
return !$section->section || $section->visible;
}
}

/**
Expand Down Expand Up @@ -1278,3 +1286,12 @@ function format_flexsections_inplace_editable($itemtype, $itemid, $newvalue) {
return course_get_format($section->course)->inplace_editable_update_section_name($section, $itemtype, $newvalue);
}
}

/**
* Get icon mapping for font-awesome.
*/
function format_flexsections_get_fontawesome_icon_map() {
return [
'format_flexsections:mergeup' => 'fa-level-up',
];
}
20 changes: 10 additions & 10 deletions tests/behat/basic_actions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Feature: Using course in flexsections format
| student2 | Mary | Student | student2@example.com |
| teacher1 | Terry | Teacher | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | flexsections |
| fullname | shortname | format | numsections |
| Course 1 | C1 | flexsections | 0 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I am on "Course 1" course homepage
And I should not see "Add section"
And I turn editing mode on
And I follow "Add section"
Expand All @@ -38,7 +38,7 @@ Feature: Using course in flexsections format
And I should see "Second module"
And I log out
When I log in as "student1"
And I follow "Course 1"
And I am on "Course 1" course homepage
Then I should see "First module"
And I should see "Second module"

Expand All @@ -47,7 +47,7 @@ Feature: Using course in flexsections format
And I should see "Second module"
And I log out
When I log in as "student1"
And I follow "Course 1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
And I should see "Topic 2"
And I should see "First module"
Expand All @@ -57,7 +57,7 @@ Feature: Using course in flexsections format
When I click on "Hide" "link" in the "li#section-2" "css_element"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
And I should not see "Topic 2"
And I should see "First module"
Expand All @@ -67,7 +67,7 @@ Feature: Using course in flexsections format
When I click on "Hide" "link" in the "li#section-1" "css_element"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I am on "Course 1" course homepage
Then I should not see "Topic 1"
And I should not see "First module"
And I should not see "Topic 2"
Expand All @@ -82,7 +82,7 @@ Feature: Using course in flexsections format
When I click on "Show collapsed" "link" in the "li#section-2" "css_element"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
And I should see "First module"
And I should not see "Second module"
Expand All @@ -107,7 +107,7 @@ Feature: Using course in flexsections format
When I click on "Show collapsed" "link" in the "li#section-1" "css_element"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I am on "Course 1" course homepage
Then I should see "Topic 1" in the "region-main" "region"
And I should see "Topic 1" in the "Navigation" "block"
And I should not see "First module"
Expand All @@ -123,7 +123,7 @@ Feature: Using course in flexsections format
And I expand "Topic 2" node
And I should see "Second module" in the "Navigation" "block"

@javascript @xxx
@javascript
Scenario: Merging subsection in flexsections format
Given I add the "Navigation" block if not present
And I open the "Recent activity" blocks action menu
Expand Down
6 changes: 3 additions & 3 deletions tests/behat/delete_section.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Feature: Deleting sections in flexsections format
| username | firstname | lastname | email |
| teacher1 | Terry | Teacher | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | flexsections |
| fullname | shortname | format | numsections |
| Course 1 | C1 | flexsections | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I am on "Course 1" course homepage
And I should not see "Add section"
And I turn editing mode on
And I follow "Add section"
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2017012000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2017050500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016120500; // Requires this Moodle version
$plugin->release = "3.2.0";
$plugin->release = "3.2.1";
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'format_flexsections'; // Full name of the plugin (used for diagnostics).

0 comments on commit 8b689c7

Please sign in to comment.