mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-45562 blog: fixed issues when creating/editing an external blog.
This commit is contained in:
parent
5fd0df97c5
commit
17af896c4b
@ -79,13 +79,16 @@ if ($externalblogform->is_cancelled()){
|
||||
$newexternal->description = (empty($data->description)) ? $rss->get_description() : $data->description;
|
||||
$newexternal->userid = $USER->id;
|
||||
$newexternal->url = $data->url;
|
||||
$newexternal->filtertags = $data->filtertags;
|
||||
$newexternal->filtertags = (!empty($data->filtertags)) ? $data->filtertags : null;
|
||||
$newexternal->timemodified = time();
|
||||
|
||||
$newexternal->id = $DB->insert_record('blog_external', $newexternal);
|
||||
blog_sync_external_entries($newexternal);
|
||||
tag_set('blog_external', $newexternal->id, explode(',', $data->autotags), 'core',
|
||||
context_user::instance($newexternal->userid)->id);
|
||||
if ($CFG->usetags) {
|
||||
$autotags = (!empty($data->autotags)) ? $data->autotags : null;
|
||||
tag_set('blog_external', $newexternal->id, explode(',', $autotags), 'core',
|
||||
context_user::instance($newexternal->userid)->id);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -99,13 +102,15 @@ if ($externalblogform->is_cancelled()){
|
||||
$external->description = (empty($data->description)) ? $rss->get_description() : $data->description;
|
||||
$external->userid = $USER->id;
|
||||
$external->url = $data->url;
|
||||
$external->filtertags = $data->filtertags;
|
||||
$external->filtertags = (!empty($data->filtertags)) ? $data->filtertags : null;
|
||||
$external->timemodified = time();
|
||||
|
||||
$DB->update_record('blog_external', $external);
|
||||
tag_set('blog_external', $external->id, explode(',', $data->autotags), 'core',
|
||||
context_user::instance($newexternal->userid)->id);
|
||||
|
||||
if ($CFG->usetags) {
|
||||
$autotags = (!empty($data->autotags)) ? $data->autotags : null;
|
||||
tag_set('blog_external', $external->id, explode(',', $autotags), 'core',
|
||||
context_user::instance($external->userid)->id);
|
||||
}
|
||||
} else {
|
||||
print_error('wrongexternalid', 'blog');
|
||||
}
|
||||
|
@ -118,7 +118,9 @@ class blog_edit_external_form extends moodleform {
|
||||
if ($id = $mform->getElementValue('id')) {
|
||||
$mform->setDefault('autotags', implode(',', tag_get_tags_array('blog_external', $id)));
|
||||
$mform->freeze('url');
|
||||
$mform->freeze('filtertags');
|
||||
if ($mform->elementExists('filtertags')) {
|
||||
$mform->freeze('filtertags');
|
||||
}
|
||||
// TODO change the filtertags element to a multiple select, using the tags of the external blog
|
||||
// Use $rss->get_channel_tags()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user