You're looking at an older version of Totara Learn.

Please see Totara Learn 11 help for the latest version.

The database activity is both powerful and complex and is useful in many situations with a little ingenuity and work.

You can also share the work of creating a database. If you want your learners to create and submit a database for a project, you can override the learner role and grant them authoring capabilities. If you then use the separate groups mode, each group can create its own database of research and submit it at the end for grading.

Remember to use roles and groups functionality to create additional flexibility to your database.

Database Capabilities

The database module has a number of capabilities you can use to fine-tune your learners interaction with the activity.

View entries: This allows a user to view database entries submitted by other users. This capability is moderated by any submission requirements in the database options, such as the number of entries required before viewing.

Write entries: This allows a user to create new database entries.

Write comments: This allows a user to add comments to database entries. This capability is only active if the comments option is enabled. By default, learners are allowed to add comments. If you only want trainers to be able to add comments, you can prevent this capability with a learner role override.

View ratings: This allows a user to view all ratings.

Rate entries: This allows a user to rate entries by other users. This capability is only active if the Allow posts to be rated option is enabled. The capabilities to write comments and rate entries together allow learners to provide feedback on entries.

Approve unapproved entries: This allows a user to approve entries before they are viewable by everyone. This capability is only active if the Require approval option is enabled.

Manage entries: This allows a user to edit and delete other users’ database entries.

Manage comments: This allows a user to edit and delete other users’ comments.

Manage templates: This allows a user to edit and delete the interface templates of the database. If you want learners to create database activities for each other, you can enable this capability for them.

View presets from all users: This allows a user to view the list of site presets and select them for use.

Manage all template presets: This allows a user to delete site presets.

Add a Database activity

  1. Click Turn editing on.
  2. Select Database from the Add an activity... dropdown menu.
  3. Enter a database activity name, this appears on the course page for learners.
  4. Customise the available settings as required, see Database Settings to learn more.
  5. Set Restrict access if required.
  6. Set Activity completion if required.
  7. Click Save and display (or Save and return to course).

Creating database fields

Once you have set up the database activity you need to set up the database fields required.

To create the fields for your database:

  1. On the database setup page, select the field type you want to add from the Create a new field dropdown menu.
  2. Enter a field name and a field description. The field name is used to create the templates, so make it unique and long enough to be descriptive, but not too long to retype.
  3. If necessary, add/select the options for each field type. For example, you can set the height and width of the text area generated by the textarea field.

There are 12 available field types that can be used in your database:

Checkbox: Select Checkbox from the dropdown menu. To add multiple check boxes, enter each option on a different line in the options text field.

If you want to ensure that a learner actively selects only one of the options, it’s better to use the radio buttons field.

Date: Select Date from the dropdown menu. Creates a date field for each database entry.

File: Allows a learner to upload a file from their computer. Select File from the dropdown menu.

If you want a learner to upload image files, it's better to use the picture field.

Latitude/longitude: Allows learners to enter the geographic location by specifying the location’s latitude and longitude. When learners view the entry, links are automatically generated to geographic data services such as Google Maps, Google Earth, or Multimap.

Menu: Allows learners to select an option from a dropdown menu. Enter each option on a different line in the options text field.

Menu (multiselect): Allows learners to select multiple options from a dropdown menu (by holding down the Control (Ctrl) or Shift key as they click).

The check box field offers the same options as menu (multiselect) but with a more obvious user interface.

Number: Allows learners to enter a number (positive, negative, or zero).

Picture: Allows learners to upload an image file from their computer.

Radio buttons: Allows learners to select just one option from a list. If used, radio buttons is a required field; a learner may only submit his database entry after selecting an option.

Text: Allows learners to enter text up to 60 characters in length. For longer text, or for text that requires formatting, such as headers and bullet points, the textarea field should be used.

Textarea: Allows learners to enter text longer than 60 characters in length and/or include formatting such as headers and bullet points.

URL: For learners to enter a URL. Selecting Auto link the URL will make the URL a clickable link; entering a forced name for the link means that the name will be used for the hyperlink.

