|
By skodak:
MDL-14342 fixed wrong quotes; merged from MOODLE_19_STABLE
|
| 40 |
function data_field_base($field=0, $data=0) { // Field or data or both, each can be id or object |
function data_field_base($field=0, $data=0) { // Field or data or both, each can be id or object |
| 41 |
|
|
| 42 |
if (empty($field) && empty($data)) { |
if (empty($field) && empty($data)) { |
| 43 |
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. '); |
| 44 |
} |
} |
| 45 |
|
|
| 46 |
if (!empty($field)) { |
if (!empty($field)) { |
| 47 |
if (is_object($field)) { |
if (is_object($field)) { |
| 48 |
$this->field = $field; // Programmer knows what they are doing, we hope |
$this->field = $field; // Programmer knows what they are doing, we hope |
| 49 |
} else if (!$this->field = get_record('data_fields','id',$field)) { |
} else if (!$this->field = get_record('data_fields','id',$field)) { |
| 50 |
print_error('Bad field ID encountered: '.$field); |
error('Bad field ID encountered: '.$field); |
| 51 |
} |
} |
| 52 |
if (empty($data)) { |
if (empty($data)) { |
| 53 |
if (!$this->data = get_record('data','id',$this->field->dataid)) { |
if (!$this->data = get_record('data','id',$this->field->dataid)) { |
| 54 |
print_error('Bad data ID encountered in field data'); |
error('Bad data ID encountered in field data'); |
| 55 |
} |
} |
| 56 |
} |
} |
| 57 |
} |
} |
| 61 |
if (is_object($data)) { |
if (is_object($data)) { |
| 62 |
$this->data = $data; // Programmer knows what they are doing, we hope |
$this->data = $data; // Programmer knows what they are doing, we hope |
| 63 |
} else if (!$this->data = get_record('data','id',$data)) { |
} else if (!$this->data = get_record('data','id',$data)) { |
| 64 |
print_error('Bad data ID encountered: '.$data); |
error('Bad data ID encountered: '.$data); |
| 65 |
} |
} |
| 66 |
} else { // No way to define it! |
} else { // No way to define it! |
| 67 |
print_error('Data id or object must be provided to field class'); |
error('Data id or object must be provided to field class'); |
| 68 |
} |
} |
| 69 |
} |
} |
| 70 |
|
|
| 1711 |
global $USER; |
global $USER; |
| 1712 |
|
|
| 1713 |
if (!$cm = get_coursemodule_from_instance('data', $data->id)) { |
if (!$cm = get_coursemodule_from_instance('data', $data->id)) { |
| 1714 |
print_error('Course Module ID was incorrect'); |
error('Course Module ID was incorrect'); |
| 1715 |
} |
} |
| 1716 |
$context = get_context_instance(CONTEXT_MODULE, $cm->id); |
$context = get_context_instance(CONTEXT_MODULE, $cm->id); |
| 1717 |
|
|
| 1841 |
|
|
| 1842 |
/* Check all is well */ |
/* Check all is well */ |
| 1843 |
if (!is_directory_a_preset($tempfolder)) { |
if (!is_directory_a_preset($tempfolder)) { |
| 1844 |
print_error("Not all files generated!"); |
error("Not all files generated!"); |
| 1845 |
} |
} |
| 1846 |
|
|
| 1847 |
$filelist = array( |
$filelist = array( |
| 1884 |
global $CFG; |
global $CFG; |
| 1885 |
|
|
| 1886 |
if (!is_directory_a_preset($this->folder)) { |
if (!is_directory_a_preset($this->folder)) { |
| 1887 |
print_error("$this->userid/$this->shortname Not a preset"); |
error("$this->userid/$this->shortname Not a preset"); |
| 1888 |
} |
} |
| 1889 |
|
|
| 1890 |
/* Grab XML */ |
/* Grab XML */ |
| 1935 |
|
|
| 1936 |
function import_options() { |
function import_options() { |
| 1937 |
if (!confirm_sesskey()) { |
if (!confirm_sesskey()) { |
| 1938 |
print_error("Sesskey Invalid"); |
error("Sesskey Invalid"); |
| 1939 |
} |
} |
| 1940 |
|
|
| 1941 |
$strblank = get_string('blank', 'data'); |
$strblank = get_string('blank', 'data'); |
| 1972 |
$selected=true; |
$selected=true; |
| 1973 |
} |
} |
| 1974 |
else { |
else { |
| 1975 |
echo '<option value="$cid">'.$currentfield->name.'</option>'; |
echo '<option value="'.$cid.'">'.$currentfield->name.'</option>'; |
| 1976 |
} |
} |
| 1977 |
} |
} |
| 1978 |
} |
} |
| 1987 |
echo "<p>$strwarning</p>"; |
echo "<p>$strwarning</p>"; |
| 1988 |
} |
} |
| 1989 |
else if (empty($newfields)) { |
else if (empty($newfields)) { |
| 1990 |
print_error("New preset has no defined fields!"); |
error("New preset has no defined fields!"); |
| 1991 |
} |
} |
| 1992 |
echo '<input type="submit" value="'.$strcontinue.'" /></fieldset></form></div>'; |
echo '<input type="submit" value="'.$strcontinue.'" /></fieldset></form></div>'; |
| 1993 |
|
|
| 2006 |
$cid = optional_param("field_$nid", -1, PARAM_INT); |
$cid = optional_param("field_$nid", -1, PARAM_INT); |
| 2007 |
if ($cid == -1) continue; |
if ($cid == -1) continue; |
| 2008 |
|
|
| 2009 |
if (array_key_exists($cid, $preservedfields)) print_error("Not an injective map"); |
if (array_key_exists($cid, $preservedfields)) error("Not an injective map"); |
| 2010 |
else $preservedfields[$cid] = true; |
else $preservedfields[$cid] = true; |
| 2011 |
} |
} |
| 2012 |
|
|