Search Google Appliance

Information Technology

Add a Database Activity to Moodle

The Database activity allows students and/or instructors to populate, display, search, and comment on a bank of record entries. The format and structure of these entries is highly customizable, with the option to include images, files, URLs, numbers, checkboxes, and text. Versatile settings options make the Database activity well suited for many different kinds of assignments, such as collecting and sharing information, giving students a data array to work with, and presenting content for students to comment on.

Consider the simpler Moodle Glossary activity if you only need to build a collection of terms and definitions.

Note: With flexibility comes a fair amount of complexity. If you are considering creating a Database activity for your course, we recommend contacting the Instructional Media Lab for assistance.

Part One: Add the Database Activity & Configure Submission Options

To add a Database activity to your Moodle course, first you'll configure the submission options for making entries, availability, grading, groups, etc). After completing this step you'll need to open the activity to

  1. On your course page, click Turn editing on (top right).
  2. Locate the Section of your course page where you will add the database. (If you are using the Collapsed topics format, open the Section.)
  3. At the lower-right of the Section, click + Add an activity or resource. The Add an activity or resource window will open.
  4. In the Add an activity or resource window, select Database. A description will be displayed at right.
  5. Click Add. The Adding a new Database page will open.
  6. On the Adding a new Database page, click the headings  to view those settings, or to view all settings, click Expand all (upper right). At the bottom of each section, Click Show more... to reveal all options. 
    • Entries: View and adjust the record entry settings.
      • Approval required
        Allows you to require that an instructor or TA approve each entry before students can view it.
      • Allow comments on entries
        Allows users to comment on each other's entries. Note: The Comments option will display when users view entries individually, but not when viewing a list of all database entries.
      • Entries required for completion
        The number of entries each student is required to add before the Database activity is considered complete. Students will see a reminder message if they have not submitted the required number of entries.
      • Entries required before viewing
        The number of entries a student must submit before s/he can see entries by other students.
      • Maximum number of entries
        The maximum number of entries a student can submit before s/he is blocked from adding more.
    • Availability: View and adjust the database availability settings.
      • Available from/to
        The dates the database is visible to students and new entries can be added.
      • Read only from/to
        The dates the database is available for viewing, but not open for data entry.
    • Grade: Assign the database to a given category in your Gradebook. Note: this heading will not appear when Aggregate type (below) has been set to No ratings.
    • Ratings: View and adjust how instructors and TAs will grade entries.
      • Roles with permission to rate
        Identifies users who have permission to rate items. The list of roles may be changed via the permissions link in the Administration block.
      • Aggregate type
        Determines how the ratings are entered as a grade in the Moodle Gradebook. The options are: No ratings, Average of ratings, Count of ratings, Maximum rating, Minimum rating, Sum of ratings, and Manual Gradebook rating.
      • Scale
        Sets the maximum score for the activity. Note: For the "Sum of ratings" aggregate type, select the maximum for the sum of all ratings (the total grade for the activity), not the maximum for each rating.
      • Restrict ratings to items with dates in this range
        Limits the timeframe during which items are available for rating. Check the box to enable the drop-down date windows.
    • Common module settings: View and adjust the database visibility and group settings.
      • Visibility to students
        Set whether or not an assignment is visible to students. By default, new assignments are set to Show. (This is comparable to using the Hide/show icon for the activity on your course page.)
      • Group mode, Grouping
        These options let you restrict the assignment to particular groups of students you have already created in Moodle. For more information, see Assign an Activity to a Group or Grouping in Moodle.
    • Restrict access: To add restrictions on accessing the activity click Add restriction. The Add restriction window will open, containing the following options:
      • Date. Prevent access until (or from) a specified date and time.
      • Grade. Require students to achieve a specified grade.
      • User profile. Control access based on fields within the student’s profile.
      • Restriction set. Add a set of nested restrictions to apply complex logic.
        If you have groups in your course, you will see the following additional options:
      • Group. Allow only students who belong to a specified group, or all groups.
      • Grouping. Allow only students who belong to a group within a specified grouping.
  7. Click Save and display at the bottom of the page. The database opens to the Fields tab.

  8. Under the Fields tab, define the fields to use (see Select Database Fields below).

  9. Under the Templates tab, define the layout templates to use (see Define Database Templates below) .

Note: The Database activity cannot be used until fields and templates have been defined (see below).

Part Two: Set up Entry Fields and Select a Layout Template

Select Database Fields

Fields establish the kinds of content that can be added to entries in your database. To add a new field when first setting up your database:

  1. On your course page, find the Database activity. Click on the name of the database activity. This will open the database page.
  2. Click the Fields tab, and select a field type from the Create a new field drop-down menu. The types of fields possible are: Checkbox, Date, File, Latlong (latitude/longitude), Menu, Multimenu, Number, Picture, Radio button, Text area, Text input, and URL.
  3. Enter a Field name,Field description, and field Options(if applicable).
  4. Click Add.
  5. Use the Default sort field drop-down menu to choose the order in which fields will display in the database. The default is to display by Time added, or you choose to sort on any of the database fields you have defined.
  6. Click Save.

Define Database Templates

Templates determine the visual layout of the database when users are adding a new entry, browsing or searching all existing entries, and viewing one entry at a time. To reduce setup complexity, we recommend creating all database fields before defining templates.

To use the default templates when first setting up your database, click the Templates tab and then click Save template.

Note: The default templates can be modified, but this requires directly editing the template HTML. For assistance customizing a template, contact the Instructional Media Lab.

Update Database Templates

If you add a new field to a Database activity after saving templates for the first time, you will need to reset the templates before the field will display to users. To update your database templates:

  1. Click the Templates tab, then click the Add template tab.
  2. Click Reset template to update the template to include newly added fields.
    Note:Resetting a template will remove any changes you have made to the default template HTML.
  3. Click Save template. This will update the fields users see when adding a new database entry.
  4. Repeat the steps above in the List template, Single template, and Advanced search template tabs. This will update the fields users see when browsing database entries, viewing one entry at a time, and searching within the database.

Using the Database

  • After you have defined database fields and templates, click Add entry to create entries and populate the Database activity.
  • Once entries have been saved in the database, click View single to view them individually, or click View list to see the entries as a list.
  • To search entries in the database, click Search.

For details and instructions for your students, see Contribute to a Database in Moodle.