Required field: If you need to ensure one or several particular fields are always completed, then tick the box Required field when setting up the fields for your database. The field(s) will display a red asterisk when learners contribute to the database, and they will not be able to save their work until they have entered the relevant information. A new column will show the trainer which fields are required and not required.

Edit a Database activity

  1. Click Turn editing on.
  2. Click Edit next to the choice activity.
  3. Make the required changes.
  4. Click Save and display (or Save and return to course).

The first step to creating a database is adding it to the appropriate section of your course. As with most Totara activities, you first set the options for the database, then create the fields and templates.

Database Settings

Common Settings

Available from/to: The dates the database is both visible to learners and open for data entry.

Viewable from/to: The dates the database is available for viewing, but not open for data entry.

Required entries: The number of entries each learner is required to enter before the database activity can be considered complete. The learner will see a reminder message if she has not submitted the required number of entries.

Entries required before viewing: The number of entries the learner needs to submit before he can see entries by other learners. If the learner has not submitted the required number of entries, he will only see the entry page and not the list or single view pages.

Maximum entries: The maximum number of entries the learner can submit before she is blocked. This prevents people from spamming the system, either in the hope that one entry is good enough or, on a public site, as a way of advertising.

Comments: Enables commenting on entries. The comments field appears on the single view template when this is enabled.

Require approval?: Allows you to require each entry to be approved by someone with the appropriate role before other users can view it.

RSS articles: Enables you to publish an RSS feed of entries in the database. The option here sets the number of entries available in the feed.

Allow posts to be rated?: Lets you allow posts to be rated, which will enter a score in the grade book for the learner’s submissions in the database. The grade is set using the drop-down menu below this option.

Common module settings

See Common Module Settings to learn more.

Activity completion

See Activity Completion to learn more.

Restrict access

See Restrict Access to learn more.

Database Template

Once you have created the fields for your database, you probably want to edit the templates that define the user interface. Creating the fields produces a default template.

