Línea 45... |
Línea 45... |
45 |
* @param bool $tags whether to include tags
|
45 |
* @param bool $tags whether to include tags
|
46 |
* @param bool $includefiles whether files should be exported as well
|
46 |
* @param bool $includefiles whether files should be exported as well
|
47 |
* @return void
|
47 |
* @return void
|
48 |
*/
|
48 |
*/
|
49 |
public static function data_exportdata(int $dataid, array $fields, array $selectedfields, entries_exporter $exporter,
|
49 |
public static function data_exportdata(int $dataid, array $fields, array $selectedfields, entries_exporter $exporter,
|
50 |
int $currentgroup = 0, context $context = null, bool $userdetails = false, bool $time = false, bool $approval = false,
|
50 |
int $currentgroup = 0, ?context $context = null, bool $userdetails = false, bool $time = false, bool $approval = false,
|
51 |
bool $tags = false, bool $includefiles = true): void {
|
51 |
bool $tags = false, bool $includefiles = true): void {
|
52 |
global $DB;
|
52 |
global $DB;
|
Línea 53... |
Línea 53... |
53 |
|
53 |
|
54 |
if (is_null($context)) {
|
54 |
if (is_null($context)) {
|
Línea 121... |
Línea 121... |
121 |
$itemtags = \core_tag_tag::get_item_tags_array('mod_data', 'data_records', $record->id);
|
121 |
$itemtags = \core_tag_tag::get_item_tags_array('mod_data', 'data_records', $record->id);
|
122 |
$exporter->add_to_current_row(implode(', ', $itemtags));
|
122 |
$exporter->add_to_current_row(implode(', ', $itemtags));
|
123 |
}
|
123 |
}
|
124 |
if ($userdetails) { // Add user details to the export data.
|
124 |
if ($userdetails) { // Add user details to the export data.
|
125 |
$userdata = get_complete_user_data('id', $record->userid);
|
125 |
$userdata = get_complete_user_data('id', $record->userid);
|
- |
|
126 |
// In case of an already deleted user, we do not receive any userdata and export an empty string instead.
|
126 |
$exporter->add_to_current_row(fullname($userdata));
|
127 |
$exporter->add_to_current_row($userdata ? fullname($userdata) : '');
|
127 |
$exporter->add_to_current_row($userdata->username);
|
128 |
$exporter->add_to_current_row($userdata ? $userdata->username : '');
|
128 |
$exporter->add_to_current_row($userdata->email);
|
129 |
$exporter->add_to_current_row($userdata ? $userdata->email : '');
|
129 |
}
|
130 |
}
|
130 |
if ($time) { // Add time added / modified.
|
131 |
if ($time) { // Add time added / modified.
|
131 |
$exporter->add_to_current_row(userdate($record->timecreated));
|
132 |
$exporter->add_to_current_row(userdate($record->timecreated));
|
132 |
$exporter->add_to_current_row(userdate($record->timemodified));
|
133 |
$exporter->add_to_current_row(userdate($record->timemodified));
|
133 |
}
|
134 |
}
|