mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Merge branch 'MDL-26353-database-import-help' of git://github.com/mudrd8mz/moodle
This commit is contained in:
commit
cbe4cbc268
4 changed files with 21 additions and 24 deletions
|
@ -55,7 +55,7 @@ class mod_data_export_form extends moodleform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->add_checkbox_controller(1, null, null, 1);
|
$this->add_checkbox_controller(1, null, null, 1);
|
||||||
$this->add_action_buttons(true, get_string('exportdatabaserecords', 'data'));
|
$this->add_action_buttons(true, get_string('exportentries', 'data'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,28 +48,16 @@ if ($fieldenclosure !== '') {
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$url->param('id', $id);
|
$url->param('id', $id);
|
||||||
$PAGE->set_url($url);
|
$PAGE->set_url($url);
|
||||||
if (! $cm = get_coursemodule_from_id('data', $id)) {
|
$cm = get_coursemodule_from_id('data', $id, 0, false, MUST_EXIST);
|
||||||
print_error('invalidcoursemodule');
|
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
|
||||||
}
|
$data = $DB->get_record('data', array('id'=>$cm->instance), '*', MUST_EXIST);
|
||||||
if (! $course = $DB->get_record('course', array('id'=>$cm->course))) {
|
|
||||||
print_error('coursemisconf');
|
|
||||||
}
|
|
||||||
if (! $data = $DB->get_record('data', array('id'=>$cm->instance))) {
|
|
||||||
print_error('invalidcoursemodule');
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$url->param('d', $d);
|
$url->param('d', $d);
|
||||||
$PAGE->set_url($url);
|
$PAGE->set_url($url);
|
||||||
if (! $data = $DB->get_record('data', array('id'=>$d))) {
|
$data = $DB->get_record('data', array('id'=>$d), '*', MUST_EXIST);
|
||||||
print_error('invalidid', 'data');
|
$course = $DB->get_record('course', array('id'=>$data->course), '*', MUST_EXIST);
|
||||||
}
|
$cm = get_coursemodule_from_instance('data', $data->id, $course->id, false, MUST_EXIST);
|
||||||
if (! $course = $DB->get_record('course', array('id'=>$data->course))) {
|
|
||||||
print_error('coursemisconf');
|
|
||||||
}
|
|
||||||
if (! $cm = get_coursemodule_from_instance('data', $data->id, $course->id)) {
|
|
||||||
print_error('coursemisconf');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require_login($course, false, $cm);
|
require_login($course, false, $cm);
|
||||||
|
@ -82,8 +70,9 @@ $form = new mod_data_import_form(new moodle_url('/mod/data/import.php'));
|
||||||
$PAGE->navbar->add(get_string('add', 'data'));
|
$PAGE->navbar->add(get_string('add', 'data'));
|
||||||
$PAGE->set_title($data->name);
|
$PAGE->set_title($data->name);
|
||||||
$PAGE->set_heading($course->fullname);
|
$PAGE->set_heading($course->fullname);
|
||||||
|
navigation_node::override_active_url(new moodle_url('/mod/data/import.php', array('d' => $data->id)));
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
echo $OUTPUT->heading(format_string($data->name));
|
echo $OUTPUT->heading_with_help(get_string('uploadrecords', 'mod_data'), 'uploadrecords', 'mod_data');
|
||||||
|
|
||||||
/// Groups needed for Add entry tab
|
/// Groups needed for Add entry tab
|
||||||
$currentgroup = groups_get_activity_group($cm);
|
$currentgroup = groups_get_activity_group($cm);
|
||||||
|
@ -93,7 +82,6 @@ if (!$formdata = $form->get_data()) {
|
||||||
/// Upload records section. Only for teachers and the admin.
|
/// Upload records section. Only for teachers and the admin.
|
||||||
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
|
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
|
||||||
require_once('import_form.php');
|
require_once('import_form.php');
|
||||||
echo $OUTPUT->heading(get_string('uploadrecords', 'data'), 3);
|
|
||||||
$form = new mod_data_import_form(new moodle_url('/mod/data/import.php'));
|
$form = new mod_data_import_form(new moodle_url('/mod/data/import.php'));
|
||||||
$formdata = new stdClass();
|
$formdata = new stdClass();
|
||||||
$formdata->d = $data->id;
|
$formdata->d = $data->id;
|
||||||
|
|
|
@ -122,8 +122,8 @@ $string['excel'] = 'Excel';
|
||||||
$string['export'] = 'Export';
|
$string['export'] = 'Export';
|
||||||
$string['exportaszip'] = 'Export as zip';
|
$string['exportaszip'] = 'Export as zip';
|
||||||
$string['exportaszip_help'] = 'The export as zip feature allows you to save the templates and fields as a preset zip for download. The zip may then be imported to another course.';
|
$string['exportaszip_help'] = 'The export as zip feature allows you to save the templates and fields as a preset zip for download. The zip may then be imported to another course.';
|
||||||
$string['exportdatabaserecords'] = 'Export database records';
|
|
||||||
$string['exportedtozip'] = 'Exported to temporary zip...';
|
$string['exportedtozip'] = 'Exported to temporary zip...';
|
||||||
|
$string['exportentries'] = 'Export entries';
|
||||||
$string['exportownentries'] = 'Export your own entries only? ({$a->mine}/{$a->all})';
|
$string['exportownentries'] = 'Export your own entries only? ({$a->mine}/{$a->all})';
|
||||||
$string['failedpresetdelete'] = 'Error deleting a preset!';
|
$string['failedpresetdelete'] = 'Error deleting a preset!';
|
||||||
$string['fieldadded'] = 'Field added';
|
$string['fieldadded'] = 'Field added';
|
||||||
|
@ -170,6 +170,7 @@ $string['chooseexportfields'] = 'Choose the fields you wish to export:';
|
||||||
$string['chooseexportformat'] = 'Choose the format you wish to export to:';
|
$string['chooseexportformat'] = 'Choose the format you wish to export to:';
|
||||||
$string['chooseorupload'] = 'Choose file';
|
$string['chooseorupload'] = 'Choose file';
|
||||||
$string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available';
|
$string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available';
|
||||||
|
$string['importentries'] = 'Import entries';
|
||||||
$string['importsuccess'] = 'The preset has been successfully applied.';
|
$string['importsuccess'] = 'The preset has been successfully applied.';
|
||||||
$string['insufficiententries'] = 'more entries needed to view this database';
|
$string['insufficiententries'] = 'more entries needed to view this database';
|
||||||
$string['intro'] = 'Introduction';
|
$string['intro'] = 'Introduction';
|
||||||
|
@ -307,6 +308,14 @@ $string['unsupportedexport'] = '({$a->fieldtype}) cannot be exported.';
|
||||||
$string['updatefield'] = 'Update an existing field';
|
$string['updatefield'] = 'Update an existing field';
|
||||||
$string['uploadfile'] = 'Upload file';
|
$string['uploadfile'] = 'Upload file';
|
||||||
$string['uploadrecords'] = 'Upload entries from a file';
|
$string['uploadrecords'] = 'Upload entries from a file';
|
||||||
|
$string['uploadrecords_help'] = 'Entries may be uploaded via text file. The format of the file should be as follows:
|
||||||
|
|
||||||
|
* Each line of the file contains one record
|
||||||
|
* Each record is a series of data separated by commas (or other delimiters)
|
||||||
|
* The first record contains a list of fieldnames defining the format of the rest of the file
|
||||||
|
|
||||||
|
The field enclosure is a character that surrounds each field in each record. It can normally be left unset.';
|
||||||
|
$string['uploadrecords_link'] = 'mod/data/import';
|
||||||
$string['url'] = 'Url';
|
$string['url'] = 'Url';
|
||||||
$string['usestandard'] = 'Use a preset';
|
$string['usestandard'] = 'Use a preset';
|
||||||
$string['usestandard_help'] = 'To use a preset available to the whole site, select it from the list. (If you have added a preset to the list using the save as preset feature then you have the option of deleting it.)';
|
$string['usestandard_help'] = 'To use a preset available to the whole site, select it from the list. (If you have added a preset to the list using the save as preset feature then you have the option of deleting it.)';
|
||||||
|
|
|
@ -2848,10 +2848,10 @@ function data_extend_settings_navigation(settings_navigation $settings, navigati
|
||||||
if (has_capability(DATA_CAP_EXPORT, $PAGE->cm->context)) {
|
if (has_capability(DATA_CAP_EXPORT, $PAGE->cm->context)) {
|
||||||
// The capability required to Export database records is centrally defined in 'lib.php'
|
// The capability required to Export database records is centrally defined in 'lib.php'
|
||||||
// and should be weaker than those required to edit Templates, Fields and Presets.
|
// and should be weaker than those required to edit Templates, Fields and Presets.
|
||||||
$datanode->add(get_string('export', 'data'), new moodle_url('/mod/data/export.php', array('d'=>$data->id)));
|
$datanode->add(get_string('exportentries', 'data'), new moodle_url('/mod/data/export.php', array('d'=>$data->id)));
|
||||||
}
|
}
|
||||||
if (has_capability('mod/data:manageentries', $PAGE->cm->context)) {
|
if (has_capability('mod/data:manageentries', $PAGE->cm->context)) {
|
||||||
$datanode->add(get_string('import'), new moodle_url('/mod/data/import.php', array('d'=>$data->id)));
|
$datanode->add(get_string('importentries', 'data'), new moodle_url('/mod/data/import.php', array('d'=>$data->id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('mod/data:managetemplates', $PAGE->cm->context)) {
|
if (has_capability('mod/data:managetemplates', $PAGE->cm->context)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue