$string['foundrecords'] = 'Found records: $a->num/$a->max (<a href=\"$a->reseturl\">Reset filters</a>)';
$string['foundnorecords'] = 'No records found (<a href=\"$a->reseturl\">Reset filters</a>)';
$string['fromfile'] = 'Import from zip file';
+$string['generateerror'] = 'Not all files generated!';
$string['guestrate'] = 'Guests are not allowed to rate entries.';
$string['header'] = 'Header';
$string['headeraddtemplate'] = 'Defines the interface when editing entries';
$string['importsuccess'] = 'The preset has been successfully applied.';
$string['insufficiententries'] = 'more entries needed to view this database';
$string['intro'] = 'Introduction';
+$string['invalidaccess'] = 'This page was not accessed correctly';
$string['invalidfieldname'] = 'Please choose another name for this field';
$string['invalidfieldid'] = 'Field ID is incorrect';
$string['invalidfieldtype'] = 'Field Type is incorrect';
$string['invalidid'] = 'Incorrect data ID';
-$string['invaliddata'] = 'Incorrect data';
$string['invalidrecord'] = 'Incorrect record';
$string['invalidratedata'] = 'Incorrect submitted ratings data';
-$string['invalidaccess'] = 'This page was not accessed correctly';
+$string['invildpreset'] = '$a is not a preset.';
$string['invalidurl'] = 'The URL you just entered is not valid';
$string['jstemplate'] = 'Javascript template';
$string['latitude'] = 'Latitude';
$string['maxsize'] = 'Maximum size';
$string['menu'] = 'Menu';
$string['menuchoose'] = 'Choose...';
+$string['missingfield'] = 'Programmer error: You must specify field and/or data when defining field class. ';
+$string['missingdata'] = 'Data id or object must be provided to field class';
$string['modulename'] = 'Database';
$string['modulenameplural'] = 'Databases';
$string['more'] = 'More';
$string['undefinedprocessactionmethod'] = 'No action method defined in Data_Preset to handle action \"$a\".';
$string['unsupportedexport'] = '($a->fieldtype) cannot be exported.';
$string['updatefield'] = 'Update an existing field';
+$string['updatingerror'] = 'There was an error updating the database';
$string['uploadfile'] = 'Upload file';
$string['uploadrecords'] = 'Upload entries from a file';
$string['url'] = 'Url';
if ($id) {
if (! $cm = get_coursemodule_from_id('data', $id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record('course', array('id'=>$cm->course))) {
- error('Course is misconfigured');
+ print_error('coursemisconf');
}
if (! $data = $DB->get_record('data', array('id'=>$cm->instance))) {
- error('Course module is incorrect');
+ print_error('invalidcoursemodule');
}
} else {
if (! $data = $DB->get_record('data', array('id'=>$d))) {
- error('Data ID is incorrect');
+ print_error('invalidid', 'data');
}
if (! $course = $DB->get_record('course', array('id'=>$data->course))) {
- error('Course is misconfigured');
+ print_error('invalidcoursemodule');
}
if (! $cm = get_coursemodule_from_instance('data', $data->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
}
$rec->defaultsort = 0;
$rec->defaultsortdir = 0;
if (!$DB->update_record('data', $rec)) {
- error('There was an error updating the database');
+ print_error('updatingerror', 'data');
}
}
if ($DB->update_record('data', $rec)) {
redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id, get_string('changessaved'), 2);
} else {
- error('There was an error updating the database');
+ print_error('updatingerror', 'data');
}
exit;
}
$id = required_param('id', PARAM_INT); // course
if (!$course = $DB->get_record('course', array('id'=>$id))) {
- error("Course ID is incorrect");
+ print_error('invalidcourseid');
}
require_course_login($course);
global $DB;
if (empty($field) && empty($data)) {
- error('Programmer error: You must specify field and/or data when defining field class. ');
+ print_error('missingfield', 'data');
}
if (!empty($field)) {
if (is_object($field)) {
$this->field = $field; // Programmer knows what they are doing, we hope
} else if (!$this->field = $DB->get_record('data_fields', array('id'=>$field))) {
- error('Bad field ID encountered: '.$field);
+ print_error('invalidfieldid', 'data');
}
if (empty($data)) {
if (!$this->data = $DB->get_record('data', array('id'=>$this->field->dataid))) {
- error('Bad data ID encountered in field data');
+ print_error('invalidid', 'data');
}
}
}
if (is_object($data)) {
$this->data = $data; // Programmer knows what they are doing, we hope
} else if (!$this->data = $DB->get_record('data', array('id'=>$data))) {
- error('Bad data ID encountered: '.$data);
+ print_error('invalidid', 'data');
}
} else { // No way to define it!
- error('Data id or object must be provided to field class');
+ print_error('missingdata', 'data');
}
}
global $USER;
if (!$cm = get_coursemodule_from_instance('data', $data->id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
global $CFG, $DB;
if (!is_directory_a_preset($this->folder)) {
- error("$this->userid/$this->shortname Not a preset");
+ print_error('invildpreset', 'data', '', $this->userid.'/'.$this->shortname);
}
/* Grab XML */
function import_options() {
if (!confirm_sesskey()) {
- error("Sesskey Invalid");
+ print_error('invalidsesskey');
}
$strblank = get_string('blank', 'data');
echo "<p>$strwarning</p>";
} else if (empty($newfields)) {
- error("New preset has no defined fields!");
+ print_error('nodefinedfields', 'data');
}
echo '<div class="overwritesettings"><label for="overwritesettings">'.get_string('overwritesettings', 'data').'</label>';
$cid = optional_param("field_$nid", -1, PARAM_INT);
if ($cid == -1) continue;
- if (array_key_exists($cid, $preservedfields)) error("Not an injective map");
+ if (array_key_exists($cid, $preservedfields)){
+ print_error('notinjectivemap', 'data');
+ }
else $preservedfields[$cid] = true;
}
// Check if all files have been generated
if (! is_directory_a_preset($exportdir)) {
- error('Not all files generated!');
- // should be migrated to print_error()
+ print_error('generateerror', 'data');
}
$filelist = array(
if ($id) {
if (! $cm = get_coursemodule_from_id('data', $id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record('course', array('id'=>$cm->course))) {
- error('Course is misconfigured');
+ print_error('coursemisconf');
}
if (! $data = $DB->get_record('data', array('id'=>$cm->instance))) {
- error('Course module is incorrect');
+ print_error('invalidcoursemodule');
}
} else {
if (! $data = $DB->get_record('data', array('id'=>$d))) {
- error('Data ID is incorrect');
+ print_error('invalidid', 'data');
}
if (! $course = $DB->get_record('course', array('id'=>$data->course))) {
- error('Course is misconfigured');
+ print_error('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance('data', $data->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
}
if ($id) {
if (! $cm = get_coursemodule_from_id('data', $id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record('course', array('id'=>$cm->course))) {
- error('Course is misconfigured');
+ print_error('coursemisconf');
}
if (! $data = $DB->get_record('data', array('id'=>$cm->instance))) {
- error('Course module is incorrect');
+ print_error('invalidcoursemodule');
}
$record = NULL;
} else if ($rid) {
if (! $record = $DB->get_record('data_records', array('id'=>$rid))) {
- error('Record ID is incorrect');
+ print_error('invalidrecord', 'data');
}
if (! $data = $DB->get_record('data', array('id'=>$record->dataid))) {
- error('Data ID is incorrect');
+ print_error('invalidid', 'data');
}
if (! $course = $DB->get_record('course', array('id'=>$data->course))) {
- error('Course is misconfigured');
+ print_error('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance('data', $data->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
} else { // We must have $d
if (! $data = $DB->get_record('data', array('id'=>$d))) {
- error('Data ID is incorrect');
+ print_error('invalidid', 'data');
}
if (! $course = $DB->get_record('course', array('id'=>$data->course))) {
- error('Course is misconfigured');
+ print_error('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance('data', $data->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
$record = NULL;
}