Merge branch 'MDL-64777_delete-static' of https://github.com/dmonllao/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2019-04-16 10:59:55 +02:00
commit 7f7b751ea2
2 changed files with 9 additions and 13 deletions

View File

@ -326,16 +326,14 @@ class models_list implements \renderable, \templatable {
}
// Delete model.
if (!$model->is_static()) {
$actionid = 'delete-' . $model->get_id();
$PAGE->requires->js_call_amd('tool_analytics/model', 'confirmAction', [$actionid, 'delete']);
$urlparams['action'] = 'delete';
$url = new \moodle_url('model.php', $urlparams);
$icon = new \action_menu_link_secondary($url, new \pix_icon('t/delete',
get_string('delete', 'tool_analytics')), get_string('delete', 'tool_analytics'),
['data-action-id' => $actionid]);
$actionsmenu->add($icon);
}
$actionid = 'delete-' . $model->get_id();
$PAGE->requires->js_call_amd('tool_analytics/model', 'confirmAction', [$actionid, 'delete']);
$urlparams['action'] = 'delete';
$url = new \moodle_url('model.php', $urlparams);
$icon = new \action_menu_link_secondary($url, new \pix_icon('t/delete',
get_string('delete', 'tool_analytics')), get_string('delete', 'tool_analytics'),
['data-action-id' => $actionid]);
$actionsmenu->add($icon);
$modeldata->actions = $actionsmenu->export_for_template($output);

View File

@ -103,9 +103,7 @@ switch ($action) {
case 'delete':
confirm_sesskey();
if (!$model->is_static()) {
$model->delete();
}
$model->delete();
redirect($returnurl);
break;