Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

User talk:Douglas Loomer: Difference between revisions

From MoodleDocs
Line 192: Line 192:
! Status
! Status
! Resolution/Description
! Resolution/Description
| Date
! Date
|-
|-
|  
|  

Revision as of 12:32, 18 April 2013

Separating Activity Hiding from Activity Access

This is a proposal for separating activity hiding from activity access in Moodle 2.4.+ and beyond. I am currently developing the proposed code as a hack/patch for the Shanghai American School Moodle 2.4 installation, but would be happy to share the code with anyone interested.

In its current form, hiding an activity from student view in Moodle does two basic things:

  • stops the html relating to the activity from being rendered on the page in Student view;
  • prevents students from accessing the activity via the activity's url.

In 2006 Robert Brenstein created Moodle Tracker MDL-4782 in which he proposed a change to Moodle which would allow teachers to hide activities from students yet make them accessible to students via hyperlinking. That tracker has attracted 108 votes and this feature was slated to be added to the Moodle core in Moodle 2.0. However, due to developer time constraints it remains unimplemented.

Basic Use Case

The requests for this feature come primarily from teachers who want to provide links to activities in editable text areas such as Moodle labels or Moodle activities. Linking to activites in editable text areas allows teachers to create a context for the activities that makes their purpose clearer and potentially more asthetically pleasing than the list format generated in a standard Moodle layout. In the following example, note how links to Moodle activities are presented within the context of the directions for their use.


Linking to activities in editable areas

The Problem Inherent in the Present Moodle Activity Hiding Schema

At present when an activity is created in Moodle a link to the activity is placed within a section of the class page. As a consequence, when teachers link to an activity within an editable text area (either within another activity or within a label on the course page) two links to the activity appear - their text area link and the link generated by Moodle which appears outside the text area where they created their activity link. The Moodle generated link cannot be hidden because hiding not only removes the link from the page, but also denies students access to the activity linked in the editable text area. The existence of two links to the activity can be very confusing to students. Also, in the case of teachers who choose to present essentially all their content within labels in each section area, the single column list of activities Moodle generates by default is unnecessary and even confusing to students.


Linking to activities in editable areas with Moodle generated activity links also displayed

Existing Work-Arounds

Stealth Mode

In an effort to avoid presenting students with multiple links when using text area linking some teachers employ what has come to be known as activity Stealth Mode. This involves leaving activities unhidden and moving the Moodle generated links to a hidden section at the end of the class page. (See this Stealth mode and nested activities dev page for a more detailed description of this approach and the special implementation of it created by Tim Hunt of the Open University.)

Flexpage

A second approach to avoiding the problem of multiple links when using text area linking is that taken by the Flexpage course format Moodle plugin (add-on). Like the Stealth Mode approach, the Flexpage course format leaves activities unhidden and moves activity creation to a location separate from the main course page. (See the FlexPage Plugin page for more information about Flexpage.)

Limitations of the Existing Work-Arounds

While it is possible to eliminate the problem of double links using Stealth Mode or Flexpage, both require multiple steps and page transitions to accomplish the task. A more significant limitation, however, is that some important Moodle features (e.g. Profile Activity Reports, Activity block summary reports) assume that Moodle generated activity links will be located in the course sections where they are used. Moving Moodle generated activity links from their expected locations makes a hash of these features rendering what they produce confusing and essentially unusable.

Functionality Provided by the Proposed Enhancement

The proposed enhancement eliminates the problems inherent in the current work-arounds, allowing instructors to create more complex and varied course setups without having to twist and bend their reality, and things like Profile Activity Reports or Activity block summary reports are as they should be.

  1. Teachers will be able to:
    • using Moodle's existing activity creation schema create and maintain activities in the course section locations where they logically belong (considering course work flow and progression);
    • using Moodle's existing activity hiding schema hide activities from student view on the course page (via the activity Settings dialog and course Editing on mode icons);
    • using Moodle's existing text editing area hyperlink creation schema create links to hidden activities in any editable text area located in the same course;
    • place activities into any of four possible states (via the course Settings dialog and course Editing on mode icons):
      1. visible and accessible
      2. visible and inaccessible
      3. invisible and accessible
      4. invisible and inaccessible
  2. Students will be able to access hidden activities which are in accessible state using teacher created links.
  3. Students will be unable to access hidden activities which are in inaccessible state.
  4. Administrators will be able to:
    • assign and unassign to any role the right to set the accessible/inaccessible flag for activities;
    • assign and unassign to any role the right to access activities flagged as inaccessible.
  5. The accessible/inaccessible flag will not alter the user's experience of the functionality of Moodle's existing Restrict access schema.

Solution Design

The Activity Settings Dialog

The Common module settings section of the Activity Settings dialog page will contain a new line which will appear below the existing Visible Hide/Show label and dropbox and which will have the following characteristics/behaviors:

  • a label appearing below the Visible label which displays the text "Accessible";
  • to the right of the label, a dropbox containing two selection choices - "Allow students access to this activity", and "Deny students access to this activity";
  • clicking the choices will enable or disable student access to the activity independent of its Hide/Show state.


The current layout of the Common module settings area
Common module settings - Visible and Accessible
Common module settings - Visible and Inaccessible
Common module settings - Invisible and Accessible
Common module settings - Invisible and Inaccessible

