Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-25185 - data - Allowing data from the database to be exported acc…

…ording to group roles.
  • Loading branch information...
commit 312ada2856cfb79d03ac6effe11dd750f2aa67f0 1 parent 4f87a0d
@abgreeve abgreeve authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 mod/data/export.php
View
15 mod/data/export.php
@@ -60,6 +60,7 @@
print_header_simple($data->name, '', $nav,
'', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
navmenu($course, $cm), '', '');
+ groups_print_activity_menu($cm, "$CFG->wwwroot/mod/data/export.php?d=$d");
print_heading(format_string($data->name));
// these are for the tab display
@@ -83,13 +84,25 @@
$exportdata[0][] = $field->field->name;
}
}
+$groupid = groups_get_activity_group($cm);
$datarecords = get_records('data_records', 'dataid', $data->id);
ksort($datarecords);
$line = 1;
foreach($datarecords as $record) {
// get content indexed by fieldid
- if( $content = get_records('data_content', 'recordid', $record->id, 'fieldid', 'fieldid, content, content1, content2, content3, content4') ) {
+ if($groupid) {
+ $select = "SELECT c.fieldid, c.content, c.content1, c.content2, c.content3, c.content4
+ FROM {$CFG->prefix}data_content c, {$CFG->prefix}data_records r
+ WHERE c.recordid = $record->id
+ AND r.id = c.recordid
+ AND r.groupid = $groupid";
+ } else {
+ $select = "SELECT fieldid, content, content1, content2, content3, content4
+ FROM {$CFG->prefix}data_content
+ WHERE recordid = $record->id";
+ }
+ if( $content = get_records_sql($select) ) {
foreach($fields as $field) {
$contents = '';
if(isset($content[$field->field->id])) {
Please sign in to comment.
Something went wrong with that request. Please try again.