dataform fields - creating new ones?

dataform fields - creating new ones?

by Michelle Hollister -
Number of replies: 2

Hi All.

 I am wanting a time based field in my database activity - i.e. I want them to be able to input a start time and end time of their choosing, but time is not a viable entry.  IS it possible to create fields?  Is this simple or does it have to go back to the coders?

Many thanks for any help!

Michelle

Average of ratings: -
In reply to Michelle Hollister

Re: dataform fields - creating new ones?

by James Ballard -

Database field types are plugins that exist in /mod/data/fields so you can develop new ones and add them to your site. 

As a quick start:

  1. Copy one of the existing plugins 
  2. Rename the folder to time 
  3. Rename the class to data_field_time
  4. Start modifying to get what you want - there are two files and an image.

We have recently developed 3 new fields for a customer project to support restrictions of entries to particular groups of users for a personalised resource library and user tagging for a folksonomy approach in a more general library.

There are a couple of examples in the plugins database that you could look into: https://moodle.org/plugins/browse.php?list=category&id=15

Adding a new field type does require some development but can be sourced locally rather than requiring a core change. 

Yours

James