Database templates all work on the same principle, they are basically HTML pages with a new set of tags for the database module to interpret. When editing a template, Totara displays a list of available tags on the left side of the editing screen. Double-clicking on any of the tags adds it to the template. The database activity interprets these new tags before sending the template’s HTML to the browser for display. It looks for words enclosed in either two square brackets([[) or two hash signs (##), representing two different types of interface elements it can add to the template.

The square brackets define data tags, which tell the module to replace the word in the brackets with the value or form element of the field with the same name. So if you have a database with a name field, you would represent it in the template with [[name]]. In the single or list template, the module would replace it with the data in the name field for that entry. In the list template, the module would replace it with a text field, and put the value in the text field if you’re editing the entry instead of creating a new one.

The ## tags indicate the word should be replaced by an icon or link for interacting with the module. These tags are used to place the edit and delete icons, and links for More, Approve, Comments, and User. If you want to add the edit icon to a template, you just add a tag that looks like ##edit##. When the user looks at the page with the tag, the database module replaces it with the edit icon. If the user then clicks on the icon, it takes them to the edit template.

Aside from the replacement tags, creating a template is just like creating an HTML page. Use a table to lay out the data elements (this is an acceptable use of tables for layout), add descriptive text around the replacement tags, and publish. The database makes it easy to rapidly view your changes by flipping between the Templates tab and the tab for the template you are working on.

To edit a template:

  1. On the database page, click the Templates tab.
  2. Click one of the template links below the row of tabs.
  3. When you are done, click Save template.

Template is used to create and edit new entries. In this template, data tags are replaced with the form element for the field. If the user is editing an entry, the field will have the data from the field in the form element for editing as well.

It’s important to list every field you want the user to fill in on this template. If you leave off a field, the user won’t be able to add or edit its data.

There are three basic templates necessary to use the database: list, single, and add. The three other templates (RSS, CSS, and Java Script) are more advanced templates and aren’t necessary for basic database use.

Single template

The single template is the detailed view of an entry. This template should list all of the available data. Consider organising the data if you have a lot of fields in your database.

List template

The list template is the first page learners will see when they come to your database. The list template should give an overview of the entries and enable users to click through to the single or edit template.

Organising a good list template is a bit of a challenge. First, you should identify the fields that will be most helpful to users for selecting the entries they want to view. The default layout almost always has too much information.

The form has three areas: the Header, Body, and Footer. If you lay out the list template as a table, you’ll want to use the Header area as the table header, the Body for the data, and the Footer to close the table. The HTML editor puts a full table in each area, which makes it difficult to get proper alignment of the elements and not repeat the headers for every entry.

A knowledge of tables in HTML is required in order to lay out the entire list template as one table.

To make the entire list template as one table:

  1. On the list template page, turn off the HTML editor.
  2. In the Header area of the template, open the table and add a row for your header text. Each column should contain one element of the header.
  3. In the Body, create another row with the data and command replacement tags.
  4. In the Footer, close the table.
  5. Save the template. 

Do not switch the HTML editor on while editing this template. If you turn the editor back on, it will create tables in each of the areas.

RSS template

The RSS template allows you to structure the RSS feed from the database. If you have enabled RSS feeds for the database in the database options, the database will publish the entries in a feed. This template allows you to structure how the entries in the feed appear to the readers.

CSS template

The CSS template defines the CSS styles for all of the templates in the database. If you know CSS, you can adjust the template’s fonts, spacing, colours, and other display information.

JavaScript template

Like the CSS template, the JavaScript template is used by the other templates. The JavaScript template allows you to add new behaviours to the templates by defining JavaScript routines that can be loaded when the template page loads. At the time of this writing, the JavaScript API isn’t yet documented, but the image gallery preset uses JavaScript to define the size of images in the list and single templates.

Database Presets

To avoid the necessity of always having to create a new database from scratch, the database module has a presets feature. An image gallery preset is currently included in the database module to help get you started. You can create your own presets as well and share them with others.

To use a preset:

  1. On the database page, click the Presets tab.
  2. Either click the Choose file button, browse for the preset ZIP on your computer and click Import, or choose a previously loaded preset.
    • If you have already created fields in your database, you need to map them to the new fields in the preset or they will be deleted. 
    • For example, if you load the image gallery preset you can map three fields to the image, title, and caption fields. Any other fields will be deleted and any data in them will be lost.
  3. If you require to do so, customise the fields and templates.
  4. That’s all there is to using a preset. All the hard work of setting up the templates has been done for you.
  5. If you wish to share your database presets with others, you have two options:
    • Export as a ZIP file, which can then be imported to another course or Totara site.
    • Save as a preset, which publishes the database for other trainers on your site to use. It will then appear in the preset list (you can delete it from the list at any time).

Grading Database Entries

Giving grades for entries is the single most powerful motivator for learners. It also rewards learners for their time and effort. As always, if you don’t want to assign a numerical grade to an entry, you can create a custom scale and assign a qualitative grade. When you rate an entry, the grade is added to the grade book, like a rated forum post.

We would strongly recommend combining rating and comments. Rating allows you to assign a numerical value to an entry, but it doesn’t give you a method to tell the learner why they received the particular grade. The comments box enables you to communicate the reason.

Ratings and comments can be turned into a collaborative venture with your learners. By default, learners are allowed to add comments and only trainers are allowed to rate entries. However you can enable collaborative rating by setting a learner role override.

If you don’t see the Override roles link in the Roles tab, ask your system administrator. By default trainers are unable to override roles, so this ability must be granted by your system administrator as well as setting which roles can be overridden by the trainer role.

To enable learner rating of entries:

  1. On the Updating database page, select the Roles tab.
  2. Click the Override roles link just below the tabs.
  3. Select the learner role from the list of roles in your course.
  4. Select Allow for the Rate entries capability.
  5. Click Save changes.

On this page

Still have questions? Why not post them in the forums of the Totara Community.

  • No labels