Posts made by Itamar Tzadok

Here is another possible workaround that should be generic enough to apply in any Database activity regardless of theme. It increases the page size in the background so might reach some limit if the page displays a large amount of content to begin with.

The solution requires css and javascript but both are fairly simple. The javascript adds a new element under body and copy into it the content of the main region. The css makes sure that only this element will be sent to the printer to the effect that only the activity title and list of entries will be printed. In the header section of the list template we can add a print a button as a shortcut to the browser window printing. In the footer section of the list template we add an inline script that calls the javascript function we added in the javascript tab. That's it.

If you use Windows 8 you can print to Microsoft XPS Ducoment Writer which sends the content to oxps file which you can then open for viewing with the integral xps viewer. 

If you use chrome browser the PRINT button will open the Chrome Print Preview and the content can be viewed there before printing.

hth smile

Javascript tab
function preparePrint() {
    var mainregion = document.getElementById('region-main');
    var printarea = document.createElement("DIV");
    printarea.className = 'printme';
    printarea.innerHTML = mainregion.innerHTML;
    document.body.insertBefore(printarea, document.body.childNodes[0]);
}


CSS tab
body .printme {
    display: none;
}

@media print {
     body > * {
          display: none;
     }
    
     body .printme {
          display: block;
     }
}

List template Header
<button id="printbutton" onclick="window.print()">PRINT</button>


List template Footer
<script>
preparePrint();
</script>


Average of ratings: Useful (2)

The link to the Database export appears in the Administration block and looks something like:

http://your-moodle-path/mod/data/export.php?d=1

where 1 in d=1 is the instance id.

The problem is that the link goes to a designated export form where you select what and where to export. There is no shortcut to a default export. So it might not be very useful for you.

Your requirement is very reasonable but it would require development to add it to the Database module and given the already long wishlist, I'm not sure when it will get implemented, if at all. At any rate you need to add a tracker issue, if not already exists, to give this requirement a chance to be considered.

If you want CSV export(s) which you can predefine and then allow access by simple links, try the Dataform module.

hth smile 

The "database" in Moodle: Is it a real database that exists separate from the main Moodle database?

No. The DB support for the Database module consists of several tables in the Moodle DB.

A php script is obviously extracting that data out in the export function and writing it as an Excel and ODS format. So why is it hard amplify that so that it exports in some other format besides Excel or ODS?

Excel and ODS formats and even CSV format are not that simple and require specialized php libraries. CSV is considered simplest but it is only an apparent simplicity. The content exported by CSV is simple text but the content that is stored in DB isn't always meaningful when presented as is in simple text. For example, the content of the time field is stored in DB as unix timestamp, and what you get in the export file if you don't convert that timestamp to a date/time string is not very useful. You can find plenty of disucssions about that down this forum. Another example is exporting the textarea content. You get all the html there which in a spreadsheet is not very useful, and you don't get the content of images, so you don't get everything which is also not very useful. And converting rich content to something that could work in a spreadsheet is not simple.

Other formats are less simple than spreadsheets. The simplest of those is probably html as it could be "what you see is what you export". But there is still the question of what exactly to export. For you the content of the export should include only entries. Others may want to export also blocks if included.

It is possible to write a script that would do that, but the development costs and further maintenance costs more. Someone needs to comission the work and the ongoing maintenance.

In some cases, workarounds are actually preferrable to features because they are cheaper and more flexible. You can be the master of your workaround. The CSS approach in the Database activity is one such workaround.

smile

You are in the wrong forum. For development questions, try the General developer forum.

With respect to your question, if by restrictions you refer to the Restrict access conditions, then these are availability plugins which are located under your-moodle-root/availability/condition. If you're not looking to add restriction types, but only to manipulate existing conditions in your programatically added instances, then the availability conditions are stored for each instance in the availability columns in the respective table. For course section it would be in the mdl_course_sections, for activities and resources it would be in the mdl_course_modules, etc.

hth smile

Average of ratings: Useful (2)
It has been suggested that this is expected behavior. However, all activity modules seem to work differently. For example, when an assignment is uploaded by a student it will be visible in all groups the student is a member of.

Maybe all the other activity modules which work differently are at fault. I guess it depends on which concept of group you apply. If what you describe about the assignment module is accurate then to me it would be a bug.

Consider the following case:

  • Group A
    • Student 1
    • Student 2
  • Group B
    • Student 1
    • Student 3

By your logic if Student 1 submits an entry in Group A, this entry should be visible to Student 3 in Group B. But since it is a group work, the entry may relate to content submitted by or discussed with Student 2 in Group A. If that content becomes available to Student 3 by means of the entry submitted by Student 1, it appears to me that it would defeat the whole idea of separate groups.

smile