mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-65967 tool_recyclebin: add recycle bin link to category edit menu
This commit is contained in:
parent
9df4a4de18
commit
934ad2c869
2 changed files with 53 additions and 0 deletions
|
@ -127,3 +127,36 @@ Feature: Basic recycle bin functionality
|
||||||
And I press "Yes"
|
And I press "Yes"
|
||||||
And I should see "Recycle bin has been emptied"
|
And I should see "Recycle bin has been emptied"
|
||||||
And I should see "There are no items in the recycle bin."
|
And I should see "There are no items in the recycle bin."
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Show recycle bin on category action menu
|
||||||
|
Given I log in as "admin"
|
||||||
|
And I navigate to "Courses > Manage courses and categories" in site administration
|
||||||
|
And I click on "Actions menu" "link"
|
||||||
|
And I click on "Recycle bin" "link"
|
||||||
|
Then I should see "There are no items in the recycle bin."
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Not show recycle bin empty on category action menu whit autohide enable
|
||||||
|
Given I log in as "admin"
|
||||||
|
And the following config values are set as admin:
|
||||||
|
| categorybinenable | 0 | tool_recyclebin |
|
||||||
|
And I navigate to "Courses > Manage courses and categories" in site administration
|
||||||
|
And I click on "Actions menu" "link"
|
||||||
|
Then I should not see "Recycle bin"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Show recycle bin not empty on category action menu whit autohide enable
|
||||||
|
Given I log in as "admin"
|
||||||
|
And the following config values are set as admin:
|
||||||
|
| autohide | 1 | tool_recyclebin |
|
||||||
|
And I navigate to "Courses > Manage courses and categories" in site administration
|
||||||
|
And I click on "Actions menu" "link"
|
||||||
|
Then I should not see "Recycle bin"
|
||||||
|
And I click on "delete" action for "Course 2" in management course listing
|
||||||
|
And I press "Delete"
|
||||||
|
And I should see "Deleting C2"
|
||||||
|
And I should see "C2 has been completely deleted"
|
||||||
|
And I press "Continue"
|
||||||
|
When I click on "Actions menu" "link"
|
||||||
|
Then I should see "Recycle bin"
|
||||||
|
|
|
@ -330,6 +330,26 @@ class helper {
|
||||||
'string' => new \lang_string('restorecourse', 'admin')
|
'string' => new \lang_string('restorecourse', 'admin')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// Recyclebyn.
|
||||||
|
if (\tool_recyclebin\category_bin::is_enabled()) {
|
||||||
|
$categorybin = new \tool_recyclebin\category_bin($category->id);
|
||||||
|
if ($categorybin->can_view()) {
|
||||||
|
$autohide = get_config('tool_recyclebin', 'autohide');
|
||||||
|
if ($autohide) {
|
||||||
|
$items = $categorybin->get_items();
|
||||||
|
} else {
|
||||||
|
$items = [];
|
||||||
|
}
|
||||||
|
if (!$autohide || !empty($items)) {
|
||||||
|
$pluginname = get_string('pluginname', 'tool_recyclebin');
|
||||||
|
$actions['recyclebin'] = [
|
||||||
|
'url' => new \moodle_url('/admin/tool/recyclebin/index.php', ['contextid' => $category->get_context()->id]),
|
||||||
|
'icon' => new \pix_icon('trash', $pluginname, 'tool_recyclebin'),
|
||||||
|
'string' => $pluginname
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue