function data_field_base($field=0, $data=0) { // Field or data or both, each can be id or object
if (empty($field) && empty($data)) {
- print_error('Programmer error: You must specify field and/or data when defining field class. ');
+ error('Programmer error: You must specify field and/or data when defining field class. ');
}
if (!empty($field)) {
if (is_object($field)) {
$this->field = $field; // Programmer knows what they are doing, we hope
} else if (!$this->field = get_record('data_fields','id',$field)) {
- print_error('Bad field ID encountered: '.$field);
+ error('Bad field ID encountered: '.$field);
}
if (empty($data)) {
if (!$this->data = get_record('data','id',$this->field->dataid)) {
- print_error('Bad data ID encountered in field data');
+ error('Bad data ID encountered in field data');
}
}
}
if (is_object($data)) {
$this->data = $data; // Programmer knows what they are doing, we hope
} else if (!$this->data = get_record('data','id',$data)) {
- print_error('Bad data ID encountered: '.$data);
+ error('Bad data ID encountered: '.$data);
}
} else { // No way to define it!
- print_error('Data id or object must be provided to field class');
+ error('Data id or object must be provided to field class');
}
}
global $USER;
if (!$cm = get_coursemodule_from_instance('data', $data->id)) {
- print_error('Course Module ID was incorrect');
+ error('Course Module ID was incorrect');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/* Check all is well */
if (!is_directory_a_preset($tempfolder)) {
- print_error("Not all files generated!");
+ error("Not all files generated!");
}
$filelist = array(
global $CFG;
if (!is_directory_a_preset($this->folder)) {
- print_error("$this->userid/$this->shortname Not a preset");
+ error("$this->userid/$this->shortname Not a preset");
}
/* Grab XML */
function import_options() {
if (!confirm_sesskey()) {
- print_error("Sesskey Invalid");
+ error("Sesskey Invalid");
}
$strblank = get_string('blank', 'data');
$selected=true;
}
else {
- echo '<option value="$cid">'.$currentfield->name.'</option>';
+ echo '<option value="'.$cid.'">'.$currentfield->name.'</option>';
}
}
}
echo "<p>$strwarning</p>";
}
else if (empty($newfields)) {
- print_error("New preset has no defined fields!");
+ error("New preset has no defined fields!");
}
echo '<input type="submit" value="'.$strcontinue.'" /></fieldset></form></div>';
$cid = optional_param("field_$nid", -1, PARAM_INT);
if ($cid == -1) continue;
- if (array_key_exists($cid, $preservedfields)) print_error("Not an injective map");
+ if (array_key_exists($cid, $preservedfields)) error("Not an injective map");
else $preservedfields[$cid] = true;
}