Note: You are currently viewing documentation for Moodle 3.8. Up-to-date documentation for the latest stable version of Moodle may be available here: Database activity FAQ.

Database activity FAQ: Difference between revisions

From MoodleDocs
(→‎See also: forum discussion link)
 
(18 intermediate revisions by 7 users not shown)
Line 2: Line 2:
==Where can I download additional database presets?==
==Where can I download additional database presets?==


See [[Database presets]] for discussion links with presets for download.
See the Presets and See also sections in [[Building Database]] for various places with presets for download.


==How can I add to the list of database presets available for users to choose from?==
==How can I add to the list of database presets available for users to choose from?==


[[File:Database preset.png|thumb|Database presets]]
[[File:databasepresetsnew.png|thumb|Database presets]]


There is one default preset, Image Gallery. It is possible to create your own presets.  
There is one default preset, Image Gallery. It is possible to create your own presets.  
Line 29: Line 29:


http://moodle.org/mod/data/view.php?d=13&sort=44&order=DESC
http://moodle.org/mod/data/view.php?d=13&sort=44&order=DESC
==How can I add highlighting like on the Module and plugins page?==
In the repeated part of the template (note onmouseover and onmouseout to change the classes):
<pre><tr onmouseover="this.className='trhighlight'" onmouseout="this.className='trnormal'">
<td class="c0"><b><a href="##MoreURL##">[[Name]]</a></b></td>
<td class="c1">[[Type]]</td>
<td class="c2">[[Requirement]]</td>
<td class="c3">[[Status]]</td>
<td class="c4">[[Summary]]</td>
<td align="center" class="c5">##Edit##&nbsp;##Delete##&nbsp;##More##&nbsp;##Approve## </td>
</tr></pre>
In the CSS template there are two styles:
<pre>.trnormal td {
  background-color: #FFFFFF;
}
.trhighlight td {
  background-color: #EEEEEE;
}</pre>


==How can I list database information horizontally instead of vertically?==
==How can I list database information horizontally instead of vertically?==
Line 62: Line 41:
==Is there a Time stamp for database entries?==
==Is there a Time stamp for database entries?==


<nowiki>##timeadded##</nowiki>
<nowiki>##timeadded##</nowiki>


==How can I make the title of an entry into a link?==
==How can I make the title of an entry into a link?==
Line 69: Line 48:
   
   
  <nowiki><a href="##moreurl##">[[Title]]</a></nowiki>
  <nowiki><a href="##moreurl##">[[Title]]</a></nowiki>
==How can I make email addresses clickable?==
To make email addresses clickable, add the following code to the single template:
<nowiki><a href="mailto:[[Email]]">[[Email]]</a></nowiki>
where 'Email' is the text field for inputting email addresses.
==How can I delete a file attached to a database entry?==
There is currently no user interface for deleting a file attached to a database entry, however a workaround would be to delete the entry completely and then create a new entry without the file attached.


==How can I hide a database entry which was previously approved?==
==How can I hide a database entry which was previously approved?==


There is currently no user interface for hiding a database entry which was previously approved i.e. setting it to require approval again. However, an entry can be hidden using [[MySQL Admin]] by editing it in the ''data_records'' table and changing the approved value from 1 to 0.
Edit the list and or single template and add the undo approval tag (##disapprove##).


==How can I add a default sort order of entries?==
==How can I add a default sort order of entries?==
Line 103: Line 70:


==How can I empty a database / remove records from a database en masse?==
==How can I empty a database / remove records from a database en masse?==
If your clearance is part of a general course clear-out e.g. at rollover time, you may be better off using Reset to clear all student activity (which Moodle calls 'user data') in one go.
In List view, there is a checkbox next to each entry. Click to select the ones you wish to delete and then click the 'Delete selected' button. Alternatively, click the 'Select all' and 'Delete all' buttons. A warning message will appear asking you to confirm what you wish to delete.
 
==I get an error message when importing a csv of entries==
One thing to try is to open up the csv file in Excel and save it again as a csv file - with another name - and then try importing it agin. Sometimes this just works :)
 
==How do I export/import picture fields from a database activity from one course to another?==
You cannot export/import database entries with picture fields using the csv option, you will need to use Moodle's backup and restore functionality. Please note that you will need to backup and restore the database activity with user data in order for the entries to be carried over.
 
==How can I show recently added entries in a block on the course page?==
 
# Enable an RSS feed of recently added entries as described in [[Using Database]]
# Add a [[Remote RSS feeds block]] to the course page
# Add the database activity RSS feed to it
 
==How can I have entries waiting for approval highlighted?==


But if you just have one database to clear, read on.
In Moodle 3.0 onwards, any newly created database activities show entries waiting for approval as highlighted for the teacher and the user who added the entry.  


'''Just one database to clear'''
For existing database activities, the highlighting can be added by editing the list and/or single template and resetting it, or adding some inline css:


# Log in, go to the Moodle area containing the database you want to clear out and Turn Editing On
class="mod-data-default-template ##approvalstatus##"
# From the array of icons adjacent to your database to click the Duplicate icon (if in doubt, hover your mouse pointer over the icon to display a tooltip indicating what the icon does)
# Click through to Edit your duplicate, giving it a distinctive name to avoid confusion with the original. Then Save and return to the course area front page.
# You can then - assuming you have used Export to save all you need - delete the original.


'''Save some database records but delete others'''
==Any further questions?==


