1
commit 312ada2856cfb79d03ac6effe11dd750f2aa67f0
2
Author: Adrian Greeve <adrian@moodle.com>
3
Date: Tue Jan 31 12:09:30 2012 +0800
5
MDL-25185 - data - Allowing data from the database to be exported according to group roles.
7
diff --git a/mod/data/export.php b/mod/data/export.php
8
index 6ac914e..edea566 100644
9
--- a/mod/data/export.php
10
+++ b/mod/data/export.php
11
@@ -60,6 +60,7 @@ if($mform->is_cancelled()) {
12
print_header_simple($data->name, '', $nav,
13
'', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
14
navmenu($course, $cm), '', '');
15
+ groups_print_activity_menu($cm, "$CFG->wwwroot/mod/data/export.php?d=$d");
16
print_heading(format_string($data->name));
18
// these are for the tab display
19
@@ -83,13 +84,25 @@ foreach($fields as $key => $field) {
20
$exportdata[0][] = $field->field->name;
23
+$groupid = groups_get_activity_group($cm);
25
$datarecords = get_records('data_records', 'dataid', $data->id);
28
foreach($datarecords as $record) {
29
// get content indexed by fieldid
30
- if( $content = get_records('data_content', 'recordid', $record->id, 'fieldid', 'fieldid, content, content1, content2, content3, content4') ) {
32
+ $select = "SELECT c.fieldid, c.content, c.content1, c.content2, c.content3, c.content4
33
+ FROM {$CFG->prefix}data_content c, {$CFG->prefix}data_records r
34
+ WHERE c.recordid = $record->id
35
+ AND r.id = c.recordid
36
+ AND r.groupid = $groupid";
38
+ $select = "SELECT fieldid, content, content1, content2, content3, content4
39
+ FROM {$CFG->prefix}data_content
40
+ WHERE recordid = $record->id";
42
+ if( $content = get_records_sql($select) ) {
43
foreach($fields as $field) {
45
if(isset($content[$field->field->id])) {