You are on page 1of 3

BRYN MAWR COLLEGE Month YYYY

Information Services

Working with Databases in Moodle


The Moodle Database is one of the trickier activities in Moodle that some professors may wish to avoid. The user interface to
create the database itself seems to presuppose some prior knowledge of databases and will even require you to use HTML for
some things. However, there can be many benefits of creating such a tool for students to use. Before I get started, let me briefly
describe just exactly what a Moodle database is and what its potential uses may be.

If you’re familiar with databases, then you know that it is basi-


cally an electronic index of searchable information. In the Endless Possibilities: “Only your imagination limits the poten-
Moodle Database, you will define the fields for the data you tial uses of the database module. You could use the database
wish to store and then will design templates for adding, listing, to create glossaries, catalogs, taxonomies, registrations, paper
and searching the database. In Moodle, there is a single table submissions, maps, or anything where the students in your
per database and there are no joins. This eliminates the possi- class can fill in a form to add data.”
bility of cross-referencing with another database but makes
implementation somewhat simpler. The system is also there- Example databases
fore redundant (you will have to enter information more than
once in some cases). Moodle.org has three good examples of the database module
in action:
Potential uses Moodle Buzz, a database of the titles, authors and web links to
The database activity does not seem to have a specific use in news articles mentioning Moodle
mind. Perhaps it is exactly this that makes Moodle’s database Themes, a database with screenshots, download links and user
activity so versatile! comments about Moodle themes
Modules and plugins, a database containing a variety of web
Here are some potential uses (some as suggested in Moodle links (download, documentation, discussion) and info
Docs): (maintainer, module type, requirements) about the modular
components of Moodle, including those created by third par-
A database of famous paintings: such a database may have a ties.
picture field called painting, for uploading an image file show-
ing the painting, and two text fields called artist and title for Getting started
the name of the artist and the painting.
So now that you have an idea of what you want to use the da-
A database of Buildings for an Architecture class: such a data- tabase for, how can you get started? The first step, of course,
base may have a picture field called building, for uploading an is adding the database to your course page.
image file showing a particular building, and four text fields To do this, first, make sure editing is on. (The ‘Turn editing on’
called architect for the architect’s name, location for where button is in the upper right-hand corner of the course page.)
the building is located, building name for the name of a partic- Now go to the particular block you wish to add the database
ular piece of architecture, and date for the time period from to, choose the activity dropdown menu, and select database.
which the architecture comes from. (This could help students
study for exams, for example) This will bring you to the Adding a new database page, where
you should give your database a name and description.
Collaboration: allow collaboration on building a collection of
web links/books/journal references related to a particular sub-
ject .
BRYN MAWR COLLEGE Month YYYY

Lets you allow posts to be rated, which will enter a score in the
gradebook for the student’s submissions in the database. The
grade is set using the dropdown menu below this option.
Once you’re finished, select Save and return to course at the
bottom of the page.

Now you have a Database, but where on earth do you go from


here?

Then Creating Fields for your Database


edit
the general settings to fit your needs. Here’s an explanation Remember, the fields in your database specify the type of data
provided by the people at Moodle of what some of these you’ll be adding to the database. To add fields to your data-
settings mean: base, you’ll first have to select the database from your course
page. (In this case, you’ll select directly on the link to the item.
Available from/to Do not select the edit icon.)
The dates the database is both visible to students and open for
data entry. When you get to this page, look at the tabs located under the
database’s header. You should find one labeled fields. Select
Viewable from/to this.
The dates the database is available for viewing, but not open
for data entry.

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

Entries required before viewing


The number of entries the student needs to submit before he
can see entries by other students. If the student has not sub- You should see here, that there is an option to Create a new
mitted the required number of entries, he will only see the field. Select this drop down menu and choose the type of field
entry page and not the list or single view pages. that you wish to add. For now, I’ll choose picture.

Maximum entries
The maximum number of entries the student can submit be-
fore 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
Allow posts to be rated?
BRYN MAWR COLLEGE Month YYYY

Now you should see a page that says Picture field. (Your page layout), add descriptive text around the replacement tags, and
will be titled differently based on what kind of field you chose.) publish. The database makes it easy to rapidly view your
Enter a field name and description. Enter the other specifica- changes by flipping between the Templates tab and
tions as necessary. For now, we’ll probably say that it isn’t. the tab for the template you are working on.”
Necessity will be determined by the kind of template you des-
ignate for your database or other factors that may not be fore- If you wish to create your own template, you should be able to
seen in this guide. (You can go back and edit these later if you work from the text extracted above. This guide will not go into
find out that it is necessary.) detail on specifics and for most purposes, the default template
Once you’re finished, select the button Add. works well enough.
MAKE SURE WHEN YOU ARE SWITCHING BETWEEN VIEWS
You can continue to add fields as described above until you THAT YOU SAVE YOUR WORK. Otherwise, it will be lost.
have all the fields you need.
Adding Entries
Templates for the Interface
Once your finished with your fields and your template, you
When you set your fields, a default interface is created. If you should be able to add entries relatively easily. You should
wish, however, you can improve the interface if you have a make sure that your field descriptions are specific enough so
basic knowledge of HTML. that everyone will enter information in a similar way, in the
This is quoted from the Moodle Book: example included it is clear that the Location field isn’t specific
“Database templates all work on the same principle. They are enough. (It should dictate a format for entry such as CITY,
basically HTML pages with a new set of tags for the database STATE, COUNTRY)
module to interpret. When editing a template, Moodle dis-
plays a list of available tags on the left side of the editing Once you’re finished with an entry, make sure to either choose
screen. Double-clicking on any of the tags adds it to the tem- Save and view or Save and add another.
plate. The database activity interprets these new tags before
sending the template’s HTML to the browser for display. It Importing
looks for words enclosed in either two square brackets ([[) or
two hash signs (##), representing two different types of inter- When creating a database in Moodle, you also have the option
face elements it can add to the template. of importing a .csv file. You can do this by going to the New
entry tab and choosing the link at the bottom that says Upload
The square brackets define data tags, which tell the module to entries from a file.
replace the word in the brackets with the value or form ele-
ment 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 mod-
ule 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 Wrapping it up
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 That’s it for the basics of starting up a database. If you wish to
page with the tag, the database module replaces it with the read more about its implementation or simply gain a bit more
edit icon. If the user then selects the icon, it takes her to the information in general, please see the Moodle Book at http://
edit template. Aside from the replacement tags, creating a docs.moodle.org/20/en/Using_Moodle_book.
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

You might also like