The Course Page in Editing On Mode

When Editing on mode is enabled on the course page all activities will display an added icon to the right of the Show/Hide icon which will have the following characteristics/behaviors:


  • a graphic (Icon One - an open lock) to indicate that the activity is accessible;


Activity icon list showing an open lock


  • Icon One will appear when the state of the activity is accessible;
  • a graphic (Icon Two - a closed lock) to indicate that the activity is inaccessible;


Activity icon list showing a closed lock


  • Icon Two will appear when the state of the activity is inaccessible;
  • clicking on either icon will toggle the icon graphic between Icon One and Icon Two and the accessibility state of the activity between accessible and inaccessible;
  • mouse-over of Icon One will display a tooltip stating "Deny access to activity" to alert the user that clicking it will make the activity inaccessible;


Activity icon list showing the open lock tool tip


  • mouse-over of Icon Two will display a tooltip stating "Allow access to activity" to alert the user that clicking it will make the activity accessible.


Activity icon list showing the closed lock tool tip

The Course Page in Editing Off Mode

When Editing on mode is NOT enabled on the course page Moodle generated activity links will have the following characteristics/behaviors:

  • if the state of visibility is show and the state of accessibility is allow, the link will appear normally and the activity will be accessible via the link, a teacher created hyperlink, or its url;
  • if the state of visibility is show and the state of accessibility is deny:
    • for teachers the link will appear but be greyed-out, an access restriction explanation will appear below the link, and the activity will be accessible via the link, a teacher created hyperlink, or its url;
    • for students the link will appear but be greyed-out, an access restriction explanation will appear below the link, and the activity will NOT be accessible via the link, a teacher created hyperlink, nor its url;
  • if the state of visibility is hide and the state of accessibility is allow:
    • for teachers the link will appear but be greyed out, and the activity will be accessible via the link, a teacher created hyperlink, or its url;
    • for students the link will not appear but the activity will be accessible via a teacher created hyperlink or its url;
  • if the state of visibility is hide and the state of accessibility is deny:
    • for teachers the link will appear but be greyed out, and the activity will be accessible via the link, a teacher created hyperlink, or its url;
    • for students the link will not appear and the activity will NOT be available via a teacher created hyperlink nor its url.

The Editing Role Pages

The Activities subsection of the Editing role page for each role defined in Moodle will contain two new entries - Make activities accessible/inaccessible, and Access inaccessible activities. Both new entries will possess the standard Capability, Permission, and Risk fields with specific values to be determined. Throughout this dev spec page it is presumed that the Admin and Teacher roles will have both these new capabilities set to Allow, and that other roles (including Student) will not.

The Relationship Between the Accessibile and Restrict Access Settings

Moodle 2.4 contains an optional Restrict access feature which can be enabled by checking the Enable conditional access (enableavailability) box in Settings > Site administration > Advanced features. Although they are related, the proposed Accessible selection box should appear in the Common module settings section of the Settings page rather than in the Restrict access section; Restrict access functionality is an optional Moodle feature and the proposed enhancement should not be an optional feature.

When conditional access is enabled, a Restrict access section appears on the course Settings page of each course directly below the Common module settings section. The Restrict access section allows teachers to set conditions under which an activity should be accessible to students. Accessibility can be based upon dates, and/or score ranges of other activities, and/or if other activities are considered completed. Note that ALL access restrictions (date, grade condition, activity completion condition) have to be met in order for the activity to be made available. (See Conditional activities settings.) This Restrict access feature employs the existing Moodle Visibile (Hide/Show) schema described above in order to limit student access to activities.

Currently:

  • when the Visible toggle is set to Hide, Restrict access functionality is disabled;
  • when the Visible toggle is set to Show, the conditions set in the Restrict access section control activity availability and visibility.

Separating visibility from accessibility in Moodle will have an impact upon Restrict access functionality, and the functionality of the proposed enhancement should be coordinated with the functionality of the existing Restrict access feature as follows:

  • when the Accessible toggle is set to Deny student access to this activity AND/OR the Visible toggle is set to Hide, the Restrict access section should be greyed out and Restrict access functionality should be disabled;
  • when the Accessible toggle is set to Allow student access to this activity and the Visible toggle is set to Show, the Restrict access section should appear normally and the conditions set in the Restrict access section should control activity availability and visibility.

The Relationship Between the Accessible and Completion Tracking Settings

While the proposed enhancement will not directly affect Moodle's Completion Tracking functionality, hiding Moodle generated activity links from students also hides the activities' completion check boxes. This could present an unintended problem in situations where the activities are hidden but accessible via teacher created links because students would not be able to check/see whether the status of such activities was completed. It would, perhaps, make sense to also display the activity completion check boxes for students to check/see on the various activity summary list pages and/or add an Activity Completion Report for students in the course navigation block.

Technical Specifications

Roles Capabilities Table

The following new capabilities will appear in the mdl_capabilities table.

Description Capability Captype Contextlevel Component Riskbitmask
Make activities accessible/inaccessible moodle/course:activityaccessibity write 70 Moodle
Access inaccessible activities moodle/course:accessinaccessibleactivities read 70 Moodle

mdl_course_modules Table

The following field will be added to the mdl_course_modules table.

Field Type Description
accessible tinyint(1) [1]


Specification Change Log

Issue Status Resolution/Description Date