Note: You are currently viewing documentation for Moodle 3.6. Up-to-date documentation for the latest stable version of Moodle is likely available here: Dataform building.

Dataform building

From MoodleDocs


Building a simple activity

Preventing participants from viewing other entries

One setting and two permissions can affect whether the user can is limited to viewing only his/her entries.

Separate participants by activity setting

df-activity-settings-separate-participants.png

The activity setting 'Separate participants' set to 'Yes' will restrict all roles which do not have the 'mod/dataform:manageentries' capability to their own entries. By default permissions, that's all roles below editing teacher. This means that non-editing teachers are also restricted to their own entries by this setting. If you want to allow non-editing teachers (graders/TAs) access to certain entries you can use an Entry access rule and set the rule with entry filter to fetch the designated entries and a role override where you assign the designated non-editing teacher to the editing teacher role.

Separate participants by permission

df-activity-permissions-entryanyview.png

By default the mod/dataform:entryanyview permission is granted to everyone. You can exclude certain roles in the activity level by removing the role from the permission (Prevent), or by adding the role under Prohibited. Note that if you want to then grant the permission to particular users from the excluded role, use the Prevent method and then add an Entry access rule with a proper override.

Setting entry actions to open in different views

Yes. There are many other patterns which are not visible via the UI and only some are currently listed in the docs.

In the entry level you can use (note redundant spaces between brackets)

[ [EAC:more:viewname]] 
[ [EAC:edit:viewname]]

Which will send you to view or edit (respectively) the entry in the specified view.

Also

[ [EAC:moreurl:viewname]]

which you can use in the href of a tag to create a custom link to the target view.


In the view level you can use:

##viewurl:viewname## 

which displays the url of the specified view and you can use in the href of a tag.

##viewlink:viewname## 

which displays a link to the specified view

There is also a composite version of the viewlink pattern which looks like this:

##viewlink:Single view;Add a new entry;editentries=-1;##

This particular instance will mimic the addnewentry pattern but in the specified view. Details on the syntax should be available in this post: https://moodle.org/mod/forum/discuss.php?d=256813#p1123734.

The view patterns are also parsed in the entry level so you can use the composite viewlink pattern in the entry with the entry id pattern:

##viewlink:Edit view;Edit this submission;editentries=[ [entryid]];##

or

##viewlink:Details view;More details ...;eids=[ [entryid]];##


Another relevant view function is redirection of the view to another view in the activity after form submission. The setting under the 'Submission' section in the view configuration form. There you can also set the redirection timeout and message, and also add additional submission buttons as well as custom labels for these buttons.