Skip to content

Commit

Permalink
MDL-55340 mod_feedback: export question labels
Browse files Browse the repository at this point in the history
This was present in export in 3.0 but got lost during export
refactoring in 3.1
  • Loading branch information
marinaglancy authored and sarjona committed Aug 28, 2020
1 parent c3673a9 commit a44ce9a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mod/feedback/classes/complete_form.php
Expand Up @@ -399,8 +399,8 @@ protected function add_item_number($item, $element) {
*/
protected function add_item_label($item, $element) {
if (strlen($item->label) && ($this->mode == self::MODE_EDIT || $this->mode == self::MODE_VIEW_TEMPLATE)) {
$name = $element->getLabel();
$name = '('.format_string($item->label).') '.$name;
$name = get_string('nameandlabelformat', 'mod_feedback',
(object)['label' => format_string($item->label), 'name' => $element->getLabel()]);
$element->setLabel($name);
}
}
Expand Down
10 changes: 9 additions & 1 deletion mod/feedback/classes/responses_table.php
Expand Up @@ -314,7 +314,15 @@ protected function add_all_values_to_output() {

$tablecolumns[] = "val{$nr}";
$itemobj = feedback_get_item_class($item->typ);
$tableheaders[] = $itemobj->get_display_name($item, $headernamepostfix);
$columnheader = $itemobj->get_display_name($item, $headernamepostfix);
if (!$this->is_downloading()) {
$columnheader = shorten_text($columnheader);
}
if (strval($item->label) !== '') {
$columnheader = get_string('nameandlabelformat', 'mod_feedback',
(object)['label' => format_string($item->label), 'name' => $columnheader]);
}
$tableheaders[] = $columnheader;
}

// Add 'Delete entry' column.
Expand Down
1 change: 1 addition & 0 deletions mod/feedback/lang/en/feedback.php
Expand Up @@ -195,6 +195,7 @@
$string['multiplesubmit_help'] = 'If enabled for anonymous surveys, users can submit feedback an unlimited number of times.';
$string['name'] = 'Name';
$string['name_required'] = 'Name required';
$string['nameandlabelformat'] = '({$a->label}) {$a->name}';
$string['next_page'] = 'Next page';
$string['no_handler'] = 'No action handler exists for';
$string['no_itemlabel'] = 'No label';
Expand Down

0 comments on commit a44ce9a

Please sign in to comment.