Skip to content

Commit

Permalink
MDL-50140 grade/import: Added CSH buttons to import grades
Browse files Browse the repository at this point in the history
CSH buttons have been added to CSV Import as well as Paste
from spreadsheet in the following areas:
Encoding, Separator (csv only), Verbose, Preview, Map to,
and Map from.

The heading of Import CSV had a CSH button added as well.

All CSH buttons were given associated language strings.
  • Loading branch information
jinhofer committed May 28, 2015
1 parent 0c6faf4 commit 0fa9b33
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion grade/import/csv/index.php
Expand Up @@ -51,7 +51,8 @@
!has_capability('moodle/site:accessallgroups', $context));
$currentgroup = groups_get_course_group($course);

print_grade_page_head($course->id, 'import', 'csv', get_string('importcsv', 'grades'));
print_grade_page_head($course->id, 'import', 'csv', get_string('importcsv', 'grades'), false, false, true,
'importcsv', 'grades');

$renderer = $PAGE->get_renderer('gradeimport_csv');

Expand Down
3 changes: 3 additions & 0 deletions grade/import/direct/classes/import_form.php
Expand Up @@ -55,14 +55,17 @@ public function definition() {

$encodings = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
$mform->addHelpButton('encoding', 'encoding', 'grades');

if (!empty($features['verbosescales'])) {
$options = array(1 => get_string('yes'), 0 => get_string('no'));
$mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
$mform->addHelpButton('verbosescales', 'verbosescales', 'grades');
}

$options = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options);
$mform->addHelpButton('previewrows', 'rowpreviewnum', 'grades');
$mform->setType('previewrows', PARAM_INT);
$mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
$mform->setType('groupid', PARAM_INT);
Expand Down
3 changes: 3 additions & 0 deletions grade/import/direct/classes/mapping_form.php
Expand Up @@ -50,6 +50,7 @@ public function definition() {
}
}
$mform->addElement('select', 'mapfrom', get_string('mapfrom', 'grades'), $mapfromoptions);
$mform->addHelpButton('mapfrom', 'mapfrom', 'grades');

$maptooptions = array(
'userid' => get_string('userid', 'grades'),
Expand All @@ -59,8 +60,10 @@ public function definition() {
'0' => get_string('ignore', 'grades')
);
$mform->addElement('select', 'mapto', get_string('mapto', 'grades'), $maptooptions);
$mform->addHelpButton('mapto', 'mapto', 'grades');

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

// Add a feedback option.
$feedbacks = array();
Expand Down
7 changes: 7 additions & 0 deletions grade/import/grade_import_form.php
Expand Up @@ -51,6 +51,7 @@ function definition (){
$mform->addRule('userfile', null, 'required');
$encodings = core_text::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
$mform->addHelpButton('encoding', 'encoding', 'grades');

if (!empty($features['includeseparator'])) {
$radio = array();
Expand All @@ -59,16 +60,19 @@ function definition (){
$radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcolon', 'grades'), 'colon');
$radio[] = $mform->createElement('radio', 'separator', null, get_string('sepsemicolon', 'grades'), 'semicolon');
$mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
$mform->addHelpButton('separator', 'separator', 'grades');
$mform->setDefault('separator', 'comma');
}

if (!empty($features['verbosescales'])) {
$options = array(1=>get_string('yes'), 0=>get_string('no'));
$mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
$mform->addHelpButton('verbosescales', 'verbosescales', 'grades');
}

$options = array('10'=>10, '20'=>20, '100'=>100, '1000'=>1000, '100000'=>100000);
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options); // TODO: localize
$mform->addHelpButton('previewrows', 'rowpreviewnum', 'grades');
$mform->setType('previewrows', PARAM_INT);
$mform->addElement('checkbox', 'forceimport', get_string('forceimport', 'grades'));
$mform->addHelpButton('forceimport', 'forceimport', 'grades');
Expand Down Expand Up @@ -99,6 +103,7 @@ function definition () {
}
}
$mform->addElement('select', 'mapfrom', get_string('mapfrom', 'grades'), $mapfromoptions);
$mform->addHelpButton('mapfrom', 'mapfrom', 'grades');

$maptooptions = array(
'userid' => get_string('userid', 'grades'),
Expand All @@ -109,7 +114,9 @@ function definition () {
);
$mform->addElement('select', 'mapto', get_string('mapto', 'grades'), $maptooptions);

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

// Add a feedback option.
$feedbacks = array();
Expand Down
15 changes: 15 additions & 0 deletions lang/en/grades.php
Expand Up @@ -179,6 +179,7 @@
$string['enableoutcomes'] = 'Enable outcomes';
$string['enableoutcomes_help'] = 'Support for Outcomes (also known as Competencies, Goals, Standards or Criteria) means that we can grade things using one or more scales that are tied to outcome statements. Enabling outcomes makes such special grading possible throughout the site.';
$string['encoding'] = 'Encoding';
$string['encoding_help'] = 'Select the character encoding used for the data. (The standard encoding is UTF-8.) If the wrong encoding is selected by mistake, it will be noticeable when previewing the data for import.';
$string['errorcalculationnoequal'] = 'Formula must start with equal sign (=1+2)';
$string['errorcalculationunknown'] = 'Invalid formula';
$string['errorcalculationbroken'] = 'Probably circular reference or broken calculation formula';
Expand Down Expand Up @@ -371,6 +372,14 @@
$string['ignore'] = 'Ignore';
$string['import'] = 'Import';
$string['importcsv'] = 'Import CSV';
$string['importcsv_help'] = 'Grades can be imported via a CSV file with format as follows:
* Each line of the file contains one record
* Each record is a series of data separated by commas or an alternative separator
* The first record contains a list of fieldnames defining the format of the rest of the file
* A fieldname containing user identity data is required - either username or ID number or email address
A file of the correct format can be obtained by first exporting some grades. The file can then be edited and saved as a CSV file.';
$string['importcustom'] = 'Import as custom outcomes (only this course)';
$string['importerror'] = 'An error occurred, this script wasn\'t called with the right parameters.';
$string['importfailed'] = 'Import failed. No data was imported.';
Expand Down Expand Up @@ -430,8 +439,11 @@
$string['lowgradeletter'] = 'Low';
$string['manualitem'] = 'Manual item';
$string['mapfrom'] = 'Map from';
$string['mapfrom_help'] = 'Select the column in the spreadsheet containing data for identifying the user, such as username, user ID or email address.';
$string['mappings'] = 'Grade item mappings';
$string['mappings_help'] = 'For each column of grades in the spreadsheet, select the corresponding grade item to import the grades into.';
$string['mapto'] = 'Map to';
$string['mapto_help'] = 'Select the same identifying data as selected for \'Map from\'.';
$string['max'] = 'Highest';
$string['maxgrade'] = 'Max grade';
$string['meanall'] = 'All grades';
Expand Down Expand Up @@ -592,6 +604,7 @@
$string['resetweights'] = 'Reset weights of {$a->itemname}';
$string['respectingcurrentdata'] = 'leaving current configuration unmodified';
$string['rowpreviewnum'] = 'Preview rows';
$string['rowpreviewnum_help'] = 'Data for import may be previewed before confirming the import. This setting determines how many rows are displayed in the preview.';
$string['savechanges'] = 'Save changes';
$string['savepreferences'] = 'Save preferences';
$string['scaleconfirmdelete'] = 'Are you sure you wish to delete the scale "{$a}"?';
Expand All @@ -602,6 +615,7 @@
$string['selectauser'] = 'Select a user';
$string['selectdestination'] = 'Select destination of {$a}';
$string['separator'] = 'Separator';
$string['separator_help'] = 'Select the separator used in the CSV file. (Normally this is a comma.)';
$string['sepcolon'] = 'Colon';
$string['sepcomma'] = 'Comma';
$string['sepsemicolon'] = 'Semicolon';
Expand Down Expand Up @@ -737,6 +751,7 @@
$string['userenrolmentsuspended'] = 'User enrolment suspended';
$string['useweighted'] = 'Use weighted';
$string['verbosescales'] = 'Verbose scales';
$string['verbosescales_help'] = 'A verbose scale uses words rather than numbers. Set to \'Yes\' if both numerical and verbose scales are to be imported. Set to \'No\' if only numerical scales are to be imported.';
$string['viewbygroup'] = 'Group';
$string['viewgrades'] = 'View grades';
$string['weight'] = 'weight';
Expand Down

0 comments on commit 0fa9b33

Please sign in to comment.