MDL-50140 grade/import: Added CSH buttons to import grades

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.
This commit is contained in:
jinhofer 2015-05-18 09:44:37 -05:00
parent 0c6faf4b51
commit 0fa9b33463
5 changed files with 30 additions and 1 deletions

View File

@ -51,7 +51,8 @@ $separatemode = (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and
!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');

View File

@ -55,14 +55,17 @@ class gradeimport_direct_import_form extends moodleform {
$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);

View File

@ -50,6 +50,7 @@ class gradeimport_direct_mapping_form extends moodleform {
}
}
$mform->addElement('select', 'mapfrom', get_string('mapfrom', 'grades'), $mapfromoptions);
$mform->addHelpButton('mapfrom', 'mapfrom', 'grades');
$maptooptions = array(
'userid' => get_string('userid', 'grades'),
@ -59,8 +60,10 @@ class gradeimport_direct_mapping_form extends moodleform {
'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();

View File

@ -51,6 +51,7 @@ class grade_import_form extends moodleform {
$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();
@ -59,16 +60,19 @@ class grade_import_form extends moodleform {
$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');
@ -99,6 +103,7 @@ class grade_import_mapping_form extends moodleform {
}
}
$mform->addElement('select', 'mapfrom', get_string('mapfrom', 'grades'), $mapfromoptions);
$mform->addHelpButton('mapfrom', 'mapfrom', 'grades');
$maptooptions = array(
'userid' => get_string('userid', 'grades'),
@ -109,7 +114,9 @@ class grade_import_mapping_form extends moodleform {
);
$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();

View File

@ -179,6 +179,7 @@ $string['enableajax_help'] = 'Adds a layer of AJAX functionality to the grader r
$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';
@ -371,6 +372,14 @@ $string['idnumbers'] = 'ID numbers';
$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.';
@ -430,8 +439,11 @@ $string['lowest'] = 'Lowest';
$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';
@ -592,6 +604,7 @@ $string['resetweightsshort'] = 'Reset weights';
$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}"?';
@ -602,6 +615,7 @@ $string['selectalloroneuser'] = 'Select all or one user';
$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';
@ -737,6 +751,7 @@ $string['userpreferences'] = 'User preferences';
$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';