Skip to content

Commit

Permalink
MDL-38317 grade import: Translation support for import mappings form.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaudreaj committed Sep 13, 2013
1 parent 83f26f6 commit 3aaa906
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
3 changes: 2 additions & 1 deletion grade/import/csv/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@

$displaystring = null;
if (!empty($grade_item->itemmodule)) {
$displaystring = get_string('modulename', $grade_item->itemmodule).': '.$grade_item->get_name();
$displaystring = get_string('modulename', $grade_item->itemmodule).get_string('labelsep', 'langconfig')
.$grade_item->get_name();
} else {
$displaystring = $grade_item->get_name();
}
Expand Down
30 changes: 20 additions & 10 deletions grade/import/grade_import_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,39 @@ function definition () {
}
$mform->addElement('select', 'mapfrom', get_string('mapfrom', 'grades'), $mapfromoptions);

$maptooptions = array('userid'=>'userid', 'username'=>'username', 'useridnumber'=>'useridnumber', 'useremail'=>'useremail', '0'=>'ignore');
$maptooptions = array(
'userid' => get_string('userid', 'grades'),
'username' => get_string('username'),
'useridnumber' => get_string('idnumber'),
'useremail' => get_string('email'),
'0' => get_string('ignore', 'grades')
);
$mform->addElement('select', 'mapto', get_string('mapto', 'grades'), $maptooptions);

$mform->addElement('header', 'general', get_string('mappings', 'grades'));

// add a comment option

$comments = array();
// Add a feedback option.
$feedbacks = array();
if ($gradeitems = $this->_customdata['gradeitems']) {
foreach ($gradeitems as $itemid => $itemname) {
$comments['feedback_'.$itemid] = 'comments for '.$itemname;
$feedbacks['feedback_'.$itemid] = get_string('feedbackforgradeitems', 'grades', $itemname);
}
}

if ($header) {
$i = 0; // index
foreach ($header as $h) {
$h = trim($h);
// this is what each header maps to
$mform->addElement('selectgroups', 'mapping_'.$i, s($h),
array('others'=>array('0'=>'ignore', 'new'=>'new gradeitem'),
'gradeitems'=>$gradeitems,
'comments'=>$comments));
// This is what each header maps to.
$headermapsto = array(
get_string('others', 'grades') => array(
'0' => get_string('ignore', 'grades'),
'new' => get_string('newitem', 'grades')
),
get_string('gradeitems', 'grades') => $gradeitems,
get_string('feedbacks', 'grades') => $feedbacks
);
$mform->addElement('selectgroups', 'mapping_'.$i, s($h), $headermapsto);
$i++;
}
}
Expand Down
5 changes: 5 additions & 0 deletions lang/en/grades.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
$string['feedback_help'] = 'This box enables any comments about the grade to be added.';
$string['feedbackadd'] = 'Add feedback';
$string['feedbackedit'] = 'Edit feedback';
$string['feedbackforgradeitems'] = 'Feedback for {$a}';
$string['feedbacks'] = 'Feedbacks';
$string['feedbacksaved'] = 'Feedback saved';
$string['feedbackview'] = 'View feedback';
$string['finalgrade'] = 'Final grade';
Expand Down Expand Up @@ -335,6 +337,7 @@
$string['choosecategory'] = 'Select category';
$string['identifier'] = 'Identify user by';
$string['idnumbers'] = 'ID numbers';
$string['ignore'] = 'Ignore';
$string['import'] = 'Import';
$string['importcsv'] = 'Import CSV';
$string['importcustom'] = 'Import as custom outcomes (only this course)';
Expand Down Expand Up @@ -446,6 +449,7 @@
$string['onascaleof'] = 'on a scale of {$a->grademin} to {$a->grademax}';
$string['operations'] = 'Operations';
$string['options'] = 'Options';
$string['others'] = 'Others';
$string['outcome'] = 'Outcome';
$string['outcome_help'] = 'This setting determines the outcome which this grade item will represent in the gradebook.';
$string['outcomeassigntocourse'] = 'Assign another outcome to this course';
Expand Down Expand Up @@ -656,6 +660,7 @@
$string['usepercent'] = 'Use percent';
$string['user'] = 'User';
$string['usergrade'] = 'User {$a->fullname} ({$a->useridnumber}) on item {$a->gradeidnumber}';
$string['userid'] = 'User ID';
$string['userpreferences'] = 'User preferences';
$string['userenrolmentsuspended'] = 'User enrolment suspended';
$string['useweighted'] = 'Use weighted';
Expand Down

0 comments on commit 3aaa906

Please sign in to comment.