# Log in, go to the area containing the database you want to clear out and Turn Editing On
Please post in the [https://moodle.org/mod/forum/view.php?id=3505 Database forum] on moodle.org
# Click on the link to the database you want to clear
# From its Settings, click on Export to export all the records from your database into a CSV file; save that somewhere secure where you can find it again.
# Open the CSV file in e.g. a spreadsheet package, delete the records you don't want (easiest way may be to select all, unselect the ones you want to keep, then press delete) and remember to save.
# Then return to your Moodle area and use the Duplicate icon on the existing database to create an empty copy n.b. give it a distinctive name to avoid confusion with the original.
# Open up the new database, and from its Settings use Import to import the records you need into that.
# Test out (both viewing and adding).
# Once you're satisfied everything is working and you have saved all you need, you can delete the original copy.


==See also==
==See also==
Using Moodle forum discussions:
Forum discussions:


*[http://moodle.org/mod/forum/discuss.php?d=87005 New preset, please review, and make suggestions!] including FAQ preset for download
*[http://moodle.org/mod/forum/discuss.php?d=87005 New preset, please review, and make suggestions!] including FAQ preset for download
Line 133: Line 104:
*[http://moodle.org/mod/forum/discuss.php?d=61179 For those who want the display of Moodle Site's Modules and plugins]
*[http://moodle.org/mod/forum/discuss.php?d=61179 For those who want the display of Moodle Site's Modules and plugins]
*[http://moodle.org/mod/forum/discuss.php?d=94854#p457252 Looking for some stellar examples of Moodle courses] including book reviews preset for download
*[http://moodle.org/mod/forum/discuss.php?d=94854#p457252 Looking for some stellar examples of Moodle courses] including book reviews preset for download
*[https://moodle.org/mod/forum/discuss.php?d=268206 Database 2.7 List and Single View: Possible to view only entered fields?]
*[https://moodle.org/mod/forum/discuss.php?d=324452 Glossary autolink within a database activity]
*[https://moodle.org/mod/forum/discuss.php?d=393775 Downloading Database Entries]


[[Category:FAQ]]
[[Category:FAQ]]


[[de:Datenbank FAQ]]
[[de:Datenbank FAQ]]
[[es:Actividad BasedeDatos FAQ]]
[[fr:FAQ sur la base de données]]

Latest revision as of 12:46, 26 November 2019

Where can I download additional database presets?

See the Presets and See also sections in Building Database for various places with presets for download.

How can I add to the list of database presets available for users to choose from?

Database presets

There is one default preset, Image Gallery. It is possible to create your own presets.

When you have created your database that you desire to set as a preset; go to the "Presets" tab of the database and choose "Save as preset". Give the preset a name and the database fields and templates will now be available as a preset for the rest of the site. You will need site admin rights to do this.

Please see the Database presets for other available presets you can import into your system.

How can I create a database in which students can only view their own entries?

Either:

  • Set up the database so that entries require approval. If the entries are never approved, then only the student that added a particular entry and the teachers can view it.

Or:

  • Set the group mode of the database to "Separate groups" and assign each student to a separate group.

How can I enable a sort function by clicking on the field headings?

For sorting, you need to manually create the link in the template around that heading. To find the URL you need, you can do a sort using the menus and then look in the URLs. Take out everything but the d, sort and order parameters. For example,

http://moodle.org/mod/data/view.php?d=13&sort=44&order=ASC

http://moodle.org/mod/data/view.php?d=13&sort=44&order=DESC

How can I list database information horizontally instead of vertically?

Can't get columns to line up in list view

How can I make an Encyclopedia database preset?

Is there a Time stamp for database entries?

##timeadded##

How can I make the title of an entry into a link?

To make the title of an entry in list view link to the single view, add the following code to the list template:

<a href="##moreurl##">[[Title]]</a>

How can I hide a database entry which was previously approved?

Edit the list and or single template and add the undo approval tag (##disapprove##).

How can I add a default sort order of entries?

In the Fields tab, select a default sort field, choose ascending or descending then click the Save button.

Why is my database so slow to show each page?

Try to go to "Administration > Miscellaneous > XMLDB editor" and choose "Check Indexes". If you have any missing indexes found; upgrade your Moodle to the latest weekly build of your version; re-run the test; backup your site database and then run the suggested SQL from the test on your site database. This should speed up your database activity load times.

How can I prevent students from adding entries?

An override may be used to close/archive a database activity, or have a database in which only teachers can add entries, but students can view the entries.

  1. Follow the Permissions link in the settings block under Database activity administration
  2. Remove Student from the capability mod/data:writeentry by clicking the 'X' next to it.
  3. Click the continue button to confirm.

How can I empty a database / remove records from a database en masse?

In List view, there is a checkbox next to each entry. Click to select the ones you wish to delete and then click the 'Delete selected' button. Alternatively, click the 'Select all' and 'Delete all' buttons. A warning message will appear asking you to confirm what you wish to delete.

I get an error message when importing a csv of entries

One thing to try is to open up the csv file in Excel and save it again as a csv file - with another name - and then try importing it agin. Sometimes this just works :)

How do I export/import picture fields from a database activity from one course to another?

You cannot export/import database entries with picture fields using the csv option, you will need to use Moodle's backup and restore functionality. Please note that you will need to backup and restore the database activity with user data in order for the entries to be carried over.

How can I show recently added entries in a block on the course page?

  1. Enable an RSS feed of recently added entries as described in Using Database
  2. Add a Remote RSS feeds block to the course page
  3. Add the database activity RSS feed to it

How can I have entries waiting for approval highlighted?

In Moodle 3.0 onwards, any newly created database activities show entries waiting for approval as highlighted for the teacher and the user who added the entry.

For existing database activities, the highlighting can be added by editing the list and/or single template and resetting it, or adding some inline css:

class="mod-data-default-template ##approvalstatus##"

Any further questions?

Please post in the Database forum on moodle.org

See also

Forum discussions: