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

Dataform building

From MoodleDocs
Revision as of 20:23, 8 March 2014 by Itamar Tzadok (talk | contribs)


Understanding the Dataform activity

Resource or Activity?

A Dataform instance is essentially a collection of content entries entered and interacted with by the activity participants. The type of content, the content itself and the manner of interaction depend on the specific objectives of the intended activity.

Moodle divides modules into two groups, Activities and Resources. Modules that involve something that a participant will do by way of interaction with other participants are typically classified as Activities. Modules that can be seen is mere channels of content are typically classified as Resources. To be sure, this classification is often not a clear-cut as some Activity modules do not really involve interaction between participants (e.g. Quiz) and some Resource modules can be constructed with interactive components and allow interaction between participants (e.g. adding comments block to Book pages).

The Dataform is an example for a module that can be used either as an Activity or as a Resource depending on the specific application and/or learning objectives. When adding an instance to the course via the 'Add an activity or resource' link, the Dataform is listed in the Group of activities only because it can appear in one group only.

Application wise, the Dataform can emulate many of the standard Moodle resources and activities at least to a certain extent. It's real strength is where the desired behaviour of the resource or activity is not quite standard and the non-standard part can be applied by means of components that are included with the Dataform or can easily plugged in. Of course, within their intended scope designated modules are likely to be more user friendly for setup then the generic Dataform.

Templates and patterns

View types are templates that allow you to control the visual layout (and behaviour) of information when listing, viewing or editing entries. This is similar to the technique used to mail merge letters in word processors such as Open Office Writer or Microsoft Word. In designated areas in the View configuration form you can insert special patterns that will be replaced with certain content when the view is displayed. The designated areas for these patterns are typically WYSIWYG editors which allow you to insert static content and decorations in addition to the patterns in order to create the desired visual effect.

For example, in order to display the list of entries in the view, you need to have the pattern ##entries## in the View template area in the view configuration form. In most view types this pattern is added by default when you create the view. If you delete it and want to re-insert it, you can either select it from the View patterns dropdown under the editor or simply type it in. Now you can add decorations to the layout.

The view template and its display with only the ##entries## pattern:

df-view template-styling2.png df-view template-styling3.png


The template and its display with the ##entries## pattern and additional content and styles:

df-view template-styling.png df-view template-styling1.png