mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
Fixed bug in /mod/data/filter.php - content list for autolinking was not being
generated properly. Updated /mod/data/fields.php - deletion of a field now also deletes data_contents and any files associated as well. Add/update/delete fields - template now gets updates in the following cases: 1) Deletion: remove template tags for the field from all templates 2) Edit: search and replace template tags for the field in all templates 3) Add: append template tag for field into the signe and rss templates, but only if these templates are not empty. Otherwise we'd rather the user uses the automatic template generation facility, which produces better display.
This commit is contained in:
parent
20f601d324
commit
f9eab7b0c9
4 changed files with 114 additions and 9 deletions
|
@ -249,7 +249,28 @@ class data_field_file extends data_field_base {// extends
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function delete_data_contents() {
|
||||
// Delete the content files first.
|
||||
$sql = 'SELECT dc.content AS content, '.
|
||||
'df.dataid AS dataid, '.
|
||||
'dc.recordid AS recordid '.
|
||||
'FROM data_fields AS df, '.
|
||||
'data_content AS dc '.
|
||||
"WHERE df.id = {$this->id} ".
|
||||
"AND dc.fieldid = {$this->id}";
|
||||
|
||||
if (!$results = recordset_to_array(get_recordset_sql($sql))) {
|
||||
return false;
|
||||
}
|
||||
foreach ($results as $result) {
|
||||
$this->delete_data_content_files($result->dataid, $result->recordid, $result->content);
|
||||
}
|
||||
|
||||
// Then delete the data_content records.
|
||||
return delete_records('data_content', 'fieldid', $this->id);
|
||||
}
|
||||
|
||||
function delete_data_content_files($dataid, $recordid, $content){
|
||||
global $CFG, $course;
|
||||
$filepath = $CFG->dataroot.'/'.$course->id.'/'.$CFG->moddata.'/data/'.$dataid.'/'.$this->id.'/'.$recordid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue